Skip to contentSkip to conversation

Renesas R8A7790 Common Clock Framework support

PATCH Superseded Laurent Pinchart 3 participants 10 messages Nov 10, 2013 – Nov 14, 2013

Subsystems (5)

v2 of 4 Superseded Latest is v4 →

lore
Share & tools
lore
#0 lore raw

v2 cover Renesas R8A7790 Common Clock Framework support

Hello,

This is the second version of the CCF clock drivers for the Renesas R-Car R8A7790 (H2) SoC.

The patches are pretty self-explanatory and described in their respective commit message. The R8A7790 datasheet is unfortunately not publicly available.

The code is available in my git tree at

git://linuxtv.org/pinchartl/fbdev.git clocks/ccf/r8a7790

The branch is based on a merge of renesas-devel-v3.12-rc7-20131101, v3.12, and clk-prepare patches I've posted earlier on the list (see "[PATCH 00/12] Prepare various SH/R Mobile/Car drivers for CCF migration").

Changes compared to v1:

- The core CPG clocks driver now supports the r8a7791 SoC in addition to the r8a7790. They are collectively refered to as 'R-Car Gen2'. The driver has thus been renamed to clk-rcar-gen2.c. The DT bindings have been updated accordingly.

- Several MSTP clocks have been added to the r8a7790-clock.h header and a new header has been added for the r8a7791

- The r8a7790 dtsi patches that add and reference clocks have been added to this series.

Cc devicetree at vger.kernel.org

Laurent Pinchart (7):
clk: shmobile: Add R-Car Gen2 clocks support
clk: shmobile: Add DIV6 clock support
clk: shmobile: Add MSTP clock support
ARM: shmobile: r8a7790: Add clock index macros for DT sources
ARM: shmobile: r8a7791: Add clock index macros for DT sources
ARM: shmobile: r8a7790: Add clocks
ARM: shmobile: r8a7790: Reference clocks

 .../bindings/clock/renesas,cpg-div6-clocks.txt     |  27 ++
 .../bindings/clock/renesas,cpg-mstp-clocks.txt     |  47 ++++
 .../clock/renesas,rcar-gen2-cpg-clocks.txt         |  32 +++
 arch/arm/boot/dts/r8a7790-lager-reference.dts      |   2 +-
 arch/arm/boot/dts/r8a7790-lager.dts                |   2 +-
 arch/arm/boot/dts/r8a7790.dtsi                     | 310 +++++++++++++++++++++
 drivers/clk/shmobile/Makefile                      |   7 +-
 drivers/clk/shmobile/clk-div6.c                    | 185 ++++++++++++
 drivers/clk/shmobile/clk-mstp.c                    | 229 +++++++++++++++
 drivers/clk/shmobile/clk-rcar-gen2.c               | 187 +++++++++++++
 include/dt-bindings/clock/r8a7790-clock.h          |  99 +++++++
 include/dt-bindings/clock/r8a7791-clock.h          | 104 +++++++
 include/linux/clk/shmobile.h                       |  19 ++
 13 files changed, 1247 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/renesas,cpg-div6-clocks.txt
 create mode 100644 Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt
 create mode 100644 Documentation/devicetree/bindings/clock/renesas,rcar-gen2-cpg-clocks.txt
 create mode 100644 drivers/clk/shmobile/clk-div6.c
 create mode 100644 drivers/clk/shmobile/clk-mstp.c
 create mode 100644 drivers/clk/shmobile/clk-rcar-gen2.c
 create mode 100644 include/dt-bindings/clock/r8a7790-clock.h
 create mode 100644 include/dt-bindings/clock/r8a7791-clock.h
 create mode 100644 include/linux/clk/shmobile.h
Signature · 3 lines
Regards,

Laurent Pinchart
#1 lore raw

PATCH v2 1/7 clk: shmobile: Add R-Car Gen2 clocks support

The R-Car Gen2 SoCs (R8A7790 and R8A7791) have several clocks that are too custom to be supported in a generic driver. Those clocks can be divided in two categories:

- Fixed rate clocks with multiplier and divisor set according to boot mode configuration

- Custom divider clocks with SoC-specific divider values

This driver supports both.

Cc devicetree at vger.kernel.org
---
 .../clock/renesas,rcar-gen2-cpg-clocks.txt         |  32 ++++
 drivers/clk/shmobile/Makefile                      |   5 +-
 drivers/clk/shmobile/clk-rcar-gen2.c               | 187 +++++++++++++++++++++
 include/linux/clk/shmobile.h                       |  19 +++
 4 files changed, 242 insertions(+), 1 deletion(-)
 create mode 100644 Documentation/devicetree/bindings/clock/renesas,rcar-gen2-cpg-clocks.txt
 create mode 100644 drivers/clk/shmobile/clk-rcar-gen2.c
 create mode 100644 include/linux/clk/shmobile.h
Documentation/devicetree/bindings/clock/renesas,rcar-gen2-cpg-clocks.txt new file +32 -0
new file mode 100644
index 0000000..f85a0ed
@@ -0,0 +1,32 @@
+* Renesas R-Car Gen2 Clock Pulse Generator (CPG)
+
+The CPG generates core clocks for the R-Car Gen2 SoCs. It includes three PLLs
+and several fixed ratio dividers.
+
+Required Properties:
+
+  - compatible: Must be one of
+    - "renesas,r8a7790-cpg-clocks" for the r8a7790 CPG
+    - "renesas,r8a7791-cpg-clocks" for the r8a7791 CPG
+    - "renesas,rcar-gen2-cpg-clocks" for the generic R-Car Gen2 CPG
+
+  - reg: Base address and length of the memory resource used by the CPG
+
+  - clocks: Reference to the parent clock
+  - #clock-cells: Must be 1
+  - clock-output-names: The names of the clocks. Supported clocks are "main",
+    "pll0", "pll1", "pll3", "lb", "qspi", "sdh", "sd0" and "sd1".
+
+
+Example
+-------
+
+	cpg_clocks: cpg_clocks at e6150000 {
+		compatible = "renesas,r8a7790-cpg-clocks",
+			     "renesas,rcar-gen2-cpg-clocks";
+		reg = <0 0xe6150000 0 0x1000>;
+		clocks = <&extal_clk>;
+		#clock-cells = <1>;
+		clock-output-names = "main", "pll0, "pll1", "pll3",
+				     "lb", "qspi", "sdh", "sd0", "sd1";
+	};
drivers/clk/shmobile/Makefile +4 -1
index 2240730..40d88e6 100644
@@ -1,3 +1,6 @@
-obj-$(CONFIG_ARCH_EMEV2)	+= clk-emev2.o
+obj-$(CONFIG_ARCH_EMEV2)		+= clk-emev2.o
+obj-$(CONFIG_ARCH_R8A7790)		+= clk-rcar-gen2.o
+obj-$(CONFIG_ARCH_R8A7791)		+= clk-rcar-gen2.o
+
 # for emply built-in.o
 obj-n	:= dummy
drivers/clk/shmobile/clk-rcar-gen2.c new file +187 -0

187 lines not on this page · raw message

