Skip to content

Commit bb6a9aa

Browse files
bijudasgeertu
authored andcommitted
clk: renesas: rzv2h: Add support for RZ/G3E SoC
The clock structure for RZ/G3E is almost identical to RZ/V2H SoC with more IP blocks compared to RZ/V2H. For eg: VSPI, LVDS, DPI and LCDC1 are present only on the RZ/G3E SoC. Add minimal clock and reset entries required to boot the Renesas RZ/G3E SMARC EVK and binds it with the RZ/V2H CPG core driver. Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Link: https://lore.kernel.org/20241213123550.289193-3-biju.das.jz@bp.renesas.com Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
1 parent 6b4a095 commit bb6a9aa

File tree

5 files changed

+116
-1
lines changed

5 files changed

+116
-1
lines changed

drivers/clk/renesas/Kconfig

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ config CLK_RENESAS
4040
select CLK_R9A07G054 if ARCH_R9A07G054
4141
select CLK_R9A08G045 if ARCH_R9A08G045
4242
select CLK_R9A09G011 if ARCH_R9A09G011
43+
select CLK_R9A09G047 if ARCH_R9A09G047
4344
select CLK_R9A09G057 if ARCH_R9A09G057
4445
select CLK_SH73A0 if ARCH_SH73A0
4546

@@ -194,6 +195,10 @@ config CLK_R9A09G011
194195
bool "RZ/V2M clock support" if COMPILE_TEST
195196
select CLK_RZG2L
196197

198+
config CLK_R9A09G047
199+
bool "RZ/G3E clock support" if COMPILE_TEST
200+
select CLK_RZV2H
201+
197202
config CLK_R9A09G057
198203
bool "RZ/V2H(P) clock support" if COMPILE_TEST
199204
select CLK_RZV2H
@@ -234,7 +239,7 @@ config CLK_RZG2L
234239
select RESET_CONTROLLER
235240

236241
config CLK_RZV2H
237-
bool "RZ/V2H(P) family clock support" if COMPILE_TEST
242+
bool "RZ/{G3E,V2H(P)} family clock support" if COMPILE_TEST
238243
select RESET_CONTROLLER
239244

240245
config CLK_RENESAS_VBATTB

drivers/clk/renesas/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ obj-$(CONFIG_CLK_R9A07G044) += r9a07g044-cpg.o
3737
obj-$(CONFIG_CLK_R9A07G054) += r9a07g044-cpg.o
3838
obj-$(CONFIG_CLK_R9A08G045) += r9a08g045-cpg.o
3939
obj-$(CONFIG_CLK_R9A09G011) += r9a09g011-cpg.o
40+
obj-$(CONFIG_CLK_R9A09G047) += r9a09g047-cpg.o
4041
obj-$(CONFIG_CLK_R9A09G057) += r9a09g057-cpg.o
4142
obj-$(CONFIG_CLK_SH73A0) += clk-sh73a0.o
4243

drivers/clk/renesas/r9a09g047-cpg.c

