Skip to content

Commit 66a470a

Browse files
prabhakarladgeertu
authored andcommitted
clk: renesas: r9a09g057: Add clock and reset entries for DSI and LCDC
Add clock and reset entries for the DSI and LCDC peripherals. Co-developed-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com> Signed-off-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com> Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://patch.msgid.link/20251015192611.241920-5-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
1 parent d67c39b commit 66a470a

2 files changed

Lines changed: 65 additions & 0 deletions

File tree

drivers/clk/renesas/r9a09g057-cpg.c

Lines changed: 62 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>
@@ -30,6 +31,7 @@ enum clk_ids {
3031
CLK_PLLCA55,
3132
CLK_PLLVDO,
3233
CLK_PLLETH,
34+
CLK_PLLDSI,
3335
CLK_PLLGPU,
3436

3537
/* Internal Core Clocks */
@@ -64,6 +66,9 @@ enum clk_ids {
6466
CLK_SMUX2_GBE0_RXCLK,
6567
CLK_SMUX2_GBE1_TXCLK,
6668
CLK_SMUX2_GBE1_RXCLK,
69+
CLK_CDIV4_PLLETH_LPCLK,
70+
CLK_PLLETH_LPCLK_GEAR,
71+
CLK_PLLDSI_GEAR,
6772
CLK_PLLGPU_GEAR,
6873

6974
/* Module Clocks */
@@ -92,6 +97,26 @@ static const struct clk_div_table dtable_2_16[] = {
9297
{0, 0},
9398
};
9499

100+
static const struct clk_div_table dtable_2_32[] = {
101+
{0, 2},
102+
{1, 4},
103+
{2, 6},
104+
{3, 8},
105+
{4, 10},
106+
{5, 12},
107+
{6, 14},
108+
{7, 16},
109+
{8, 18},
110+
{9, 20},
111+
{10, 22},
112+
{11, 24},
113+
{12, 26},
114+
{13, 28},
115+
{14, 30},
116+
{15, 32},
117+
{0, 0},
118+
};
119+
95120
static const struct clk_div_table dtable_2_64[] = {
96121
{0, 2},
97122
{1, 4},
@@ -108,6 +133,17 @@ static const struct clk_div_table dtable_2_100[] = {
108133
{0, 0},
109134
};
110135

136+
static const struct clk_div_table dtable_16_128[] = {
137+
{0, 16},
138+
{1, 32},
139+
{2, 64},
140+
{3, 128},
141+
{0, 0},
142+
};
143+
144+
RZV2H_CPG_PLL_DSI_LIMITS(rzv2h_cpg_pll_dsi_limits);
145+
#define PLLDSI PLL_PACK_LIMITS(0xc0, 1, 0, &rzv2h_cpg_pll_dsi_limits)
146+
111147
/* Mux clock tables */
112148
static const char * const smux2_gbe0_rxclk[] = { ".plleth_gbe0", "et0_rxclk" };
113149
static const char * const smux2_gbe0_txclk[] = { ".plleth_gbe0", "et0_txclk" };
@@ -129,6 +165,7 @@ static const struct cpg_core_clk r9a09g057_core_clks[] __initconst = {
129165
DEF_PLL(".pllca55", CLK_PLLCA55, CLK_QEXTAL, PLLCA55),
130166
DEF_FIXED(".pllvdo", CLK_PLLVDO, CLK_QEXTAL, 105, 2),
131167
DEF_FIXED(".plleth", CLK_PLLETH, CLK_QEXTAL, 125, 3),
168+
DEF_PLLDSI(".plldsi", CLK_PLLDSI, CLK_QEXTAL, PLLDSI),
132169
DEF_PLL(".pllgpu", CLK_PLLGPU, CLK_QEXTAL, PLLGPU),
133170

134171
/* Internal Core Clocks */
@@ -170,6 +207,12 @@ static const struct cpg_core_clk r9a09g057_core_clks[] __initconst = {
170207
DEF_SMUX(".smux2_gbe0_rxclk", CLK_SMUX2_GBE0_RXCLK, SSEL0_SELCTL3, smux2_gbe0_rxclk),
171208
DEF_SMUX(".smux2_gbe1_txclk", CLK_SMUX2_GBE1_TXCLK, SSEL1_SELCTL0, smux2_gbe1_txclk),
172209
DEF_SMUX(".smux2_gbe1_rxclk", CLK_SMUX2_GBE1_RXCLK, SSEL1_SELCTL1, smux2_gbe1_rxclk),
210+
DEF_FIXED(".cdiv4_plleth_lpclk", CLK_CDIV4_PLLETH_LPCLK, CLK_PLLETH, 1, 4),
211+
DEF_CSDIV(".plleth_lpclk_gear", CLK_PLLETH_LPCLK_GEAR, CLK_CDIV4_PLLETH_LPCLK,
212+
CSDIV0_DIVCTL2, dtable_16_128),
213+
214+
DEF_PLLDSI_DIV(".plldsi_gear", CLK_PLLDSI_GEAR, CLK_PLLDSI,
215+
CSDIV1_DIVCTL2, dtable_2_32),
173216

174217
DEF_DDIV(".pllgpu_gear", CLK_PLLGPU_GEAR, CLK_PLLGPU, CDDIV3_DIVCTL1, dtable_2_64),
175218

@@ -383,6 +426,22 @@ static const struct rzv2h_mod_clk r9a09g057_mod_clks[] __initconst = {
383426
BUS_MSTOP(9, BIT(9))),
384427
DEF_MOD("isp_0_isp_sclk", CLK_PLLVDO_ISP, 14, 5, 7, 5,
385428
BUS_MSTOP(9, BIT(9))),
429+
DEF_MOD("dsi_0_pclk", CLK_PLLDTY_DIV16, 14, 8, 7, 8,
430+
BUS_MSTOP(9, BIT(14) | BIT(15))),
431+
DEF_MOD("dsi_0_aclk", CLK_PLLDTY_ACPU_DIV2, 14, 9, 7, 9,
432+
BUS_MSTOP(9, BIT(14) | BIT(15))),
433+
DEF_MOD("dsi_0_vclk1", CLK_PLLDSI_GEAR, 14, 10, 7, 10,
434+
BUS_MSTOP(9, BIT(14) | BIT(15))),
435+
DEF_MOD("dsi_0_lpclk", CLK_PLLETH_LPCLK_GEAR, 14, 11, 7, 11,
436+
BUS_MSTOP(9, BIT(14) | BIT(15))),
437+
DEF_MOD("dsi_0_pllref_clk", CLK_QEXTAL, 14, 12, 7, 12,
438+
BUS_MSTOP(9, BIT(14) | BIT(15))),
439+
DEF_MOD("lcdc_0_clk_a", CLK_PLLDTY_ACPU_DIV2, 14, 13, 7, 13,
440+
BUS_MSTOP(10, BIT(1) | BIT(2) | BIT(3))),
441+
DEF_MOD("lcdc_0_clk_p", CLK_PLLDTY_DIV16, 14, 14, 7, 14,
442+
BUS_MSTOP(10, BIT(1) | BIT(2) | BIT(3))),
443+
DEF_MOD("lcdc_0_clk_d", CLK_PLLDSI_GEAR, 14, 15, 7, 15,
444+
BUS_MSTOP(10, BIT(1) | BIT(2) | BIT(3))),
386445
DEF_MOD("gpu_0_clk", CLK_PLLGPU_GEAR, 15, 0, 7, 16,
387446
BUS_MSTOP(3, BIT(4))),
388447
DEF_MOD("gpu_0_axi_clk", CLK_PLLDTY_ACPU_DIV2, 15, 1, 7, 17,
@@ -464,6 +523,9 @@ static const struct rzv2h_reset r9a09g057_resets[] __initconst = {
464523
DEF_RST(13, 2, 6, 3), /* ISP_0_REG_ARESETN */
465524
DEF_RST(13, 3, 6, 4), /* ISP_0_ISP_SRESETN */
466525
DEF_RST(13, 4, 6, 5), /* ISP_0_PRESETN */
526+
DEF_RST(13, 7, 6, 8), /* DSI_0_PRESETN */
527+
DEF_RST(13, 8, 6, 9), /* DSI_0_ARESETN */
528+
DEF_RST(13, 12, 6, 13), /* LCDC_0_RESET_N */
467529
DEF_RST(13, 13, 6, 14), /* GPU_0_RESETN */
468530
DEF_RST(13, 14, 6, 15), /* GPU_0_AXI_RESETN */
469531
DEF_RST(13, 15, 6, 16), /* GPU_0_ACE_RESETN */

drivers/clk/renesas/rzv2h-cpg.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,7 @@ struct fixed_mod_conf {
127127
#define CPG_CDDIV3 (0x40C)
128128
#define CPG_CDDIV4 (0x410)
129129
#define CPG_CSDIV0 (0x500)
130+
#define CPG_CSDIV1 (0x504)
130131

131132
#define CDDIV0_DIVCTL1 DDIV_PACK(CPG_CDDIV0, 4, 3, 1)
132133
#define CDDIV0_DIVCTL2 DDIV_PACK(CPG_CDDIV0, 8, 3, 2)
@@ -144,7 +145,9 @@ struct fixed_mod_conf {
144145

145146
#define CSDIV0_DIVCTL0 DDIV_PACK(CPG_CSDIV0, 0, 2, CSDIV_NO_MON)
146147
#define CSDIV0_DIVCTL1 DDIV_PACK(CPG_CSDIV0, 4, 2, CSDIV_NO_MON)
148+
#define CSDIV0_DIVCTL2 DDIV_PACK(CPG_CSDIV0, 8, 2, CSDIV_NO_MON)
147149
#define CSDIV0_DIVCTL3 DDIV_PACK_NO_RMW(CPG_CSDIV0, 12, 2, CSDIV_NO_MON)
150+
#define CSDIV1_DIVCTL2 DDIV_PACK(CPG_CSDIV1, 8, 4, CSDIV_NO_MON)
148151

149152
#define SSEL0_SELCTL2 SMUX_PACK(CPG_SSEL0, 8, 1)
150153
#define SSEL0_SELCTL3 SMUX_PACK(CPG_SSEL0, 12, 1)

0 commit comments

Comments
 (0)