include/linux/clk/shmobile.h new file +19 -0
new file mode 100644
index 0000000..f9bf080
@@ -0,0 +1,19 @@
+/*
+ * Copyright 2013 Ideas On Board SPRL
+ *
+ * Contact: Laurent Pinchart <[email protected]>
+ *
+ * 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 __LINUX_CLK_SHMOBILE_H_
+#define __LINUX_CLK_SHMOBILE_H_
+
+#include <linux/types.h>
+
+void rcar_gen2_clocks_init(u32 mode);
+
+#endif
Signature · 1 line
1.8.1.5
#2 lore raw

PATCH v2 2/7 clk: shmobile: Add DIV6 clock support

In reply to Laurent Pinchart

DIV6 clocks are divider gate clocks controlled through a single register. The divider is expressed on 6 bits, hence the name, and can take values from 1/1 to 1/64.

Those clocks are found on Renesas ARM SoCs.

Cc devicetree at vger.kernel.org
---
 .../bindings/clock/renesas,cpg-div6-clocks.txt     |  27 +++
 drivers/clk/shmobile/Makefile                      |   1 +
 drivers/clk/shmobile/clk-div6.c                    | 185 +++++++++++++++++++++
 3 files changed, 213 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/renesas,cpg-div6-clocks.txt
 create mode 100644 drivers/clk/shmobile/clk-div6.c
Documentation/devicetree/bindings/clock/renesas,cpg-div6-clocks.txt new file +27 -0
new file mode 100644
index 0000000..316d745
@@ -0,0 +1,27 @@
+* Renesas CPG DIV6 Clock
+
+The CPG DIV6 clocks are variable factor clocks provided by the Clock Pulse
+Generator (CPG). They clock input is divided by a configurable factor from 1
+to 64.
+
+Required Properties:
+
+  - compatible: Must be one of the following
+    - "renesas,r8a7790-div6-clock" for R8A7790 (R-Car H2) DIV6 clocks
+    - "renesas,cpg-div6-clock" for generic DIV6 clocks
+  - reg: Base address and length of the memory resource used by the DIV6 clock
+  - clocks: Reference to the parent clock
+  - #clock-cells: Must be 0
+  - clock-output-names: The name of the clock as a free-form string
+
+
+Example
+-------
+
+	sd2_clk: sd2_clk at e6150078 {
+		compatible = "renesas,r8a7790-div6-clock", "renesas,cpg-div6-clock";
+		reg = <0 0xe6150078 0 4>;
+		clocks = <&pll1_div2_clk>;
+		#clock-cells = <0>;
+		clock-output-names = "sd2";
+	};
drivers/clk/shmobile/Makefile +1 -0
index 40d88e6..eded163 100644
@@ -1,6 +1,7 @@
 obj-$(CONFIG_ARCH_EMEV2)		+= clk-emev2.o
 obj-$(CONFIG_ARCH_R8A7790)		+= clk-rcar-gen2.o
 obj-$(CONFIG_ARCH_R8A7791)		+= clk-rcar-gen2.o
+obj-$(CONFIG_ARCH_SHMOBILE_MULTI)	+= clk-div6.o
 
 # for emply built-in.o
 obj-n	:= dummy
drivers/clk/shmobile/clk-div6.c new file +185 -0

185 lines not on this page · raw message

Signature · 1 line
1.8.1.5
#3 lore raw

PATCH v2 3/7 clk: shmobile: Add MSTP clock support

In reply to Laurent Pinchart

MSTP clocks are gate clocks controlled through a register that handles up to 32 clocks. The register is often sparsely populated.

Those clocks are found on Renesas ARM SoCs.

Cc devicetree at vger.kernel.org
---
 .../bindings/clock/renesas,cpg-mstp-clocks.txt     |  47 +++++
 drivers/clk/shmobile/Makefile                      |   1 +
 drivers/clk/shmobile/clk-mstp.c                    | 229 +++++++++++++++++++++
 3 files changed, 277 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt
 create mode 100644 drivers/clk/shmobile/clk-mstp.c
Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt new file +47 -0
new file mode 100644
index 0000000..5a1e050
@@ -0,0 +1,47 @@
+* Renesas R8A7790 Module Stop (MSTP) Clocks
+
+The CPG can gate SoC device clocks. The gates are organized in groups of up to
+32 gates.
+
+This device tree binding describes a single 32 gate clocks group per node.
+Clocks are referenced by user nodes by the MSTP node phandle and the clock
+index in the group, from 0 to 31.
+
+Required Properties:
+
+  - compatible: Must be one of the following
+    - "renesas,r8a7790-mstp-clocks" for R8A7790 (R-Car H2) MSTP gate clocks
+    - "renesas,cpg-mstp-clock" for generic MSTP gate clocks
+  - reg: Base address and length of the memory resource used by the MSTP
+    clocks
+  - clocks: Reference to the parent clocks
+  - #clock-cells: Must be 1
+  - clock-output-names: The name of the clocks as free-form strings
+  - renesas,indices: Indices of the gate clocks into the group (0 to 31)
+
+The clocks, clock-output-names and renesas,indices properties contain one
+entry per gate clock. The MSTP groups are sparsely populated. Unimplemented
+gate clocks must not be declared.
+
+
+Example
+-------
+
+	#include <dt-bindings/clock/r8a7790-clock.h>
+
+	mstp3_clks: mstp3_clks at e615013c {
+		compatible = "renesas,r8a7790-mstp-clocks", "renesas,cpg-mstp-clocks";
+		reg = <0 0xe615013c 0 4>, <0 0xe6150048 0 4>;
+		clocks = <&cp_clk>, <&mmc1_clk>, <&sd3_clk>, <&sd2_clk>,
+			 <&cpg_clocks R8A7790_CLK_SD1>, <&cpg_clocks R8A7790_CLK_SD0>,
+			 <&mmc0_clk>;
+		#clock-cells = <1>;
+		clock-output-names =
+			"tpu0", "mmcif1", "sdhi3", "sdhi2",
+			 "sdhi1", "sdhi0", "mmcif0";
+		renesas,clock-indices = <
+			R8A7790_CLK_TPU0 R8A7790_CLK_MMCIF1 R8A7790_CLK_SDHI3
+			R8A7790_CLK_SDHI2 R8A7790_CLK_SDHI1 R8A7790_CLK_SDHI0
+			R8A7790_CLK_MMCIF0
+		>;
+	};
drivers/clk/shmobile/Makefile +1 -0
index eded163..4df35a0 100644
@@ -2,6 +2,7 @@ obj-$(CONFIG_ARCH_EMEV2)		+= clk-emev2.o
 obj-$(CONFIG_ARCH_R8A7790)		+= clk-rcar-gen2.o
 obj-$(CONFIG_ARCH_R8A7791)		+= clk-rcar-gen2.o
 obj-$(CONFIG_ARCH_SHMOBILE_MULTI)	+= clk-div6.o
+obj-$(CONFIG_ARCH_SHMOBILE_MULTI)	+= clk-mstp.o
 
 # for emply built-in.o
 obj-n	:= dummy
drivers/clk/shmobile/clk-mstp.c new file +229 -0

229 lines not on this page · raw message

Signature · 1 line
1.8.1.5
#4 lore raw

PATCH v2 4/7 ARM: shmobile: r8a7790: Add clock index macros for DT sources

In reply to Laurent Pinchart

Add macros usable by device tree sources to reference r8a7790 clocks by index.

---
 include/dt-bindings/clock/r8a7790-clock.h | 99 +++++++++++++++++++++++++++++++
 1 file changed, 99 insertions(+)
 create mode 100644 include/dt-bindings/clock/r8a7790-clock.h
include/dt-bindings/clock/r8a7790-clock.h new file +99 -0
new file mode 100644
index 0000000..e96ded4
@@ -0,0 +1,99 @@
+/*
+ * Copyright 2013 Ideas On Board SPRL
+ *
+ * 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_R8A7790_H__
+#define __DT_BINDINGS_CLOCK_R8A7790_H__
+
+/* CPG */
+#define R8A7790_CLK_MAIN		0
+#define R8A7790_CLK_PLL0		1
+#define R8A7790_CLK_PLL1		2
+#define R8A7790_CLK_PLL3		3
+#define R8A7790_CLK_LB			4
+#define R8A7790_CLK_QSPI		5
+#define R8A7790_CLK_SDH			6
+#define R8A7790_CLK_SD0			7
+#define R8A7790_CLK_SD1			8
+
+/* MSTP1 */
+#define R8A7790_CLK_TMU1		11
+#define R8A7790_CLK_TMU3		21
+#define R8A7790_CLK_TMU2		22
+#define R8A7790_CLK_CMT0		24
+#define R8A7790_CLK_TMU0		25
+#define R8A7790_CLK_VSP1_DU1		27
+#define R8A7790_CLK_VSP1_DU0		28
+#define R8A7790_CLK_VSP1_RT		30
+#define R8A7790_CLK_VSP1_SY		31
+
+/* MSTP2 */
+#define R8A7790_CLK_SCIFA2		2
+#define R8A7790_CLK_SCIFA1		3
+#define R8A7790_CLK_SCIFA0		4
+#define R8A7790_CLK_SCIFB0		6
+#define R8A7790_CLK_SCIFB1		7
+#define R8A7790_CLK_SCIFB2		16
+#define R8A7790_CLK_SYS_DMAC0		18
+#define R8A7790_CLK_SYS_DMAC1		19
+
+/* MSTP3 */
+#define R8A7790_CLK_TPU0		4
+#define R8A7790_CLK_MMCIF1		5
+#define R8A7790_CLK_SDHI3		11
+#define R8A7790_CLK_SDHI2		12
+#define R8A7790_CLK_SDHI1		13
+#define R8A7790_CLK_SDHI0		14
+#define R8A7790_CLK_MMCIF0		15
+#define R8A7790_CLK_SSUSB		28
+#define R8A7790_CLK_CMT1		29
+#define R8A7790_CLK_USBDMAC0		30
+#define R8A7790_CLK_USBDMAC1		31
+
+/* MSTP5 */
+#define R8A7790_CLK_THERMAL		22
+#define R8A7790_CLK_PWM			23
+
+/* MSTP7 */
+#define R8A7790_CLK_EHCI		3
+#define R8A7790_CLK_HSUSB		4
+#define R8A7790_CLK_HSCIF1		16
+#define R8A7790_CLK_HSCIF0		17
+#define R8A7790_CLK_SCIF1		20
+#define R8A7790_CLK_SCIF0		21
+#define R8A7790_CLK_DU2			22
+#define R8A7790_CLK_DU1			23
+#define R8A7790_CLK_DU0			24
+#define R8A7790_CLK_LVDS1		25
+#define R8A7790_CLK_LVDS0		26
+
+/* MSTP8 */
+#define R8A7790_CLK_VIN3		8
+#define R8A7790_CLK_VIN2		9
+#define R8A7790_CLK_VIN1		10
+#define R8A7790_CLK_VIN0		11
+#define R8A7790_CLK_ETHER		13
+#define R8A7790_CLK_SATA1		14
+#define R8A7790_CLK_SATA0		15
+
+/* MSTP9 */
+#define R8A7790_CLK_GPIO5		7
+#define R8A7790_CLK_GPIO4		8
+#define R8A7790_CLK_GPIO3		9
+#define R8A7790_CLK_GPIO2		10
+#define R8A7790_CLK_GPIO1		11
+#define R8A7790_CLK_GPIO0		12
+#define R8A7790_CLK_RCAN1		15
+#define R8A7790_CLK_RCAN0		16
+#define R8A7790_CLK_IICDVFS		26
+#define R8A7790_CLK_I2C3		28
+#define R8A7790_CLK_I2C2		29
+#define R8A7790_CLK_I2C1		30
+#define R8A7790_CLK_I2C0		31
+
+#endif /* __DT_BINDINGS_CLOCK_R8A7790_H__ */
Signature · 1 line
1.8.1.5
#5 lore raw

