Skip to content

Commit 17f0ff3

Browse files
prabhakarladgeertu
authored andcommitted
clk: renesas: Add support for R9A07G044 SoC
Define the clock outputs supported by RZ/G2L (R9A07G044) SoC and bind it with RZ/G2L CPG core. Based on a patch in the BSP by Binh Nguyen <[email protected]>. Signed-off-by: Lad Prabhakar <[email protected]> Reviewed-by: Biju Das <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Geert Uytterhoeven <[email protected]>
1 parent 9c09443 commit 17f0ff3

File tree

5 files changed

+141
-0
lines changed

5 files changed

+141
-0
lines changed

drivers/clk/renesas/Kconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ config CLK_RENESAS
3232
select CLK_R8A77995 if ARCH_R8A77995
3333
select CLK_R8A779A0 if ARCH_R8A779A0
3434
select CLK_R9A06G032 if ARCH_R9A06G032
35+
select CLK_R9A07G044 if ARCH_R9A07G044
3536
select CLK_SH73A0 if ARCH_SH73A0
3637

3738
if CLK_RENESAS
@@ -156,6 +157,10 @@ config CLK_R9A06G032
156157
help
157158
This is a driver for R9A06G032 clocks
158159

160+
config CLK_R9A07G044
161+
bool "RZ/G2L clock support" if COMPILE_TEST
162+
select CLK_RZG2L
163+
159164
config CLK_SH73A0
160165
bool "SH-Mobile AG5 clock support" if COMPILE_TEST
161166
select CLK_RENESAS_CPG_MSTP

drivers/clk/renesas/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ obj-$(CONFIG_CLK_R8A77990) += r8a77990-cpg-mssr.o
2929
obj-$(CONFIG_CLK_R8A77995) += r8a77995-cpg-mssr.o
3030
obj-$(CONFIG_CLK_R8A779A0) += r8a779a0-cpg-mssr.o
3131
obj-$(CONFIG_CLK_R9A06G032) += r9a06g032-clocks.o
32+
obj-$(CONFIG_CLK_R9A07G044) += r9a07g044-cpg.o
3233
obj-$(CONFIG_CLK_SH73A0) += clk-sh73a0.o
3334

3435
# Family

