Skip to content

Commit 16afd70

Browse files
xdarklightjbrun3t
authored andcommitted
clk: meson: meson8b: Make the CCF use the glitch-free VPU mux
The "vpu_0" or "vpu_1" clock trees should not be updated while the clock is running. Enforce this by setting CLK_SET_RATE_GATE on the "vpu_0" and "vpu_1" gates. This makes the CCF switch to the "vpu_1" tree when "vpu_0" is currently active and vice versa, which is exactly what the vendor driver does when updating the frequency of the VPU clock. Signed-off-by: Martin Blumenstingl <[email protected]> Signed-off-by: Jerome Brunet <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 8bb629c commit 16afd70

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

drivers/clk/meson/meson8b.c

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2063,7 +2063,7 @@ static struct clk_regmap meson8b_vpu_0 = {
20632063
&meson8b_vpu_0_div.hw
20642064
},
20652065
.num_parents = 1,
2066-
.flags = CLK_SET_RATE_PARENT,
2066+
.flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT,
20672067
},
20682068
};
20692069

@@ -2134,10 +2134,18 @@ static struct clk_regmap meson8b_vpu_1 = {
21342134
&meson8b_vpu_1_div.hw
21352135
},
21362136
.num_parents = 1,
2137-
.flags = CLK_SET_RATE_PARENT,
2137+
.flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT,
21382138
},
21392139
};
21402140

2141+
/*
2142+
* The VPU clock has two two identical clock trees (vpu_0 and vpu_1)
2143+
* muxed by a glitch-free switch on Meson8b and Meson8m2. The CCF can
2144+
* actually manage this glitch-free mux because it does top-to-bottom
2145+
* updates the each clock tree and switches to the "inactive" one when
2146+
* CLK_SET_RATE_GATE is set.
2147+
* Meson8 only has vpu_0 and no glitch-free mux.
2148+
*/
21412149
static struct clk_regmap meson8b_vpu = {
21422150
.data = &(struct clk_regmap_mux_data){
21432151
.offset = HHI_VPU_CLK_CNTL,
@@ -2152,7 +2160,7 @@ static struct clk_regmap meson8b_vpu = {
21522160
&meson8b_vpu_1.hw,
21532161
},
21542162
.num_parents = 2,
2155-
.flags = CLK_SET_RATE_NO_REPARENT,
2163+
.flags = CLK_SET_RATE_PARENT,
21562164
},
21572165
};
21582166

0 commit comments

Comments
 (0)