Skip to content

Commit d64522b

Browse files
prabhakarladgeertu
authored andcommitted
clk: renesas: r9a09g056: Add clocks and resets for DSI and LCDC modules
Add clock and reset definitions required to support the DSI and LCDC hardware blocks on the RZ/V2N SoC. This includes new core clocks, clock dividers, module clocks, and reset entries, as well as PLL and divider configurations specific to these peripherals. Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://patch.msgid.link/20251023210724.666476-2-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
1 parent 79276fb commit d64522b

1 file changed

Lines changed: 64 additions & 0 deletions

File tree

drivers/clk/renesas/r9a09g056-cpg.c

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
*/
77

88
#include <linux/clk-provider.h>
9+
#include <linux/clk/renesas.h>
910
#include <linux/device.h>
1011
#include <linux/init.h>
1112
#include <linux/kernel.h>
@@ -29,6 +30,7 @@ enum clk_ids {
2930
CLK_PLLDTY,
3031
CLK_PLLCA55,
3132
CLK_PLLETH,
33+
CLK_PLLDSI,
3234
CLK_PLLGPU,
3335

3436
/* Internal Core Clocks */
@@ -47,6 +49,7 @@ enum clk_ids {
4749
CLK_PLLDTY_ACPU_DIV2,
4850
CLK_PLLDTY_ACPU_DIV4,
4951
CLK_PLLDTY_DIV8,
52+
CLK_PLLDTY_DIV16,
5053
CLK_PLLETH_DIV_250_FIX,
5154
CLK_PLLETH_DIV_125_FIX,
5255
CLK_CSDIV_PLLETH_GBE0,
@@ -55,6 +58,9 @@ enum clk_ids {
5558
CLK_SMUX2_GBE0_RXCLK,
5659
CLK_SMUX2_GBE1_TXCLK,
5760
CLK_SMUX2_GBE1_RXCLK,
61+
CLK_CDIV4_PLLETH_LPCLK,
62+
CLK_PLLETH_LPCLK_GEAR,
63+
CLK_PLLDSI_GEAR,
5864
CLK_PLLGPU_GEAR,
5965

6066
/* Module Clocks */
@@ -77,6 +83,26 @@ static const struct clk_div_table dtable_2_16[] = {
7783
{0, 0},
7884
};
7985

86+
static const struct clk_div_table dtable_2_32[] = {
87+
{0, 2},
88+
{1, 4},
89+
{2, 6},
90+
{3, 8},
91+
{4, 10},
92+
{5, 12},
93+
{6, 14},
94+
{7, 16},
95+
{8, 18},
96+
{9, 20},
97+
{10, 22},
98+
{11, 24},
99+
{12, 26},
100+
{13, 28},
101+
{14, 30},
102+
{15, 32},
103+
{0, 0},
104+
};
105+
80106
static const struct clk_div_table dtable_2_64[] = {
81107
{0, 2},
82108
{1, 4},
@@ -93,6 +119,17 @@ static const struct clk_div_table dtable_2_100[] = {
93119
{0, 0},
94120
};
95121

122+
static const struct clk_div_table dtable_16_128[] = {
123+
{0, 16},
124+
{1, 32},
125+
{2, 64},
126+
{3, 128},
127+
{0, 0},
128+
};
129+
130+
RZV2H_CPG_PLL_DSI_LIMITS(rzv2n_cpg_pll_dsi_limits);
131+
#define PLLDSI PLL_PACK_LIMITS(0xc0, 1, 0, &rzv2n_cpg_pll_dsi_limits)
132+
96133
/* Mux clock tables */
97134
static const char * const smux2_gbe0_rxclk[] = { ".plleth_gbe0", "et0_rxclk" };
98135
static const char * const smux2_gbe0_txclk[] = { ".plleth_gbe0", "et0_txclk" };
@@ -113,6 +150,7 @@ static const struct cpg_core_clk r9a09g056_core_clks[] __initconst = {
113150
DEF_FIXED(".plldty", CLK_PLLDTY, CLK_QEXTAL, 200, 3),
114151
DEF_PLL(".pllca55", CLK_PLLCA55, CLK_QEXTAL, PLLCA55),
115152
DEF_FIXED(".plleth", CLK_PLLETH, CLK_QEXTAL, 125, 3),
153+
DEF_PLLDSI(".plldsi", CLK_PLLDSI, CLK_QEXTAL, PLLDSI),
116154
DEF_PLL(".pllgpu", CLK_PLLGPU, CLK_QEXTAL, PLLGPU),
117155

118156
/* Internal Core Clocks */
@@ -134,6 +172,7 @@ static const struct cpg_core_clk r9a09g056_core_clks[] __initconst = {
134172
DEF_FIXED(".plldty_acpu_div2", CLK_PLLDTY_ACPU_DIV2, CLK_PLLDTY_ACPU, 1, 2),
135173
DEF_FIXED(".plldty_acpu_div4", CLK_PLLDTY_ACPU_DIV4, CLK_PLLDTY_ACPU, 1, 4),
136174
DEF_FIXED(".plldty_div8", CLK_PLLDTY_DIV8, CLK_PLLDTY, 1, 8),
175+
DEF_FIXED(".plldty_div16", CLK_PLLDTY_DIV16, CLK_PLLDTY, 1, 16),
137176

138177
DEF_FIXED(".plleth_250_fix", CLK_PLLETH_DIV_250_FIX, CLK_PLLETH, 1, 4),
139178
DEF_FIXED(".plleth_125_fix", CLK_PLLETH_DIV_125_FIX, CLK_PLLETH_DIV_250_FIX, 1, 2),
@@ -145,6 +184,12 @@ static const struct cpg_core_clk r9a09g056_core_clks[] __initconst = {
145184
DEF_SMUX(".smux2_gbe0_rxclk", CLK_SMUX2_GBE0_RXCLK, SSEL0_SELCTL3, smux2_gbe0_rxclk),
146185
DEF_SMUX(".smux2_gbe1_txclk", CLK_SMUX2_GBE1_TXCLK, SSEL1_SELCTL0, smux2_gbe1_txclk),
147186
DEF_SMUX(".smux2_gbe1_rxclk", CLK_SMUX2_GBE1_RXCLK, SSEL1_SELCTL1, smux2_gbe1_rxclk),
187+
DEF_FIXED(".cdiv4_plleth_lpclk", CLK_CDIV4_PLLETH_LPCLK, CLK_PLLETH, 1, 4),
188+
DEF_CSDIV(".plleth_lpclk_gear", CLK_PLLETH_LPCLK_GEAR, CLK_CDIV4_PLLETH_LPCLK,
189+
CSDIV0_DIVCTL2, dtable_16_128),
190+
191+
DEF_PLLDSI_DIV(".plldsi_gear", CLK_PLLDSI_GEAR, CLK_PLLDSI,
192+
CSDIV1_DIVCTL2, dtable_2_32),
148193

149194
DEF_DDIV(".pllgpu_gear", CLK_PLLGPU_GEAR, CLK_PLLGPU, CDDIV3_DIVCTL1, dtable_2_64),
150195

@@ -289,6 +334,22 @@ static const struct rzv2h_mod_clk r9a09g056_mod_clks[] __initconst = {
289334
BUS_MSTOP(8, BIT(6))),
290335
DEF_MOD("gbeth_1_aclk_i", CLK_PLLDTY_DIV8, 12, 3, 6, 3,
291336
BUS_MSTOP(8, BIT(6))),
337+
DEF_MOD("dsi_0_pclk", CLK_PLLDTY_DIV16, 14, 8, 7, 8,
338+
BUS_MSTOP(9, BIT(14) | BIT(15))),
339+
DEF_MOD("dsi_0_aclk", CLK_PLLDTY_ACPU_DIV2, 14, 9, 7, 9,
340+
BUS_MSTOP(9, BIT(14) | BIT(15))),
341+
DEF_MOD("dsi_0_vclk1", CLK_PLLDSI_GEAR, 14, 10, 7, 10,
342+
BUS_MSTOP(9, BIT(14) | BIT(15))),
343+
DEF_MOD("dsi_0_lpclk", CLK_PLLETH_LPCLK_GEAR, 14, 11, 7, 11,
344+
BUS_MSTOP(9, BIT(14) | BIT(15))),
345+
DEF_MOD("dsi_0_pllref_clk", CLK_QEXTAL, 14, 12, 7, 12,
346+
BUS_MSTOP(9, BIT(14) | BIT(15))),
347+
DEF_MOD("lcdc_0_clk_a", CLK_PLLDTY_ACPU_DIV2, 14, 13, 7, 13,
348+
BUS_MSTOP(10, BIT(1) | BIT(2) | BIT(3))),
349+
DEF_MOD("lcdc_0_clk_p", CLK_PLLDTY_DIV16, 14, 14, 7, 14,
350+
BUS_MSTOP(10, BIT(1) | BIT(2) | BIT(3))),
351+
DEF_MOD("lcdc_0_clk_d", CLK_PLLDSI_GEAR, 14, 15, 7, 15,
352+
BUS_MSTOP(10, BIT(1) | BIT(2) | BIT(3))),
292353
DEF_MOD("gpu_0_clk", CLK_PLLGPU_GEAR, 15, 0, 7, 16,
293354
BUS_MSTOP(3, BIT(4))),
294355
DEF_MOD("gpu_0_axi_clk", CLK_PLLDTY_ACPU_DIV2, 15, 1, 7, 17,
@@ -335,6 +396,9 @@ static const struct rzv2h_reset r9a09g056_resets[] __initconst = {
335396
DEF_RST(10, 15, 5, 0), /* USB2_0_PRESETN */
336397
DEF_RST(11, 0, 5, 1), /* GBETH_0_ARESETN_I */
337398
DEF_RST(11, 1, 5, 2), /* GBETH_1_ARESETN_I */
399+
DEF_RST(13, 7, 6, 8), /* DSI_0_PRESETN */
400+
DEF_RST(13, 8, 6, 9), /* DSI_0_ARESETN */
401+
DEF_RST(13, 12, 6, 13), /* LCDC_0_RESET_N */
338402
DEF_RST(13, 13, 6, 14), /* GPU_0_RESETN */
339403
DEF_RST(13, 14, 6, 15), /* GPU_0_AXI_RESETN */
340404
DEF_RST(13, 15, 6, 16), /* GPU_0_ACE_RESETN */

0 commit comments

Comments
 (0)