drivers/clk/renesas/r9a07g044-cpg.c

Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/*
3+
* RZ/G2L CPG driver
4+
*
5+
* Copyright (C) 2021 Renesas Electronics Corp.
6+
*/
7+
8+
#include <linux/clk-provider.h>
9+
#include <linux/device.h>
10+
#include <linux/init.h>
11+
#include <linux/kernel.h>
12+
13+
#include <dt-bindings/clock/r9a07g044-cpg.h>
14+
15+
#include "renesas-rzg2l-cpg.h"
16+
17+
enum clk_ids {
18+
/* Core Clock Outputs exported to DT */
19+
LAST_DT_CORE_CLK = R9A07G044_OSCCLK,
20+
21+
/* External Input Clocks */
22+
CLK_EXTAL,
23+
24+
/* Internal Core Clocks */
25+
CLK_OSC_DIV1000,
26+
CLK_PLL1,
27+
CLK_PLL2,
28+
CLK_PLL2_DIV2,
29+
CLK_PLL2_DIV16,
30+
CLK_PLL2_DIV20,
31+
CLK_PLL3,
32+
CLK_PLL3_DIV2,
33+
CLK_PLL3_DIV4,
34+
CLK_PLL3_DIV8,
35+
CLK_PLL4,
36+
CLK_PLL5,
37+
CLK_PLL5_DIV2,
38+
CLK_PLL6,
39+
40+
/* Module Clocks */
41+
MOD_CLK_BASE,
42+
};
43+
44+
/* Divider tables */
45+
static const struct clk_div_table dtable_3b[] = {
46+
{0, 1},
47+
{1, 2},
48+
{2, 4},
49+
{3, 8},
50+
{4, 32},
51+
};
52+
53+
static const struct cpg_core_clk r9a07g044_core_clks[] __initconst = {
54+
/* External Clock Inputs */
55+
DEF_INPUT("extal", CLK_EXTAL),
56+
57+
/* Internal Core Clocks */
58+
DEF_FIXED(".osc", R9A07G044_OSCCLK, CLK_EXTAL, 1, 1),
59+
DEF_FIXED(".osc_div1000", CLK_OSC_DIV1000, CLK_EXTAL, 1, 1000),
60+
DEF_SAMPLL(".pll1", CLK_PLL1, CLK_EXTAL, PLL146_CONF(0)),
61+
DEF_FIXED(".pll2", CLK_PLL2, CLK_EXTAL, 133, 2),
62+
DEF_FIXED(".pll3", CLK_PLL3, CLK_EXTAL, 133, 2),
63+
64+
DEF_FIXED(".pll2_div2", CLK_PLL2_DIV2, CLK_PLL2, 1, 2),
65+
DEF_FIXED(".pll2_div16", CLK_PLL2_DIV16, CLK_PLL2, 1, 16),
66+
DEF_FIXED(".pll2_div20", CLK_PLL2_DIV20, CLK_PLL2, 1, 20),
67+
68+
DEF_FIXED(".pll3_div2", CLK_PLL3_DIV2, CLK_PLL3, 1, 2),
69+
DEF_FIXED(".pll3_div4", CLK_PLL3_DIV4, CLK_PLL3, 1, 4),
70+
DEF_FIXED(".pll3_div8", CLK_PLL3_DIV8, CLK_PLL3, 1, 8),
71+
72+
/* Core output clk */
73+
DEF_FIXED("I", R9A07G044_CLK_I, CLK_PLL1, 1, 1),
74+
DEF_DIV("P0", R9A07G044_CLK_P0, CLK_PLL2_DIV16, DIVPL2A,
75+
dtable_3b, CLK_DIVIDER_HIWORD_MASK),
76+
DEF_FIXED("TSU", R9A07G044_CLK_TSU, CLK_PLL2_DIV20, 1, 1),
77+
DEF_DIV("P1", R9A07G044_CLK_P1, CLK_PLL3_DIV8,
78+
DIVPL3B, dtable_3b, CLK_DIVIDER_HIWORD_MASK),
79+
};
80+
81+
static struct rzg2l_mod_clk r9a07g044_mod_clks[] = {
82+
DEF_MOD("gic", R9A07G044_CLK_GIC600,
83+
R9A07G044_CLK_P1,
84+
0x514, BIT(0), (BIT(0) | BIT(1))),
85+
DEF_MOD("ia55", R9A07G044_CLK_IA55,
86+
R9A07G044_CLK_P1,
87+
0x518, (BIT(0) | BIT(1)), BIT(0)),
88+
DEF_MOD("scif0", R9A07G044_CLK_SCIF0,
89+
R9A07G044_CLK_P0,
90+
0x584, BIT(0), BIT(0)),
91+
DEF_MOD("scif1", R9A07G044_CLK_SCIF1,
92+
R9A07G044_CLK_P0,
93+
0x584, BIT(1), BIT(1)),
94+
DEF_MOD("scif2", R9A07G044_CLK_SCIF2,
95+
R9A07G044_CLK_P0,
96+
0x584, BIT(2), BIT(2)),
97+
DEF_MOD("scif3", R9A07G044_CLK_SCIF3,
98+
R9A07G044_CLK_P0,
99+
0x584, BIT(3), BIT(3)),
100+
DEF_MOD("scif4", R9A07G044_CLK_SCIF4,
101+
R9A07G044_CLK_P0,
102+
0x584, BIT(4), BIT(4)),
103+
DEF_MOD("sci0", R9A07G044_CLK_SCI0,
104+
R9A07G044_CLK_P0,
105+
0x588, BIT(0), BIT(0)),
106+
};
107+
108+
static const unsigned int r9a07g044_crit_mod_clks[] __initconst = {
109+
MOD_CLK_BASE + R9A07G044_CLK_GIC600,
110+
};
111+
112+
const struct rzg2l_cpg_info r9a07g044_cpg_info = {
113+
/* Core Clocks */
114+
.core_clks = r9a07g044_core_clks,
115+
.num_core_clks = ARRAY_SIZE(r9a07g044_core_clks),
116+
.last_dt_core_clk = LAST_DT_CORE_CLK,
117+
.num_total_core_clks = MOD_CLK_BASE,
118+
119+
/* Critical Module Clocks */
120+
.crit_mod_clks = r9a07g044_crit_mod_clks,
121+
.num_crit_mod_clks = ARRAY_SIZE(r9a07g044_crit_mod_clks),
122+
123+
/* Module Clocks */
124+
.mod_clks = r9a07g044_mod_clks,
125+
.num_mod_clks = ARRAY_SIZE(r9a07g044_mod_clks),
126+
.num_hw_mod_clks = R9A07G044_CLK_MIPI_DSI_PIN + 1,
127+
};

drivers/clk/renesas/renesas-rzg2l-cpg.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -723,6 +723,12 @@ static int __init rzg2l_cpg_probe(struct platform_device *pdev)
723723
}
724724

725725
static const struct of_device_id rzg2l_cpg_match[] = {
726+
#ifdef CONFIG_CLK_R9A07G044
727+
{
728+
.compatible = "renesas,r9a07g044-cpg",
729+
.data = &r9a07g044_cpg_info,
730+
},
731+
#endif
726732
{ /* sentinel */ }
727733
};
728734

drivers/clk/renesas/renesas-rzg2l-cpg.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -131,4 +131,6 @@ struct rzg2l_cpg_info {
131131
unsigned int num_crit_mod_clks;
132132
};
133133

134+
extern const struct rzg2l_cpg_info r9a07g044_cpg_info;
135+
134136
#endif

0 commit comments

Comments
 (0)