Skip to content

Commit 6dcf03b

Browse files
bijudasbebarino
authored andcommitted
clk: vc3: Fix output clock mapping
According to Table 3. ("Output Source") in the 5P35023 datasheet, the output clock mapping should be 0=REF, 1=SE1, 2=SE2, 3=SE3, 4=DIFF1, 5=DIFF2. But the code uses inverse. Fix this mapping issue. Suggested-by: Geert Uytterhoeven <[email protected]> Closes: https://lore.kernel.org/all/CAMuHMdUHD+bEco=WYTYWsTAyRt3dTQQt4Xpaejss0Y2ZpLCMNg@mail.gmail.com/ Fixes: 6e9aff5 ("clk: Add support for versa3 clock driver") Signed-off-by: Biju Das <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Stephen Boyd <[email protected]>
1 parent 576418e commit 6dcf03b

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed

drivers/clk/clk-versaclock3.c

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -119,20 +119,20 @@ enum vc3_div {
119119
};
120120

121121
enum vc3_clk_mux {
122-
VC3_DIFF2_MUX,
123-
VC3_DIFF1_MUX,
124-
VC3_SE3_MUX,
125-
VC3_SE2_MUX,
126122
VC3_SE1_MUX,
123+
VC3_SE2_MUX,
124+
VC3_SE3_MUX,
125+
VC3_DIFF1_MUX,
126+
VC3_DIFF2_MUX,
127127
};
128128

129129
enum vc3_clk {
130-
VC3_DIFF2,
131-
VC3_DIFF1,
132-
VC3_SE3,
133-
VC3_SE2,
134-
VC3_SE1,
135130
VC3_REF,
131+
VC3_SE1,
132+
VC3_SE2,
133+
VC3_SE3,
134+
VC3_DIFF1,
135+
VC3_DIFF2,
136136
};
137137

138138
struct vc3_clk_data {
@@ -896,33 +896,33 @@ static struct vc3_hw_data clk_div[] = {
896896
};
897897

898898
static struct vc3_hw_data clk_mux[] = {
899-
[VC3_DIFF2_MUX] = {
899+
[VC3_SE1_MUX] = {
900900
.data = &(struct vc3_clk_data) {
901-
.offs = VC3_DIFF2_CTRL_REG,
902-
.bitmsk = VC3_DIFF2_CTRL_REG_DIFF2_CLK_SEL
901+
.offs = VC3_SE1_DIV4_CTRL,
902+
.bitmsk = VC3_SE1_DIV4_CTRL_SE1_CLK_SEL
903903
},
904904
.hw.init = &(struct clk_init_data){
905-
.name = "diff2_mux",
905+
.name = "se1_mux",
906906
.ops = &vc3_clk_mux_ops,
907907
.parent_hws = (const struct clk_hw *[]) {
908-
&clk_div[VC3_DIV1].hw,
909-
&clk_div[VC3_DIV3].hw
908+
&clk_div[VC3_DIV5].hw,
909+
&clk_div[VC3_DIV4].hw
910910
},
911911
.num_parents = 2,
912912
.flags = CLK_SET_RATE_PARENT
913913
}
914914
},
915-
[VC3_DIFF1_MUX] = {
915+
[VC3_SE2_MUX] = {
916916
.data = &(struct vc3_clk_data) {
917-
.offs = VC3_DIFF1_CTRL_REG,
918-
.bitmsk = VC3_DIFF1_CTRL_REG_DIFF1_CLK_SEL
917+
.offs = VC3_SE2_CTRL_REG0,
918+
.bitmsk = VC3_SE2_CTRL_REG0_SE2_CLK_SEL
919919
},
920920
.hw.init = &(struct clk_init_data){
921-
.name = "diff1_mux",
921+
.name = "se2_mux",
922922
.ops = &vc3_clk_mux_ops,
923923
.parent_hws = (const struct clk_hw *[]) {
924-
&clk_div[VC3_DIV1].hw,
925-
&clk_div[VC3_DIV3].hw
924+
&clk_div[VC3_DIV5].hw,
925+
&clk_div[VC3_DIV4].hw
926926
},
927927
.num_parents = 2,
928928
.flags = CLK_SET_RATE_PARENT
@@ -944,33 +944,33 @@ static struct vc3_hw_data clk_mux[] = {
944944
.flags = CLK_SET_RATE_PARENT
945945
}
946946
},
947-
[VC3_SE2_MUX] = {
947+
[VC3_DIFF1_MUX] = {
948948
.data = &(struct vc3_clk_data) {
949-
.offs = VC3_SE2_CTRL_REG0,
950-
.bitmsk = VC3_SE2_CTRL_REG0_SE2_CLK_SEL
949+
.offs = VC3_DIFF1_CTRL_REG,
950+
.bitmsk = VC3_DIFF1_CTRL_REG_DIFF1_CLK_SEL
951951
},
952952
.hw.init = &(struct clk_init_data){
953-
.name = "se2_mux",
953+
.name = "diff1_mux",
954954
.ops = &vc3_clk_mux_ops,
955955
.parent_hws = (const struct clk_hw *[]) {
956-
&clk_div[VC3_DIV5].hw,
957-
&clk_div[VC3_DIV4].hw
956+
&clk_div[VC3_DIV1].hw,
957+
&clk_div[VC3_DIV3].hw
958958
},
959959
.num_parents = 2,
960960
.flags = CLK_SET_RATE_PARENT
961961
}
962962
},
963-
[VC3_SE1_MUX] = {
963+
[VC3_DIFF2_MUX] = {
964964
.data = &(struct vc3_clk_data) {
965-
.offs = VC3_SE1_DIV4_CTRL,
966-
.bitmsk = VC3_SE1_DIV4_CTRL_SE1_CLK_SEL
965+
.offs = VC3_DIFF2_CTRL_REG,
966+
.bitmsk = VC3_DIFF2_CTRL_REG_DIFF2_CLK_SEL
967967
},
968968
.hw.init = &(struct clk_init_data){
969-
.name = "se1_mux",
969+
.name = "diff2_mux",
970970
.ops = &vc3_clk_mux_ops,
971971
.parent_hws = (const struct clk_hw *[]) {
972-
&clk_div[VC3_DIV5].hw,
973-
&clk_div[VC3_DIV4].hw
972+
&clk_div[VC3_DIV1].hw,
973+
&clk_div[VC3_DIV3].hw
974974
},
975975
.num_parents = 2,
976976
.flags = CLK_SET_RATE_PARENT
@@ -1109,7 +1109,7 @@ static int vc3_probe(struct i2c_client *client)
11091109
name, 0, CLK_SET_RATE_PARENT, 1, 1);
11101110
else
11111111
clk_out[i] = devm_clk_hw_register_fixed_factor_parent_hw(dev,
1112-
name, &clk_mux[i].hw, CLK_SET_RATE_PARENT, 1, 1);
1112+
name, &clk_mux[i - 1].hw, CLK_SET_RATE_PARENT, 1, 1);
11131113

11141114
if (IS_ERR(clk_out[i]))
11151115
return PTR_ERR(clk_out[i]);

0 commit comments

Comments
 (0)