Lines changed: 102 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,102 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/*
3+
* Renesas RZ/G3E CPG driver
4+
*
5+
* Copyright (C) 2024 Renesas Electronics Corp.
6+
*/
7+
8+
#include <linux/clk-provider.h>
9+
#include <linux/device.h>
10+
#include <linux/init.h>
11+
#include <linux/kernel.h>
12+
13+
#include <dt-bindings/clock/renesas,r9a09g047-cpg.h>
14+
15+
#include "rzv2h-cpg.h"
16+
17+
enum clk_ids {
18+
/* Core Clock Outputs exported to DT */
19+
LAST_DT_CORE_CLK = R9A09G047_IOTOP_0_SHCLK,
20+
21+
/* External Input Clocks */
22+
CLK_AUDIO_EXTAL,
23+
CLK_RTXIN,
24+
CLK_QEXTAL,
25+
26+
/* PLL Clocks */
27+
CLK_PLLCM33,
28+
CLK_PLLDTY,
29+
CLK_PLLCA55,
30+
31+
/* Internal Core Clocks */
32+
CLK_PLLCM33_DIV16,
33+
CLK_PLLDTY_ACPU,
34+
CLK_PLLDTY_ACPU_DIV4,
35+
36+
/* Module Clocks */
37+
MOD_CLK_BASE,
38+
};
39+
40+
static const struct clk_div_table dtable_2_64[] = {
41+
{0, 2},
42+
{1, 4},
43+
{2, 8},
44+
{3, 16},
45+
{4, 64},
46+
{0, 0},
47+
};
48+
49+
static const struct cpg_core_clk r9a09g047_core_clks[] __initconst = {
50+
/* External Clock Inputs */
51+
DEF_INPUT("audio_extal", CLK_AUDIO_EXTAL),
52+
DEF_INPUT("rtxin", CLK_RTXIN),
53+
DEF_INPUT("qextal", CLK_QEXTAL),
54+
55+
/* PLL Clocks */
56+
DEF_FIXED(".pllcm33", CLK_PLLCM33, CLK_QEXTAL, 200, 3),
57+
DEF_FIXED(".plldty", CLK_PLLDTY, CLK_QEXTAL, 200, 3),
58+
DEF_PLL(".pllca55", CLK_PLLCA55, CLK_QEXTAL, PLL_CONF(0x64)),
59+
60+
/* Internal Core Clocks */
61+
DEF_FIXED(".pllcm33_div16", CLK_PLLCM33_DIV16, CLK_PLLCM33, 1, 16),
62+
63+
DEF_DDIV(".plldty_acpu", CLK_PLLDTY_ACPU, CLK_PLLDTY, CDDIV0_DIVCTL2, dtable_2_64),
64+
DEF_FIXED(".plldty_acpu_div4", CLK_PLLDTY_ACPU_DIV4, CLK_PLLDTY_ACPU, 1, 4),
65+
66+
/* Core Clocks */
67+
DEF_FIXED("sys_0_pclk", R9A09G047_SYS_0_PCLK, CLK_QEXTAL, 1, 1),
68+
DEF_FIXED("iotop_0_shclk", R9A09G047_IOTOP_0_SHCLK, CLK_PLLCM33_DIV16, 1, 1),
69+
};
70+
71+
static const struct rzv2h_mod_clk r9a09g047_mod_clks[] __initconst = {
72+
DEF_MOD_CRITICAL("gic_0_gicclk", CLK_PLLDTY_ACPU_DIV4, 1, 3, 0, 19,
73+
BUS_MSTOP(3, BIT(5))),
74+
DEF_MOD("scif_0_clk_pck", CLK_PLLCM33_DIV16, 8, 15, 4, 15,
75+
BUS_MSTOP(3, BIT(14))),
76+
};
77+
78+
static const struct rzv2h_reset r9a09g047_resets[] __initconst = {
79+
DEF_RST(3, 0, 1, 1), /* SYS_0_PRESETN */
80+
DEF_RST(3, 8, 1, 9), /* GIC_0_GICRESET_N */
81+
DEF_RST(3, 9, 1, 10), /* GIC_0_DBG_GICRESET_N */
82+
DEF_RST(9, 5, 4, 6), /* SCIF_0_RST_SYSTEM_N */
83+
};
84+
85+
const struct rzv2h_cpg_info r9a09g047_cpg_info __initconst = {
86+
/* Core Clocks */
87+
.core_clks = r9a09g047_core_clks,
88+
.num_core_clks = ARRAY_SIZE(r9a09g047_core_clks),
89+
.last_dt_core_clk = LAST_DT_CORE_CLK,
90+
.num_total_core_clks = MOD_CLK_BASE,
91+
92+
/* Module Clocks */
93+
.mod_clks = r9a09g047_mod_clks,
94+
.num_mod_clks = ARRAY_SIZE(r9a09g047_mod_clks),
95+
.num_hw_mod_clks = 28 * 16,
96+
97+
/* Resets */
98+
.resets = r9a09g047_resets,
99+
.num_resets = ARRAY_SIZE(r9a09g047_resets),
100+
101+
.num_mstop_bits = 208,
102+
};

drivers/clk/renesas/rzv2h-cpg.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -972,6 +972,12 @@ static const struct of_device_id rzv2h_cpg_match[] = {
972972
.compatible = "renesas,r9a09g057-cpg",
973973
.data = &r9a09g057_cpg_info,
974974
},
975+
#endif
976+
#ifdef CONFIG_CLK_R9A09G047
977+
{
978+
.compatible = "renesas,r9a09g047-cpg",
979+
.data = &r9a09g047_cpg_info,
980+
},
975981
#endif
976982
{ /* sentinel */ }
977983
};

drivers/clk/renesas/rzv2h-cpg.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ struct rzv2h_cpg_info {
218218
unsigned int num_mstop_bits;
219219
};
220220

221+
extern const struct rzv2h_cpg_info r9a09g047_cpg_info;
221222
extern const struct rzv2h_cpg_info r9a09g057_cpg_info;
222223

223224
#endif /* __RENESAS_RZV2H_CPG_H__ */

0 commit comments

Comments
 (0)