Skip to content

Commit 36932cb

Browse files
prabhakarladgeertu
authored andcommitted
clk: renesas: Add RZ/V2H(P) CPG driver
Add RZ/V2H(P) CPG driver. Signed-off-by: Lad Prabhakar <[email protected]> Reviewed-by: Geert Uytterhoeven <[email protected]> Link: https://lore.kernel.org/[email protected] Signed-off-by: Geert Uytterhoeven <[email protected]>
1 parent dd22e56 commit 36932cb

File tree

5 files changed

+94
-0
lines changed

5 files changed

+94
-0
lines changed

drivers/clk/renesas/Kconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ config CLK_RENESAS
4040
select CLK_R9A07G054 if ARCH_R9A07G054
4141
select CLK_R9A08G045 if ARCH_R9A08G045
4242
select CLK_R9A09G011 if ARCH_R9A09G011
43+
select CLK_R9A09G057 if ARCH_R9A09G057
4344
select CLK_SH73A0 if ARCH_SH73A0
4445

4546
if CLK_RENESAS
@@ -193,6 +194,10 @@ config CLK_R9A09G011
193194
bool "RZ/V2M clock support" if COMPILE_TEST
194195
select CLK_RZG2L
195196

197+
config CLK_R9A09G057
198+
bool "RZ/V2H(P) clock support" if COMPILE_TEST
199+
select CLK_RZV2H
200+
196201
config CLK_SH73A0
197202
bool "SH-Mobile AG5 clock support" if COMPILE_TEST
198203
select CLK_RENESAS_CPG_MSTP

drivers/clk/renesas/Makefile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ obj-$(CONFIG_CLK_R9A07G044) += r9a07g044-cpg.o
3737
obj-$(CONFIG_CLK_R9A07G054) += r9a07g044-cpg.o
3838
obj-$(CONFIG_CLK_R9A08G045) += r9a08g045-cpg.o
3939
obj-$(CONFIG_CLK_R9A09G011) += r9a09g011-cpg.o
40+
obj-$(CONFIG_CLK_R9A09G057) += r9a09g057-cpg.o
4041
obj-$(CONFIG_CLK_SH73A0) += clk-sh73a0.o
4142

4243
# Family

drivers/clk/renesas/r9a09g057-cpg.c

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
/*
3+
* Renesas RZ/V2H(P) CPG driver
4+
*
5+
* Copyright (C) 2024 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/renesas,r9a09g057-cpg.h>
14+
15+
#include "rzv2h-cpg.h"
16+
17+
enum clk_ids {
18+
/* Core Clock Outputs exported to DT */
19+
LAST_DT_CORE_CLK = R9A09G057_IOTOP_0_SHCLK,
20+
21+
/* External Input Clocks */
22+
CLK_AUDIO_EXTAL,
23+
CLK_RTXIN,
24+
CLK_QEXTAL,
25+
26+
/* PLL Clocks */
27+
CLK_PLLCM33,
28+
CLK_PLLDTY,
29+
CLK_PLLCA55,
30+
31+
/* Internal Core Clocks */
32+
CLK_PLLCM33_DIV16,
33+
34+
/* Module Clocks */
35+
MOD_CLK_BASE,
36+
};
37+
38+
static const struct cpg_core_clk r9a09g057_core_clks[] __initconst = {
39+
/* External Clock Inputs */
40+
DEF_INPUT("audio_extal", CLK_AUDIO_EXTAL),
41+
DEF_INPUT("rtxin", CLK_RTXIN),
42+
DEF_INPUT("qextal", CLK_QEXTAL),
43+
44+
/* PLL Clocks */
45+
DEF_FIXED(".pllcm33", CLK_PLLCM33, CLK_QEXTAL, 200, 3),
46+
DEF_FIXED(".plldty", CLK_PLLDTY, CLK_QEXTAL, 200, 3),
47+
DEF_PLL(".pllca55", CLK_PLLCA55, CLK_QEXTAL, PLL_CONF(0x64)),
48+
49+
/* Internal Core Clocks */
50+
DEF_FIXED(".pllcm33_div16", CLK_PLLCM33_DIV16, CLK_PLLCM33, 1, 16),
51+
52+
/* Core Clocks */
53+
DEF_FIXED("sys_0_pclk", R9A09G057_SYS_0_PCLK, CLK_QEXTAL, 1, 1),
54+
DEF_FIXED("iotop_0_shclk", R9A09G057_IOTOP_0_SHCLK, CLK_PLLCM33_DIV16, 1, 1),
55+
};
56+
57+
static const struct rzv2h_mod_clk r9a09g057_mod_clks[] __initconst = {
58+
DEF_MOD("scif_0_clk_pck", CLK_PLLCM33_DIV16, 8, 15, 4, 15),
59+
};
60+
61+
static const struct rzv2h_reset r9a09g057_resets[] __initconst = {
62+
DEF_RST(9, 5, 4, 6), /* SCIF_0_RST_SYSTEM_N */
63+
};
64+
65+
const struct rzv2h_cpg_info r9a09g057_cpg_info __initconst = {
66+
/* Core Clocks */
67+
.core_clks = r9a09g057_core_clks,
68+
.num_core_clks = ARRAY_SIZE(r9a09g057_core_clks),
69+
.last_dt_core_clk = LAST_DT_CORE_CLK,
70+
.num_total_core_clks = MOD_CLK_BASE,
71+
72+
/* Module Clocks */
73+
.mod_clks = r9a09g057_mod_clks,
74+
.num_mod_clks = ARRAY_SIZE(r9a09g057_mod_clks),
75+
.num_hw_mod_clks = 25 * 16,
76+
77+
/* Resets */
78+
.resets = r9a09g057_resets,
79+
.num_resets = ARRAY_SIZE(r9a09g057_resets),
80+
};

drivers/clk/renesas/rzv2h-cpg.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -664,6 +664,12 @@ static int __init rzv2h_cpg_probe(struct platform_device *pdev)
664664
}
665665

666666
static const struct of_device_id rzv2h_cpg_match[] = {
667+
#ifdef CONFIG_CLK_R9A09G057
668+
{
669+
.compatible = "renesas,r9a09g057-cpg",
670+
.data = &r9a09g057_cpg_info,
671+
},
672+
#endif
667673
{ /* sentinel */ }
668674
};
669675

drivers/clk/renesas/rzv2h-cpg.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -146,4 +146,6 @@ struct rzv2h_cpg_info {
146146
unsigned int num_resets;
147147
};
148148

149+
extern const struct rzv2h_cpg_info r9a09g057_cpg_info;
150+
149151
#endif /* __RENESAS_RZV2H_CPG_H__ */

0 commit comments

Comments
 (0)