Skip to content

Commit ee47b94

Browse files
prabhakarladgeertu
authored andcommitted
clk: renesas: r9a09g057: Add support for PLLVDO, CRU clocks, and resets
Add support for the PLLVDO clock and its related CRU clocks and reset entries in the r9a09g057 CPG driver. Introduce `CLK_PLLVDO` and associated clocks like `CLK_PLLVDO_CRU0`, `CLK_PLLVDO_CRU1`, `CLK_PLLVDO_CRU2`, and `CLK_PLLVDO_CRU3`, along with their corresponding dividers. Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/20241202203916.48668-3-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
1 parent 03108a2 commit ee47b94

File tree

2 files changed

+51
-0
lines changed

2 files changed

+51
-0
lines changed

drivers/clk/renesas/r9a09g057-cpg.c

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,21 @@ enum clk_ids {
2828
CLK_PLLCLN,
2929
CLK_PLLDTY,
3030
CLK_PLLCA55,
31+
CLK_PLLVDO,
3132

3233
/* Internal Core Clocks */
3334
CLK_PLLCM33_DIV16,
3435
CLK_PLLCLN_DIV2,
3536
CLK_PLLCLN_DIV8,
3637
CLK_PLLCLN_DIV16,
3738
CLK_PLLDTY_ACPU,
39+
CLK_PLLDTY_ACPU_DIV2,
3840
CLK_PLLDTY_ACPU_DIV4,
41+
CLK_PLLDTY_DIV16,
42+
CLK_PLLVDO_CRU0,
43+
CLK_PLLVDO_CRU1,
44+
CLK_PLLVDO_CRU2,
45+
CLK_PLLVDO_CRU3,
3946

4047
/* Module Clocks */
4148
MOD_CLK_BASE,
@@ -49,6 +56,12 @@ static const struct clk_div_table dtable_1_8[] = {
4956
{0, 0},
5057
};
5158

59+
static const struct clk_div_table dtable_2_4[] = {
60+
{0, 2},
61+
{1, 4},
62+
{0, 0},
63+
};
64+
5265
static const struct clk_div_table dtable_2_64[] = {
5366
{0, 2},
5467
{1, 4},
@@ -69,6 +82,7 @@ static const struct cpg_core_clk r9a09g057_core_clks[] __initconst = {
6982
DEF_FIXED(".pllcln", CLK_PLLCLN, CLK_QEXTAL, 200, 3),
7083
DEF_FIXED(".plldty", CLK_PLLDTY, CLK_QEXTAL, 200, 3),
7184
DEF_PLL(".pllca55", CLK_PLLCA55, CLK_QEXTAL, PLL_CONF(0x64)),
85+
DEF_FIXED(".pllvdo", CLK_PLLVDO, CLK_QEXTAL, 105, 2),
7286

7387
/* Internal Core Clocks */
7488
DEF_FIXED(".pllcm33_div16", CLK_PLLCM33_DIV16, CLK_PLLCM33, 1, 16),
@@ -78,7 +92,14 @@ static const struct cpg_core_clk r9a09g057_core_clks[] __initconst = {
7892
DEF_FIXED(".pllcln_div16", CLK_PLLCLN_DIV16, CLK_PLLCLN, 1, 16),
7993

8094
DEF_DDIV(".plldty_acpu", CLK_PLLDTY_ACPU, CLK_PLLDTY, CDDIV0_DIVCTL2, dtable_2_64),
95+
DEF_FIXED(".plldty_acpu_div2", CLK_PLLDTY_ACPU_DIV2, CLK_PLLDTY_ACPU, 1, 2),
8196
DEF_FIXED(".plldty_acpu_div4", CLK_PLLDTY_ACPU_DIV4, CLK_PLLDTY_ACPU, 1, 4),
97+
DEF_FIXED(".plldty_div16", CLK_PLLDTY_DIV16, CLK_PLLDTY, 1, 16),
98+
99+
DEF_DDIV(".pllvdo_cru0", CLK_PLLVDO_CRU0, CLK_PLLVDO, CDDIV3_DIVCTL3, dtable_2_4),
100+
DEF_DDIV(".pllvdo_cru1", CLK_PLLVDO_CRU1, CLK_PLLVDO, CDDIV4_DIVCTL0, dtable_2_4),
101+
DEF_DDIV(".pllvdo_cru2", CLK_PLLVDO_CRU2, CLK_PLLVDO, CDDIV4_DIVCTL1, dtable_2_4),
102+
DEF_DDIV(".pllvdo_cru3", CLK_PLLVDO_CRU3, CLK_PLLVDO, CDDIV4_DIVCTL2, dtable_2_4),
82103

83104
/* Core Clocks */
84105
DEF_FIXED("sys_0_pclk", R9A09G057_SYS_0_PCLK, CLK_QEXTAL, 1, 1),
@@ -133,6 +154,18 @@ static const struct rzv2h_mod_clk r9a09g057_mod_clks[] __initconst = {
133154
DEF_MOD("sdhi_2_imclk2", CLK_PLLCLN_DIV8, 10, 12, 5, 12),
134155
DEF_MOD("sdhi_2_clk_hs", CLK_PLLCLN_DIV2, 10, 13, 5, 13),
135156
DEF_MOD("sdhi_2_aclk", CLK_PLLDTY_ACPU_DIV4, 10, 14, 5, 14),
157+
DEF_MOD("cru_0_aclk", CLK_PLLDTY_ACPU_DIV2, 13, 2, 6, 18),
158+
DEF_MOD_NO_PM("cru_0_vclk", CLK_PLLVDO_CRU0, 13, 3, 6, 19),
159+
DEF_MOD("cru_0_pclk", CLK_PLLDTY_DIV16, 13, 4, 6, 20),
160+
DEF_MOD("cru_1_aclk", CLK_PLLDTY_ACPU_DIV2, 13, 5, 6, 21),
161+
DEF_MOD_NO_PM("cru_1_vclk", CLK_PLLVDO_CRU1, 13, 6, 6, 22),
162+
DEF_MOD("cru_1_pclk", CLK_PLLDTY_DIV16, 13, 7, 6, 23),
163+
DEF_MOD("cru_2_aclk", CLK_PLLDTY_ACPU_DIV2, 13, 8, 6, 24),
164+
DEF_MOD_NO_PM("cru_2_vclk", CLK_PLLVDO_CRU2, 13, 9, 6, 25),
165+
DEF_MOD("cru_2_pclk", CLK_PLLDTY_DIV16, 13, 10, 6, 26),
166+
DEF_MOD("cru_3_aclk", CLK_PLLDTY_ACPU_DIV2, 13, 11, 6, 27),
167+
DEF_MOD_NO_PM("cru_3_vclk", CLK_PLLVDO_CRU3, 13, 12, 6, 28),
168+
DEF_MOD("cru_3_pclk", CLK_PLLDTY_DIV16, 13, 13, 6, 29),
136169
};
137170

138171
static const struct rzv2h_reset r9a09g057_resets[] __initconst = {
@@ -162,6 +195,18 @@ static const struct rzv2h_reset r9a09g057_resets[] __initconst = {
162195
DEF_RST(10, 7, 4, 24), /* SDHI_0_IXRST */
163196
DEF_RST(10, 8, 4, 25), /* SDHI_1_IXRST */
164197
DEF_RST(10, 9, 4, 26), /* SDHI_2_IXRST */
198+
DEF_RST(12, 5, 5, 22), /* CRU_0_PRESETN */
199+
DEF_RST(12, 6, 5, 23), /* CRU_0_ARESETN */
200+
DEF_RST(12, 7, 5, 24), /* CRU_0_S_RESETN */
201+
DEF_RST(12, 8, 5, 25), /* CRU_1_PRESETN */
202+
DEF_RST(12, 9, 5, 26), /* CRU_1_ARESETN */
203+
DEF_RST(12, 10, 5, 27), /* CRU_1_S_RESETN */
204+
DEF_RST(12, 11, 5, 28), /* CRU_2_PRESETN */
205+
DEF_RST(12, 12, 5, 29), /* CRU_2_ARESETN */
206+
DEF_RST(12, 13, 5, 30), /* CRU_2_S_RESETN */
207+
DEF_RST(12, 14, 5, 31), /* CRU_3_PRESETN */
208+
DEF_RST(12, 15, 6, 0), /* CRU_3_ARESETN */
209+
DEF_RST(13, 0, 6, 1), /* CRU_3_S_RESETN */
165210
};
166211

167212
const struct rzv2h_cpg_info r9a09g057_cpg_info __initconst = {

drivers/clk/renesas/rzv2h-cpg.h

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,12 +33,18 @@ struct ddiv {
3333

3434
#define CPG_CDDIV0 (0x400)
3535
#define CPG_CDDIV1 (0x404)
36+
#define CPG_CDDIV3 (0x40C)
37+
#define CPG_CDDIV4 (0x410)
3638

3739
#define CDDIV0_DIVCTL2 DDIV_PACK(CPG_CDDIV0, 8, 3, 2)
3840
#define CDDIV1_DIVCTL0 DDIV_PACK(CPG_CDDIV1, 0, 2, 4)
3941
#define CDDIV1_DIVCTL1 DDIV_PACK(CPG_CDDIV1, 4, 2, 5)
4042
#define CDDIV1_DIVCTL2 DDIV_PACK(CPG_CDDIV1, 8, 2, 6)
4143
#define CDDIV1_DIVCTL3 DDIV_PACK(CPG_CDDIV1, 12, 2, 7)
44+
#define CDDIV3_DIVCTL3 DDIV_PACK(CPG_CDDIV3, 12, 1, 15)
45+
#define CDDIV4_DIVCTL0 DDIV_PACK(CPG_CDDIV4, 0, 1, 16)
46+
#define CDDIV4_DIVCTL1 DDIV_PACK(CPG_CDDIV4, 4, 1, 17)
47+
#define CDDIV4_DIVCTL2 DDIV_PACK(CPG_CDDIV4, 8, 1, 18)
4248

4349
/**
4450
* Definitions of CPG Core Clocks

0 commit comments

Comments
 (0)