Skip to content

Commit 373bd6f

Browse files
bijudasgeertu
authored andcommitted
clk: renesas: r9a07g044: Add SDHI clock and reset entries
Add SDHI{0,1} mux, clock and reset entries to CPG driver. Signed-off-by: Biju Das <[email protected]> Reviewed-by: Lad Prabhakar <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Geert Uytterhoeven <[email protected]>
1 parent eaff336 commit 373bd6f

File tree

2 files changed

+40
-0
lines changed

2 files changed

+40
-0
lines changed

drivers/clk/renesas/r9a07g044-cpg.c

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,12 @@ enum clk_ids {
4444
CLK_PLL6,
4545
CLK_PLL6_250,
4646
CLK_P1_DIV2,
47+
CLK_PLL2_800,
48+
CLK_PLL2_SDHI_533,
49+
CLK_PLL2_SDHI_400,
50+
CLK_PLL2_SDHI_266,
51+
CLK_SD0_DIV4,
52+
CLK_SD1_DIV4,
4753

4854
/* Module Clocks */
4955
MOD_CLK_BASE,
@@ -62,6 +68,7 @@ static const struct clk_div_table dtable_1_32[] = {
6268
/* Mux clock tables */
6369
static const char * const sel_pll3_3[] = { ".pll3_533", ".pll3_400" };
6470
static const char * const sel_pll6_2[] = { ".pll6_250", ".pll5_250" };
71+
static const char * const sel_shdi[] = { ".clk_533", ".clk_400", ".clk_266" };
6572

6673
static const struct cpg_core_clk r9a07g044_core_clks[] __initconst = {
6774
/* External Clock Inputs */
@@ -82,6 +89,11 @@ static const struct cpg_core_clk r9a07g044_core_clks[] __initconst = {
8289
DEF_FIXED(".pll6", CLK_PLL6, CLK_EXTAL, 125, 6),
8390

8491
DEF_FIXED(".pll2_div2", CLK_PLL2_DIV2, CLK_PLL2, 1, 2),
92+
DEF_FIXED(".clk_800", CLK_PLL2_800, CLK_PLL2, 1, 2),
93+
DEF_FIXED(".clk_533", CLK_PLL2_SDHI_533, CLK_PLL2, 1, 3),
94+
DEF_FIXED(".clk_400", CLK_PLL2_SDHI_400, CLK_PLL2_800, 1, 2),
95+
DEF_FIXED(".clk_266", CLK_PLL2_SDHI_266, CLK_PLL2_SDHI_533, 1, 2),
96+
8597
DEF_FIXED(".pll2_div16", CLK_PLL2_DIV16, CLK_PLL2, 1, 16),
8698
DEF_FIXED(".pll2_div20", CLK_PLL2_DIV20, CLK_PLL2, 1, 20),
8799

@@ -114,6 +126,12 @@ static const struct cpg_core_clk r9a07g044_core_clks[] __initconst = {
114126
sel_pll6_2, ARRAY_SIZE(sel_pll6_2), 0, CLK_MUX_HIWORD_MASK),
115127
DEF_FIXED("SPI0", R9A07G044_CLK_SPI0, CLK_DIV_PLL3_C, 1, 2),
116128
DEF_FIXED("SPI1", R9A07G044_CLK_SPI1, CLK_DIV_PLL3_C, 1, 4),
129+
DEF_SD_MUX("SD0", R9A07G044_CLK_SD0, SEL_SDHI0,
130+
sel_shdi, ARRAY_SIZE(sel_shdi)),
131+
DEF_SD_MUX("SD1", R9A07G044_CLK_SD1, SEL_SDHI1,
132+
sel_shdi, ARRAY_SIZE(sel_shdi)),
133+
DEF_FIXED("SD0_DIV4", CLK_SD0_DIV4, R9A07G044_CLK_SD0, 1, 4),
134+
DEF_FIXED("SD1_DIV4", CLK_SD1_DIV4, R9A07G044_CLK_SD1, 1, 4),
117135
};
118136

119137
static struct rzg2l_mod_clk r9a07g044_mod_clks[] = {
@@ -131,6 +149,22 @@ static struct rzg2l_mod_clk r9a07g044_mod_clks[] = {
131149
0x550, 0),
132150
DEF_MOD("spi_clk", R9A07G044_SPI_CLK, R9A07G044_CLK_SPI0,
133151
0x550, 1),
152+
DEF_MOD("sdhi0_imclk", R9A07G044_SDHI0_IMCLK, CLK_SD0_DIV4,
153+
0x554, 0),
154+
DEF_MOD("sdhi0_imclk2", R9A07G044_SDHI0_IMCLK2, CLK_SD0_DIV4,
155+
0x554, 1),
156+
DEF_MOD("sdhi0_clk_hs", R9A07G044_SDHI0_CLK_HS, R9A07G044_CLK_SD0,
157+
0x554, 2),
158+
DEF_MOD("sdhi0_aclk", R9A07G044_SDHI0_ACLK, R9A07G044_CLK_P1,
159+
0x554, 3),
160+
DEF_MOD("sdhi1_imclk", R9A07G044_SDHI1_IMCLK, CLK_SD1_DIV4,
161+
0x554, 4),
162+
DEF_MOD("sdhi1_imclk2", R9A07G044_SDHI1_IMCLK2, CLK_SD1_DIV4,
163+
0x554, 5),
164+
DEF_MOD("sdhi1_clk_hs", R9A07G044_SDHI1_CLK_HS, R9A07G044_CLK_SD1,
165+
0x554, 6),
166+
DEF_MOD("sdhi1_aclk", R9A07G044_SDHI1_ACLK, R9A07G044_CLK_P1,
167+
0x554, 7),
134168
DEF_MOD("ssi0_pclk", R9A07G044_SSI0_PCLK2, R9A07G044_CLK_P0,
135169
0x570, 0),
136170
DEF_MOD("ssi0_sfr", R9A07G044_SSI0_PCLK_SFR, R9A07G044_CLK_P0,
@@ -200,6 +234,8 @@ static struct rzg2l_reset r9a07g044_resets[] = {
200234
DEF_RST(R9A07G044_DMAC_ARESETN, 0x82c, 0),
201235
DEF_RST(R9A07G044_DMAC_RST_ASYNC, 0x82c, 1),
202236
DEF_RST(R9A07G044_SPI_RST, 0x850, 0),
237+
DEF_RST(R9A07G044_SDHI0_IXRST, 0x854, 0),
238+
DEF_RST(R9A07G044_SDHI1_IXRST, 0x854, 1),
203239
DEF_RST(R9A07G044_SSI0_RST_M2_REG, 0x870, 0),
204240
DEF_RST(R9A07G044_SSI1_RST_M2_REG, 0x870, 1),
205241
DEF_RST(R9A07G044_SSI2_RST_M2_REG, 0x870, 2),

drivers/clk/renesas/rzg2l-cpg.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
#define CPG_PL2_DDIV (0x204)
1313
#define CPG_PL3A_DDIV (0x208)
14+
#define CPG_PL2SDHI_DSEL (0x218)
1415
#define CPG_CLKSTATUS (0x280)
1516
#define CPG_PL3_SSEL (0x408)
1617
#define CPG_PL6_ETH_SSEL (0x418)
@@ -39,6 +40,9 @@
3940
#define SEL_PLL3_3 SEL_PLL_PACK(CPG_PL3_SSEL, 8, 1)
4041
#define SEL_PLL6_2 SEL_PLL_PACK(CPG_PL6_ETH_SSEL, 0, 1)
4142

43+
#define SEL_SDHI0 DDIV_PACK(CPG_PL2SDHI_DSEL, 0, 2)
44+
#define SEL_SDHI1 DDIV_PACK(CPG_PL2SDHI_DSEL, 4, 2)
45+
4246
/**
4347
* Definitions of CPG Core Clocks
4448
*

0 commit comments

Comments
 (0)