Skip to contentSkip to conversation

Renesas R8A7745 CPG/MSSR clock support

PATCH Superseded Sergei Shtylyov 2 participants 8 messages Nov 5, 2016 – Nov 10, 2016

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

v3 cover Renesas R8A7745 CPG/MSSR clock support

Hello.

Here's the set of 2 patches against the 'clk-next' branch of CLK group's
'linux.git' repo plus the R8A7743 CPG/MSSR patches just re-posted. They also depend on the common R-Car Gen2 support patch. As the DT patches in the R8A7745/SK-RZG1E board support series depend on the patch #1 of this series, it might make sense to merge this patch to the 'renesas.git' repo as well...

[1/2] ARM: shmobile: r8a7745: add CPG clock index macros [2/2] clk: renesas: cpg-mssr: add R8A7745 support

MBR, Sergei

#1 lore raw

PATCH v3 1/2 ARM: shmobile: r8a7745: add CPG clock index macros

Add macros usable by the device tree sources to reference the R8A7745 CPG clocks by index. The data comes from the table 7.2c in the revision 0.50 of the RZ/G Series User's Manual.

---
Changes in version 2:
- added Geert's tag.

 include/dt-bindings/clock/r8a7745-cpg-mssr.h |   44 +++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)
include/dt-bindings/clock/r8a7745-cpg-mssr.h new file +44 -0
Index: linux/include/dt-bindings/clock/r8a7745-cpg-mssr.h
===================================================================
@@ -0,0 +1,44 @@
+/*
+ * Copyright (C) 2016 Cogent Embedded Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ */
+#ifndef __DT_BINDINGS_CLOCK_R8A7745_CPG_MSSR_H__
+#define __DT_BINDINGS_CLOCK_R8A7745_CPG_MSSR_H__
+
+#include <dt-bindings/clock/renesas-cpg-mssr.h>
+
+/* r8a7745 CPG Core Clocks */
+#define R8A7745_CLK_Z2		0
+#define R8A7745_CLK_ZG		1
+#define R8A7745_CLK_ZTR		2
+#define R8A7745_CLK_ZTRD2	3
+#define R8A7745_CLK_ZT		4
+#define R8A7745_CLK_ZX		5
+#define R8A7745_CLK_ZS		6
+#define R8A7745_CLK_HP		7
+#define R8A7745_CLK_B		9
+#define R8A7745_CLK_LB		10
+#define R8A7745_CLK_P		11
+#define R8A7745_CLK_CL		12
+#define R8A7745_CLK_CP		13
+#define R8A7745_CLK_M2		14
+#define R8A7745_CLK_ZB3		16
+#define R8A7745_CLK_ZB3D2	17
+#define R8A7745_CLK_DDR		18
+#define R8A7745_CLK_SDH		19
+#define R8A7745_CLK_SD0		20
+#define R8A7745_CLK_SD2		21
+#define R8A7745_CLK_SD3		22
+#define R8A7745_CLK_MMC0	23
+#define R8A7745_CLK_MP		24
+#define R8A7745_CLK_QSPI	25
+#define R8A7745_CLK_ACP		26
+#define R8A7745_CLK_RCAN	27
+#define R8A7745_CLK_R		28
+#define R8A7745_CLK_OSC		29
+
+#endif /* __DT_BINDINGS_CLOCK_R8A7745_CPG_MSSR_H__ */
#2 lore raw

Re: [PATCH v3 1/2] ARM: shmobile: r8a7745: add CPG clock index macros

Hi Sergei,

Quoted 18 lines · Sergei Shtylyov

Add macros usable by the device tree sources to reference the R8A7745 CPG clocks by index. The data comes from the table 7.2c in the revision 0.50 of the RZ/G Series User's Manual.

---
Changes in version 2:
- added Geert's tag.

 include/dt-bindings/clock/r8a7745-cpg-mssr.h |   44 +++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

Index: linux/include/dt-bindings/clock/r8a7745-cpg-mssr.h
===================================================================

include/dt-bindings/clock/r8a7745-cpg-mssr.h

Quoted 2 lines
include/dt-bindings/clock/r8a7745-cpg-mssr.h new file +1 -0
 
+#define R8A7745_CLK_ACP                26

This clock is called CPEX instead of ACP in rev. 1.00 of the RZ/G Series User's
Manual: Hardware.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#3 lore raw

Re: [PATCH v3 1/2] ARM: shmobile: r8a7745: add CPG clock index macros

Quoted 21 lines · Geert Uytterhoeven
Quoted 18 lines · Sergei Shtylyov

Add macros usable by the device tree sources to reference the R8A7745 CPG clocks by index. The data comes from the table 7.2c in the revision 0.50 of the RZ/G Series User's Manual.

