Skip to content

Commit 70a4af3

Browse files
bijudasgeertu
authored andcommitted
clk: renesas: r9a07g044: Add ethernet clock sources
Ethernet reference clock can be sourced from PLL5_FOUT3 or PLL6. Add support for ethernet source clock selection using SEL_PLL_6_2 mux. This patch also renames the PLL5_DIV2 core clock to PLL5_250 to match with the register description as mentioned in RZ/G2L HW manual (Rev.1.00). 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 7c5a256 commit 70a4af3

File tree

2 files changed

+21
-1
lines changed

2 files changed

+21
-1
lines changed

drivers/clk/renesas/r9a07g044-cpg.c

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ enum clk_ids {
3535
CLK_PLL3_DIV4,
3636
CLK_PLL4,
3737
CLK_PLL5,
38-
CLK_PLL5_DIV2,
38+
CLK_PLL5_FOUT3,
39+
CLK_PLL5_250,
3940
CLK_PLL6,
41+
CLK_PLL6_250,
4042
CLK_P1_DIV2,
4143

4244
/* Module Clocks */
@@ -53,6 +55,9 @@ static const struct clk_div_table dtable_1_32[] = {
5355
{0, 0},
5456
};
5557

58+
/* Mux clock tables */
59+
static const char * const sel_pll6_2[] = { ".pll6_250", ".pll5_250" };
60+
5661
static const struct cpg_core_clk r9a07g044_core_clks[] __initconst = {
5762
/* External Clock Inputs */
5863
DEF_INPUT("extal", CLK_EXTAL),
@@ -64,6 +69,11 @@ static const struct cpg_core_clk r9a07g044_core_clks[] __initconst = {
6469
DEF_FIXED(".pll2", CLK_PLL2, CLK_EXTAL, 133, 2),
6570
DEF_FIXED(".pll3", CLK_PLL3, CLK_EXTAL, 133, 2),
6671

72+
DEF_FIXED(".pll5", CLK_PLL5, CLK_EXTAL, 125, 1),
73+
DEF_FIXED(".pll5_fout3", CLK_PLL5_FOUT3, CLK_PLL5, 1, 6),
74+
75+
DEF_FIXED(".pll6", CLK_PLL6, CLK_EXTAL, 125, 6),
76+
6777
DEF_FIXED(".pll2_div2", CLK_PLL2_DIV2, CLK_PLL2, 1, 2),
6878
DEF_FIXED(".pll2_div16", CLK_PLL2_DIV16, CLK_PLL2, 1, 16),
6979
DEF_FIXED(".pll2_div20", CLK_PLL2_DIV20, CLK_PLL2, 1, 20),
@@ -73,6 +83,9 @@ static const struct cpg_core_clk r9a07g044_core_clks[] __initconst = {
7383
DEF_FIXED(".pll3_div2_4_2", CLK_PLL3_DIV2_4_2, CLK_PLL3_DIV2_4, 1, 2),
7484
DEF_FIXED(".pll3_div4", CLK_PLL3_DIV4, CLK_PLL3, 1, 4),
7585

86+
DEF_FIXED(".pll5_250", CLK_PLL5_250, CLK_PLL5_FOUT3, 1, 2),
87+
DEF_FIXED(".pll6_250", CLK_PLL6_250, CLK_PLL6, 1, 2),
88+
7689
/* Core output clk */
7790
DEF_FIXED("I", R9A07G044_CLK_I, CLK_PLL1, 1, 1),
7891
DEF_DIV("P0", R9A07G044_CLK_P0, CLK_PLL2_DIV16, DIVPL2A,
@@ -84,6 +97,10 @@ static const struct cpg_core_clk r9a07g044_core_clks[] __initconst = {
8497
DEF_FIXED("P1_DIV2", CLK_P1_DIV2, R9A07G044_CLK_P1, 1, 2),
8598
DEF_DIV("P2", R9A07G044_CLK_P2, CLK_PLL3_DIV2_4_2,
8699
DIVPL3A, dtable_1_32, CLK_DIVIDER_HIWORD_MASK),
100+
DEF_FIXED("M0", R9A07G044_CLK_M0, CLK_PLL3_DIV2_4, 1, 1),
101+
DEF_FIXED("ZT", R9A07G044_CLK_ZT, CLK_PLL3_DIV2_4_2, 1, 1),
102+
DEF_MUX("HP", R9A07G044_CLK_HP, SEL_PLL6_2,
103+
sel_pll6_2, ARRAY_SIZE(sel_pll6_2), 0, CLK_MUX_HIWORD_MASK),
87104
};
88105

89106
static struct rzg2l_mod_clk r9a07g044_mod_clks[] = {

drivers/clk/renesas/rzg2l-cpg.h

Lines changed: 3 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_PL6_ETH_SSEL (0x418)
1415

1516
/* n = 0/1/2 for PLL1/4/6 */
1617
#define CPG_SAMPLL_CLK1(n) (0x04 + (16 * n))
@@ -27,6 +28,8 @@
2728
#define SEL_PLL_PACK(offset, bitpos, size) \
2829
(((offset) << 20) | ((bitpos) << 12) | ((size) << 8))
2930

31+
#define SEL_PLL6_2 SEL_PLL_PACK(CPG_PL6_ETH_SSEL, 0, 1)
32+
3033
/**
3134
* Definitions of CPG Core Clocks
3235
*

0 commit comments

Comments
 (0)