Skip to content

Commit 7ef9c45

Browse files
bijudasgeertu
authored andcommitted
clk: renesas: r9a07g044: Add mux and divider for G clock
G clock is sourced from PLL3 and PLL6. The output of the mux is connected to divider. This patch adds a mux and divider for getting different rates from this clock sources. 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 98ee8b2 commit 7ef9c45

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

drivers/clk/renesas/r9a07g044-cpg.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ enum clk_ids {
5050
CLK_PLL2_SDHI_266,
5151
CLK_SD0_DIV4,
5252
CLK_SD1_DIV4,
53+
CLK_SEL_GPU2,
5354

5455
/* Module Clocks */
5556
MOD_CLK_BASE,
@@ -77,6 +78,7 @@ static const struct clk_div_table dtable_1_32[] = {
7778
static const char * const sel_pll3_3[] = { ".pll3_533", ".pll3_400" };
7879
static const char * const sel_pll6_2[] = { ".pll6_250", ".pll5_250" };
7980
static const char * const sel_shdi[] = { ".clk_533", ".clk_400", ".clk_266" };
81+
static const char * const sel_gpu2[] = { ".pll6", ".pll3_div2_2" };
8082

8183
static const struct cpg_core_clk r9a07g044_core_clks[] __initconst = {
8284
/* External Clock Inputs */
@@ -116,6 +118,8 @@ static const struct cpg_core_clk r9a07g044_core_clks[] __initconst = {
116118

117119
DEF_FIXED(".pll5_250", CLK_PLL5_250, CLK_PLL5_FOUT3, 1, 2),
118120
DEF_FIXED(".pll6_250", CLK_PLL6_250, CLK_PLL6, 1, 2),
121+
DEF_MUX(".sel_gpu2", CLK_SEL_GPU2, SEL_GPU2,
122+
sel_gpu2, ARRAY_SIZE(sel_gpu2), 0, CLK_MUX_READ_ONLY),
119123

120124
/* Core output clk */
121125
DEF_DIV("I", R9A07G044_CLK_I, CLK_PLL1, DIVPL1A, dtable_1_8,
@@ -141,6 +145,8 @@ static const struct cpg_core_clk r9a07g044_core_clks[] __initconst = {
141145
sel_shdi, ARRAY_SIZE(sel_shdi)),
142146
DEF_FIXED("SD0_DIV4", CLK_SD0_DIV4, R9A07G044_CLK_SD0, 1, 4),
143147
DEF_FIXED("SD1_DIV4", CLK_SD1_DIV4, R9A07G044_CLK_SD1, 1, 4),
148+
DEF_DIV("G", R9A07G044_CLK_G, CLK_SEL_GPU2, DIVGPU, dtable_1_8,
149+
CLK_DIVIDER_HIWORD_MASK),
144150
};
145151

146152
static struct rzg2l_mod_clk r9a07g044_mod_clks[] = {

drivers/clk/renesas/rzg2l-cpg.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,11 @@
1212
#define CPG_PL1_DDIV (0x200)
1313
#define CPG_PL2_DDIV (0x204)
1414
#define CPG_PL3A_DDIV (0x208)
15+
#define CPG_PL6_DDIV (0x210)
1516
#define CPG_PL2SDHI_DSEL (0x218)
1617
#define CPG_CLKSTATUS (0x280)
1718
#define CPG_PL3_SSEL (0x408)
19+
#define CPG_PL6_SSEL (0x414)
1820
#define CPG_PL6_ETH_SSEL (0x418)
1921

2022
#define CPG_CLKSTATUS_SELSDHI0_STS BIT(28)
@@ -35,12 +37,14 @@
3537
#define DIVPL3A DDIV_PACK(CPG_PL3A_DDIV, 0, 3)
3638
#define DIVPL3B DDIV_PACK(CPG_PL3A_DDIV, 4, 3)
3739
#define DIVPL3C DDIV_PACK(CPG_PL3A_DDIV, 8, 3)
40+
#define DIVGPU DDIV_PACK(CPG_PL6_DDIV, 0, 2)
3841

3942
#define SEL_PLL_PACK(offset, bitpos, size) \
4043
(((offset) << 20) | ((bitpos) << 12) | ((size) << 8))
4144

4245
#define SEL_PLL3_3 SEL_PLL_PACK(CPG_PL3_SSEL, 8, 1)
4346
#define SEL_PLL6_2 SEL_PLL_PACK(CPG_PL6_ETH_SSEL, 0, 1)
47+
#define SEL_GPU2 SEL_PLL_PACK(CPG_PL6_SSEL, 12, 1)
4448

4549
#define SEL_SDHI0 DDIV_PACK(CPG_PL2SDHI_DSEL, 0, 2)
4650
#define SEL_SDHI1 DDIV_PACK(CPG_PL2SDHI_DSEL, 4, 2)

0 commit comments

Comments
 (0)