Skip to content

Commit e6e5422

Browse files
John Madieugeertu
authored andcommitted
clk: renesas: r9a09g047: Add clock and reset signals for the GBETH IPs
Add clock and reset entries for the Gigabit Ethernet Interfaces (GBETH 0-1) IPs found on the RZ/G3E SoC. This includes various PLLs, dividers, and mux clocks needed by these two GBETH IPs. Reviewed-by: Biju Das <[email protected]> Signed-off-by: John Madieu <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Geert Uytterhoeven <[email protected]>
1 parent fc7dd51 commit e6e5422

File tree

1 file changed

+64
-0
lines changed

1 file changed

+64
-0
lines changed

drivers/clk/renesas/r9a09g047-cpg.c

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ enum clk_ids {
2929
CLK_PLLDTY,
3030
CLK_PLLCA55,
3131
CLK_PLLVDO,
32+
CLK_PLLETH,
3233

3334
/* Internal Core Clocks */
3435
CLK_PLLCM33_DIV3,
@@ -46,6 +47,15 @@ enum clk_ids {
4647
CLK_PLLDTY_ACPU,
4748
CLK_PLLDTY_ACPU_DIV2,
4849
CLK_PLLDTY_ACPU_DIV4,
50+
CLK_PLLDTY_DIV8,
51+
CLK_PLLETH_DIV_250_FIX,
52+
CLK_PLLETH_DIV_125_FIX,
53+
CLK_CSDIV_PLLETH_GBE0,
54+
CLK_CSDIV_PLLETH_GBE1,
55+
CLK_SMUX2_GBE0_TXCLK,
56+
CLK_SMUX2_GBE0_RXCLK,
57+
CLK_SMUX2_GBE1_TXCLK,
58+
CLK_SMUX2_GBE1_RXCLK,
4959
CLK_PLLDTY_DIV16,
5060
CLK_PLLVDO_CRU0,
5161
CLK_PLLVDO_GPU,
@@ -85,7 +95,18 @@ static const struct clk_div_table dtable_2_64[] = {
8595
{0, 0},
8696
};
8797

98+
static const struct clk_div_table dtable_2_100[] = {
99+
{0, 2},
100+
{1, 10},
101+
{2, 100},
102+
{0, 0},
103+
};
104+
88105
/* Mux clock tables */
106+
static const char * const smux2_gbe0_rxclk[] = { ".plleth_gbe0", "et0_rxclk" };
107+
static const char * const smux2_gbe0_txclk[] = { ".plleth_gbe0", "et0_txclk" };
108+
static const char * const smux2_gbe1_rxclk[] = { ".plleth_gbe1", "et1_rxclk" };
109+
static const char * const smux2_gbe1_txclk[] = { ".plleth_gbe1", "et1_txclk" };
89110
static const char * const smux2_xspi_clk0[] = { ".pllcm33_div3", ".pllcm33_div4" };
90111
static const char * const smux2_xspi_clk1[] = { ".smux2_xspi_clk0", ".pllcm33_div5" };
91112

@@ -100,6 +121,7 @@ static const struct cpg_core_clk r9a09g047_core_clks[] __initconst = {
100121
DEF_FIXED(".pllcln", CLK_PLLCLN, CLK_QEXTAL, 200, 3),
101122
DEF_FIXED(".plldty", CLK_PLLDTY, CLK_QEXTAL, 200, 3),
102123
DEF_PLL(".pllca55", CLK_PLLCA55, CLK_QEXTAL, PLLCA55),
124+
DEF_FIXED(".plleth", CLK_PLLETH, CLK_QEXTAL, 125, 3),
103125
DEF_FIXED(".pllvdo", CLK_PLLVDO, CLK_QEXTAL, 105, 2),
104126

105127
/* Internal Core Clocks */
@@ -122,6 +144,18 @@ static const struct cpg_core_clk r9a09g047_core_clks[] __initconst = {
122144
DEF_DDIV(".plldty_acpu", CLK_PLLDTY_ACPU, CLK_PLLDTY, CDDIV0_DIVCTL2, dtable_2_64),
123145
DEF_FIXED(".plldty_acpu_div2", CLK_PLLDTY_ACPU_DIV2, CLK_PLLDTY_ACPU, 1, 2),
124146
DEF_FIXED(".plldty_acpu_div4", CLK_PLLDTY_ACPU_DIV4, CLK_PLLDTY_ACPU, 1, 4),
147+
DEF_FIXED(".plldty_div8", CLK_PLLDTY_DIV8, CLK_PLLDTY, 1, 8),
148+
149+
DEF_FIXED(".plleth_250_fix", CLK_PLLETH_DIV_250_FIX, CLK_PLLETH, 1, 4),
150+
DEF_FIXED(".plleth_125_fix", CLK_PLLETH_DIV_125_FIX, CLK_PLLETH_DIV_250_FIX, 1, 2),
151+
DEF_CSDIV(".plleth_gbe0", CLK_CSDIV_PLLETH_GBE0, CLK_PLLETH_DIV_250_FIX,
152+
CSDIV0_DIVCTL0, dtable_2_100),
153+
DEF_CSDIV(".plleth_gbe1", CLK_CSDIV_PLLETH_GBE1, CLK_PLLETH_DIV_250_FIX,
154+
CSDIV0_DIVCTL1, dtable_2_100),
155+
DEF_SMUX(".smux2_gbe0_txclk", CLK_SMUX2_GBE0_TXCLK, SSEL0_SELCTL2, smux2_gbe0_txclk),
156+
DEF_SMUX(".smux2_gbe0_rxclk", CLK_SMUX2_GBE0_RXCLK, SSEL0_SELCTL3, smux2_gbe0_rxclk),
157+
DEF_SMUX(".smux2_gbe1_txclk", CLK_SMUX2_GBE1_TXCLK, SSEL1_SELCTL0, smux2_gbe1_txclk),
158+
DEF_SMUX(".smux2_gbe1_rxclk", CLK_SMUX2_GBE1_RXCLK, SSEL1_SELCTL1, smux2_gbe1_rxclk),
125159
DEF_FIXED(".plldty_div16", CLK_PLLDTY_DIV16, CLK_PLLDTY, 1, 16),
126160

127161
DEF_DDIV(".pllvdo_cru0", CLK_PLLVDO_CRU0, CLK_PLLVDO, CDDIV3_DIVCTL3, dtable_2_4),
@@ -139,6 +173,10 @@ static const struct cpg_core_clk r9a09g047_core_clks[] __initconst = {
139173
CDDIV1_DIVCTL3, dtable_1_8),
140174
DEF_FIXED("iotop_0_shclk", R9A09G047_IOTOP_0_SHCLK, CLK_PLLCM33_DIV16, 1, 1),
141175
DEF_FIXED("spi_clk_spi", R9A09G047_SPI_CLK_SPI, CLK_PLLCM33_XSPI, 1, 2),
176+
DEF_FIXED("gbeth_0_clk_ptp_ref_i", R9A09G047_GBETH_0_CLK_PTP_REF_I,
177+
CLK_PLLETH_DIV_125_FIX, 1, 1),
178+
DEF_FIXED("gbeth_1_clk_ptp_ref_i", R9A09G047_GBETH_1_CLK_PTP_REF_I,
179+
CLK_PLLETH_DIV_125_FIX, 1, 1),
142180
};
143181

144182
static const struct rzv2h_mod_clk r9a09g047_mod_clks[] __initconst = {
@@ -220,6 +258,30 @@ static const struct rzv2h_mod_clk r9a09g047_mod_clks[] __initconst = {
220258
BUS_MSTOP(8, BIT(4))),
221259
DEF_MOD("sdhi_2_aclk", CLK_PLLDTY_ACPU_DIV4, 10, 14, 5, 14,
222260
BUS_MSTOP(8, BIT(4))),
261+
DEF_MOD_MUX_EXTERNAL("gbeth_0_clk_tx_i", CLK_SMUX2_GBE0_TXCLK, 11, 8, 5, 24,
262+
BUS_MSTOP(8, BIT(5)), 1),
263+
DEF_MOD_MUX_EXTERNAL("gbeth_0_clk_rx_i", CLK_SMUX2_GBE0_RXCLK, 11, 9, 5, 25,
264+
BUS_MSTOP(8, BIT(5)), 1),
265+
DEF_MOD_MUX_EXTERNAL("gbeth_0_clk_tx_180_i", CLK_SMUX2_GBE0_TXCLK, 11, 10, 5, 26,
266+
BUS_MSTOP(8, BIT(5)), 1),
267+
DEF_MOD_MUX_EXTERNAL("gbeth_0_clk_rx_180_i", CLK_SMUX2_GBE0_RXCLK, 11, 11, 5, 27,
268+
BUS_MSTOP(8, BIT(5)), 1),
269+
DEF_MOD("gbeth_0_aclk_csr_i", CLK_PLLDTY_DIV8, 11, 12, 5, 28,
270+
BUS_MSTOP(8, BIT(5))),
271+
DEF_MOD("gbeth_0_aclk_i", CLK_PLLDTY_DIV8, 11, 13, 5, 29,
272+
BUS_MSTOP(8, BIT(5))),
273+
DEF_MOD_MUX_EXTERNAL("gbeth_1_clk_tx_i", CLK_SMUX2_GBE1_TXCLK, 11, 14, 5, 30,
274+
BUS_MSTOP(8, BIT(6)), 1),
275+
DEF_MOD_MUX_EXTERNAL("gbeth_1_clk_rx_i", CLK_SMUX2_GBE1_RXCLK, 11, 15, 5, 31,
276+
BUS_MSTOP(8, BIT(6)), 1),
277+
DEF_MOD_MUX_EXTERNAL("gbeth_1_clk_tx_180_i", CLK_SMUX2_GBE1_TXCLK, 12, 0, 6, 0,
278+
BUS_MSTOP(8, BIT(6)), 1),
279+
DEF_MOD_MUX_EXTERNAL("gbeth_1_clk_rx_180_i", CLK_SMUX2_GBE1_RXCLK, 12, 1, 6, 1,
280+
BUS_MSTOP(8, BIT(6)), 1),
281+
DEF_MOD("gbeth_1_aclk_csr_i", CLK_PLLDTY_DIV8, 12, 2, 6, 2,
282+
BUS_MSTOP(8, BIT(6))),
283+
DEF_MOD("gbeth_1_aclk_i", CLK_PLLDTY_DIV8, 12, 3, 6, 3,
284+
BUS_MSTOP(8, BIT(6))),
223285
DEF_MOD("cru_0_aclk", CLK_PLLDTY_ACPU_DIV2, 13, 2, 6, 18,
224286
BUS_MSTOP(9, BIT(4))),
225287
DEF_MOD_NO_PM("cru_0_vclk", CLK_PLLVDO_CRU0, 13, 3, 6, 19,
@@ -263,6 +325,8 @@ static const struct rzv2h_reset r9a09g047_resets[] __initconst = {
263325
DEF_RST(10, 7, 4, 24), /* SDHI_0_IXRST */
264326
DEF_RST(10, 8, 4, 25), /* SDHI_1_IXRST */
265327
DEF_RST(10, 9, 4, 26), /* SDHI_2_IXRST */
328+
DEF_RST(11, 0, 5, 1), /* GBETH_0_ARESETN_I */
329+
DEF_RST(11, 1, 5, 2), /* GBETH_1_ARESETN_I */
266330
DEF_RST(12, 5, 5, 22), /* CRU_0_PRESETN */
267331
DEF_RST(12, 6, 5, 23), /* CRU_0_ARESETN */
268332
DEF_RST(12, 7, 5, 24), /* CRU_0_S_RESETN */

0 commit comments

Comments
 (0)