Skip to content

Commit 95d48d2

Browse files
prabhakarladgeertu
authored andcommitted
clk: renesas: r9a07g043: Add support for RZ/Five SoC
Renesas RZ/Five SoC has almost the same clock structure compared to the Renesas RZ/G2UL SoC, re-use the r9a07g043-cpg.c file to add support for RZ/Five SoC. This patch splits up the clocks and reset arrays for RZ/G2UL and RZ/Five SoC using #ifdef CONFIG_ARM64 and #ifdef CONFIG_RISCV checks. Signed-off-by: Lad Prabhakar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Geert Uytterhoeven <[email protected]>
1 parent ce05f30 commit 95d48d2

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

drivers/clk/renesas/r9a07g043-cpg.c

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ enum clk_ids {
3636
CLK_PLL3_DIV2_4_2,
3737
CLK_SEL_PLL3_3,
3838
CLK_DIV_PLL3_C,
39+
#ifdef CONFIG_ARM64
3940
CLK_PLL5,
4041
CLK_PLL5_500,
4142
CLK_PLL5_250,
43+
#endif
4244
CLK_PLL6,
4345
CLK_PLL6_250,
4446
CLK_P1_DIV2,
@@ -100,9 +102,11 @@ static const struct cpg_core_clk r9a07g043_core_clks[] __initconst = {
100102
DEF_FIXED(".pll3_533", CLK_PLL3_533, CLK_PLL3, 1, 3),
101103
DEF_MUX_RO(".sel_pll3_3", CLK_SEL_PLL3_3, SEL_PLL3_3, sel_pll3_3),
102104
DEF_DIV("divpl3c", CLK_DIV_PLL3_C, CLK_SEL_PLL3_3, DIVPL3C, dtable_1_32),
105+
#ifdef CONFIG_ARM64
103106
DEF_FIXED(".pll5", CLK_PLL5, CLK_EXTAL, 125, 1),
104107
DEF_FIXED(".pll5_500", CLK_PLL5_500, CLK_PLL5, 1, 6),
105108
DEF_FIXED(".pll5_250", CLK_PLL5_250, CLK_PLL5_500, 1, 2),
109+
#endif
106110
DEF_FIXED(".pll6", CLK_PLL6, CLK_EXTAL, 125, 6),
107111
DEF_FIXED(".pll6_250", CLK_PLL6_250, CLK_PLL6, 1, 2),
108112

@@ -126,12 +130,20 @@ static const struct cpg_core_clk r9a07g043_core_clks[] __initconst = {
126130
};
127131

128132
static struct rzg2l_mod_clk r9a07g043_mod_clks[] = {
133+
#ifdef CONFIG_ARM64
129134
DEF_MOD("gic", R9A07G043_GIC600_GICCLK, R9A07G043_CLK_P1,
130135
0x514, 0),
131136
DEF_MOD("ia55_pclk", R9A07G043_IA55_PCLK, R9A07G043_CLK_P2,
132137
0x518, 0),
133138
DEF_MOD("ia55_clk", R9A07G043_IA55_CLK, R9A07G043_CLK_P1,
134139
0x518, 1),
140+
#endif
141+
#ifdef CONFIG_RISCV
142+
DEF_MOD("iax45_pclk", R9A07G043_IAX45_PCLK, R9A07G043_CLK_P2,
143+
0x518, 0),
144+
DEF_MOD("iax45_clk", R9A07G043_IAX45_CLK, R9A07G043_CLK_P1,
145+
0x518, 1),
146+
#endif
135147
DEF_MOD("dmac_aclk", R9A07G043_DMAC_ACLK, R9A07G043_CLK_P1,
136148
0x52c, 0),
137149
DEF_MOD("dmac_pclk", R9A07G043_DMAC_PCLK, CLK_P1_DIV2,
@@ -243,9 +255,14 @@ static struct rzg2l_mod_clk r9a07g043_mod_clks[] = {
243255
};
244256

245257
static struct rzg2l_reset r9a07g043_resets[] = {
258+
#ifdef CONFIG_ARM64
246259
DEF_RST(R9A07G043_GIC600_GICRESET_N, 0x814, 0),
247260
DEF_RST(R9A07G043_GIC600_DBG_GICRESET_N, 0x814, 1),
248261
DEF_RST(R9A07G043_IA55_RESETN, 0x818, 0),
262+
#endif
263+
#ifdef CONFIG_RISCV
264+
DEF_RST(R9A07G043_IAX45_RESETN, 0x818, 0),
265+
#endif
249266
DEF_RST(R9A07G043_DMAC_ARESETN, 0x82c, 0),
250267
DEF_RST(R9A07G043_DMAC_RST_ASYNC, 0x82c, 1),
251268
DEF_RST(R9A07G043_OSTM0_PRESETZ, 0x834, 0),
@@ -291,8 +308,13 @@ static struct rzg2l_reset r9a07g043_resets[] = {
291308
};
292309

293310
static const unsigned int r9a07g043_crit_mod_clks[] __initconst = {
311+
#ifdef CONFIG_ARM64
294312
MOD_CLK_BASE + R9A07G043_GIC600_GICCLK,
295313
MOD_CLK_BASE + R9A07G043_IA55_CLK,
314+
#endif
315+
#ifdef CONFIG_RISCV
316+
MOD_CLK_BASE + R9A07G043_IAX45_CLK,
317+
#endif
296318
MOD_CLK_BASE + R9A07G043_DMAC_ACLK,
297319
};
298320

@@ -310,11 +332,21 @@ const struct rzg2l_cpg_info r9a07g043_cpg_info = {
310332
/* Module Clocks */
311333
.mod_clks = r9a07g043_mod_clks,
312334
.num_mod_clks = ARRAY_SIZE(r9a07g043_mod_clks),
335+
#ifdef CONFIG_ARM64
313336
.num_hw_mod_clks = R9A07G043_TSU_PCLK + 1,
337+
#endif
338+
#ifdef CONFIG_RISCV
339+
.num_hw_mod_clks = R9A07G043_IAX45_PCLK + 1,
340+
#endif
314341

315342
/* Resets */
316343
.resets = r9a07g043_resets,
344+
#ifdef CONFIG_ARM64
317345
.num_resets = R9A07G043_TSU_PRESETN + 1, /* Last reset ID + 1 */
346+
#endif
347+
#ifdef CONFIG_RISCV
348+
.num_resets = R9A07G043_IAX45_RESETN + 1, /* Last reset ID + 1 */
349+
#endif
318350

319351
.has_clk_mon_regs = true,
320352
};

0 commit comments

Comments
 (0)