* [PATCH 00/12] Add support for Renesas RZ/G3E SoC and SMARC-EVK platform
@ 2024-11-22 12:45 Biju Das
2024-11-22 12:45 ` [PATCH 04/12] dt-bindings: clock: renesas: Document RZ/G3E SoC CPG Biju Das
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Biju Das @ 2024-11-22 12:45 UTC (permalink / raw)
To: Rob Herring, Krzysztof Kozlowski, Michael Turquette, Stephen Boyd,
Conor Dooley
Cc: Biju Das, Greg Kroah-Hartman, Jiri Slaby, Geert Uytterhoeven,
Magnus Damm, linux-serial, devicetree, linux-renesas-soc,
linux-clk, Prabhakar Mahadev Lad, Biju Das
Hi all,
This patch series adds initial support for the Renesas RZ/G3E SoC and
RZ/G3E SMARC EVK platform. The RZ/G3E device is a general-purpose
microprocessor with a quad-core CA-55, single core CM-33, Ethos-U55 NPU
, Mali-G52 3-D Graphics and other peripherals.
Support for below list of blocks added on SoC DTSI (r9a09g047.dtsi):
- EXT CLKs
- 4X CA55
- SCIF
- CPG
- GIC
- ARMv8 Timer
This adds also support for the RZ/G3E SMARC EVK board
(r9a09g047e57-smarc.dts) and enable the following peripheral:
- SCIF
Note:
This patch series gives a boot console with serial driver support.
Later there is a plan to add support for SoC Identification using
SYSC driver and pin controller support were also added.
Test logs:
/ # uname -r
6.12.0-next-20241122-12513-g189628626a52
/ # cat /proc/cpuinfo
processor : 0
BogoMIPS : 48.00
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x2
CPU part : 0xd05
CPU revision : 0
processor : 1
BogoMIPS : 48.00
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x2
CPU part : 0xd05
CPU revision : 0
processor : 2
BogoMIPS : 48.00
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x2
CPU part : 0xd05
CPU revision : 0
processor : 3
BogoMIPS : 48.00
Features : fp asimd evtstrm aes pmull sha1 sha2 crc32 atomics fphp asimdhp cpuid asimdrdm lrcpc dcpop asimddp
CPU implementer : 0x41
CPU architecture: 8
CPU variant : 0x2
CPU part : 0xd05
CPU revision : 0
/ #
/ # cat /proc/interrupts
CPU0 CPU1 CPU2 CPU3
11: 436 539 467 446 GICv3 27 Level arch_timer
14: 0 0 0 0 GICv3 561 Level 11c01400.serial:rx err
15: 0 0 0 0 GICv3 564 Level 11c01400.serial:rx full
16: 391 0 0 0 GICv3 565 Level 11c01400.serial:tx empty
17: 0 0 0 0 GICv3 562 Level 11c01400.serial:break
18: 67 0 0 0 GICv3 566 Level 11c01400.serial:rx ready
19: 0 0 0 0 GICv3 563 Level 11c01400.serial:tx end
IPI0: 3 12 12 25 Rescheduling interrupts
IPI1: 299 276 347 82 Function call interrupts
IPI2: 0 0 0 0 CPU stop interrupts
IPI3: 0 0 0 0 CPU stop NMIs
IPI4: 0 0 0 0 Timer broadcast interrupts
IPI5: 0 0 0 0 IRQ work interrupts
IPI6: 0 0 0 0 CPU backtrace interrupts
IPI7: 0 0 0 0 KGDB roundup interrupts
Err: 0
/ #
/ # cat /proc/meminfo
MemTotal: 3882652 kB
MemFree: 3846048 kB
MemAvailable: 3775780 kB
Biju Das (12):
dt-bindings: serial: renesas: Document RZ/G3E (r9a09g047) scif
dt-bindings: soc: renesas: Document Renesas RZ/G3E SoC variants
dt-bindings: soc: renesas: Document RZ/G3E SMARC SoM and Carrier-II
EVK
dt-bindings: clock: renesas: Document RZ/G3E SoC CPG
soc: renesas: Add RZ/G3E (R9A09G047) config option
clk: renesas: Add support for RZ/G3E SoC
clk: renesas: rzv2h-cpg: Add MSTOP support
arm64: dts: renesas: Add initial DTSI for RZ/G3E SoC
arm64: dts: renesas: Add initial support for RZ/G3E SMARC SoM
arm64: dts: renesas: Add initial device tree for RZ/G3E SMARC EVK
board
arm64: defconfig: Enable R9A09G047 SoC
HACK-DO-NOT-APPLY-defconfig: Enable INIT RAMFS
.../bindings/clock/renesas,rzv2h-cpg.yaml | 15 +-
.../bindings/serial/renesas,scif.yaml | 5 +
.../bindings/soc/renesas/renesas.yaml | 17 +++
arch/arm64/boot/dts/renesas/Makefile | 2 +
arch/arm64/boot/dts/renesas/r9a09g047.dtsi | 144 ++++++++++++++++++
arch/arm64/boot/dts/renesas/r9a09g047e37.dtsi | 18 +++
.../boot/dts/renesas/r9a09g047e57-smarc.dts | 18 +++
arch/arm64/boot/dts/renesas/r9a09g047e57.dtsi | 13 ++
.../boot/dts/renesas/renesas-smarc2.dtsi | 24 +++
.../boot/dts/renesas/rzg3e-smarc-som.dtsi | 28 ++++
arch/arm64/configs/defconfig | 2 +
drivers/clk/renesas/Kconfig | 7 +-
drivers/clk/renesas/Makefile | 1 +
drivers/clk/renesas/r9a09g047-cpg.c | 100 ++++++++++++
drivers/clk/renesas/r9a09g057-cpg.c | 117 +++++++++-----
drivers/clk/renesas/rzv2h-cpg.c | 98 +++++++++++-
drivers/clk/renesas/rzv2h-cpg.h | 23 ++-
drivers/soc/renesas/Kconfig | 5 +
.../dt-bindings/clock/renesas,r9a09g047-cpg.h | 21 +++
19 files changed, 604 insertions(+), 54 deletions(-)
create mode 100644 arch/arm64/boot/dts/renesas/r9a09g047.dtsi
create mode 100644 arch/arm64/boot/dts/renesas/r9a09g047e37.dtsi
create mode 100644 arch/arm64/boot/dts/renesas/r9a09g047e57-smarc.dts
create mode 100644 arch/arm64/boot/dts/renesas/r9a09g047e57.dtsi
create mode 100644 arch/arm64/boot/dts/renesas/renesas-smarc2.dtsi
create mode 100644 arch/arm64/boot/dts/renesas/rzg3e-smarc-som.dtsi
create mode 100644 drivers/clk/renesas/r9a09g047-cpg.c
create mode 100644 include/dt-bindings/clock/renesas,r9a09g047-cpg.h
--
2.43.0
^ permalink raw reply [flat|nested] 7+ messages in thread* [PATCH 04/12] dt-bindings: clock: renesas: Document RZ/G3E SoC CPG 2024-11-22 12:45 [PATCH 00/12] Add support for Renesas RZ/G3E SoC and SMARC-EVK platform Biju Das @ 2024-11-22 12:45 ` Biju Das 2024-11-25 18:52 ` Conor Dooley 2024-11-29 14:44 ` Biju Das 2024-11-22 12:45 ` [PATCH 06/12] clk: renesas: Add support for RZ/G3E SoC Biju Das 2024-11-22 12:45 ` [PATCH 07/12] clk: renesas: rzv2h-cpg: Add MSTOP support Biju Das 2 siblings, 2 replies; 7+ messages in thread From: Biju Das @ 2024-11-22 12:45 UTC (permalink / raw) To: Michael Turquette, Stephen Boyd, Rob Herring, Krzysztof Kozlowski, Conor Dooley Cc: Biju Das, Geert Uytterhoeven, Magnus Damm, Lad Prabhakar, linux-renesas-soc, linux-clk, devicetree, Biju Das Document the device tree bindings for the Renesas RZ/G3E SoC Clock Pulse Generator (CPG). Also define constants for the core clocks of the RZ/G3E SoC. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> --- .../bindings/clock/renesas,rzv2h-cpg.yaml | 15 +++++++------ .../dt-bindings/clock/renesas,r9a09g047-cpg.h | 21 +++++++++++++++++++ 2 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 include/dt-bindings/clock/renesas,r9a09g047-cpg.h diff --git a/Documentation/devicetree/bindings/clock/renesas,rzv2h-cpg.yaml b/Documentation/devicetree/bindings/clock/renesas,rzv2h-cpg.yaml index 926c503bed1f..c3fe76abd549 100644 --- a/Documentation/devicetree/bindings/clock/renesas,rzv2h-cpg.yaml +++ b/Documentation/devicetree/bindings/clock/renesas,rzv2h-cpg.yaml @@ -4,19 +4,22 @@ $id: http://devicetree.org/schemas/clock/renesas,rzv2h-cpg.yaml# $schema: http://devicetree.org/meta-schemas/core.yaml# -title: Renesas RZ/V2H(P) Clock Pulse Generator (CPG) +title: Renesas RZ/{G3E,V2H(P)} Clock Pulse Generator (CPG) maintainers: - Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> description: - On Renesas RZ/V2H(P) SoCs, the CPG (Clock Pulse Generator) handles generation - and control of clock signals for the IP modules, generation and control of resets, - and control over booting, low power consumption and power supply domains. + On Renesas RZ/{G3E,V2H(P)} SoCs, the CPG (Clock Pulse Generator) handles + generation and control of clock signals for the IP modules, generation and + control of resets, and control over booting, low power consumption and power + supply domains. properties: compatible: - const: renesas,r9a09g057-cpg + enum: + - renesas,r9a09g047-cpg # RZ/G3E + - renesas,r9a09g057-cpg # RZ/V2H reg: maxItems: 1 @@ -37,7 +40,7 @@ properties: description: | - For CPG core clocks, the two clock specifier cells must be "CPG_CORE" and a core clock reference, as defined in - <dt-bindings/clock/renesas,r9a09g057-cpg.h>, + <dt-bindings/clock/renesas,r9a09g0*-cpg.h>, - For module clocks, the two clock specifier cells must be "CPG_MOD" and a module number. The module number is calculated as the CLKON register offset index multiplied by 16, plus the actual bit in the register diff --git a/include/dt-bindings/clock/renesas,r9a09g047-cpg.h b/include/dt-bindings/clock/renesas,r9a09g047-cpg.h new file mode 100644 index 000000000000..5bcab7ca2bfc --- /dev/null +++ b/include/dt-bindings/clock/renesas,r9a09g047-cpg.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) + * + * Copyright (C) 2024 Renesas Electronics Corp. + */ +#ifndef __DT_BINDINGS_CLOCK_RENESAS_R9A09G047_CPG_H__ +#define __DT_BINDINGS_CLOCK_RENESAS_R9A09G047_CPG_H__ + +#include <dt-bindings/clock/renesas-cpg-mssr.h> + +/* Core Clock list */ +#define R9A09G047_SYS_0_PCLK 0 +#define R9A09G047_CA55_0_CORE_CLK0 1 +#define R9A09G047_CA55_0_CORE_CLK1 2 +#define R9A09G047_CA55_0_CORE_CLK2 3 +#define R9A09G047_CA55_0_CORE_CLK3 4 +#define R9A09G047_CA55_0_PERIPHCLK 5 +#define R9A09G047_CM33_CLK0 6 +#define R9A09G047_CST_0_SWCLKTCK 7 +#define R9A09G047_IOTOP_0_SHCLK 8 + +#endif /* __DT_BINDINGS_CLOCK_RENESAS_R9A09G047_CPG_H__ */ -- 2.43.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH 04/12] dt-bindings: clock: renesas: Document RZ/G3E SoC CPG 2024-11-22 12:45 ` [PATCH 04/12] dt-bindings: clock: renesas: Document RZ/G3E SoC CPG Biju Das @ 2024-11-25 18:52 ` Conor Dooley 2024-11-29 14:44 ` Biju Das 1 sibling, 0 replies; 7+ messages in thread From: Conor Dooley @ 2024-11-25 18:52 UTC (permalink / raw) To: Biju Das Cc: Michael Turquette, Stephen Boyd, Rob Herring, Krzysztof Kozlowski, Conor Dooley, Geert Uytterhoeven, Magnus Damm, Lad Prabhakar, linux-renesas-soc, linux-clk, devicetree, Biju Das [-- Attachment #1: Type: text/plain, Size: 338 bytes --] On Fri, Nov 22, 2024 at 12:45:40PM +0000, Biju Das wrote: > Document the device tree bindings for the Renesas RZ/G3E SoC > Clock Pulse Generator (CPG). > > Also define constants for the core clocks of the RZ/G3E SoC. > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> Acked-by: Conor Dooley <conor.dooley@microchip.com> [-- Attachment #2: signature.asc --] [-- Type: application/pgp-signature, Size: 228 bytes --] ^ permalink raw reply [flat|nested] 7+ messages in thread
* RE: [PATCH 04/12] dt-bindings: clock: renesas: Document RZ/G3E SoC CPG 2024-11-22 12:45 ` [PATCH 04/12] dt-bindings: clock: renesas: Document RZ/G3E SoC CPG Biju Das 2024-11-25 18:52 ` Conor Dooley @ 2024-11-29 14:44 ` Biju Das 1 sibling, 0 replies; 7+ messages in thread From: Biju Das @ 2024-11-29 14:44 UTC (permalink / raw) To: Biju Das, Michael Turquette, Stephen Boyd, Rob Herring, Krzysztof Kozlowski, Conor Dooley Cc: Geert Uytterhoeven, Magnus Damm, Prabhakar Mahadev Lad, linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, devicetree@vger.kernel.org, biju.das.au Hi Conor and Geert, > -----Original Message----- > From: Biju Das <biju.das.jz@bp.renesas.com> > Sent: 22 November 2024 12:46 > Subject: [PATCH 04/12] dt-bindings: clock: renesas: Document RZ/G3E SoC CPG > > Document the device tree bindings for the Renesas RZ/G3E SoC Clock Pulse Generator (CPG). > > Also define constants for the core clocks of the RZ/G3E SoC. > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > --- > .../bindings/clock/renesas,rzv2h-cpg.yaml | 15 +++++++------ > .../dt-bindings/clock/renesas,r9a09g047-cpg.h | 21 +++++++++++++++++++ > 2 files changed, 30 insertions(+), 6 deletions(-) create mode 100644 include/dt- > bindings/clock/renesas,r9a09g047-cpg.h > > diff --git a/Documentation/devicetree/bindings/clock/renesas,rzv2h-cpg.yaml > b/Documentation/devicetree/bindings/clock/renesas,rzv2h-cpg.yaml > index 926c503bed1f..c3fe76abd549 100644 > --- a/Documentation/devicetree/bindings/clock/renesas,rzv2h-cpg.yaml > +++ b/Documentation/devicetree/bindings/clock/renesas,rzv2h-cpg.yaml > @@ -4,19 +4,22 @@ > $id: http://devicetree.org/schemas/clock/renesas,rzv2h-cpg.yaml# > $schema: http://devicetree.org/meta-schemas/core.yaml# > > -title: Renesas RZ/V2H(P) Clock Pulse Generator (CPG) > +title: Renesas RZ/{G3E,V2H(P)} Clock Pulse Generator (CPG) > > maintainers: > - Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> > > description: > - On Renesas RZ/V2H(P) SoCs, the CPG (Clock Pulse Generator) handles generation > - and control of clock signals for the IP modules, generation and control of resets, > - and control over booting, low power consumption and power supply domains. > + On Renesas RZ/{G3E,V2H(P)} SoCs, the CPG (Clock Pulse Generator) > + handles generation and control of clock signals for the IP modules, > + generation and control of resets, and control over booting, low power > + consumption and power supply domains. > > properties: > compatible: > - const: renesas,r9a09g057-cpg > + enum: > + - renesas,r9a09g047-cpg # RZ/G3E > + - renesas,r9a09g057-cpg # RZ/V2H > > reg: > maxItems: 1 > @@ -37,7 +40,7 @@ properties: > description: | > - For CPG core clocks, the two clock specifier cells must be "CPG_CORE" > and a core clock reference, as defined in > - <dt-bindings/clock/renesas,r9a09g057-cpg.h>, > + <dt-bindings/clock/renesas,r9a09g0*-cpg.h>, > - For module clocks, the two clock specifier cells must be "CPG_MOD" and > a module number. The module number is calculated as the CLKON register > offset index multiplied by 16, plus the actual bit in the register diff --git a/include/dt- > bindings/clock/renesas,r9a09g047-cpg.h b/include/dt-bindings/clock/renesas,r9a09g047-cpg.h > new file mode 100644 > index 000000000000..5bcab7ca2bfc > --- /dev/null > +++ b/include/dt-bindings/clock/renesas,r9a09g047-cpg.h > @@ -0,0 +1,21 @@ > +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) > + * > + * Copyright (C) 2024 Renesas Electronics Corp. > + */ > +#ifndef __DT_BINDINGS_CLOCK_RENESAS_R9A09G047_CPG_H__ > +#define __DT_BINDINGS_CLOCK_RENESAS_R9A09G047_CPG_H__ > + > +#include <dt-bindings/clock/renesas-cpg-mssr.h> > + > +/* Core Clock list */ > +#define R9A09G047_SYS_0_PCLK 0 > +#define R9A09G047_CA55_0_CORE_CLK0 1 > +#define R9A09G047_CA55_0_CORE_CLK1 2 > +#define R9A09G047_CA55_0_CORE_CLK2 3 > +#define R9A09G047_CA55_0_CORE_CLK3 4 Typo here based on the based on "RZG3E_ClockList_rev1.0_na.xlsx" CORE_CLK*-> CORECLK* I will fix this while sending v2. Cheers, Biju ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH 06/12] clk: renesas: Add support for RZ/G3E SoC 2024-11-22 12:45 [PATCH 00/12] Add support for Renesas RZ/G3E SoC and SMARC-EVK platform Biju Das 2024-11-22 12:45 ` [PATCH 04/12] dt-bindings: clock: renesas: Document RZ/G3E SoC CPG Biju Das @ 2024-11-22 12:45 ` Biju Das 2024-11-22 12:45 ` [PATCH 07/12] clk: renesas: rzv2h-cpg: Add MSTOP support Biju Das 2 siblings, 0 replies; 7+ messages in thread From: Biju Das @ 2024-11-22 12:45 UTC (permalink / raw) To: Michael Turquette, Stephen Boyd Cc: Biju Das, Geert Uytterhoeven, linux-renesas-soc, linux-clk, Prabhakar Mahadev Lad, Biju Das The clock structure for RZ/G3E is almost identical to RZ/V2H SoC with more IP blocks compared to RZ/V2H. For eg: VSPI, LVDS, DPI and LCDC1 are present only on the RZ/G3E SoC. Add minimal clock and reset entries required to boot the Renesas RZ/G3E SMARC EVK and binds it with the RZ/V2H CPG core driver. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> --- drivers/clk/renesas/Kconfig | 7 ++- drivers/clk/renesas/Makefile | 1 + drivers/clk/renesas/r9a09g047-cpg.c | 98 +++++++++++++++++++++++++++++ drivers/clk/renesas/rzv2h-cpg.c | 6 ++ drivers/clk/renesas/rzv2h-cpg.h | 1 + 5 files changed, 112 insertions(+), 1 deletion(-) create mode 100644 drivers/clk/renesas/r9a09g047-cpg.c diff --git a/drivers/clk/renesas/Kconfig b/drivers/clk/renesas/Kconfig index ff01f5f0ed20..5a4bc3f94d49 100644 --- a/drivers/clk/renesas/Kconfig +++ b/drivers/clk/renesas/Kconfig @@ -40,6 +40,7 @@ config CLK_RENESAS select CLK_R9A07G054 if ARCH_R9A07G054 select CLK_R9A08G045 if ARCH_R9A08G045 select CLK_R9A09G011 if ARCH_R9A09G011 + select CLK_R9A09G047 if ARCH_R9A09G047 select CLK_R9A09G057 if ARCH_R9A09G057 select CLK_SH73A0 if ARCH_SH73A0 @@ -194,6 +195,10 @@ config CLK_R9A09G011 bool "RZ/V2M clock support" if COMPILE_TEST select CLK_RZG2L +config CLK_R9A09G047 + bool "RZ/G3E clock support" if COMPILE_TEST + select CLK_RZV2H + config CLK_R9A09G057 bool "RZ/V2H(P) clock support" if COMPILE_TEST select CLK_RZV2H @@ -234,7 +239,7 @@ config CLK_RZG2L select RESET_CONTROLLER config CLK_RZV2H - bool "RZ/V2H(P) family clock support" if COMPILE_TEST + bool "RZ/{G3E,V2H(P)} family clock support" if COMPILE_TEST select RESET_CONTROLLER config CLK_RENESAS_VBATTB diff --git a/drivers/clk/renesas/Makefile b/drivers/clk/renesas/Makefile index 82efaa835ac7..2d6e746939c4 100644 --- a/drivers/clk/renesas/Makefile +++ b/drivers/clk/renesas/Makefile @@ -37,6 +37,7 @@ obj-$(CONFIG_CLK_R9A07G044) += r9a07g044-cpg.o obj-$(CONFIG_CLK_R9A07G054) += r9a07g044-cpg.o obj-$(CONFIG_CLK_R9A08G045) += r9a08g045-cpg.o obj-$(CONFIG_CLK_R9A09G011) += r9a09g011-cpg.o +obj-$(CONFIG_CLK_R9A09G047) += r9a09g047-cpg.o obj-$(CONFIG_CLK_R9A09G057) += r9a09g057-cpg.o obj-$(CONFIG_CLK_SH73A0) += clk-sh73a0.o diff --git a/drivers/clk/renesas/r9a09g047-cpg.c b/drivers/clk/renesas/r9a09g047-cpg.c new file mode 100644 index 000000000000..5d7611cee9bc --- /dev/null +++ b/drivers/clk/renesas/r9a09g047-cpg.c @@ -0,0 +1,98 @@ +// SPDX-License-Identifier: GPL-2.0 +/* + * Renesas RZ/G3E CPG driver + * + * Copyright (C) 2024 Renesas Electronics Corp. + */ + +#include <linux/clk-provider.h> +#include <linux/device.h> +#include <linux/init.h> +#include <linux/kernel.h> + +#include <dt-bindings/clock/renesas,r9a09g047-cpg.h> + +#include "rzv2h-cpg.h" + +enum clk_ids { + /* Core Clock Outputs exported to DT */ + LAST_DT_CORE_CLK = R9A09G047_IOTOP_0_SHCLK, + + /* External Input Clocks */ + CLK_AUDIO_EXTAL, + CLK_RTXIN, + CLK_QEXTAL, + + /* PLL Clocks */ + CLK_PLLCM33, + CLK_PLLDTY, + CLK_PLLCA55, + + /* Internal Core Clocks */ + CLK_PLLCM33_DIV16, + CLK_PLLDTY_ACPU, + CLK_PLLDTY_ACPU_DIV4, + + /* Module Clocks */ + MOD_CLK_BASE, +}; + +static const struct clk_div_table dtable_2_64[] = { + {0, 2}, + {1, 4}, + {2, 8}, + {3, 16}, + {4, 64}, + {0, 0}, +}; + +static const struct cpg_core_clk r9a09g047_core_clks[] __initconst = { + /* External Clock Inputs */ + DEF_INPUT("audio_extal", CLK_AUDIO_EXTAL), + DEF_INPUT("rtxin", CLK_RTXIN), + DEF_INPUT("qextal", CLK_QEXTAL), + + /* PLL Clocks */ + DEF_FIXED(".pllcm33", CLK_PLLCM33, CLK_QEXTAL, 200, 3), + DEF_FIXED(".plldty", CLK_PLLDTY, CLK_QEXTAL, 200, 3), + DEF_PLL(".pllca55", CLK_PLLCA55, CLK_QEXTAL, PLL_CONF(0x64)), + + /* Internal Core Clocks */ + DEF_FIXED(".pllcm33_div16", CLK_PLLCM33_DIV16, CLK_PLLCM33, 1, 16), + + DEF_DDIV(".plldty_acpu", CLK_PLLDTY_ACPU, CLK_PLLDTY, CDDIV0_DIVCTL2, dtable_2_64), + DEF_FIXED(".plldty_acpu_div4", CLK_PLLDTY_ACPU_DIV4, CLK_PLLDTY_ACPU, 1, 4), + + /* Core Clocks */ + DEF_FIXED("sys_0_pclk", R9A09G047_SYS_0_PCLK, CLK_QEXTAL, 1, 1), + DEF_FIXED("iotop_0_shclk", R9A09G047_IOTOP_0_SHCLK, CLK_PLLCM33_DIV16, 1, 1), +}; + +static const struct rzv2h_mod_clk r9a09g047_mod_clks[] __initconst = { + DEF_MOD_CRITICAL("gic_0_gicclk", CLK_PLLDTY_ACPU_DIV4, 1, 3, 0, 19), + DEF_MOD("scif_0_clk_pck", CLK_PLLCM33_DIV16, 8, 15, 4, 15), +}; + +static const struct rzv2h_reset r9a09g047_resets[] __initconst = { + DEF_RST(3, 0, 1, 1), /* SYS_0_PRESETN */ + DEF_RST(3, 8, 1, 9), /* GIC_0_GICRESET_N */ + DEF_RST(3, 9, 1, 10), /* GIC_0_DBG_GICRESET_N */ + DEF_RST(9, 5, 4, 6), /* SCIF_0_RST_SYSTEM_N */ +}; + +const struct rzv2h_cpg_info r9a09g047_cpg_info __initconst = { + /* Core Clocks */ + .core_clks = r9a09g047_core_clks, + .num_core_clks = ARRAY_SIZE(r9a09g047_core_clks), + .last_dt_core_clk = LAST_DT_CORE_CLK, + .num_total_core_clks = MOD_CLK_BASE, + + /* Module Clocks */ + .mod_clks = r9a09g047_mod_clks, + .num_mod_clks = ARRAY_SIZE(r9a09g047_mod_clks), + .num_hw_mod_clks = 28 * 16, + + /* Resets */ + .resets = r9a09g047_resets, + .num_resets = ARRAY_SIZE(r9a09g047_resets), +}; diff --git a/drivers/clk/renesas/rzv2h-cpg.c b/drivers/clk/renesas/rzv2h-cpg.c index b524a9d33610..af961808f735 100644 --- a/drivers/clk/renesas/rzv2h-cpg.c +++ b/drivers/clk/renesas/rzv2h-cpg.c @@ -832,6 +832,12 @@ static const struct of_device_id rzv2h_cpg_match[] = { .compatible = "renesas,r9a09g057-cpg", .data = &r9a09g057_cpg_info, }, +#endif +#ifdef CONFIG_CLK_R9A09G047 + { + .compatible = "renesas,r9a09g047-cpg", + .data = &r9a09g047_cpg_info, + }, #endif { /* sentinel */ } }; diff --git a/drivers/clk/renesas/rzv2h-cpg.h b/drivers/clk/renesas/rzv2h-cpg.h index 819029c81904..8a676813f7bb 100644 --- a/drivers/clk/renesas/rzv2h-cpg.h +++ b/drivers/clk/renesas/rzv2h-cpg.h @@ -190,6 +190,7 @@ struct rzv2h_cpg_info { unsigned int num_resets; }; +extern const struct rzv2h_cpg_info r9a09g047_cpg_info; extern const struct rzv2h_cpg_info r9a09g057_cpg_info; #endif /* __RENESAS_RZV2H_CPG_H__ */ -- 2.43.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [PATCH 07/12] clk: renesas: rzv2h-cpg: Add MSTOP support 2024-11-22 12:45 [PATCH 00/12] Add support for Renesas RZ/G3E SoC and SMARC-EVK platform Biju Das 2024-11-22 12:45 ` [PATCH 04/12] dt-bindings: clock: renesas: Document RZ/G3E SoC CPG Biju Das 2024-11-22 12:45 ` [PATCH 06/12] clk: renesas: Add support for RZ/G3E SoC Biju Das @ 2024-11-22 12:45 ` Biju Das 2024-11-29 14:49 ` Biju Das 2 siblings, 1 reply; 7+ messages in thread From: Biju Das @ 2024-11-22 12:45 UTC (permalink / raw) To: Michael Turquette, Stephen Boyd Cc: Biju Das, Geert Uytterhoeven, Magnus Damm, linux-renesas-soc, linux-clk, Prabhakar Mahadev Lad, Biju Das Add bus MSTOP support for RZ/{V2H, G3E}. For some module clocks, there are no MSTOP bits and the sequence ordering for mstop and clock on is different compared to the RZ/G2L family. Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> --- drivers/clk/renesas/r9a09g047-cpg.c | 6 +- drivers/clk/renesas/r9a09g057-cpg.c | 117 ++++++++++++++++++---------- drivers/clk/renesas/rzv2h-cpg.c | 92 +++++++++++++++++++++- drivers/clk/renesas/rzv2h-cpg.h | 22 ++++-- 4 files changed, 188 insertions(+), 49 deletions(-) diff --git a/drivers/clk/renesas/r9a09g047-cpg.c b/drivers/clk/renesas/r9a09g047-cpg.c index 5d7611cee9bc..ab63a7e7e480 100644 --- a/drivers/clk/renesas/r9a09g047-cpg.c +++ b/drivers/clk/renesas/r9a09g047-cpg.c @@ -69,8 +69,10 @@ static const struct cpg_core_clk r9a09g047_core_clks[] __initconst = { }; static const struct rzv2h_mod_clk r9a09g047_mod_clks[] __initconst = { - DEF_MOD_CRITICAL("gic_0_gicclk", CLK_PLLDTY_ACPU_DIV4, 1, 3, 0, 19), - DEF_MOD("scif_0_clk_pck", CLK_PLLCM33_DIV16, 8, 15, 4, 15), + DEF_MOD_CRITICAL("gic_0_gicclk", CLK_PLLDTY_ACPU_DIV4, 1, 3, 0, 19, + BUS_MSTOP(3, BIT(5))), + DEF_MOD("scif_0_clk_pck", CLK_PLLCM33_DIV16, 8, 15, 4, 15, + BUS_MSTOP(3, BIT(14))), }; static const struct rzv2h_reset r9a09g047_resets[] __initconst = { diff --git a/drivers/clk/renesas/r9a09g057-cpg.c b/drivers/clk/renesas/r9a09g057-cpg.c index 7c4507fd34e6..6abc5104972c 100644 --- a/drivers/clk/renesas/r9a09g057-cpg.c +++ b/drivers/clk/renesas/r9a09g057-cpg.c @@ -94,45 +94,84 @@ static const struct cpg_core_clk r9a09g057_core_clks[] __initconst = { }; static const struct rzv2h_mod_clk r9a09g057_mod_clks[] __initconst = { - DEF_MOD_CRITICAL("icu_0_pclk_i", CLK_PLLCM33_DIV16, 0, 5, 0, 5), - DEF_MOD("gtm_0_pclk", CLK_PLLCM33_DIV16, 4, 3, 2, 3), - DEF_MOD("gtm_1_pclk", CLK_PLLCM33_DIV16, 4, 4, 2, 4), - DEF_MOD("gtm_2_pclk", CLK_PLLCLN_DIV16, 4, 5, 2, 5), - DEF_MOD("gtm_3_pclk", CLK_PLLCLN_DIV16, 4, 6, 2, 6), - DEF_MOD("gtm_4_pclk", CLK_PLLCLN_DIV16, 4, 7, 2, 7), - DEF_MOD("gtm_5_pclk", CLK_PLLCLN_DIV16, 4, 8, 2, 8), - DEF_MOD("gtm_6_pclk", CLK_PLLCLN_DIV16, 4, 9, 2, 9), - DEF_MOD("gtm_7_pclk", CLK_PLLCLN_DIV16, 4, 10, 2, 10), - DEF_MOD("wdt_0_clkp", CLK_PLLCM33_DIV16, 4, 11, 2, 11), - DEF_MOD("wdt_0_clk_loco", CLK_QEXTAL, 4, 12, 2, 12), - DEF_MOD("wdt_1_clkp", CLK_PLLCLN_DIV16, 4, 13, 2, 13), - DEF_MOD("wdt_1_clk_loco", CLK_QEXTAL, 4, 14, 2, 14), - DEF_MOD("wdt_2_clkp", CLK_PLLCLN_DIV16, 4, 15, 2, 15), - DEF_MOD("wdt_2_clk_loco", CLK_QEXTAL, 5, 0, 2, 16), - DEF_MOD("wdt_3_clkp", CLK_PLLCLN_DIV16, 5, 1, 2, 17), - DEF_MOD("wdt_3_clk_loco", CLK_QEXTAL, 5, 2, 2, 18), - DEF_MOD("scif_0_clk_pck", CLK_PLLCM33_DIV16, 8, 15, 4, 15), - DEF_MOD("riic_8_ckm", CLK_PLLCM33_DIV16, 9, 3, 4, 19), - DEF_MOD("riic_0_ckm", CLK_PLLCLN_DIV16, 9, 4, 4, 20), - DEF_MOD("riic_1_ckm", CLK_PLLCLN_DIV16, 9, 5, 4, 21), - DEF_MOD("riic_2_ckm", CLK_PLLCLN_DIV16, 9, 6, 4, 22), - DEF_MOD("riic_3_ckm", CLK_PLLCLN_DIV16, 9, 7, 4, 23), - DEF_MOD("riic_4_ckm", CLK_PLLCLN_DIV16, 9, 8, 4, 24), - DEF_MOD("riic_5_ckm", CLK_PLLCLN_DIV16, 9, 9, 4, 25), - DEF_MOD("riic_6_ckm", CLK_PLLCLN_DIV16, 9, 10, 4, 26), - DEF_MOD("riic_7_ckm", CLK_PLLCLN_DIV16, 9, 11, 4, 27), - DEF_MOD("sdhi_0_imclk", CLK_PLLCLN_DIV8, 10, 3, 5, 3), - DEF_MOD("sdhi_0_imclk2", CLK_PLLCLN_DIV8, 10, 4, 5, 4), - DEF_MOD("sdhi_0_clk_hs", CLK_PLLCLN_DIV2, 10, 5, 5, 5), - DEF_MOD("sdhi_0_aclk", CLK_PLLDTY_ACPU_DIV4, 10, 6, 5, 6), - DEF_MOD("sdhi_1_imclk", CLK_PLLCLN_DIV8, 10, 7, 5, 7), - DEF_MOD("sdhi_1_imclk2", CLK_PLLCLN_DIV8, 10, 8, 5, 8), - DEF_MOD("sdhi_1_clk_hs", CLK_PLLCLN_DIV2, 10, 9, 5, 9), - DEF_MOD("sdhi_1_aclk", CLK_PLLDTY_ACPU_DIV4, 10, 10, 5, 10), - DEF_MOD("sdhi_2_imclk", CLK_PLLCLN_DIV8, 10, 11, 5, 11), - DEF_MOD("sdhi_2_imclk2", CLK_PLLCLN_DIV8, 10, 12, 5, 12), - DEF_MOD("sdhi_2_clk_hs", CLK_PLLCLN_DIV2, 10, 13, 5, 13), - DEF_MOD("sdhi_2_aclk", CLK_PLLDTY_ACPU_DIV4, 10, 14, 5, 14), + DEF_MOD_CRITICAL("icu_0_pclk_i", CLK_PLLCM33_DIV16, 0, 5, 0, 5, + BUS_MSTOP_NO_DATA), + DEF_MOD("gtm_0_pclk", CLK_PLLCM33_DIV16, 4, 3, 2, 3, + BUS_MSTOP(5, BIT(10))), + DEF_MOD("gtm_1_pclk", CLK_PLLCM33_DIV16, 4, 4, 2, 4, + BUS_MSTOP(5, BIT(11))), + DEF_MOD("gtm_2_pclk", CLK_PLLCLN_DIV16, 4, 5, 2, 5, + BUS_MSTOP(2, BIT(13))), + DEF_MOD("gtm_3_pclk", CLK_PLLCLN_DIV16, 4, 6, 2, 6, + BUS_MSTOP(2, BIT(14))), + DEF_MOD("gtm_4_pclk", CLK_PLLCLN_DIV16, 4, 7, 2, 7, + BUS_MSTOP(11, BIT(13))), + DEF_MOD("gtm_5_pclk", CLK_PLLCLN_DIV16, 4, 8, 2, 8, + BUS_MSTOP(11, BIT(14))), + DEF_MOD("gtm_6_pclk", CLK_PLLCLN_DIV16, 4, 9, 2, 9, + BUS_MSTOP(11, BIT(15))), + DEF_MOD("gtm_7_pclk", CLK_PLLCLN_DIV16, 4, 10, 2, 10, + BUS_MSTOP(12, BIT(0))), + DEF_MOD("wdt_0_clkp", CLK_PLLCM33_DIV16, 4, 11, 2, 11, + BUS_MSTOP(3, BIT(10))), + DEF_MOD("wdt_0_clk_loco", CLK_QEXTAL, 4, 12, 2, 12, + BUS_MSTOP(3, BIT(10))), + DEF_MOD("wdt_1_clkp", CLK_PLLCLN_DIV16, 4, 13, 2, 13, + BUS_MSTOP(1, BIT(0))), + DEF_MOD("wdt_1_clk_loco", CLK_QEXTAL, 4, 14, 2, 14, + BUS_MSTOP(1, BIT(0))), + DEF_MOD("wdt_2_clkp", CLK_PLLCLN_DIV16, 4, 15, 2, 15, + BUS_MSTOP(5, BIT(12))), + DEF_MOD("wdt_2_clk_loco", CLK_QEXTAL, 5, 0, 2, 16, + BUS_MSTOP(5, BIT(12))), + DEF_MOD("wdt_3_clkp", CLK_PLLCLN_DIV16, 5, 1, 2, 17, + BUS_MSTOP(5, BIT(13))), + DEF_MOD("wdt_3_clk_loco", CLK_QEXTAL, 5, 2, 2, 18, + BUS_MSTOP(5, BIT(13))), + DEF_MOD("scif_0_clk_pck", CLK_PLLCM33_DIV16, 8, 15, 4, 15, + BUS_MSTOP(3, BIT(14))), + DEF_MOD("riic_8_ckm", CLK_PLLCM33_DIV16, 9, 3, 4, 19, + BUS_MSTOP(3, BIT(13))), + DEF_MOD("riic_0_ckm", CLK_PLLCLN_DIV16, 9, 4, 4, 20, + BUS_MSTOP(1, BIT(1))), + DEF_MOD("riic_1_ckm", CLK_PLLCLN_DIV16, 9, 5, 4, 21, + BUS_MSTOP(1, BIT(2))), + DEF_MOD("riic_2_ckm", CLK_PLLCLN_DIV16, 9, 6, 4, 22, + BUS_MSTOP(1, BIT(3))), + DEF_MOD("riic_3_ckm", CLK_PLLCLN_DIV16, 9, 7, 4, 23, + BUS_MSTOP(1, BIT(4))), + DEF_MOD("riic_4_ckm", CLK_PLLCLN_DIV16, 9, 8, 4, 24, + BUS_MSTOP(1, BIT(5))), + DEF_MOD("riic_5_ckm", CLK_PLLCLN_DIV16, 9, 9, 4, 25, + BUS_MSTOP(1, BIT(6))), + DEF_MOD("riic_6_ckm", CLK_PLLCLN_DIV16, 9, 10, 4, 26, + BUS_MSTOP(1, BIT(7))), + DEF_MOD("riic_7_ckm", CLK_PLLCLN_DIV16, 9, 11, 4, 27, + BUS_MSTOP(1, BIT(8))), + DEF_MOD("sdhi_0_imclk", CLK_PLLCLN_DIV8, 10, 3, 5, 3, + BUS_MSTOP_NO_DATA), + DEF_MOD("sdhi_0_imclk2", CLK_PLLCLN_DIV8, 10, 4, 5, 4, + BUS_MSTOP_NO_DATA), + DEF_MOD("sdhi_0_clk_hs", CLK_PLLCLN_DIV2, 10, 5, 5, 5, + BUS_MSTOP_NO_DATA), + DEF_MOD("sdhi_0_aclk", CLK_PLLDTY_ACPU_DIV4, 10, 6, 5, 6, + BUS_MSTOP_NO_DATA), + DEF_MOD("sdhi_1_imclk", CLK_PLLCLN_DIV8, 10, 7, 5, 7, + BUS_MSTOP_NO_DATA), + DEF_MOD("sdhi_1_imclk2", CLK_PLLCLN_DIV8, 10, 8, 5, 8, + BUS_MSTOP_NO_DATA), + DEF_MOD("sdhi_1_clk_hs", CLK_PLLCLN_DIV2, 10, 9, 5, 9, + BUS_MSTOP_NO_DATA), + DEF_MOD("sdhi_1_aclk", CLK_PLLDTY_ACPU_DIV4, 10, 10, 5, 10, + BUS_MSTOP_NO_DATA), + DEF_MOD("sdhi_2_imclk", CLK_PLLCLN_DIV8, 10, 11, 5, 11, + BUS_MSTOP_NO_DATA), + DEF_MOD("sdhi_2_imclk2", CLK_PLLCLN_DIV8, 10, 12, 5, 12, + BUS_MSTOP_NO_DATA), + DEF_MOD("sdhi_2_clk_hs", CLK_PLLCLN_DIV2, 10, 13, 5, 13, + BUS_MSTOP_NO_DATA), + DEF_MOD("sdhi_2_aclk", CLK_PLLDTY_ACPU_DIV4, 10, 14, 5, 14, + BUS_MSTOP_NO_DATA), }; static const struct rzv2h_reset r9a09g057_resets[] __initconst = { diff --git a/drivers/clk/renesas/rzv2h-cpg.c b/drivers/clk/renesas/rzv2h-cpg.c index af961808f735..8f4fa155bc54 100644 --- a/drivers/clk/renesas/rzv2h-cpg.c +++ b/drivers/clk/renesas/rzv2h-cpg.c @@ -23,6 +23,7 @@ #include <linux/platform_device.h> #include <linux/pm_clock.h> #include <linux/pm_domain.h> +#include <linux/refcount.h> #include <linux/reset-controller.h> #include <dt-bindings/clock/renesas-cpg-mssr.h> @@ -83,6 +84,11 @@ struct rzv2h_cpg_priv { #define rcdev_to_priv(x) container_of(x, struct rzv2h_cpg_priv, rcdev) +struct rzv2h_mstop { + u32 data; + refcount_t ref_cnt; +}; + struct pll_clk { struct rzv2h_cpg_priv *priv; void __iomem *base; @@ -97,6 +103,7 @@ struct pll_clk { * struct mod_clock - Module clock * * @priv: CPG private data + * @mstop: handle to cpg bus mstop data * @hw: handle between common and hardware-specific interfaces * @on_index: register offset * @on_bit: ON/MON bit @@ -105,6 +112,7 @@ struct pll_clk { */ struct mod_clock { struct rzv2h_cpg_priv *priv; + struct rzv2h_mstop *mstop; struct clk_hw hw; u8 on_index; u8 on_bit; @@ -431,6 +439,38 @@ rzv2h_cpg_register_core_clk(const struct cpg_core_clk *core, core->name, PTR_ERR(clk)); } +static void rzv2h_mod_clock_mstop_enable(struct rzv2h_cpg_priv *priv, + struct mod_clock *clock) +{ + unsigned long flags; + u32 val; + + spin_lock_irqsave(&priv->rmw_lock, flags); + if (!refcount_read(&clock->mstop->ref_cnt)) { + val = BUS_MSTOP_VAL(clock->mstop->data) << 16; + writel(val, priv->base + BUS_MSTOP_OFF(clock->mstop->data)); + refcount_set(&clock->mstop->ref_cnt, 1); + } else { + refcount_inc(&clock->mstop->ref_cnt); + } + spin_unlock_irqrestore(&priv->rmw_lock, flags); +} + +static void rzv2h_mod_clock_mstop_disable(struct rzv2h_cpg_priv *priv, + struct mod_clock *clock) +{ + unsigned long flags; + u32 val; + + spin_lock_irqsave(&priv->rmw_lock, flags); + if (refcount_dec_and_test(&clock->mstop->ref_cnt)) { + val = BUS_MSTOP_VAL(clock->mstop->data) << 16 | + BUS_MSTOP_VAL(clock->mstop->data); + writel(val, priv->base + BUS_MSTOP_OFF(clock->mstop->data)); + } + spin_unlock_irqrestore(&priv->rmw_lock, flags); +} + static int rzv2h_mod_clock_endisable(struct clk_hw *hw, bool enable) { struct mod_clock *clock = to_mod_clock(hw); @@ -445,10 +485,16 @@ static int rzv2h_mod_clock_endisable(struct clk_hw *hw, bool enable) enable ? "ON" : "OFF"); value = bitmask << 16; - if (enable) + if (enable) { value |= bitmask; - - writel(value, priv->base + reg); + writel(value, priv->base + reg); + if (clock->mstop) + rzv2h_mod_clock_mstop_enable(priv, clock); + } else { + if (clock->mstop) + rzv2h_mod_clock_mstop_disable(priv, clock); + writel(value, priv->base + reg); + } if (!enable || clock->mon_index < 0) return 0; @@ -498,6 +544,38 @@ static const struct clk_ops rzv2h_mod_clock_ops = { .is_enabled = rzv2h_mod_clock_is_enabled, }; +static struct rzv2h_mstop +*rzv2h_cpg_get_mstop(struct rzv2h_cpg_priv *priv, u32 mstop_data) +{ + struct rzv2h_mstop *mstop; + unsigned int i; + + for (i = 0; i < priv->num_mod_clks; i++) { + struct mod_clock *clk; + struct clk_hw *hw; + + if (priv->clks[priv->num_core_clks + i] == ERR_PTR(-ENOENT)) + continue; + + hw = __clk_get_hw(priv->clks[priv->num_core_clks + i]); + clk = to_mod_clock(hw); + if (!clk->mstop) + continue; + + if (clk->mstop->data == mstop_data) + return clk->mstop; + } + + mstop = devm_kzalloc(priv->dev, sizeof(*mstop), GFP_KERNEL); + if (!mstop) + return NULL; + + mstop->data = mstop_data; + refcount_set(&mstop->ref_cnt, 0); + + return mstop; +} + static void __init rzv2h_cpg_register_mod_clk(const struct rzv2h_mod_clk *mod, struct rzv2h_cpg_priv *priv) @@ -552,6 +630,14 @@ rzv2h_cpg_register_mod_clk(const struct rzv2h_mod_clk *mod, priv->clks[id] = clock->hw.clk; + if (mod->mstop_data != BUS_MSTOP_NO_DATA) { + clock->mstop = rzv2h_cpg_get_mstop(priv, mod->mstop_data); + if (!clock->mstop) { + clock = ERR_PTR(-ENOMEM); + goto fail; + } + } + return; fail: diff --git a/drivers/clk/renesas/rzv2h-cpg.h b/drivers/clk/renesas/rzv2h-cpg.h index 8a676813f7bb..c75f98861165 100644 --- a/drivers/clk/renesas/rzv2h-cpg.h +++ b/drivers/clk/renesas/rzv2h-cpg.h @@ -33,6 +33,7 @@ struct ddiv { #define CPG_CDDIV0 (0x400) #define CPG_CDDIV1 (0x404) +#define CPG_BUS_1_MSTOP (0xd00) #define CDDIV0_DIVCTL2 DDIV_PACK(CPG_CDDIV0, 8, 3, 2) #define CDDIV1_DIVCTL0 DDIV_PACK(CPG_CDDIV1, 0, 2, 4) @@ -40,6 +41,14 @@ struct ddiv { #define CDDIV1_DIVCTL2 DDIV_PACK(CPG_CDDIV1, 8, 2, 6) #define CDDIV1_DIVCTL3 DDIV_PACK(CPG_CDDIV1, 12, 2, 7) +#define CPG_BUS_MSTOP_START (CPG_BUS_1_MSTOP - 4) +#define CPG_BUS_MSTOP(x) (CPG_BUS_MSTOP_START + (x) * 4) + +#define BUS_MSTOP(index, mask) ((CPG_BUS_MSTOP(index) & 0xffff) << 16 | (mask)) +#define BUS_MSTOP_OFF(val) (((val) >> 16) & 0xffff) +#define BUS_MSTOP_VAL(val) ((val) & 0xffff) +#define BUS_MSTOP_NO_DATA GENMASK(31, 0) + /** * Definitions of CPG Core Clocks * @@ -98,6 +107,7 @@ enum clk_types { * struct rzv2h_mod_clk - Module Clocks definitions * * @name: handle between common and hardware-specific interfaces + * @mstop_data: packed data mstop register offset and mask * @parent: id of parent clock * @critical: flag to indicate the clock is critical * @on_index: control register index @@ -107,6 +117,7 @@ enum clk_types { */ struct rzv2h_mod_clk { const char *name; + u32 mstop_data; u16 parent; bool critical; u8 on_index; @@ -115,9 +126,10 @@ struct rzv2h_mod_clk { u8 mon_bit; }; -#define DEF_MOD_BASE(_name, _parent, _critical, _onindex, _onbit, _monindex, _monbit) \ +#define DEF_MOD_BASE(_name, _mstop, _parent, _critical, _onindex, _onbit, _monindex, _monbit) \ { \ .name = (_name), \ + .mstop_data = (_mstop), \ .parent = (_parent), \ .critical = (_critical), \ .on_index = (_onindex), \ @@ -126,11 +138,11 @@ struct rzv2h_mod_clk { .mon_bit = (_monbit), \ } -#define DEF_MOD(_name, _parent, _onindex, _onbit, _monindex, _monbit) \ - DEF_MOD_BASE(_name, _parent, false, _onindex, _onbit, _monindex, _monbit) +#define DEF_MOD(_name, _parent, _onindex, _onbit, _monindex, _monbit, _mstop) \ + DEF_MOD_BASE(_name, _mstop, _parent, false, _onindex, _onbit, _monindex, _monbit) -#define DEF_MOD_CRITICAL(_name, _parent, _onindex, _onbit, _monindex, _monbit) \ - DEF_MOD_BASE(_name, _parent, true, _onindex, _onbit, _monindex, _monbit) +#define DEF_MOD_CRITICAL(_name, _parent, _onindex, _onbit, _monindex, _monbit, _mstop) \ + DEF_MOD_BASE(_name, _mstop, _parent, true, _onindex, _onbit, _monindex, _monbit) /** * struct rzv2h_reset - Reset definitions -- 2.43.0 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* RE: [PATCH 07/12] clk: renesas: rzv2h-cpg: Add MSTOP support 2024-11-22 12:45 ` [PATCH 07/12] clk: renesas: rzv2h-cpg: Add MSTOP support Biju Das @ 2024-11-29 14:49 ` Biju Das 0 siblings, 0 replies; 7+ messages in thread From: Biju Das @ 2024-11-29 14:49 UTC (permalink / raw) To: Biju Das, Michael Turquette, Stephen Boyd Cc: Geert Uytterhoeven, Magnus Damm, linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, Prabhakar Mahadev Lad, biju.das.au Hi All, > -----Original Message----- > From: Biju Das <biju.das.jz@bp.renesas.com> > Sent: 22 November 2024 12:46 > Subject: [PATCH 07/12] clk: renesas: rzv2h-cpg: Add MSTOP support > > Add bus MSTOP support for RZ/{V2H, G3E}. For some module clocks, there are no MSTOP bits and the > sequence ordering for mstop and clock on is different compared to the RZ/G2L family. > > Signed-off-by: Biju Das <biju.das.jz@bp.renesas.com> > --- > drivers/clk/renesas/r9a09g047-cpg.c | 6 +- > drivers/clk/renesas/r9a09g057-cpg.c | 117 ++++++++++++++++++---------- > drivers/clk/renesas/rzv2h-cpg.c | 92 +++++++++++++++++++++- > drivers/clk/renesas/rzv2h-cpg.h | 22 ++++-- > 4 files changed, 188 insertions(+), 49 deletions(-) > > diff --git a/drivers/clk/renesas/r9a09g047-cpg.c b/drivers/clk/renesas/r9a09g047-cpg.c > index 5d7611cee9bc..ab63a7e7e480 100644 > --- a/drivers/clk/renesas/r9a09g047-cpg.c > +++ b/drivers/clk/renesas/r9a09g047-cpg.c > @@ -69,8 +69,10 @@ static const struct cpg_core_clk r9a09g047_core_clks[] __initconst = { }; > > static void __init > rzv2h_cpg_register_mod_clk(const struct rzv2h_mod_clk *mod, > struct rzv2h_cpg_priv *priv) > @@ -552,6 +630,14 @@ rzv2h_cpg_register_mod_clk(const struct rzv2h_mod_clk *mod, > > priv->clks[id] = clock->hw.clk; > > + if (mod->mstop_data != BUS_MSTOP_NO_DATA) { > + clock->mstop = rzv2h_cpg_get_mstop(priv, mod->mstop_data); > + if (!clock->mstop) { > + clock = ERR_PTR(-ENOMEM); Typo this has to be clk = ERR_PTR(-ENOMEM); Will fix this in next version Cheers, Biju ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2024-11-29 14:49 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2024-11-22 12:45 [PATCH 00/12] Add support for Renesas RZ/G3E SoC and SMARC-EVK platform Biju Das 2024-11-22 12:45 ` [PATCH 04/12] dt-bindings: clock: renesas: Document RZ/G3E SoC CPG Biju Das 2024-11-25 18:52 ` Conor Dooley 2024-11-29 14:44 ` Biju Das 2024-11-22 12:45 ` [PATCH 06/12] clk: renesas: Add support for RZ/G3E SoC Biju Das 2024-11-22 12:45 ` [PATCH 07/12] clk: renesas: rzv2h-cpg: Add MSTOP support Biju Das 2024-11-29 14:49 ` Biju Das
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox