Skip to content

Commit 9199ec2

Browse files
Nicolas Frattarolimmind
authored andcommitted
clk: rockchip: add GATE_GRFs for SAI MCLKOUT to rk3576
The Rockchip RK3576 gates the SAI MCLKOUT clocks behind some IOC GRF writes. Add these clock branches, and add the IOC GRF to the auxiliary GRF hashtable. Signed-off-by: Nicolas Frattaroli <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Heiko Stuebner <[email protected]>
1 parent e277168 commit 9199ec2

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

drivers/clk/rockchip/clk-rk3576.c

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515

1616
#define RK3576_GRF_SOC_STATUS0 0x600
1717
#define RK3576_PMU0_GRF_OSC_CON6 0x18
18+
#define RK3576_VCCIO_IOC_MISC_CON0 0x6400
1819

1920
enum rk3576_plls {
2021
bpll, lpll, vpll, aupll, cpll, gpll, ppll,
@@ -1479,6 +1480,14 @@ static struct rockchip_clk_branch rk3576_clk_branches[] __initdata = {
14791480
RK3576_CLKGATE_CON(10), 0, GFLAGS),
14801481
GATE(CLK_SAI0_MCLKOUT, "clk_sai0_mclkout", "mclk_sai0_8ch", 0,
14811482
RK3576_CLKGATE_CON(10), 1, GFLAGS),
1483+
GATE_GRF(CLK_SAI0_MCLKOUT_TO_IO, "mclk_sai0_to_io", "clk_sai0_mclkout",
1484+
0, RK3576_VCCIO_IOC_MISC_CON0, 0, GFLAGS, grf_type_ioc),
1485+
GATE_GRF(CLK_SAI1_MCLKOUT_TO_IO, "mclk_sai1_to_io", "clk_sai1_mclkout",
1486+
0, RK3576_VCCIO_IOC_MISC_CON0, 1, GFLAGS, grf_type_ioc),
1487+
GATE_GRF(CLK_SAI2_MCLKOUT_TO_IO, "mclk_sai2_to_io", "clk_sai2_mclkout",
1488+
0, RK3576_VCCIO_IOC_MISC_CON0, 2, GFLAGS, grf_type_ioc),
1489+
GATE_GRF(CLK_SAI3_MCLKOUT_TO_IO, "mclk_sai3_to_io", "clk_sai3_mclkout",
1490+
0, RK3576_VCCIO_IOC_MISC_CON0, 3, GFLAGS, grf_type_ioc),
14821491

14831492
/* sdgmac */
14841493
COMPOSITE_NODIV(HCLK_SDGMAC_ROOT, "hclk_sdgmac_root", mux_200m_100m_50m_24m_p, 0,
@@ -1725,7 +1734,9 @@ static void __init rk3576_clk_init(struct device_node *np)
17251734
struct rockchip_clk_provider *ctx;
17261735
unsigned long clk_nr_clks;
17271736
void __iomem *reg_base;
1737+
struct rockchip_aux_grf *ioc_grf_e;
17281738
struct rockchip_aux_grf *pmu0_grf_e;
1739+
struct regmap *ioc_grf;
17291740
struct regmap *pmu0_grf;
17301741

17311742
clk_nr_clks = rockchip_clk_find_max_clk_id(rk3576_clk_branches,
@@ -1737,6 +1748,12 @@ static void __init rk3576_clk_init(struct device_node *np)
17371748
return;
17381749
}
17391750

1751+
ioc_grf = syscon_regmap_lookup_by_compatible("rockchip,rk3576-ioc-grf");
1752+
if (IS_ERR(ioc_grf)) {
1753+
pr_err("%s: could not get IOC GRF syscon\n", __func__);
1754+
return;
1755+
}
1756+
17401757
reg_base = of_iomap(np, 0);
17411758
if (!reg_base) {
17421759
pr_err("%s: could not map cru region\n", __func__);
@@ -1757,6 +1774,14 @@ static void __init rk3576_clk_init(struct device_node *np)
17571774
pmu0_grf_e->type = grf_type_pmu0;
17581775
hash_add(ctx->aux_grf_table, &pmu0_grf_e->node, grf_type_pmu0);
17591776

1777+
ioc_grf_e = kzalloc(sizeof(*ioc_grf_e), GFP_KERNEL);
1778+
if (!ioc_grf_e)
1779+
goto err_free_pmu0;
1780+
1781+
ioc_grf_e->grf = ioc_grf;
1782+
ioc_grf_e->type = grf_type_ioc;
1783+
hash_add(ctx->aux_grf_table, &ioc_grf_e->node, grf_type_ioc);
1784+
17601785
rockchip_clk_register_plls(ctx, rk3576_pll_clks,
17611786
ARRAY_SIZE(rk3576_pll_clks),
17621787
RK3576_GRF_SOC_STATUS0);
@@ -1781,6 +1806,8 @@ static void __init rk3576_clk_init(struct device_node *np)
17811806

17821807
return;
17831808

1809+
err_free_pmu0:
1810+
kfree(pmu0_grf_e);
17841811
err_unmap:
17851812
iounmap(reg_base);
17861813
return;

0 commit comments

Comments
 (0)