Skip to content

Commit 96b61c8

Browse files
xdarklightjbrun3t
authored andcommitted
clk: meson: gxbb: remove the "cpu_clk" from the GXBB and GXL driver
It seems that the "cpu_clk" was carried over from the meson8b clock controller driver. On Meson GX (GXBB/GXL/GXM) the registers which are used by the cpu_clk have a different purpose (in other words: they don't control the CPU clock anymore). HHI_SYS_CPU_CLK_CNTL1 bits 31:24 are reserved according to the public S905 datasheet, while bit 23 is the "A53_trace_clk_DIS" gate (which according to the datasheet should only be used in case a silicon bug is discovered) and bits 22:20 are a divider (A53_trace_clk). The meson clk-cpu code however expects that bits 28:20 are reserved for a divider (according to the public S805 datasheet this "SCALE_DIV: This value represents an N+1 divider of the input clock."). The CPU clock on Meson GX SoCs is provided by the SCPI DVFS clock driver instead. Two examples from a Meson GXL S905X SoC: - vcpu (SCPI DVFS clock 0) rate: 1000000000 / cpu_clk rate: 708000000 - vcpu (SCPI DVFS clock 0) rate: 1512000000 / cpu_clk rate: 708000000 Unfortunately the CLKID_CPUCLK was already exported (but is currently not used) to DT. Due to the removal of this clock definition there is now a hole in the clk_hw_onecell_data (which is not a problem because this case is already handled in gxbb_clkc_probe). Signed-off-by: Martin Blumenstingl <[email protected]> Signed-off-by: Jerome Brunet <[email protected]>
1 parent f40a8ce commit 96b61c8

File tree

2 files changed

+4
-62
lines changed

2 files changed

+4
-62
lines changed

drivers/clk/meson/gxbb.c

Lines changed: 3 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -278,20 +278,6 @@ static const struct pll_rate_table gxl_gp0_pll_rate_table[] = {
278278
{ /* sentinel */ },
279279
};
280280

281-
static const struct clk_div_table cpu_div_table[] = {
282-
{ .val = 1, .div = 1 },
283-
{ .val = 2, .div = 2 },
284-
{ .val = 3, .div = 3 },
285-
{ .val = 2, .div = 4 },
286-
{ .val = 3, .div = 6 },
287-
{ .val = 4, .div = 8 },
288-
{ .val = 5, .div = 10 },
289-
{ .val = 6, .div = 12 },
290-
{ .val = 7, .div = 14 },
291-
{ .val = 8, .div = 16 },
292-
{ /* sentinel */ },
293-
};
294-
295281
static struct meson_clk_pll gxbb_fixed_pll = {
296282
.m = {
297283
.reg_off = HHI_MPLL_CNTL,
@@ -612,21 +598,10 @@ static struct meson_clk_mpll gxbb_mpll2 = {
612598
};
613599

614600
/*
615-
* FIXME cpu clocks and the legacy composite clocks (e.g. clk81) are both PLL
616-
* post-dividers and should be modeled with their respective PLLs via the
617-
* forthcoming coordinated clock rates feature
601+
* FIXME The legacy composite clocks (e.g. clk81) are both PLL post-dividers
602+
* and should be modeled with their respective PLLs via the forthcoming
603+
* coordinated clock rates feature
618604
*/
619-
static struct meson_clk_cpu gxbb_cpu_clk = {
620-
.reg_off = HHI_SYS_CPU_CLK_CNTL1,
621-
.div_table = cpu_div_table,
622-
.clk_nb.notifier_call = meson_clk_cpu_notifier_cb,
623-
.hw.init = &(struct clk_init_data){
624-
.name = "cpu_clk",
625-
.ops = &meson_clk_cpu_ops,
626-
.parent_names = (const char *[]){ "sys_pll" },
627-
.num_parents = 1,
628-
},
629-
};
630605

631606
static u32 mux_table_clk81[] = { 6, 5, 7 };
632607

@@ -1045,7 +1020,6 @@ static MESON_GATE(gxbb_ao_i2c, HHI_GCLK_AO, 4);
10451020
static struct clk_hw_onecell_data gxbb_hw_onecell_data = {
10461021
.hws = {
10471022
[CLKID_SYS_PLL] = &gxbb_sys_pll.hw,
1048-
[CLKID_CPUCLK] = &gxbb_cpu_clk.hw,
10491023
[CLKID_HDMI_PLL] = &gxbb_hdmi_pll.hw,
10501024
[CLKID_FIXED_PLL] = &gxbb_fixed_pll.hw,
10511025
[CLKID_FCLK_DIV2] = &gxbb_fclk_div2.hw,
@@ -1165,7 +1139,6 @@ static struct clk_hw_onecell_data gxbb_hw_onecell_data = {
11651139
static struct clk_hw_onecell_data gxl_hw_onecell_data = {
11661140
.hws = {
11671141
[CLKID_SYS_PLL] = &gxbb_sys_pll.hw,
1168-
[CLKID_CPUCLK] = &gxbb_cpu_clk.hw,
11691142
[CLKID_HDMI_PLL] = &gxbb_hdmi_pll.hw,
11701143
[CLKID_FIXED_PLL] = &gxbb_fixed_pll.hw,
11711144
[CLKID_FCLK_DIV2] = &gxbb_fclk_div2.hw,
@@ -1430,7 +1403,6 @@ struct clkc_data {
14301403
unsigned int clk_dividers_count;
14311404
struct meson_clk_audio_divider *const *clk_audio_dividers;
14321405
unsigned int clk_audio_dividers_count;
1433-
struct meson_clk_cpu *cpu_clk;
14341406
struct clk_hw_onecell_data *hw_onecell_data;
14351407
};
14361408

@@ -1447,7 +1419,6 @@ static const struct clkc_data gxbb_clkc_data = {
14471419
.clk_dividers_count = ARRAY_SIZE(gxbb_clk_dividers),
14481420
.clk_audio_dividers = gxbb_audio_dividers,
14491421
.clk_audio_dividers_count = ARRAY_SIZE(gxbb_audio_dividers),
1450-
.cpu_clk = &gxbb_cpu_clk,
14511422
.hw_onecell_data = &gxbb_hw_onecell_data,
14521423
};
14531424

@@ -1464,7 +1435,6 @@ static const struct clkc_data gxl_clkc_data = {
14641435
.clk_dividers_count = ARRAY_SIZE(gxbb_clk_dividers),
14651436
.clk_audio_dividers = gxbb_audio_dividers,
14661437
.clk_audio_dividers_count = ARRAY_SIZE(gxbb_audio_dividers),
1467-
.cpu_clk = &gxbb_cpu_clk,
14681438
.hw_onecell_data = &gxl_hw_onecell_data,
14691439
};
14701440

@@ -1479,8 +1449,6 @@ static int gxbb_clkc_probe(struct platform_device *pdev)
14791449
const struct clkc_data *clkc_data;
14801450
void __iomem *clk_base;
14811451
int ret, clkid, i;
1482-
struct clk_hw *parent_hw;
1483-
struct clk *parent_clk;
14841452
struct device *dev = &pdev->dev;
14851453

14861454
clkc_data = of_device_get_match_data(&pdev->dev);
@@ -1502,9 +1470,6 @@ static int gxbb_clkc_probe(struct platform_device *pdev)
15021470
for (i = 0; i < clkc_data->clk_mplls_count; i++)
15031471
clkc_data->clk_mplls[i]->base = clk_base;
15041472

1505-
/* Populate the base address for CPU clk */
1506-
clkc_data->cpu_clk->base = clk_base;
1507-
15081473
/* Populate base address for gates */
15091474
for (i = 0; i < clkc_data->clk_gates_count; i++)
15101475
clkc_data->clk_gates[i]->reg = clk_base +
@@ -1538,29 +1503,6 @@ static int gxbb_clkc_probe(struct platform_device *pdev)
15381503
goto iounmap;
15391504
}
15401505

1541-
/*
1542-
* Register CPU clk notifier
1543-
*
1544-
* FIXME this is wrong for a lot of reasons. First, the muxes should be
1545-
* struct clk_hw objects. Second, we shouldn't program the muxes in
1546-
* notifier handlers. The tricky programming sequence will be handled
1547-
* by the forthcoming coordinated clock rates mechanism once that
1548-
* feature is released.
1549-
*
1550-
* Furthermore, looking up the parent this way is terrible. At some
1551-
* point we will stop allocating a default struct clk when registering
1552-
* a new clk_hw, and this hack will no longer work. Releasing the ccr
1553-
* feature before that time solves the problem :-)
1554-
*/
1555-
parent_hw = clk_hw_get_parent(&clkc_data->cpu_clk->hw);
1556-
parent_clk = parent_hw->clk;
1557-
ret = clk_notifier_register(parent_clk, &clkc_data->cpu_clk->clk_nb);
1558-
if (ret) {
1559-
pr_err("%s: failed to register clock notifier for cpu_clk\n",
1560-
__func__);
1561-
goto iounmap;
1562-
}
1563-
15641506
return of_clk_add_hw_provider(dev->of_node, of_clk_hw_onecell_get,
15651507
clkc_data->hw_onecell_data);
15661508

drivers/clk/meson/gxbb.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@
171171
* to be exposed to client nodes in DT: include/dt-bindings/clock/gxbb-clkc.h
172172
*/
173173
#define CLKID_SYS_PLL 0
174-
#define CLKID_CPUCLK 1
174+
/* ID 1 is unused (it was used by the non-existing CLKID_CPUCLK before) */
175175
/* CLKID_HDMI_PLL */
176176
#define CLKID_FIXED_PLL 3
177177
/* CLKID_FCLK_DIV2 */

0 commit comments

Comments
 (0)