Skip to content

Commit 7f8a37a

Browse files
committed
Merge tag 'renesas-clk-for-v5.14-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers into clk-renesas
Pull Renesas clk driver updates from Geert Uytterhoeven: - Add support for the new RZ/G2L SoC * tag 'renesas-clk-for-v5.14-tag2' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/renesas-drivers: clk: renesas: Add support for R9A07G044 SoC clk: renesas: Add CPG core wrapper for RZ/G2L SoC dt-bindings: clock: renesas: Document RZ/G2L SoC CPG driver dt-bindings: clock: Add r9a07g044 CPG Clock Definitions
2 parents 6435c49 + 17f0ff3 commit 7f8a37a

File tree

7 files changed

+1196
-0
lines changed

7 files changed

+1196
-0
lines changed
Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
2+
%YAML 1.2
3+
---
4+
$id: "http://devicetree.org/schemas/clock/renesas,rzg2l-cpg.yaml#"
5+
$schema: "http://devicetree.org/meta-schemas/core.yaml#"
6+
7+
title: Renesas RZ/G2L Clock Pulse Generator / Module Standby Mode
8+
9+
maintainers:
10+
- Geert Uytterhoeven <[email protected]>
11+
12+
description: |
13+
On Renesas RZ/G2L SoC, the CPG (Clock Pulse Generator) and Module
14+
Standby Mode share the same register block.
15+
16+
They provide the following functionalities:
17+
- The CPG block generates various core clocks,
18+
- The Module Standby Mode block provides two functions:
19+
1. Module Standby, providing a Clock Domain to control the clock supply
20+
to individual SoC devices,
21+
2. Reset Control, to perform a software reset of individual SoC devices.
22+
23+
properties:
24+
compatible:
25+
const: renesas,r9a07g044-cpg # RZ/G2{L,LC}
26+
27+
reg:
28+
maxItems: 1
29+
30+
clocks:
31+
maxItems: 1
32+
33+
clock-names:
34+
description:
35+
Clock source to CPG can be either from external clock input (EXCLK) or
36+
crystal oscillator (XIN/XOUT).
37+
const: extal
38+
39+
'#clock-cells':
40+
description: |
41+
- For CPG core clocks, the two clock specifier cells must be "CPG_CORE"
42+
and a core clock reference, as defined in
43+
<dt-bindings/clock/r9a07g044-cpg.h>
44+
- For module clocks, the two clock specifier cells must be "CPG_MOD" and
45+
a module number, as defined in the <dt-bindings/clock/r9a07g044-cpg.h>.
46+
const: 2
47+
48+
'#power-domain-cells':
49+
description:
50+
SoC devices that are part of the CPG/Module Standby Mode Clock Domain and
51+
can be power-managed through Module Standby should refer to the CPG device
52+
node in their "power-domains" property, as documented by the generic PM
53+
Domain bindings in Documentation/devicetree/bindings/power/power-domain.yaml.
54+
const: 0
55+
56+
'#reset-cells':
57+
description:
58+
The single reset specifier cell must be the module number, as defined in
59+
the <dt-bindings/clock/r9a07g044-cpg.h>.
60+
const: 1
61+
62+
required:
63+
- compatible
64+
- reg
65+
- clocks
66+
- clock-names
67+
- '#clock-cells'
68+
- '#power-domain-cells'
69+
- '#reset-cells'
70+
71+
additionalProperties: false
72+
73+
examples:
74+
- |
75+
cpg: clock-controller@11010000 {
76+
compatible = "renesas,r9a07g044-cpg";
77+
reg = <0x11010000 0x10000>;
78+
clocks = <&extal_clk>;
79+
clock-names = "extal";
80+
#clock-cells = <2>;
81+
#power-domain-cells = <0>;
82+
#reset-cells = <1>;
83+
};

drivers/clk/renesas/Kconfig

Lines changed: 9 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
@@ -182,6 +187,10 @@ config CLK_RCAR_USB2_CLOCK_SEL
182187
help
183188
This is a driver for R-Car USB2 clock selector
184189

190+
config CLK_RZG2L
191+
bool "Renesas RZ/G2L family clock support" if COMPILE_TEST
192+
select RESET_CONTROLLER
193+
185194
# Generic
186195
config CLK_RENESAS_CPG_MSSR
187196
bool "CPG/MSSR clock support" if COMPILE_TEST

drivers/clk/renesas/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@ 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
3536
obj-$(CONFIG_CLK_RCAR_CPG_LIB) += rcar-cpg-lib.o
3637
obj-$(CONFIG_CLK_RCAR_GEN2_CPG) += rcar-gen2-cpg.o
3738
obj-$(CONFIG_CLK_RCAR_GEN3_CPG) += rcar-gen3-cpg.o
3839
obj-$(CONFIG_CLK_RCAR_USB2_CLOCK_SEL) += rcar-usb2-clock-sel.o
40+
obj-$(CONFIG_CLK_RZG2L) += renesas-rzg2l-cpg.o
3941

4042
# Generic
4143
obj-$(CONFIG_CLK_RENESAS_CPG_MSSR) += renesas-cpg-mssr.o

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+
};

0 commit comments

Comments
 (0)