---
Changes in version 2:
- added Geert's tag.

 include/dt-bindings/clock/r8a7745-cpg-mssr.h |   44 +++++++++++++++++++++++++++
 1 file changed, 44 insertions(+)

Index: linux/include/dt-bindings/clock/r8a7745-cpg-mssr.h
===================================================================

include/dt-bindings/clock/r8a7745-cpg-mssr.h new file +0 -0
Quoted 4 lines
Quoted 1 line

+#define R8A7745_CLK_ACP 26

This clock is called CPEX instead of ACP in rev. 1.00 of the RZ/G Series User's
Manual: Hardware.

Applied with s/ACP/CPEX/, and included in second clk-renesas-for-v4.10 pull request.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#4 lore raw

PATCH v3 2/2 clk: renesas: cpg-mssr: add R8A7745 support

In reply to Sergei Shtylyov

Add RZ/G1E (R8A7745) Clock Pulse Generator / Module Standby and Software Reset support, using the CPG/MSSR driver core and the common R-Car Gen2 (and RZ/G) code.

Based on the proof-of-concept R8A7791 CPG/MSSR patch by Geert Uytterhoeven <[email protected]>.

---
Changes in version 3:
- removed the FDP1-1 module clock;
- added Geert's tag.

Changes in version 2:
- changed the Z2 clock's divisor to 3.

 Documentation/devicetree/bindings/clock/renesas,cpg-mssr.txt |    5 
 drivers/clk/renesas/Kconfig                                  |    1 
 drivers/clk/renesas/Makefile                                 |    1 
 drivers/clk/renesas/r8a7745-cpg-mssr.c                       |  260 +++++++++++
 drivers/clk/renesas/renesas-cpg-mssr.c                       |    6 
 drivers/clk/renesas/renesas-cpg-mssr.h                       |    1 
 6 files changed, 272 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/clock/renesas,cpg-mssr.txt +3 -2
Index: linux/Documentation/devicetree/bindings/clock/renesas,cpg-mssr.txt
===================================================================
@@ -14,6 +14,7 @@ They provide the following functionaliti
 Required Properties:
   - compatible: Must be one of:
       - "renesas,r8a7743-cpg-mssr" for the r8a7743 SoC (RZ/G1M)
+      - "renesas,r8a7745-cpg-mssr" for the r8a7745 SoC (RZ/G1E)
       - "renesas,r8a7795-cpg-mssr" for the r8a7795 SoC (R-Car H3)
       - "renesas,r8a7796-cpg-mssr" for the r8a7796 SoC (R-Car M3-W)
 
@@ -23,8 +24,8 @@ Required Properties:
   - clocks: References to external parent clocks, one entry for each entry in
     clock-names
   - clock-names: List of external parent clock names. Valid names are:
-      - "extal" (r8a7743, r8a7795, r8a7796)
-      - "usb_extal" (r8a7743)
+      - "extal" (r8a7743, r8a7745, r8a7795, r8a7796)
+      - "usb_extal" (r8a7743, r8a7745)
       - "extalr" (r8a7795, r8a7796)
 
   - #clock-cells: Must be 2
drivers/clk/renesas/Kconfig +1 -0
Index: linux/drivers/clk/renesas/Kconfig
===================================================================
@@ -1,6 +1,7 @@
 config CLK_RENESAS_CPG_MSSR
 	bool
 	default y if ARCH_R8A7743
+	default y if ARCH_R8A7745
 	default y if ARCH_R8A7795
 	default y if ARCH_R8A7796
 
drivers/clk/renesas/Makefile +1 -0
Index: linux/drivers/clk/renesas/Makefile
===================================================================
@@ -3,6 +3,7 @@ obj-$(CONFIG_ARCH_R7S72100)		+= clk-rz.o
 obj-$(CONFIG_ARCH_R8A73A4)		+= clk-r8a73a4.o clk-div6.o
 obj-$(CONFIG_ARCH_R8A7740)		+= clk-r8a7740.o clk-div6.o
 obj-$(CONFIG_ARCH_R8A7743)		+= r8a7743-cpg-mssr.o rcar-gen2-cpg.o
+obj-$(CONFIG_ARCH_R8A7745)		+= r8a7745-cpg-mssr.o rcar-gen2-cpg.o
 obj-$(CONFIG_ARCH_R8A7778)		+= clk-r8a7778.o
 obj-$(CONFIG_ARCH_R8A7779)		+= clk-r8a7779.o
 obj-$(CONFIG_ARCH_R8A7790)		+= clk-rcar-gen2.o clk-div6.o
drivers/clk/renesas/r8a7745-cpg-mssr.c new file +260 -0

260 lines not on this page · raw message

drivers/clk/renesas/renesas-cpg-mssr.c +6 -0
Index: linux/drivers/clk/renesas/renesas-cpg-mssr.c
===================================================================
@@ -509,6 +509,12 @@ static const struct of_device_id cpg_mss
 		.data = &r8a7743_cpg_mssr_info,
 	},
 #endif
