Skip to content

Commit 7aada0a

Browse files
prabhakarladgeertu
authored andcommitted
clk: renesas: r9a09g057: Add support for xspi mux and divider
The mux smux2_xspi_clk{0,1} used for selecting spi and spix2 clocks and pllcm33_xspi divider to select different clock rates. Add support for both. Signed-off-by: Lad Prabhakar <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Geert Uytterhoeven <[email protected]>
1 parent 2a4c0e7 commit 7aada0a

File tree

1 file changed

+22
-1
lines changed

1 file changed

+22
-1
lines changed

drivers/clk/renesas/r9a09g057-cpg.c

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
enum clk_ids {
1818
/* Core Clock Outputs exported to DT */
19-
LAST_DT_CORE_CLK = R9A09G057_GBETH_1_CLK_PTP_REF_I,
19+
LAST_DT_CORE_CLK = R9A09G057_SPI_CLK_SPI,
2020

2121
/* External Input Clocks */
2222
CLK_AUDIO_EXTAL,
@@ -33,9 +33,14 @@ enum clk_ids {
3333
CLK_PLLGPU,
3434

3535
/* Internal Core Clocks */
36+
CLK_PLLCM33_DIV3,
3637
CLK_PLLCM33_DIV4,
38+
CLK_PLLCM33_DIV5,
3739
CLK_PLLCM33_DIV4_PLLCM33,
3840
CLK_PLLCM33_DIV16,
41+
CLK_SMUX2_XSPI_CLK0,
42+
CLK_SMUX2_XSPI_CLK1,
43+
CLK_PLLCM33_XSPI,
3944
CLK_PLLCLN_DIV2,
4045
CLK_PLLCLN_DIV8,
4146
CLK_PLLCLN_DIV16,
@@ -78,6 +83,14 @@ static const struct clk_div_table dtable_2_4[] = {
7883
{0, 0},
7984
};
8085

86+
static const struct clk_div_table dtable_2_16[] = {
87+
{0, 2},
88+
{1, 4},
89+
{2, 8},
90+
{3, 16},
91+
{0, 0},
92+
};
93+
8194
static const struct clk_div_table dtable_2_64[] = {
8295
{0, 2},
8396
{1, 4},
@@ -99,6 +112,8 @@ static const char * const smux2_gbe0_rxclk[] = { ".plleth_gbe0", "et0_rxclk" };
99112
static const char * const smux2_gbe0_txclk[] = { ".plleth_gbe0", "et0_txclk" };
100113
static const char * const smux2_gbe1_rxclk[] = { ".plleth_gbe1", "et1_rxclk" };
101114
static const char * const smux2_gbe1_txclk[] = { ".plleth_gbe1", "et1_txclk" };
115+
static const char * const smux2_xspi_clk0[] = { ".pllcm33_div3", ".pllcm33_div4" };
116+
static const char * const smux2_xspi_clk1[] = { ".smux2_xspi_clk0", ".pllcm33_div5" };
102117

103118
static const struct cpg_core_clk r9a09g057_core_clks[] __initconst = {
104119
/* External Clock Inputs */
@@ -116,10 +131,16 @@ static const struct cpg_core_clk r9a09g057_core_clks[] __initconst = {
116131
DEF_PLL(".pllgpu", CLK_PLLGPU, CLK_QEXTAL, PLLGPU),
117132

118133
/* Internal Core Clocks */
134+
DEF_FIXED(".pllcm33_div3", CLK_PLLCM33_DIV3, CLK_PLLCM33, 1, 3),
119135
DEF_FIXED(".pllcm33_div4", CLK_PLLCM33_DIV4, CLK_PLLCM33, 1, 4),
136+
DEF_FIXED(".pllcm33_div5", CLK_PLLCM33_DIV5, CLK_PLLCM33, 1, 5),
120137
DEF_DDIV(".pllcm33_div4_pllcm33", CLK_PLLCM33_DIV4_PLLCM33,
121138
CLK_PLLCM33_DIV4, CDDIV0_DIVCTL1, dtable_2_64),
122139
DEF_FIXED(".pllcm33_div16", CLK_PLLCM33_DIV16, CLK_PLLCM33, 1, 16),
140+
DEF_SMUX(".smux2_xspi_clk0", CLK_SMUX2_XSPI_CLK0, SSEL1_SELCTL2, smux2_xspi_clk0),
141+
DEF_SMUX(".smux2_xspi_clk1", CLK_SMUX2_XSPI_CLK1, SSEL1_SELCTL3, smux2_xspi_clk1),
142+
DEF_CSDIV(".pllcm33_xspi", CLK_PLLCM33_XSPI, CLK_SMUX2_XSPI_CLK1, CSDIV0_DIVCTL3,
143+
dtable_2_16),
123144

124145
DEF_FIXED(".pllcln_div2", CLK_PLLCLN_DIV2, CLK_PLLCLN, 1, 2),
125146
DEF_FIXED(".pllcln_div8", CLK_PLLCLN_DIV8, CLK_PLLCLN, 1, 8),

0 commit comments

Comments
 (0)