PATCH v2 5/7 ARM: shmobile: r8a7791: Add clock index macros for DT sources

In reply to Laurent Pinchart

Add macros usable by device tree sources to reference r8a7791 clocks by index.

---
 include/dt-bindings/clock/r8a7791-clock.h | 104 ++++++++++++++++++++++++++++++
 1 file changed, 104 insertions(+)
 create mode 100644 include/dt-bindings/clock/r8a7791-clock.h
include/dt-bindings/clock/r8a7791-clock.h new file +104 -0
new file mode 100644
index 0000000..5a4482a
@@ -0,0 +1,104 @@
+/*
+ * Copyright 2013 Ideas On Board SPRL
+ *
+ * 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_R8A7791_H__
+#define __DT_BINDINGS_CLOCK_R8A7791_H__
+
+/* CPG */
+#define R8A7791_CLK_MAIN		0
+#define R8A7791_CLK_PLL0		1
+#define R8A7791_CLK_PLL1		2
+#define R8A7791_CLK_PLL3		3
+#define R8A7791_CLK_LB			4
+#define R8A7791_CLK_QSPI		5
+#define R8A7791_CLK_SDH			6
+#define R8A7791_CLK_SD0			7
+
+/* MSTP1 */
+#define R8A7791_CLK_TMU1		11
+#define R8A7791_CLK_TMU3		21
+#define R8A7791_CLK_TMU2		22
+#define R8A7791_CLK_CMT0		24
+#define R8A7791_CLK_TMU0		25
+#define R8A7791_CLK_VSP1_DU1		27
+#define R8A7791_CLK_VSP1_DU0		28
+#define R8A7791_CLK_VSP1_SY		31
+
+/* MSTP2 */
+#define R8A7791_CLK_SCIFA2		2
+#define R8A7791_CLK_SCIFA1		3
+#define R8A7791_CLK_SCIFA0		4
+#define R8A7791_CLK_SCIFB0		6
+#define R8A7791_CLK_SCIFB1		7
+#define R8A7791_CLK_SCIFB2		16
+#define R8A7791_CLK_DMAC		18
+
+/* MSTP3 */
+#define R8A7791_CLK_TPU0		4
+#define R8A7791_CLK_SDHI2		11
+#define R8A7791_CLK_SDHI1		12
+#define R8A7791_CLK_SDHI0		14
+#define R8A7791_CLK_MMCIF0		15
+#define R8A7791_CLK_SSUSB		28
+#define R8A7791_CLK_CMT1		29
+#define R8A7791_CLK_USBDMAC0		30
+#define R8A7791_CLK_USBDMAC1		31
+
+/* MSTP5 */
+#define R8A7791_CLK_THERMAL		22
+#define R8A7791_CLK_PWM			23
+
+/* MSTP7 */
+#define R8A7791_CLK_HSUSB		4
+#define R8A7791_CLK_HSCIF2		13
+#define R8A7791_CLK_SCIF5		14
+#define R8A7791_CLK_SCIF4		15
+#define R8A7791_CLK_HSCIF1		16
+#define R8A7791_CLK_HSCIF0		17
+#define R8A7791_CLK_SCIF3		18
+#define R8A7791_CLK_SCIF2		19
+#define R8A7791_CLK_SCIF1		20
+#define R8A7791_CLK_SCIF0		21
+#define R8A7791_CLK_DU1			23
+#define R8A7791_CLK_DU0			24
+#define R8A7791_CLK_LVDS0		26
+
+/* MSTP8 */
+#define R8A7791_CLK_VIN2		9
+#define R8A7791_CLK_VIN1		10
+#define R8A7791_CLK_VIN0		11
+#define R8A7791_CLK_ETHER		13
+#define R8A7791_CLK_SATA1		14
+#define R8A7791_CLK_SATA0		15
+
+/* MSTP9 */
+#define R8A7791_CLK_GPIO7		4
+#define R8A7791_CLK_GPIO6		5
+#define R8A7791_CLK_GPIO5		7
+#define R8A7791_CLK_GPIO4		8
+#define R8A7791_CLK_GPIO3		9
+#define R8A7791_CLK_GPIO2		10
+#define R8A7791_CLK_GPIO1		11
+#define R8A7791_CLK_GPIO0		12
+#define R8A7791_CLK_RCAN1		15
+#define R8A7791_CLK_RCAN0		16
+#define R8A7791_CLK_I2C5		25
+#define R8A7791_CLK_IICDVFS		26
+#define R8A7791_CLK_I2C4		27
+#define R8A7791_CLK_I2C3		28
+#define R8A7791_CLK_I2C2		29
+#define R8A7791_CLK_I2C1		30
+#define R8A7791_CLK_I2C0		31
+
+/* MSTP11 */
+#define R8A7791_CLK_SCIF23		6
+#define R8A7791_CLK_SCIF24		7
+#define R8A7791_CLK_SCIF25		8
+
+#endif /* __DT_BINDINGS_CLOCK_R8A7791_H__ */
Signature · 1 line
1.8.1.5
#6 lore raw

PATCH v2 6/7 ARM: shmobile: r8a7790: Add clocks

In reply to Laurent Pinchart

Declare all core clocks and DIV6 clocks, as well as all MSTP clocks currently used by r8a7790 boards.

Cc devicetree at vger.kernel.org
---
 arch/arm/boot/dts/r8a7790-lager-reference.dts |   2 +-
 arch/arm/boot/dts/r8a7790-lager.dts           |   2 +-
 arch/arm/boot/dts/r8a7790.dtsi                | 300 ++++++++++++++++++++++++++
 3 files changed, 302 insertions(+), 2 deletions(-)
arch/arm/boot/dts/r8a7790-lager-reference.dts +1 -1
index ec82674..cce7dbf 100644
@@ -9,7 +9,7 @@
  */
 
 /dts-v1/;
-/include/ "r8a7790.dtsi"
+#include "r8a7790.dtsi"
 #include <dt-bindings/gpio/gpio.h>
 
 / {
arch/arm/boot/dts/r8a7790-lager.dts +1 -1
index 203bd08..8799dfb 100644
@@ -9,7 +9,7 @@
  */
 
 /dts-v1/;
-/include/ "r8a7790.dtsi"
+#include "r8a7790.dtsi"
 
 / {
 	model = "Lager";
arch/arm/boot/dts/r8a7790.dtsi +300 -0

310 lines not on this page · raw message

Signature · 1 line
1.8.1.5
#7 lore raw

PATCH v2 7/7 ARM: shmobile: r8a7790: Reference clocks

In reply to Laurent Pinchart

Reference clocks using a "clocks" property in all nodes corresponding to devices that require a clock.

---
 arch/arm/boot/dts/r8a7790.dtsi | 10 ++++++++++
 1 file changed, 10 insertions(+)
arch/arm/boot/dts/r8a7790.dtsi +10 -0
index 5d8c8c7..098b2d6 100644
@@ -185,6 +185,7 @@
 		reg = <0 0xe6508000 0 0x40>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 287 0x4>;
+		clocks = <&mstp3_clks R8A7790_CLK_I2C0>;
 		status = "disabled";
 	};
 
@@ -195,6 +196,7 @@
 		reg = <0 0xe6518000 0 0x40>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 288 0x4>;
+		clocks = <&mstp3_clks R8A7790_CLK_I2C1>;
 		status = "disabled";
 	};
 
@@ -205,6 +207,7 @@
 		reg = <0 0xe6530000 0 0x40>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 286 0x4>;
+		clocks = <&mstp3_clks R8A7790_CLK_I2C2>;
 		status = "disabled";
 	};
 
@@ -215,6 +218,7 @@
 		reg = <0 0xe6540000 0 0x40>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 290 0x4>;
+		clocks = <&mstp3_clks R8A7790_CLK_I2C3>;
 		status = "disabled";
 	};
 
@@ -223,6 +227,7 @@
 		reg = <0 0xee200000 0 0x80>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 169 0x4>;
+		clocks = <&mstp3_clks R8A7790_CLK_MMCIF0>;
 		reg-io-width = <4>;
 		status = "disabled";
 	};
@@ -232,6 +237,7 @@
 		reg = <0 0xee220000 0 0x80>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 170 0x4>;
+		clocks = <&mstp3_clks R8A7790_CLK_MMCIF1>;
 		reg-io-width = <4>;
 		status = "disabled";
 	};
@@ -246,6 +252,7 @@
 		reg = <0 0xee100000 0 0x100>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 165 4>;
+		clocks = <&mstp3_clks R8A7790_CLK_SDHI0>;
 		cap-sd-highspeed;
 		status = "disabled";
 	};
@@ -255,6 +262,7 @@
 		reg = <0 0xee120000 0 0x100>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 166 4>;
+		clocks = <&mstp3_clks R8A7790_CLK_SDHI1>;
 		cap-sd-highspeed;
 		status = "disabled";
 	};
@@ -264,6 +272,7 @@
 		reg = <0 0xee140000 0 0x100>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 167 4>;
+		clocks = <&mstp3_clks R8A7790_CLK_SDHI2>;
 		cap-sd-highspeed;
 		status = "disabled";
 	};
@@ -273,6 +282,7 @@
 		reg = <0 0xee160000 0 0x100>;
 		interrupt-parent = <&gic>;
 		interrupts = <0 168 4>;
+		clocks = <&mstp3_clks R8A7790_CLK_SDHI3>;
 		cap-sd-highspeed;
 		status = "disabled";
 	};
Signature · 1 line
1.8.1.5
maintainer
#8 lore raw

v2 cover Renesas R8A7790 Common Clock Framework support

In reply to Laurent Pinchart

Hi Laurent,

Thanks for V2, it is looking better and better. Great that r8a7791 and r8a7790 can share the CPG code. I have now finally got my r8a7791 board replaced so I intend to try your code out on Lager and then see if I can cook something up on Koelsch.

I have one question related to the CPG. What is your plan regarding CPU Frequency scaling? I'd like to see "z_clk" and "z2_clk" implemented together with some way to let CPUFreq scale "z_clk". Can you please spend some time on that?

Cheers,

/ magnus

Quoted 72 lines · Laurent Pinchart

Hello,

This is the second version of the CCF clock drivers for the Renesas R-Car R8A7790 (H2) SoC.

The patches are pretty self-explanatory and described in their respective commit message. The R8A7790 datasheet is unfortunately not publicly available.

The code is available in my git tree at

git://linuxtv.org/pinchartl/fbdev.git clocks/ccf/r8a7790

The branch is based on a merge of renesas-devel-v3.12-rc7-20131101, v3.12, and clk-prepare patches I've posted earlier on the list (see "[PATCH 00/12] Prepare various SH/R Mobile/Car drivers for CCF migration").

Changes compared to v1:

- The core CPG clocks driver now supports the r8a7791 SoC in addition to the r8a7790. They are collectively refered to as 'R-Car Gen2'. The driver has thus been renamed to clk-rcar-gen2.c. The DT bindings have been updated accordingly.

- Several MSTP clocks have been added to the r8a7790-clock.h header and a new header has been added for the r8a7791

- The r8a7790 dtsi patches that add and reference clocks have been added to this series.

Cc devicetree at vger.kernel.org

Laurent Pinchart (7):
clk: shmobile: Add R-Car Gen2 clocks support
clk: shmobile: Add DIV6 clock support
clk: shmobile: Add MSTP clock support
ARM: shmobile: r8a7790: Add clock index macros for DT sources
ARM: shmobile: r8a7791: Add clock index macros for DT sources
ARM: shmobile: r8a7790: Add clocks
ARM: shmobile: r8a7790: Reference clocks

 .../bindings/clock/renesas,cpg-div6-clocks.txt     |  27 ++
 .../bindings/clock/renesas,cpg-mstp-clocks.txt     |  47 ++++
 .../clock/renesas,rcar-gen2-cpg-clocks.txt         |  32 +++
 arch/arm/boot/dts/r8a7790-lager-reference.dts      |   2 +-
 arch/arm/boot/dts/r8a7790-lager.dts                |   2 +-
 arch/arm/boot/dts/r8a7790.dtsi                     | 310 +++++++++++++++++++++
 drivers/clk/shmobile/Makefile                      |   7 +-
 drivers/clk/shmobile/clk-div6.c                    | 185 ++++++++++++
 drivers/clk/shmobile/clk-mstp.c                    | 229 +++++++++++++++
 drivers/clk/shmobile/clk-rcar-gen2.c               | 187 +++++++++++++
 include/dt-bindings/clock/r8a7790-clock.h          |  99 +++++++
 include/dt-bindings/clock/r8a7791-clock.h          | 104 +++++++
 include/linux/clk/shmobile.h                       |  19 ++
 13 files changed, 1247 insertions(+), 3 deletions(-)
 create mode 100644 Documentation/devicetree/bindings/clock/renesas,cpg-div6-clocks.txt
 create mode 100644 Documentation/devicetree/bindings/clock/renesas,cpg-mstp-clocks.txt
 create mode 100644 Documentation/devicetree/bindings/clock/renesas,rcar-gen2-cpg-clocks.txt
 create mode 100644 drivers/clk/shmobile/clk-div6.c
 create mode 100644 drivers/clk/shmobile/clk-mstp.c
 create mode 100644 drivers/clk/shmobile/clk-rcar-gen2.c
 create mode 100644 include/dt-bindings/clock/r8a7790-clock.h
 create mode 100644 include/dt-bindings/clock/r8a7791-clock.h
 create mode 100644 include/linux/clk/shmobile.h

--
Regards,

Laurent Pinchart

--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in the body of a message to majordomo at vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html

#9 lore raw

v2 cover Renesas R8A7790 Common Clock Framework support

Hi Magnus,

Quoted 6 lines · On Thursday 14 November 2013 19:16:05 Magnus Damm wrote:

Hi Laurent,

Thanks for V2, it is looking better and better. Great that r8a7791 and r8a7790 can share the CPG code. I have now finally got my r8a7791 board replaced so I intend to try your code out on Lager and then see if I can cook something up on Koelsch.

I was actually planning to test the code on the Koelsch board. I don't want to step on anyone's toes, so please let me know if someone is already working on CCF patches for M2, otherwise I'll send them.

Quoted 4 lines

I have one question related to the CPG. What is your plan regarding CPU Frequency scaling? I'd like to see "z_clk" and "z2_clk" implemented together with some way to let CPUFreq scale "z_clk". Can you please spend some time on that?

Z2 is a fixed factor clock, I'll just add it to DT.

Z is a bit more tricky. It's the output of a pure multiplier (PLL0) followed by a pure divisor (SYS-CPU divider 1). I can easily model the two as separate clock devices, but I'm unsure about what should be done at runtime when setting the Z clock frequency. Would it be enough to have a fixed PLL0 frequency and configure the SYS-CPU divider 1 only (from 1/1 to 1/32), or would we need to configure the PLL0 multiplier as well for a more fine-grained Z frequency configuration ?

Signature · 3 lines
Regards,

Laurent Pinchart