+#ifdef CONFIG_ARCH_R8A7745
+	{
+		.compatible = "renesas,r8a7745-cpg-mssr",
+		.data = &r8a7745_cpg_mssr_info,
+	},
+#endif
 #ifdef CONFIG_ARCH_R8A7795
 	{
 		.compatible = "renesas,r8a7795-cpg-mssr",
drivers/clk/renesas/renesas-cpg-mssr.h +1 -0
Index: linux/drivers/clk/renesas/renesas-cpg-mssr.h
===================================================================
@@ -131,6 +131,7 @@ struct cpg_mssr_info {
 };
 
 extern const struct cpg_mssr_info r8a7743_cpg_mssr_info;
+extern const struct cpg_mssr_info r8a7745_cpg_mssr_info;
 extern const struct cpg_mssr_info r8a7795_cpg_mssr_info;
 extern const struct cpg_mssr_info r8a7796_cpg_mssr_info;
 #endif
#5 lore raw

Re: [PATCH v3 2/2] clk: renesas: cpg-mssr: add R8A7745 support

Hi Sergei,

Quoted 21 lines · Sergei Shtylyov

Add RZ/G1E (R8A7745) Clock Pulse Generator / Module Standby and Software Reset support, using the CPG/MSSR driver core and the common R-Car Gen2 (and RZ/G) code.

Based on the proof-of-concept R8A7791 CPG/MSSR patch by Geert Uytterhoeven <[email protected]>.

---
Changes in version 3:
- removed the FDP1-1 module clock;
- added Geert's tag.

Changes in version 2:
- changed the Z2 clock's divisor to 3.

drivers/clk/renesas/r8a7745-cpg-mssr.c line 74

Quoted 6 lines
drivers/clk/renesas/r8a7745-cpg-mssr.c new file +3 -0
@@ -0,0 +1,260 @@
 
+static const struct cpg_core_clk r8a7745_core_clks[] __initconst = {
 
+       /* Core Clock Outputs */
 
+       DEF_FIXED("acp",    R8A7745_CLK_ACP,   CLK_EXTAL,         2, 1),

This clock is called CPEX instead of ACP in rev. 1.00 of the RZ/G Series User's
Manual: Hardware.

drivers/clk/renesas/r8a7745-cpg-mssr.c line 120

Quoted 5 lines
drivers/clk/renesas/r8a7745-cpg-mssr.c new file +4 -0
+};
+
+static const struct mssr_mod_clk r8a7745_mod_clks[] __initconst = {
 
+       DEF_MOD("thermal",        522,  CLK_EXTAL),

RZ/G1E does not have the thermal sensor (confirmed by rev. 1.00).

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds

#6 lore raw

PATCH v4 1/1 clk: renesas: cpg-mssr: add R8A7745 support

In reply to Sergei Shtylyov

Add RZ/G1E (R8A7745) Clock Pulse Generator / Module Standby and Software Reset support, using the CPG/MSSR driver core and the common R-Car Gen2 (and RZ/G) code.

Based on the proof-of-concept R8A7791 CPG/MSSR patch by Geert Uytterhoeven <[email protected]>.

---
This patch is against the 'clk-next' branch of CLK group's 'linux.git' repo plus the R8A7743 clock driver patch. It depends on the common R-Car gen2 (and RZ/G) support just posted.

Changes in version 4:
- changed the Z2 clock's divisor to 1;
- passed the PLL0 divisor to rcar_gen2_cpg_init();
- renamed the ACP clock to CPEX;
- removed the thermal module clock.

Changes in version 3:
- removed the FDP1-1 module clock;
- added Geert's tag.

Changes in version 2:
- changed the Z2 clock's divisor to 3.

 Documentation/devicetree/bindings/clock/renesas,cpg-mssr.txt |    5 
 drivers/clk/renesas/Kconfig                                  |    1 
 drivers/clk/renesas/Makefile                                 |    1 
 drivers/clk/renesas/r8a7745-cpg-mssr.c                       |  259 +++++++++++
 drivers/clk/renesas/renesas-cpg-mssr.c                       |    6 
 drivers/clk/renesas/renesas-cpg-mssr.h                       |    1 
 6 files changed, 271 insertions(+), 2 deletions(-)
Documentation/devicetree/bindings/clock/renesas,cpg-mssr.txt +3 -2
Index: linux/Documentation/devicetree/bindings/clock/renesas,cpg-mssr.txt
===================================================================
@@ -14,6 +14,7 @@ They provide the following functionaliti
 Required Properties:
   - compatible: Must be one of:
       - "renesas,r8a7743-cpg-mssr" for the r8a7743 SoC (RZ/G1M)
+      - "renesas,r8a7745-cpg-mssr" for the r8a7745 SoC (RZ/G1E)
       - "renesas,r8a7795-cpg-mssr" for the r8a7795 SoC (R-Car H3)
       - "renesas,r8a7796-cpg-mssr" for the r8a7796 SoC (R-Car M3-W)
 
@@ -23,8 +24,8 @@ Required Properties:
   - clocks: References to external parent clocks, one entry for each entry in
     clock-names
   - clock-names: List of external parent clock names. Valid names are:
-      - "extal" (r8a7743, r8a7795, r8a7796)
-      - "usb_extal" (r8a7743)
+      - "extal" (r8a7743, r8a7745, r8a7795, r8a7796)
+      - "usb_extal" (r8a7743, r8a7745)
       - "extalr" (r8a7795, r8a7796)
 
   - #clock-cells: Must be 2
drivers/clk/renesas/Kconfig +1 -0
Index: linux/drivers/clk/renesas/Kconfig
===================================================================
@@ -1,6 +1,7 @@
 config CLK_RENESAS_CPG_MSSR
 	bool
 	default y if ARCH_R8A7743
+	default y if ARCH_R8A7745
 	default y if ARCH_R8A7795
 	default y if ARCH_R8A7796
 
drivers/clk/renesas/Makefile +1 -0
Index: linux/drivers/clk/renesas/Makefile
===================================================================
@@ -3,6 +3,7 @@ obj-$(CONFIG_ARCH_R7S72100)		+= clk-rz.o
 obj-$(CONFIG_ARCH_R8A73A4)		+= clk-r8a73a4.o clk-div6.o
 obj-$(CONFIG_ARCH_R8A7740)		+= clk-r8a7740.o clk-div6.o
 obj-$(CONFIG_ARCH_R8A7743)		+= r8a7743-cpg-mssr.o rcar-gen2-cpg.o
+obj-$(CONFIG_ARCH_R8A7745)		+= r8a7745-cpg-mssr.o rcar-gen2-cpg.o
 obj-$(CONFIG_ARCH_R8A7778)		+= clk-r8a7778.o
 obj-$(CONFIG_ARCH_R8A7779)		+= clk-r8a7779.o
 obj-$(CONFIG_ARCH_R8A7790)		+= clk-rcar-gen2.o clk-div6.o
drivers/clk/renesas/r8a7745-cpg-mssr.c new file +259 -0

259 lines not on this page · raw message

drivers/clk/renesas/renesas-cpg-mssr.c +6 -0
Index: linux/drivers/clk/renesas/renesas-cpg-mssr.c
===================================================================
@@ -509,6 +509,12 @@ static const struct of_device_id cpg_mss
 		.data = &r8a7743_cpg_mssr_info,
 	},
 #endif
+#ifdef CONFIG_ARCH_R8A7745
+	{
+		.compatible = "renesas,r8a7745-cpg-mssr",
+		.data = &r8a7745_cpg_mssr_info,
+	},
+#endif
 #ifdef CONFIG_ARCH_R8A7795
 	{
 		.compatible = "renesas,r8a7795-cpg-mssr",
drivers/clk/renesas/renesas-cpg-mssr.h +1 -0
Index: linux/drivers/clk/renesas/renesas-cpg-mssr.h
===================================================================
@@ -131,6 +131,7 @@ struct cpg_mssr_info {
 };
 
 extern const struct cpg_mssr_info r8a7743_cpg_mssr_info;
+extern const struct cpg_mssr_info r8a7745_cpg_mssr_info;
 extern const struct cpg_mssr_info r8a7795_cpg_mssr_info;
 extern const struct cpg_mssr_info r8a7796_cpg_mssr_info;
 #endif
#7 lore raw

Re: [PATCH v4] clk: renesas: cpg-mssr: add R8A7745 support

Quoted 15 lines · Sergei Shtylyov

Add RZ/G1E (R8A7745) Clock Pulse Generator / Module Standby and Software Reset support, using the CPG/MSSR driver core and the common R-Car Gen2 (and RZ/G) code.

Based on the proof-of-concept R8A7791 CPG/MSSR patch by Geert Uytterhoeven <[email protected]>.

---
This patch is against the 'clk-next' branch of CLK group's 'linux.git' repo plus the R8A7743 clock driver patch. It depends on the common R-Car gen2 (and RZ/G) support just posted.

Quoted 5 lines

Changes in version 4:
- changed the Z2 clock's divisor to 1;
- passed the PLL0 divisor to rcar_gen2_cpg_init();
- renamed the ACP clock to CPEX;
- removed the thermal module clock.

Thanks!

Will queue with the following trivial changes:
- pass cpg_mode to rcar_gen2_cpg_init(),
- sort clock names in DT bindings,
- reformat tables for easier comparison with other clock drivers.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- [email protected]

In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds