Skip to content

Commit 6dde0ae

Browse files
xdarklightjbrun3t
authored andcommitted
clk: meson: g12a: Prepare the GPU clock tree to change at runtime
The "mali_0" or "mali_1" clock trees should not be updated while the clock is running. Enforce this by setting CLK_SET_RATE_GATE on the "mali_0" and "mali_1" gates. This makes the CCF switch to the "mali_1" tree when "mali_0" is currently active and vice versa, which is exactly what the vendor driver does when updating the frequency of the mali clock. Also propagate set_rate requests from the gate to the divider and from the divider to the the mux so the GPU clock frequency can be updated at runtime (which will be required for GPU DVFS). Don't propagate rate changes to the mux parents because we don't want to change the MPLL clocks (these are reserved for audio). Signed-off-by: Martin Blumenstingl <[email protected]> Signed-off-by: Jerome Brunet <[email protected]> Acked-by: Neil Armstrong <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 5c2602e commit 6dde0ae

File tree

1 file changed

+22
-8
lines changed

1 file changed

+22
-8
lines changed

drivers/clk/meson/g12a.c

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3702,7 +3702,9 @@ static struct clk_regmap g12a_hdmi = {
37023702

37033703
/*
37043704
* The MALI IP is clocked by two identical clocks (mali_0 and mali_1)
3705-
* muxed by a glitch-free switch.
3705+
* muxed by a glitch-free switch. The CCF can manage this glitch-free
3706+
* mux because it does top-to-bottom updates the each clock tree and
3707+
* switches to the "inactive" one when CLK_SET_RATE_GATE is set.
37063708
*/
37073709
static const struct clk_parent_data g12a_mali_0_1_parent_data[] = {
37083710
{ .fw_name = "xtal", },
@@ -3726,7 +3728,13 @@ static struct clk_regmap g12a_mali_0_sel = {
37263728
.ops = &clk_regmap_mux_ops,
37273729
.parent_data = g12a_mali_0_1_parent_data,
37283730
.num_parents = 8,
3729-
.flags = CLK_SET_RATE_NO_REPARENT,
3731+
/*
3732+
* Don't request the parent to change the rate because
3733+
* all GPU frequencies can be derived from the fclk_*
3734+
* clocks and one special GP0_PLL setting. This is
3735+
* important because we need the MPLL clocks for audio.
3736+
*/
3737+
.flags = 0,
37303738
},
37313739
};
37323740

@@ -3743,7 +3751,7 @@ static struct clk_regmap g12a_mali_0_div = {
37433751
&g12a_mali_0_sel.hw
37443752
},
37453753
.num_parents = 1,
3746-
.flags = CLK_SET_RATE_NO_REPARENT,
3754+
.flags = CLK_SET_RATE_PARENT,
37473755
},
37483756
};
37493757

@@ -3759,7 +3767,7 @@ static struct clk_regmap g12a_mali_0 = {
37593767
&g12a_mali_0_div.hw
37603768
},
37613769
.num_parents = 1,
3762-
.flags = CLK_SET_RATE_PARENT,
3770+
.flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT,
37633771
},
37643772
};
37653773

@@ -3774,7 +3782,13 @@ static struct clk_regmap g12a_mali_1_sel = {
37743782
.ops = &clk_regmap_mux_ops,
37753783
.parent_data = g12a_mali_0_1_parent_data,
37763784
.num_parents = 8,
3777-
.flags = CLK_SET_RATE_NO_REPARENT,
3785+
/*
3786+
* Don't request the parent to change the rate because
3787+
* all GPU frequencies can be derived from the fclk_*
3788+
* clocks and one special GP0_PLL setting. This is
3789+
* important because we need the MPLL clocks for audio.
3790+
*/
3791+
.flags = 0,
37783792
},
37793793
};
37803794

@@ -3791,7 +3805,7 @@ static struct clk_regmap g12a_mali_1_div = {
37913805
&g12a_mali_1_sel.hw
37923806
},
37933807
.num_parents = 1,
3794-
.flags = CLK_SET_RATE_NO_REPARENT,
3808+
.flags = CLK_SET_RATE_PARENT,
37953809
},
37963810
};
37973811

@@ -3807,7 +3821,7 @@ static struct clk_regmap g12a_mali_1 = {
38073821
&g12a_mali_1_div.hw
38083822
},
38093823
.num_parents = 1,
3810-
.flags = CLK_SET_RATE_PARENT,
3824+
.flags = CLK_SET_RATE_GATE | CLK_SET_RATE_PARENT,
38113825
},
38123826
};
38133827

@@ -3827,7 +3841,7 @@ static struct clk_regmap g12a_mali = {
38273841
.ops = &clk_regmap_mux_ops,
38283842
.parent_hws = g12a_mali_parent_hws,
38293843
.num_parents = 2,
3830-
.flags = CLK_SET_RATE_NO_REPARENT,
3844+
.flags = CLK_SET_RATE_PARENT,
38313845
},
38323846
};
38333847

0 commit comments

Comments
 (0)