Skip to content

Commit 5edf5b5

Browse files
bijudasgeertu
authored andcommitted
clk: renesas: r9a09g011: Add USB clock and reset entries
Add USB clock and reset entries to CPG driver. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Link: https://lore.kernel.org/r/20221212172804.1277751-2-biju.das.jz@bp.renesas.com Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
1 parent d459f55 commit 5edf5b5

1 file changed

Lines changed: 21 additions & 0 deletions

File tree

drivers/clk/renesas/r9a09g011-cpg.c

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@
2323

2424
#define DIV_A DDIV_PACK(0x200, 0, 3)
2525
#define DIV_B DDIV_PACK(0x204, 0, 2)
26+
#define DIV_D DDIV_PACK(0x204, 4, 2)
2627
#define DIV_E DDIV_PACK(0x204, 8, 1)
2728
#define DIV_W DDIV_PACK(0x328, 0, 3)
2829

2930
#define SEL_B SEL_PLL_PACK(0x214, 0, 1)
31+
#define SEL_D SEL_PLL_PACK(0x214, 1, 1)
3032
#define SEL_E SEL_PLL_PACK(0x214, 2, 1)
3133
#define SEL_W0 SEL_PLL_PACK(0x32C, 0, 1)
3234

@@ -50,10 +52,12 @@ enum clk_ids {
5052
CLK_PLL4,
5153
CLK_DIV_A,
5254
CLK_DIV_B,
55+
CLK_DIV_D,
5356
CLK_DIV_E,
5457
CLK_DIV_W,
5558
CLK_SEL_B,
5659
CLK_SEL_B_D2,
60+
CLK_SEL_D,
5761
CLK_SEL_E,
5862
CLK_SEL_W0,
5963

@@ -81,6 +85,13 @@ static const struct clk_div_table dtable_divb[] = {
8185
{0, 0},
8286
};
8387

88+
static const struct clk_div_table dtable_divd[] = {
89+
{0, 1},
90+
{1, 2},
91+
{2, 4},
92+
{0, 0},
93+
};
94+
8495
static const struct clk_div_table dtable_divw[] = {
8596
{0, 6},
8697
{1, 7},
@@ -94,6 +105,7 @@ static const struct clk_div_table dtable_divw[] = {
94105

95106
/* Mux clock tables */
96107
static const char * const sel_b[] = { ".main", ".divb" };
108+
static const char * const sel_d[] = { ".main", ".divd" };
97109
static const char * const sel_e[] = { ".main", ".dive" };
98110
static const char * const sel_w[] = { ".main", ".divw" };
99111

@@ -115,10 +127,12 @@ static const struct cpg_core_clk r9a09g011_core_clks[] __initconst = {
115127

116128
DEF_DIV_RO(".diva", CLK_DIV_A, CLK_PLL1, DIV_A, dtable_diva),
117129
DEF_DIV_RO(".divb", CLK_DIV_B, CLK_PLL2_400, DIV_B, dtable_divb),
130+
DEF_DIV_RO(".divd", CLK_DIV_D, CLK_PLL2_200, DIV_D, dtable_divd),
118131
DEF_DIV_RO(".dive", CLK_DIV_E, CLK_PLL2_100, DIV_E, NULL),
119132
DEF_DIV_RO(".divw", CLK_DIV_W, CLK_PLL4, DIV_W, dtable_divw),
120133

121134
DEF_MUX_RO(".selb", CLK_SEL_B, SEL_B, sel_b),
135+
DEF_MUX_RO(".seld", CLK_SEL_D, SEL_D, sel_d),
122136
DEF_MUX_RO(".sele", CLK_SEL_E, SEL_E, sel_e),
123137
DEF_MUX(".selw0", CLK_SEL_W0, SEL_W0, sel_w),
124138

@@ -131,6 +145,9 @@ static const struct rzg2l_mod_clk r9a09g011_mod_clks[] __initconst = {
131145
DEF_COUPLED("eth_axi", R9A09G011_ETH0_CLK_AXI, CLK_PLL2_200, 0x40c, 8),
132146
DEF_COUPLED("eth_chi", R9A09G011_ETH0_CLK_CHI, CLK_PLL2_100, 0x40c, 8),
133147
DEF_MOD("eth_clk_gptp", R9A09G011_ETH0_GPTP_EXT, CLK_PLL2_100, 0x40c, 9),
148+
DEF_MOD("usb_aclk_h", R9A09G011_USB_ACLK_H, CLK_SEL_D, 0x40c, 4),
149+
DEF_MOD("usb_aclk_p", R9A09G011_USB_ACLK_P, CLK_SEL_D, 0x40c, 5),
150+
DEF_MOD("usb_pclk", R9A09G011_USB_PCLK, CLK_SEL_E, 0x40c, 6),
134151
DEF_MOD("syc_cnt_clk", R9A09G011_SYC_CNT_CLK, CLK_MAIN_24, 0x41c, 12),
135152
DEF_MOD("iic_pclk0", R9A09G011_IIC_PCLK0, CLK_SEL_E, 0x420, 12),
136153
DEF_MOD("cperi_grpb", R9A09G011_CPERI_GRPB_PCLK, CLK_SEL_E, 0x424, 0),
@@ -169,6 +186,10 @@ static const struct rzg2l_mod_clk r9a09g011_mod_clks[] __initconst = {
169186

170187
static const struct rzg2l_reset r9a09g011_resets[] = {
171188
DEF_RST(R9A09G011_PFC_PRESETN, 0x600, 2),
189+
DEF_RST(R9A09G011_USB_PRESET_N, 0x608, 7),
190+
DEF_RST(R9A09G011_USB_DRD_RESET, 0x608, 8),
191+
DEF_RST(R9A09G011_USB_ARESETN_P, 0x608, 9),
192+
DEF_RST(R9A09G011_USB_ARESETN_H, 0x608, 10),
172193
DEF_RST_MON(R9A09G011_ETH0_RST_HW_N, 0x608, 11, 11),
173194
DEF_RST_MON(R9A09G011_SYC_RST_N, 0x610, 9, 13),
174195
DEF_RST(R9A09G011_TIM_GPB_PRESETN, 0x614, 1),

0 commit comments

Comments
 (0)