Skip to contentSkip to conversation

ARM: shmobile: r8a7779, marzen: CCF and multiplatform

PATCH New Simon Horman 3 participants 25 messages May 15, 2014 – May 16, 2014

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

v6 cover ARM: shmobile: r8a7779, marzen: CCF and multiplatform

The aim of this series is to add common clock framework and in turn multiplatform support to the r8a7779 SoC and marzen-reference. It subsequently removes non-multiplatform support from marzen-reference.

This is based on work for R-Car Gen2 by Laurent Pinchart and Magnus Damm.

This series is a minor update to v5 to take into account:
* An Ack
* Request for caching of the pin mode
* Patches that have been queued up for v3.16

I intend to merge this series unless there are objections.

Applied on top of a merge of:
* The renesas-devel-v3.15-rc1-20140515 tag of my renesas tree.
* The clk-next branch of Mike Turquettes's tree
This is to provide the following which were previously part of this series:
- clk: shmobile: r8a7779: Add MSTP clock support
- clk: shmobile: r8a7779: Add clocks support

Caveats:

* SMSC_PHY is known not to work with marzen though the reason for this is not known. As this is selected in the shmobile_defconfig it should be manually disabled before compiling that configuration for use on Marzen.

Simon Horman (17):
ARM: shmobile: r8a7779: Add clock index macros for DT sources
ARM: shmobile: r8a7779: Add clocks
ARM: shmobile: Sync Marzen DTS with Marzen reference DTS
ARM: shmobile: marzen: Specify external clock frequency in DT
ARM: shmobile: r8a7779: Reference clocks
ARM: shmobile: r8a7779: Add helper to read mode pins
ARM: shmobile: r8a7779: Move r8a7779_earlytimer_init to

    clock-r8a7779.c

ARM: shmobile: marzen-reference: Move clock and OF device
initialisation into board code
ARM: shmobile: r8a7779: Do not include sh_clk.h in r8a7779.h
ARM: shmobile: r8a7779: Initial multiplatform support
ARM: shmobile: marzen-reference: Initialize CPG device
ARM: shmobile: marzen-reference: Instantiate clkdevs for SCIF and TMU
ARM: shmobile: marzen: Add to shmobile defconfig
ARM: shmobile: Remove non-multiplatform Marzen reference support
ARM: shmobile: Let Marzen multiplatform boot with Marzen DTB
ARM: shmobile: Remove Marzen reference DTS
ARM: shmobile: marzen-reference: Remove legacy clock support

 arch/arm/boot/dts/Makefile                      |   4 +-
 arch/arm/boot/dts/r8a7779-marzen-reference.dts  | 121 ------------------
 arch/arm/boot/dts/r8a7779-marzen.dts            |  98 +++++++++++++++
 arch/arm/boot/dts/r8a7779.dtsi                  | 156 ++++++++++++++++++++++++
 arch/arm/configs/shmobile_defconfig             |   2 +
 arch/arm/mach-shmobile/Kconfig                  |  23 ++--
 arch/arm/mach-shmobile/Makefile                 |   2 +-
 arch/arm/mach-shmobile/Makefile.boot            |   1 -
 arch/arm/mach-shmobile/board-marzen-reference.c |  28 +++++
 arch/arm/mach-shmobile/clock-r8a7779.c          |  22 ++--
 arch/arm/mach-shmobile/include/mach/r8a7779.h   |   2 +-
 arch/arm/mach-shmobile/setup-r8a7779.c          |  32 ++---
 include/dt-bindings/clock/r8a7779-clock.h       |  64 ++++++++++
 13 files changed, 393 insertions(+), 162 deletions(-)
 delete mode 100644 arch/arm/boot/dts/r8a7779-marzen-reference.dts
 create mode 100644 include/dt-bindings/clock/r8a7779-clock.h
Signature · 1 line
1.8.5.2
#1 lore raw

PATCH v6 1/17 ARM: shmobile: r8a7779: Add clock index macros for DT sources

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

Based on work for the r8a7791 SoC by Laurent Pinchart.

---
v5
* No Change

v4
* Add R8A7779_CLK_B

v3
* As suggested by Laurent Pinchart
- Consolidate R8A7779_CLK_HSPI{0,1,2} into R8A7779_CLK_HSPI
- Correct inverted indexes of R8A7779_CLK_TMU{1,2}
- Consolidate R8A7779_CLK_{E,O}HCI{0,1} into R8A7779_CLK_USB{0,1}
- Add ethernet, MMC and HSCIF entries
- Replace R8A7779_SCIF6 with R8A7779_CLK_SCIF5

* Add R8A7779_CLK_PCIE

v2
* No change

---
 include/dt-bindings/clock/r8a7779-clock.h | 64 +++++++++++++++++++++++++++++++
 1 file changed, 64 insertions(+)
 create mode 100644 include/dt-bindings/clock/r8a7779-clock.h
include/dt-bindings/clock/r8a7779-clock.h new file +64 -0
new file mode 100644
index 0000000..381a611
@@ -0,0 +1,64 @@
+/*
+ * Copyright (C) 2013  Horms Solutions Ltd.
+ *
+ * Contact: Simon Horman <[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 __DT_BINDINGS_CLOCK_R8A7779_H__
+#define __DT_BINDINGS_CLOCK_R8A7779_H__
+
+/* CPG */
+#define R8A7779_CLK_PLLA	0
+#define R8A7779_CLK_Z		1
+#define R8A7779_CLK_ZS		2
+#define R8A7779_CLK_S		3
+#define R8A7779_CLK_S1		4
+#define R8A7779_CLK_P		5
+#define R8A7779_CLK_B		6
+#define R8A7779_CLK_OUT		7
+
+/* MSTP 0 */
+#define R8A7779_CLK_HSPI	7
+#define R8A7779_CLK_TMU2	14
+#define R8A7779_CLK_TMU1	15
+#define R8A7779_CLK_TMU0	16
+#define R8A7779_CLK_HSCIF1	18
+#define R8A7779_CLK_HSCIF0	19
+#define R8A7779_CLK_SCIF5	21
+#define R8A7779_CLK_SCIF4	22
+#define R8A7779_CLK_SCIF3	23
+#define R8A7779_CLK_SCIF2	24
+#define R8A7779_CLK_SCIF1	25
+#define R8A7779_CLK_SCIF0	26
+#define R8A7779_CLK_I2C3	27
+#define R8A7779_CLK_I2C2	28
+#define R8A7779_CLK_I2C1	29
+#define R8A7779_CLK_I2C0	30
+
+/* MSTP 1 */
+#define R8A7779_CLK_USB01	0
+#define R8A7779_CLK_USB2	1
+#define R8A7779_CLK_DU		3
+#define R8A7779_CLK_VIN2	8
+#define R8A7779_CLK_VIN1	9
+#define R8A7779_CLK_VIN0	10
+#define R8A7779_CLK_ETHER	14
+#define R8A7779_CLK_SATA	15
+#define R8A7779_CLK_PCIE	16
+#define R8A7779_CLK_VIN3	20
+
+/* MSTP 3 */
+#define R8A7779_CLK_SDHI3	20
+#define R8A7779_CLK_SDHI2	21
+#define R8A7779_CLK_SDHI1	22
+#define R8A7779_CLK_SDHI0	23
+#define R8A7779_CLK_MMC1	30
+#define R8A7779_CLK_MMC0	31
+
+
+#endif /* __DT_BINDINGS_CLOCK_R8A7779_H__ */
Signature · 1 line
1.8.5.2
#2 lore raw

PATCH v6 2/17 ARM: shmobile: r8a7779: Add clocks

In reply to Simon Horman

Declare all core and MSTP clocks currently used by r8a7779-based boards.

Based on work by Laurent Pinchart for the r8a7790 and r8a7791 SoCs.

Acked-by Laurent Pinchart <laurent.pinchart at ideasonboard.com

---
v6
* Add Ack by Laurent Pinchart

v5
* As suggested by Laurent Pinchart
- Do not add duplicate HSPI or USB clocks
- Add TMU1 and TMU2 clocks instead of duplicate TMU0 clocks

v4
* As suggested by Laurent Pinchart
- Do not duplicate clocks
- Use TMU2 and TMU1 instead of TMU0 three times.
- Correct order of tmu clock output names
- Use usb01 and usb2 as clock output names instead of ehci0 and ehci1.
* As suggested by Geert Uytterhoeven
- Wrap lines at < 80columns
- Beef-up short lines towards 80 columns
* As suggested by Laurent Pinchart
- Add HSCIF clocks
- Correct many clock sources
- Correct reg of cpg_clocks
* Add CPG clock "b" which is now part of the binding

v3
* As suggested by Laurent Pinchart
- Add and use extal_clk
- Fix bogus status register use for MSTP clocks
- Fix bogus mstp3_cls to use its own entries rather than that of mstp1_clks

* Update to use "main" in cpg_clocks as per updated binding in previous patch
* Update for new, consolidated and renamed index macros
- R8A7779_CLK_ETHER
- R8A7779_CLK_HSCIF
- R8A7779_CLK_HSPI
- R8A7779_CLK_MMC0,1
- R8A7779_CLK_PCIE
- R8A7779_CLK_USB01,2

---
 arch/arm/boot/dts/r8a7779.dtsi | 144 +++++++++++++++++++++++++++++++++++++++++
 1 file changed, 144 insertions(+)
arch/arm/boot/dts/r8a7779.dtsi +144 -0
index b517c8e..5a62970 100644
@@ -11,6 +11,7 @@
 
 /include/ "skeleton.dtsi"
 
+#include <dt-bindings/clock/r8a7779-clock.h>
 #include <dt-bindings/interrupt-controller/irq.h>
 
 / {
@@ -265,4 +266,147 @@
 		#size-cells = <0>;
 		status = "disabled";
 	};
+
+	clocks {
+		#address-cells = <2>;
+		#size-cells = <2>;
+		ranges;
+
+		/* External root clock */
+		extal_clk: extal_clk {
+			compatible = "fixed-clock";
+			#clock-cells = <0>;
+			/* This value must be overriden by the board. */
+			clock-frequency = <0>;
+			clock-output-names = "extal";
+		};
+
+		/* Special CPG clocks */
+		cpg_clocks: cpg_clocks at 0xe6150000 {
+			compatible = "renesas,r8a7779-cpg-clocks";
+			reg = <0 0xffc80000 0 0x30>;
+			clocks = <&extal_clk>;
+			#clock-cells = <1>;
+			clock-output-names = "plla", "z", "zs", "s",
+					     "s1", "p", "b", "out";
+		};
+
+		/* Fixed factor clocks */
+		i_clk: i_clk {
+			compatible = "fixed-factor-clock";
+			clocks = <&cpg_clocks R8A7779_CLK_PLLA>;
+			#clock-cells = <0>;
+			clock-div = <2>;
+			clock-mult = <1>;
+			clock-output-names = "i";
+		};
+		s3_clk: s3_clk {
+			compatible = "fixed-factor-clock";
+			clocks = <&cpg_clocks R8A7779_CLK_PLLA>;
+			#clock-cells = <0>;
+			clock-div = <8>;
+			clock-mult = <1>;
+			clock-output-names = "s3";
+		};
+		s4_clk: s4_clk {
+			compatible = "fixed-factor-clock";
+			clocks = <&cpg_clocks R8A7779_CLK_PLLA>;
+			#clock-cells = <0>;
+			clock-div = <16>;
+			clock-mult = <1>;
+			clock-output-names = "s4";
+		};
+		g_clk: g_clk {
+			compatible = "fixed-factor-clock";
+			clocks = <&cpg_clocks R8A7779_CLK_PLLA>;
+			#clock-cells = <0>;
+			clock-div = <24>;
+			clock-mult = <1>;
+			clock-output-names = "g";
+		};
+
+		/* Gate clocks */
+		mstp0_clks: mstp0_clks {
+			compatible = "renesas,r8a7779-mstp-clocks",
+			             "renesas,cpg-mstp-clocks";
+			reg = <0 0xffc80030 0 4>;
+			clocks = <&cpg_clocks R8A7779_CLK_S>,
+			         <&cpg_clocks R8A7779_CLK_P>,
+				 <&cpg_clocks R8A7779_CLK_P>,
+				 <&cpg_clocks R8A7779_CLK_P>,
+				 <&cpg_clocks R8A7779_CLK_S>,
+				 <&cpg_clocks R8A7779_CLK_S>,
+				 <&cpg_clocks R8A7779_CLK_S1>,
+				 <&cpg_clocks R8A7779_CLK_S1>,
+				 <&cpg_clocks R8A7779_CLK_S1>,
+				 <&cpg_clocks R8A7779_CLK_S1>,
+				 <&cpg_clocks R8A7779_CLK_S1>,
+				 <&cpg_clocks R8A7779_CLK_S1>,
+				 <&cpg_clocks R8A7779_CLK_P>,
+				 <&cpg_clocks R8A7779_CLK_P>,
+				 <&cpg_clocks R8A7779_CLK_P>,
+				 <&cpg_clocks R8A7779_CLK_P>;
+			#clock-cells = <1>;
+			renesas,clock-indices = <
+				R8A7779_CLK_HSPI R8A7779_CLK_TMU2
+				R8A7779_CLK_TMU1 R8A7779_CLK_TMU0
+				R8A7779_CLK_HSCIF1 R8A7779_CLK_HSCIF0
+				R8A7779_CLK_SCIF5 R8A7779_CLK_SCIF4
+				R8A7779_CLK_SCIF3 R8A7779_CLK_SCIF2
+				R8A7779_CLK_SCIF1 R8A7779_CLK_SCIF0
+				R8A7779_CLK_I2C3 R8A7779_CLK_I2C2
+				R8A7779_CLK_I2C1 R8A7779_CLK_I2C0
+			>;
+			clock-output-names =
+				"hspi", "tmu2", "tmu1", "tmu0", "hscif1",
+				"hscif0", "scif5", "scif4", "scif3", "scif2",
+				"scif1", "scif0", "i2c3", "i2c2", "i2c1",
+				"i2c0";
+		};
+		mstp1_clks: mstp1_clks {
+			compatible = "renesas,r8a7779-mstp-clocks",
+			             "renesas,cpg-mstp-clocks";
+			reg = <0 0xffc80034 0 4>, <0 0xffc80044 0 4>;
+			clocks = <&cpg_clocks R8A7779_CLK_P>,
+				 <&cpg_clocks R8A7779_CLK_P>,
+				 <&cpg_clocks R8A7779_CLK_S>,
+				 <&cpg_clocks R8A7779_CLK_S>,
+				 <&cpg_clocks R8A7779_CLK_S>,
+				 <&cpg_clocks R8A7779_CLK_S>,
+				 <&cpg_clocks R8A7779_CLK_P>,
+				 <&cpg_clocks R8A7779_CLK_P>,
+				 <&cpg_clocks R8A7779_CLK_P>,
+				 <&cpg_clocks R8A7779_CLK_S>;
+			#clock-cells = <1>;
+			renesas,clock-indices = <
+				R8A7779_CLK_USB01 R8A7779_CLK_USB2
+				R8A7779_CLK_DU R8A7779_CLK_VIN2
+				R8A7779_CLK_VIN1 R8A7779_CLK_VIN0
+				R8A7779_CLK_ETHER R8A7779_CLK_SATA
+				R8A7779_CLK_PCIE R8A7779_CLK_VIN3
+			>;
+			clock-output-names =
+				"usb01", "usb2",
+				"du", "vin2",
+				"vin1", "vin0",
+				"ether", "sata",
+				"pcie", "vin3";
+		};
+		mstp3_clks: mstp3_clks {
+			compatible = "renesas,r8a7779-mstp-clocks",
+			             "renesas,cpg-mstp-clocks";
+			reg = <0 0xffc8003c 0 4>;
+			clocks = <&s4_clk>, <&s4_clk>, <&s4_clk>, <&s4_clk>,
+				 <&s4_clk>, <&s4_clk>;
+			#clock-cells = <1>;
+			renesas,clock-indices = <
+				R8A7779_CLK_SDHI3 R8A7779_CLK_SDHI2
+				R8A7779_CLK_SDHI1 R8A7779_CLK_SDHI0
+				R8A7779_CLK_MMC1 R8A7779_CLK_MMC0
+			>;
+			clock-output-names =
+				"sdhi3", "sdhi2", "sdhi1", "sdhi0",
+				"mmc1", "mmc0";
+		};
+	};
 };
Signature · 1 line
1.8.5.2
#3 lore raw

PATCH v6 3/17 ARM: shmobile: Sync Marzen DTS with Marzen reference DTS

In reply to Simon Horman

Copy the device nodes from Marzen reference into the Marzen device tree file. This will allow us to use a single DTS file regardless of kernel configuration. In case of legacy C board code the device nodes may or may not be used, but in the multiplatform case all the DT device nodes will be used.

Based on a similar change for the Lager board by Laurent Pinchart.

---
v6
* Updated for recent changes to Marzen reference DTS

v4 - v5
* No change

v3
* Updated for recent changes to Marzen reference DTS

---
 arch/arm/boot/dts/r8a7779-marzen.dts | 94 ++++++++++++++++++++++++++++++++++++
 1 file changed, 94 insertions(+)
arch/arm/boot/dts/r8a7779-marzen.dts +94 -0
index a7af2c2..ddf9b9e 100644
@@ -11,6 +11,8 @@
 
 /dts-v1/;
 #include "r8a7779.dtsi"
+#include <dt-bindings/gpio/gpio.h>
+#include <dt-bindings/interrupt-controller/irq.h>
 
 / {
 	model = "marzen";
@@ -24,4 +26,96 @@
 		device_type = "memory";
 		reg = <0x60000000 0x40000000>;
 	};
+
+	fixedregulator3v3: fixedregulator at 0 {
+		compatible = "regulator-fixed";
+		regulator-name = "fixed-3.3V";
+		regulator-min-microvolt = <3300000>;
+		regulator-max-microvolt = <3300000>;
+		regulator-boot-on;
+		regulator-always-on;
+	};
+
+	lan0 at 18000000 {
+		compatible = "smsc,lan9220", "smsc,lan9115";
+		reg = <0x18000000 0x100>;
+		pinctrl-0 = <&lan0_pins>;
+		pinctrl-names = "default";
+
+		phy-mode = "mii";
+		interrupt-parent = <&irqpin0>;
+		interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
+		smsc,irq-push-pull;
+		reg-io-width = <4>;
+		vddvario-supply = <&fixedregulator3v3>;
+		vdd33a-supply = <&fixedregulator3v3>;
+	};
+
+	leds {
+		compatible = "gpio-leds";
+		led2 {
+			gpios = <&gpio4 29 GPIO_ACTIVE_HIGH>;
+		};
+		led3 {
+			gpios = <&gpio4 30 GPIO_ACTIVE_HIGH>;
+		};
+		led4 {
+			gpios = <&gpio4 31 GPIO_ACTIVE_HIGH>;
+		};
+	};
+};
+
+&irqpin0 {
+	status = "okay";
+};
+
+&pfc {
+	pinctrl-0 = <&scif2_pins &scif4_pins>;
+	pinctrl-names = "default";
+
+	lan0_pins: lan0 {
+		intc {
+			renesas,groups = "intc_irq1_b";
+			renesas,function = "intc";
+		};
+		lbsc {
+			renesas,groups = "lbsc_ex_cs0";
+			renesas,function = "lbsc";
+		};
+	};
+
+	scif2_pins: serial2 {
+		renesas,groups = "scif2_data_c";
+		renesas,function = "scif2";
+	};
+
+	scif4_pins: serial4 {
+		renesas,groups = "scif4_data";
+		renesas,function = "scif4";
+	};
+
+	sdhi0_pins: sd0 {
+		renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_cd";
+		renesas,function = "sdhi0";
+	};
+
+	hspi0_pins: hspi0 {
+		renesas,groups = "hspi0";
+		renesas,function = "hspi0";
+	};
+};
+
+&sdhi0 {
+	pinctrl-0 = <&sdhi0_pins>;
+	pinctrl-names = "default";
+
+	vmmc-supply = <&fixedregulator3v3>;
+	bus-width = <4>;
+	status = "okay";
+};
+
+&hspi0 {
+	pinctrl-0 = <&hspi0_pins>;
+	pinctrl-names = "default";
+	status = "okay";
 };
Signature · 1 line
1.8.5.2
#4 lore raw

PATCH v6 4/17 ARM: shmobile: marzen: Specify external clock frequency in DT

In reply to Simon Horman

The external crystal frequency is 31.25 on the Marzen board. Specify it in the device tree.

Based on work for the Lager board by Laurent Pinchart.

---
v4 - v5
* No change

v3
* Update r8a7779-marzen.dts instead of r8a7779-marzen-reference.dts

---
 arch/arm/boot/dts/r8a7779-marzen.dts | 4 ++++
 1 file changed, 4 insertions(+)
arch/arm/boot/dts/r8a7779-marzen.dts +4 -0
index ddf9b9e..363f693 100644
@@ -69,6 +69,10 @@
 	status = "okay";
 };
 
+&extal_clk {
+	clock-frequency = <31250000>;
+};
+
 &pfc {
 	pinctrl-0 = <&scif2_pins &scif4_pins>;
 	pinctrl-names = "default";
Signature · 1 line
1.8.5.2
#5 lore raw

PATCH v6 5/17 ARM: shmobile: r8a7779: Reference clocks

In reply to Simon Horman

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

Based on work by Laurent Pinchart for the r8a7790 and r8a7791 SoC.

---
v4 - v5
* No change

v3
* Also update the following nodes which are now present
- hspi{0,1,2}
- sata: Suggested by Laurent Pinchart

---
 arch/arm/boot/dts/r8a7779.dtsi | 12 ++++++++++++
 1 file changed, 12 insertions(+)
arch/arm/boot/dts/r8a7779.dtsi +12 -0
index 5a62970..bdaaadc 100644
@@ -158,6 +158,7 @@
 		compatible = "renesas,i2c-r8a7779";
 		reg = <0xffc70000 0x1000>;
 		interrupts = <0 79 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&mstp0_clks R8A7779_CLK_I2C0>;
 		status = "disabled";
 	};
 
@@ -167,6 +168,7 @@
 		compatible = "renesas,i2c-r8a7779";
 		reg = <0xffc71000 0x1000>;
 		interrupts = <0 82 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&mstp0_clks R8A7779_CLK_I2C1>;
 		status = "disabled";
 	};
 
@@ -176,6 +178,7 @@
 		compatible = "renesas,i2c-r8a7779";
 		reg = <0xffc72000 0x1000>;
 		interrupts = <0 80 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&mstp0_clks R8A7779_CLK_I2C2>;
 		status = "disabled";
 	};
 
@@ -185,6 +188,7 @@
 		compatible = "renesas,i2c-r8a7779";
 		reg = <0xffc73000 0x1000>;
 		interrupts = <0 81 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&mstp0_clks R8A7779_CLK_I2C3>;
 		status = "disabled";
 	};
 
@@ -202,12 +206,14 @@
 		compatible = "renesas,rcar-sata";
 		reg = <0xfc600000 0x2000>;
 		interrupts = <0 100 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&mstp1_clks R8A7779_CLK_SATA>;
 	};
 
 	sdhi0: sd at ffe4c000 {
 		compatible = "renesas,sdhi-r8a7779";
 		reg = <0xffe4c000 0x100>;
 		interrupts = <0 104 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&mstp3_clks R8A7779_CLK_SDHI0>;
 		cap-sd-highspeed;
 		cap-sdio-irq;
 		status = "disabled";
@@ -217,6 +223,7 @@
 		compatible = "renesas,sdhi-r8a7779";
 		reg = <0xffe4d000 0x100>;
 		interrupts = <0 105 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&mstp3_clks R8A7779_CLK_SDHI1>;
 		cap-sd-highspeed;
 		cap-sdio-irq;
 		status = "disabled";
@@ -226,6 +233,7 @@
 		compatible = "renesas,sdhi-r8a7779";
 		reg = <0xffe4e000 0x100>;
 		interrupts = <0 107 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&mstp3_clks R8A7779_CLK_SDHI2>;
 		cap-sd-highspeed;
 		cap-sdio-irq;
 		status = "disabled";
@@ -235,6 +243,7 @@
 		compatible = "renesas,sdhi-r8a7779";
 		reg = <0xffe4f000 0x100>;
 		interrupts = <0 106 IRQ_TYPE_LEVEL_HIGH>;
+		clocks = <&mstp3_clks R8A7779_CLK_SDHI3>;
 		cap-sd-highspeed;
 		cap-sdio-irq;
 		status = "disabled";
@@ -246,6 +255,7 @@
 		interrupts = <0 73 IRQ_TYPE_LEVEL_HIGH>;
 		#address-cells = <1>;
 		#size-cells = <0>;
+		clocks = <&mstp0_clks R8A7779_CLK_HSPI>;
 		status = "disabled";
 	};
 
@@ -255,6 +265,7 @@
 		interrupts = <0 74 IRQ_TYPE_LEVEL_HIGH>;
 		#address-cells = <1>;
 		#size-cells = <0>;
+		clocks = <&mstp0_clks R8A7779_CLK_HSPI>;
 		status = "disabled";
 	};
 
@@ -264,6 +275,7 @@
 		interrupts = <0 75 IRQ_TYPE_LEVEL_HIGH>;
 		#address-cells = <1>;
 		#size-cells = <0>;
+		clocks = <&mstp0_clks R8A7779_CLK_HSPI>;
 		status = "disabled";
 	};
 
Signature · 1 line
1.8.5.2
#6 lore raw

PATCH v6 6/17 ARM: shmobile: r8a7779: Add helper to read mode pins

In reply to Simon Horman

Add and use helper to read mode pins.
This will be re-used when moving marzen-reference to the common clock framework.

---

There seems to be some scope to share this code with similar code in setup-rcar-gen2.c

v6
* As suggested by Geert Uytterhoeven
- Cache result

v2 - v5
* No change

---
 arch/arm/mach-shmobile/clock-r8a7779.c        | 11 ++---------
 arch/arm/mach-shmobile/include/mach/r8a7779.h |  1 +
 arch/arm/mach-shmobile/setup-r8a7779.c        | 18 ++++++++++++++++++
 3 files changed, 21 insertions(+), 9 deletions(-)
arch/arm/mach-shmobile/clock-r8a7779.c +2 -9
index a13298b..e9d3348 100644
@@ -25,6 +25,7 @@
 #include <linux/clkdev.h>
 #include <mach/clock.h>
 #include <mach/common.h>
+#include <mach/r8a7779.h>
 
 /*
  *		MD1 = 1			MD1 = 0
@@ -52,9 +53,6 @@
 #define MSTPCR3		IOMEM(0xffc8003c)
 #define MSTPSR1		IOMEM(0xffc80044)
 
-#define MODEMR		0xffcc0020
-
-
 /* ioremap() through clock mapping mandatory to avoid
  * collision with ARM coherent DMA virtual memory range.
  */
@@ -207,14 +205,9 @@ static struct clk_lookup lookups[] = {
 
 void __init r8a7779_clock_init(void)
 {
-	void __iomem *modemr = ioremap_nocache(MODEMR, PAGE_SIZE);
-	u32 mode;
+	u32 mode = r8a7779_read_mode_pins();
 	int k, ret = 0;
 
-	BUG_ON(!modemr);
-	mode = ioread32(modemr);
-	iounmap(modemr);
-
 	if (mode & MD(1)) {
 		plla_clk.rate = 1500000000;
 
arch/arm/mach-shmobile/include/mach/r8a7779.h +1 -0
index 88eecea..d5ba2d8 100644
@@ -32,6 +32,7 @@ extern void r8a7779_add_early_devices(void);
 extern void r8a7779_add_standard_devices(void);
 extern void r8a7779_add_standard_devices_dt(void);
 extern void r8a7779_init_late(void);
+extern u32 r8a7779_read_mode_pins(void);
 extern void r8a7779_clock_init(void);
 extern void r8a7779_pinmux_init(void);
 extern void r8a7779_pm_init(void);
arch/arm/mach-shmobile/setup-r8a7779.c +18 -0
index d197b5a..6d091bd 100644
@@ -762,6 +762,24 @@ void __init r8a7779_add_standard_devices_dt(void)
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
 
+#define MODEMR		0xffcc0020
+
+u32 __init r8a7779_read_mode_pins(void)
+{
+	static u32 mode;
+	static bool mode_valid;
+
+	if (!mode_valid) {
+		void __iomem *modemr = ioremap_nocache(MODEMR, PAGE_SIZE);
+		BUG_ON(!modemr);
+		mode = ioread32(modemr);
+		iounmap(modemr);
+		mode_valid = true;
+	}
+
+	return mode;
+}
+
 static const char *r8a7779_compat_dt[] __initdata = {
 	"renesas,r8a7779",
 	NULL,
Signature · 1 line
1.8.5.2
#7 lore raw

PATCH v6 7/17 ARM: shmobile: r8a7779: Move r8a7779_earlytimer_init to clock-r8a7779.c

In reply to Simon Horman

r8a7779_earlytimer_init() calls r8a7779_clock_init() and r8a7779_clock_init() is defined in clock-r8a7779.c.

If both CONFIG_COMMON_CLK and CONFIG_ARCH_R8A7779 are enabled, as will be the case when marzen-reference moves to use the common clock framework, then setup-r8a7779.c is compiled but clock-r8a7779.c is not.

As r8a7779_earlytimer_init() is not used by marzen-reference simply move it to clock-r8a7779.c.

---
 arch/arm/mach-shmobile/clock-r8a7779.c | 11 +++++++++++
 arch/arm/mach-shmobile/setup-r8a7779.c | 10 ----------
 2 files changed, 11 insertions(+), 10 deletions(-)
arch/arm/mach-shmobile/clock-r8a7779.c +11 -0
index e9d3348..4c8add9 100644
@@ -23,6 +23,7 @@
 #include <linux/io.h>
 #include <linux/sh_clk.h>
 #include <linux/clkdev.h>
+#include <linux/sh_timer.h>
 #include <mach/clock.h>
 #include <mach/common.h>
 #include <mach/r8a7779.h>
@@ -261,3 +262,13 @@ void __init r8a7779_clock_init(void)
 	else
 		panic("failed to setup r8a7779 clocks\n");
 }
+
+/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
+void __init __weak r8a7779_register_twd(void) { }
+
+void __init r8a7779_earlytimer_init(void)
+{
+	r8a7779_clock_init();
+	r8a7779_register_twd();
+	shmobile_earlytimer_init();
+}
arch/arm/mach-shmobile/setup-r8a7779.c +0 -10
index 6d091bd..6c1aef0 100644
@@ -674,16 +674,6 @@ void __init r8a7779_add_standard_devices(void)
 	r8a7779_register_hpb_dmae();
 }
 
-/* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
-void __init __weak r8a7779_register_twd(void) { }
-
-void __init r8a7779_earlytimer_init(void)
-{
-	r8a7779_clock_init();
-	r8a7779_register_twd();
-	shmobile_earlytimer_init();
-}
-
 void __init r8a7779_add_early_devices(void)
 {
 	early_platform_add_devices(r8a7779_devices_dt,
Signature · 1 line
1.8.5.2
#8 lore raw

PATCH v6 8/17 ARM: shmobile: marzen-reference: Move clock and OF device initialisation into board code

In reply to Simon Horman

Move the clock initialisation and OF device population from SoC to board code. This is in keeping with the pattern used by Lager. And the clock portion is part of decoupling clock initialisation from SoC code in preparation for moving to the common clock framework.

---
 arch/arm/mach-shmobile/board-marzen-reference.c | 3 +++
 arch/arm/mach-shmobile/setup-r8a7779.c          | 4 ----
 2 files changed, 3 insertions(+), 4 deletions(-)
arch/arm/mach-shmobile/board-marzen-reference.c +3 -0
index 2773936..c22e5c2 100644
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <linux/of_platform.h>
 #include <mach/r8a7779.h>
 #include <mach/common.h>
 #include <mach/irqs.h>
@@ -27,7 +28,9 @@
 
 static void __init marzen_init(void)
 {
+	r8a7779_clock_init();
 	r8a7779_add_standard_devices_dt();
+	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 	r8a7779_init_irq_extpin_dt(1); /* IRQ1 as individual interrupt */
 }
 
arch/arm/mach-shmobile/setup-r8a7779.c +0 -4
index 6c1aef0..c0e61d5 100644
@@ -744,12 +744,8 @@ void __init r8a7779_init_delay(void)
 
 void __init r8a7779_add_standard_devices_dt(void)
 {
-	/* clocks are setup late during boot in the case of DT */
-	r8a7779_clock_init();
-
 	platform_add_devices(r8a7779_devices_dt,
 			     ARRAY_SIZE(r8a7779_devices_dt));
-	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
 
 #define MODEMR		0xffcc0020
Signature · 1 line
1.8.5.2
#9 lore raw

PATCH v6 9/17 ARM: shmobile: r8a7779: Do not include sh_clk.h in r8a7779.h

In reply to Simon Horman

Do not include sh_clk.h in r8a7779.h as it is not necessary.

---
 arch/arm/mach-shmobile/include/mach/r8a7779.h | 1 -
 1 file changed, 1 deletion(-)
arch/arm/mach-shmobile/include/mach/r8a7779.h +0 -1
index d5ba2d8..757b903 100644
@@ -1,7 +1,6 @@
 #ifndef __ASM_R8A7779_H__
 #define __ASM_R8A7779_H__
 
-#include <linux/sh_clk.h>
 #include <linux/pm_domain.h>
 #include <mach/pm-rcar.h>
 
Signature · 1 line
1.8.5.2
#10 lore raw

PATCH v6 10/17 ARM: shmobile: r8a7779: Initial multiplatform support

In reply to Simon Horman

Add Marzen and r8a7779 to CONFIG_SHMOBILE_MULTI. At this point CCF is not yet supported so you cannot run this code yet. For CCF support to happen several different components are needed, and this is one simple portion that moves us forward. Other patches need to build on top of this one.

Marzen board support exists in 3 flavours:
1) SHMOBILE_MULTI, MACH_MARZEN - board-marzen-reference.c (CCF + DT)
2) SHMOBILE, MACH_MARZEN_REFERENCE - board-marzen-reference.c (DT)
3) SHMOBILE, MACH_MARZEN - board-marzen.c (legacy C code)

When CCF is done then 2) will be removed. When 1) includes same features as 3) then 3) will be removed.

Based on work for the Koelsch and r8a7791 by Magnus Damm.

---
v5
* Select SYS_SUPPORTS_SH_TMU

v4
* No change

v3
* Select RENESAS_INTC_IRQPIN

fix ARCH_R8A7779

---
 arch/arm/boot/dts/Makefile                      |  3 ++-
 arch/arm/mach-shmobile/Kconfig                  | 10 ++++++++++
 arch/arm/mach-shmobile/Makefile                 |  1 +
 arch/arm/mach-shmobile/board-marzen-reference.c |  5 +++++
 4 files changed, 18 insertions(+), 1 deletion(-)
arch/arm/boot/dts/Makefile +2 -1
index fbebf73..4694dcb 100644
@@ -316,7 +316,8 @@ dtb-$(CONFIG_ARCH_SHMOBILE_MULTI) += emev2-kzm9d.dtb \
 	r7s72100-genmai-reference.dtb \
 	r8a7791-henninger.dtb \
 	r8a7791-koelsch.dtb \
-	r8a7790-lager.dtb
+	r8a7790-lager.dtb \
+	r8a7779-marzen-reference.dtb
 dtb-$(CONFIG_ARCH_SOCFPGA) += socfpga_arria5_socdk.dtb \
 	socfpga_cyclone5_socdk.dtb \
 	socfpga_cyclone5_sockit.dtb \
arch/arm/mach-shmobile/Kconfig +10 -0
index 037c006..28d7e86 100644
@@ -26,6 +26,11 @@ config ARCH_R7S72100
 	bool "RZ/A1H (R7S72100)"
 	select SYS_SUPPORTS_SH_MTU2
 
+config ARCH_R8A7779
+	bool "R-Car H1 (R8A77790)"
+	select RENESAS_INTC_IRQPIN
+	select SYS_SUPPORTS_SH_TMU
+
 config ARCH_R8A7790
 	bool "R-Car H2 (R8A77900)"
 	select RENESAS_IRQC
@@ -52,6 +57,11 @@ config MACH_LAGER
 	depends on ARCH_R8A7790
 	select MICREL_PHY if SH_ETH
 
+config MACH_MARZEN
+	bool "MARZEN board"
+	depends on ARCH_R8A7779
+	select REGULATOR_FIXED_VOLTAGE if REGULATOR
+
 comment "Renesas ARM SoCs System Configuration"
 endif
 
arch/arm/mach-shmobile/Makefile +1 -0
index 9c5cd8c..ed49315 100644
@@ -59,6 +59,7 @@ ifdef CONFIG_ARCH_SHMOBILE_MULTI
 obj-$(CONFIG_MACH_GENMAI)	+= board-genmai-reference.o
 obj-$(CONFIG_MACH_KOELSCH)	+= board-koelsch-reference.o
 obj-$(CONFIG_MACH_LAGER)	+= board-lager-reference.o
+obj-$(CONFIG_MACH_MARZEN)	+= board-marzen-reference.o
 else
 obj-$(CONFIG_MACH_APE6EVM)	+= board-ape6evm.o
 obj-$(CONFIG_MACH_APE6EVM_REFERENCE)	+= board-ape6evm-reference.o
arch/arm/mach-shmobile/board-marzen-reference.c +5 -0
index c22e5c2..d3e8319 100644
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <linux/clk-provider.h>
 #include <linux/of_platform.h>
 #include <mach/r8a7779.h>
 #include <mach/common.h>
@@ -28,7 +29,11 @@
 
 static void __init marzen_init(void)
 {
+#ifdef CONFIG_COMMON_CLK
+	of_clk_init(NULL);
+#else
 	r8a7779_clock_init();
+#endif
 	r8a7779_add_standard_devices_dt();
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 	r8a7779_init_irq_extpin_dt(1); /* IRQ1 as individual interrupt */
Signature · 1 line
1.8.5.2
#11 lore raw

PATCH v6 11/17 ARM: shmobile: marzen-reference: Initialize CPG device

In reply to Simon Horman

On multiplatform kernels clocks are handled by the CCF CPG driver. It must be explicitly initialized by a call to r8a7779_clocks_init() with the value of the boot mode pins.

Based on similar work for the Koelsch board by Laurent Pinchart.

---
 arch/arm/mach-shmobile/board-marzen-reference.c | 16 ++++++++++++----
 1 file changed, 12 insertions(+), 4 deletions(-)
arch/arm/mach-shmobile/board-marzen-reference.c +12 -4
index d3e8319..e261431 100644
@@ -19,7 +19,8 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-#include <linux/clk-provider.h>
+#include <linux/clk/shmobile.h>
+#include <linux/clocksource.h>
 #include <linux/of_platform.h>
 #include <mach/r8a7779.h>
 #include <mach/common.h>
@@ -27,11 +28,17 @@
 #include <asm/irq.h>
 #include <asm/mach/arch.h>
 
-static void __init marzen_init(void)
+static void __init marzen_init_timer(void)
 {
 #ifdef CONFIG_COMMON_CLK
-	of_clk_init(NULL);
-#else
+	r8a7779_clocks_init(r8a7779_read_mode_pins());
+#endif
+	clocksource_of_init();
+}
+
+static void __init marzen_init(void)
+{
+#ifndef CONFIG_COMMON_CLK
 	r8a7779_clock_init();
 #endif
 	r8a7779_add_standard_devices_dt();
@@ -48,6 +55,7 @@ DT_MACHINE_START(MARZEN, "marzen")
 	.smp		= smp_ops(r8a7779_smp_ops),
 	.map_io		= r8a7779_map_io,
 	.init_early	= r8a7779_init_delay,
+	.init_time	= marzen_init_timer,
 	.nr_irqs	= NR_IRQS_LEGACY,
 	.init_irq	= r8a7779_init_irq_dt,
 	.init_machine	= marzen_init,
Signature · 1 line
1.8.5.2
#12 lore raw

PATCH v6 12/17 ARM: shmobile: marzen-reference: Instantiate clkdevs for SCIF and TMU

In reply to Simon Horman

Now that the common clock framework is supported, the clock lookup entries in clock-r8a7779.c are not registered anymore. Devices must instead reference their clocks in the device tree. However, SCIF and CMT devices are still instantiated through platform code, and thus need a clock lookup entry.

Retrieve the SCIF and CMT clock entries by name and register clkdevs for the corresponding devices. This will be removed when the SCIF and CMT devices will be instantiated from the device tree.

Based on work for the Koelsch board by Laurent Pinchart.

Cc Laurent Pinchart <[email protected]>

---
v6
* Update for "ARM: shmobile: r8a7778: Switch to new style TMU device"

v5
* No change

v4
* As suggested by Geert Uytterhoeven and Magnus Damm
- Make use of shmobile_clk_workaround()
- This patch now depends on
"ARM: shmobile: Introduce shmobile_clk_workaround()"

v3
* Initialise TMU clocks instead of CMT clocks
- It is TMU that Marzen uses as a clocksource
* Refactor clock initialisation hack as per more recent mainline code for Koelsch
* Use IS_ERR to check the return value of clk_get()

---
 arch/arm/mach-shmobile/board-marzen-reference.c | 21 ++++++++++++++++++++-
 1 file changed, 20 insertions(+), 1 deletion(-)
arch/arm/mach-shmobile/board-marzen-reference.c +20 -1
index e261431..d09e850 100644
@@ -23,6 +23,7 @@
 #include <linux/clocksource.h>
 #include <linux/of_platform.h>
 #include <mach/r8a7779.h>
+#include <mach/clock.h>
 #include <mach/common.h>
 #include <mach/irqs.h>
 #include <asm/irq.h>
@@ -36,9 +37,27 @@ static void __init marzen_init_timer(void)
 	clocksource_of_init();
 }
 
+#ifdef CONFIG_COMMON_CLK
+/*
+ * This is a really crude hack to provide clkdev support to platform
+ * devices until they get moved to DT.
+ */
+static const struct clk_name clk_names[] __initconst = {
+	{ "scif0", NULL, "sh-sci.0" },
+	{ "scif1", NULL, "sh-sci.1" },
+	{ "scif2", NULL, "sh-sci.2" },
+	{ "scif3", NULL, "sh-sci.3" },
+	{ "scif4", NULL, "sh-sci.4" },
+	{ "scif5", NULL, "sh-sci.5" },
+	{ "tmu0", "fck", "sh-tmu.0" },
+};
+#endif
+
 static void __init marzen_init(void)
 {
-#ifndef CONFIG_COMMON_CLK
+#ifdef CONFIG_COMMON_CLK
+	shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
+#else
 	r8a7779_clock_init();
 #endif
 	r8a7779_add_standard_devices_dt();
Signature · 1 line
1.8.5.2
#13 lore raw

PATCH v6 13/17 ARM: shmobile: marzen: Add to shmobile defconfig

In reply to Simon Horman

Add marzen to shmobile defconfig now that it supports multiplatform

---
 arch/arm/configs/shmobile_defconfig | 2 ++
 1 file changed, 2 insertions(+)
arch/arm/configs/shmobile_defconfig +2 -0
index 6d6437c..ea7673a 100644
@@ -9,11 +9,13 @@ CONFIG_EMBEDDED=y
 CONFIG_PERF_EVENTS=y
 CONFIG_SLAB=y
 CONFIG_ARCH_SHMOBILE_MULTI=y
+CONFIG_ARCH_R8A7779=y
 CONFIG_ARCH_EMEV2=y
 CONFIG_ARCH_R8A7790=y
 CONFIG_ARCH_R8A7791=y
 CONFIG_MACH_KOELSCH=y
 CONFIG_MACH_LAGER=y
+CONFIG_MACH_MARZEN=y
 # CONFIG_SWP_EMULATE is not set
 CONFIG_CPU_BPREDICT_DISABLE=y
 CONFIG_PL310_ERRATA_588369=y
Signature · 1 line
1.8.5.2
#14 lore raw

PATCH v6 13/17 ARM: shmobile: marzen: Add to shmobile defconfig

Hi Simon,

Quoted 8 lines · Simon Horman
arch/arm/configs/shmobile_defconfig +0 -0
index 6d6437c..ea7673a 100644
@@ -9,11 +9,13 @@ CONFIG_EMBEDDED=y
 CONFIG_PERF_EVENTS=y
 CONFIG_SLAB=y
 CONFIG_ARCH_SHMOBILE_MULTI=y

arch/arm/configs/shmobile_defconfig CONFIG_EMBEDDED=y · line 21

Quoted 10 lines
arch/arm/configs/shmobile_defconfig +2 -0
+CONFIG_ARCH_R8A7779=y
 CONFIG_ARCH_EMEV2=y
 CONFIG_ARCH_R8A7790=y
 CONFIG_ARCH_R8A7791=y
 CONFIG_MACH_KOELSCH=y
 CONFIG_MACH_LAGER=y
+CONFIG_MACH_MARZEN=y
 # CONFIG_SWP_EMULATE is not set
 CONFIG_CPU_BPREDICT_DISABLE=y
 CONFIG_PL310_ERRATA_588369=y

I think you also need:
CONFIG_SPI_SH_HSPI=y
CONFIG_USB_RCAR_PHY=y
CONFIG_PM_RUNTIME=y

(the last one is set in all shmobile defconfigs, except ape6evm and shmobile).

The other differences seem to be cruft not really related to hardware support.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

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

#15 lore raw

PATCH v6 13/17 ARM: shmobile: marzen: Add to shmobile defconfig

Quoted 28 lines · Geert Uytterhoeven

Hi Simon,

Quoted 8 lines · Simon Horman
arch/arm/configs/shmobile_defconfig +0 -0
index 6d6437c..ea7673a 100644
@@ -9,11 +9,13 @@ CONFIG_EMBEDDED=y
 CONFIG_PERF_EVENTS=y
 CONFIG_SLAB=y
 CONFIG_ARCH_SHMOBILE_MULTI=y

arch/arm/configs/shmobile_defconfig CONFIG_EMBEDDED=y · line 21

Quoted 10 lines
arch/arm/configs/shmobile_defconfig +2 -0
+CONFIG_ARCH_R8A7779=y
 CONFIG_ARCH_EMEV2=y
 CONFIG_ARCH_R8A7790=y
 CONFIG_ARCH_R8A7791=y
 CONFIG_MACH_KOELSCH=y
 CONFIG_MACH_LAGER=y
+CONFIG_MACH_MARZEN=y
 # CONFIG_SWP_EMULATE is not set
 CONFIG_CPU_BPREDICT_DISABLE=y
 CONFIG_PL310_ERRATA_588369=y

I think you also need:
CONFIG_SPI_SH_HSPI=y
CONFIG_USB_RCAR_PHY=y
CONFIG_PM_RUNTIME=y

Quoted 3 lines

(the last one is set in all shmobile defconfigs, except ape6evm and shmobile).

The other differences seem to be cruft not really related to hardware support.

Thanks, I'll verify that and make a follow-up patch.

#16 lore raw

PATCH v6 13/17 ARM: shmobile: marzen: Add to shmobile defconfig

Quoted 29 lines · Simon Horman
Quoted 28 lines · Geert Uytterhoeven

Hi Simon,

Quoted 8 lines · Simon Horman
arch/arm/configs/shmobile_defconfig +0 -0
index 6d6437c..ea7673a 100644
@@ -9,11 +9,13 @@ CONFIG_EMBEDDED=y
 CONFIG_PERF_EVENTS=y
 CONFIG_SLAB=y
 CONFIG_ARCH_SHMOBILE_MULTI=y

arch/arm/configs/shmobile_defconfig CONFIG_EMBEDDED=y · line 21

Quoted 10 lines
arch/arm/configs/shmobile_defconfig +2 -0
+CONFIG_ARCH_R8A7779=y
 CONFIG_ARCH_EMEV2=y
 CONFIG_ARCH_R8A7790=y
 CONFIG_ARCH_R8A7791=y
 CONFIG_MACH_KOELSCH=y
 CONFIG_MACH_LAGER=y
+CONFIG_MACH_MARZEN=y
 # CONFIG_SWP_EMULATE is not set
 CONFIG_CPU_BPREDICT_DISABLE=y
 CONFIG_PL310_ERRATA_588369=y

I think you also need:
CONFIG_SPI_SH_HSPI=y
CONFIG_USB_RCAR_PHY=y
CONFIG_PM_RUNTIME=y

Quoted 5 lines
Quoted 3 lines

(the last one is set in all shmobile defconfigs, except ape6evm and shmobile).

The other differences seem to be cruft not really related to hardware support.

Thanks, I'll verify that and make a follow-up patch.

After some more consideration I have decided on a slightly modified plan.

1. SPI_SH_HSPI and USB_RCAR_PHY

Thanks for noticing these. I think they do belong in this patch. I plan to queue up the version below:

2. PM_RUNTIME

I would like to handle this as a follow-up patch. In particular, I seem to recall that Magnus wanted to hold back on this at some point. So I'd like his input.

From: Simon Horman <[email protected]>

[PATCH v6.1] ARM: shmobile: marzen: Add to shmobile defconfig

Add marzen to shmobile defconfig now that it supports multiplatform

---
v6.1
* Also enable SPI_SH_HSPI and USB_RCAR_PHY

v2 - v6
* No Change

arch/arm/configs/shmobile_defconfig +6 -1
index b76fb9b..114e88e 100644
@@ -10,10 +10,12 @@ CONFIG_PERF_EVENTS=y
 CONFIG_SLAB=y
 CONFIG_ARCH_SHMOBILE_MULTI=y
 CONFIG_ARCH_EMEV2=y
+CONFIG_ARCH_R8A7779=y
 CONFIG_ARCH_R8A7790=y
 CONFIG_ARCH_R8A7791=y
 CONFIG_MACH_KOELSCH=y
 CONFIG_MACH_LAGER=y
+CONFIG_MACH_MARZEN=y
 # CONFIG_SWP_EMULATE is not set
 CONFIG_CPU_BPREDICT_DISABLE=y
 CONFIG_PL310_ERRATA_588369=y
@@ -81,6 +83,7 @@ CONFIG_I2C_RCAR=y
 CONFIG_SPI=y
 CONFIG_SPI_RSPI=y
 CONFIG_SPI_SH_MSIOF=y
+CONFIG_SPI_SH_HSPI=y
 CONFIG_GPIO_EM=y
 CONFIG_GPIO_RCAR=y
 # CONFIG_HWMON is not set
@@ -108,12 +111,14 @@ CONFIG_SND=y
 CONFIG_SND_SOC=y
 CONFIG_SND_SOC_RCAR=y
 CONFIG_USB=y
-CONFIG_USB_RCAR_GEN2_PHY=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_OHCI_HCD=y
 CONFIG_USB_RENESAS_USBHS=y
+CONFIG_USB_RCAR_PHY=y
+CONFIG_USB_RCAR_GEN2_PHY=y
 CONFIG_USB_GADGET=y
 CONFIG_USB_RENESAS_USBHS_UDC=y
+CONFIG_USB_ETH=y
 CONFIG_MMC=y
 CONFIG_MMC_SDHI=y
 CONFIG_MMC_SH_MMCIF=y
#17 lore raw

PATCH v6 13/17 ARM: shmobile: marzen: Add to shmobile defconfig

Hi Simon,

Quoted 15 lines · Simon Horman

Add marzen to shmobile defconfig now that it supports multiplatform

---
v6.1
* Also enable SPI_SH_HSPI and USB_RCAR_PHY

v2 - v6
* No Change

arch/arm/configs/shmobile_defconfig +0 -0
index b76fb9b..114e88e 100644

arch/arm/configs/shmobile_defconfig CONFIG_SND=y · line 118

Quoted 3 lines
arch/arm/configs/shmobile_defconfig +2 -0
 
+CONFIG_USB_RCAR_PHY=y
+CONFIG_USB_RCAR_GEN2_PHY=y

While I don't dispute the need for CONFIG_USB_RCAR_GEN2_PHY in shmobile_defconfig, this is not needed for Marzen, right?

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

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

#18 lore raw

PATCH v6 13/17 ARM: shmobile: marzen: Add to shmobile defconfig

Quoted 19 lines · Geert Uytterhoeven

Hi Simon,

Quoted 15 lines · Simon Horman

Add marzen to shmobile defconfig now that it supports multiplatform

---
v6.1
* Also enable SPI_SH_HSPI and USB_RCAR_PHY

v2 - v6
* No Change

arch/arm/configs/shmobile_defconfig +0 -0
index b76fb9b..114e88e 100644
Quoted 5 lines

arch/arm/configs/shmobile_defconfig CONFIG_SND=y · line 118

Quoted 2 lines
arch/arm/configs/shmobile_defconfig +2 -0
+CONFIG_USB_RCAR_PHY=y
+CONFIG_USB_RCAR_GEN2_PHY=y

While I don't dispute the need for CONFIG_USB_RCAR_GEN2_PHY in shmobile_defconfig, this is not needed for Marzen, right?

The CONFIG_USB_RCAR_GEN2_PHY was moved from above (by savedefconfig). I decided to include that change due to proximity to the new CONFIG_USB_RCAR_PHY line. But perhaps it would have been better not to.

#19 lore raw

PATCH v6 13/17 ARM: shmobile: marzen: Add to shmobile defconfig

Quoted 10 lines · Simon Horman
Quoted 8 lines

arch/arm/configs/shmobile_defconfig CONFIG_SND=y · line 118

Quoted 5 lines
arch/arm/configs/shmobile_defconfig +2 -0
 
+CONFIG_USB_RCAR_PHY=y
+CONFIG_USB_RCAR_GEN2_PHY=y

While I don't dispute the need for CONFIG_USB_RCAR_GEN2_PHY in shmobile_defconfig, this is not needed for Marzen, right?

The CONFIG_USB_RCAR_GEN2_PHY was moved from above (by savedefconfig).

Sorry, I had missed that.

Quoted 2 lines

I decided to include that change due to proximity to the new CONFIG_USB_RCAR_PHY line. But perhaps it would have been better not to.

Nevermind.

BTW, avoiding this moving around in real changes is another reason for refreshing the defconfigs on a regular basis ;-)

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert at linux-m68k.org

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

#20 lore raw

PATCH v6 13/17 ARM: shmobile: marzen: Add to shmobile defconfig

Quoted 14 lines · Geert Uytterhoeven
Quoted 10 lines · Simon Horman
Quoted 8 lines

arch/arm/configs/shmobile_defconfig CONFIG_SND=y · line 118

Quoted 5 lines
arch/arm/configs/shmobile_defconfig +2 -0
 
+CONFIG_USB_RCAR_PHY=y
+CONFIG_USB_RCAR_GEN2_PHY=y

While I don't dispute the need for CONFIG_USB_RCAR_GEN2_PHY in shmobile_defconfig, this is not needed for Marzen, right?

The CONFIG_USB_RCAR_GEN2_PHY was moved from above (by savedefconfig).

Sorry, I had missed that.

Quoted 7 lines
Quoted 2 lines

I decided to include that change due to proximity to the new CONFIG_USB_RCAR_PHY line. But perhaps it would have been better not to.

Nevermind.

BTW, avoiding this moving around in real changes is another reason for refreshing the defconfigs on a regular basis ;-)

Good point.

#21 lore raw

PATCH v6 14/17 ARM: shmobile: Remove non-multiplatform Marzen reference support

In reply to Simon Horman

Now that r8a7779 has CCF support remove the legacy Marzen reference Kconfig bits CONFIG_MACH_MARZEN_REFERENCE for the non-multiplatform case.

Starting from this commit Marzen board support is always enabled via CONFIG_MACH_MARZEN, and CONFIG_ARCH_MULTIPLATFORM is used to select between board-marzen.c and board-marzen-reference.c

The file board-marzen-reference.c can no longer be used together with the legacy sh-clk clock framework, instead CCF is used.

Based on work for the Koelsch board by Laurent Pinchart.

Cc Laurent Pinchart <[email protected]>
---
 arch/arm/boot/dts/Makefile           |  1 -
 arch/arm/mach-shmobile/Kconfig       | 13 -------------
 arch/arm/mach-shmobile/Makefile      |  1 -
 arch/arm/mach-shmobile/Makefile.boot |  1 -
 4 files changed, 16 deletions(-)
arch/arm/boot/dts/Makefile +0 -1
index 4694dcb..0d05589 100644
@@ -304,7 +304,6 @@ dtb-$(CONFIG_ARCH_SHMOBILE_LEGACY) += r7s72100-genmai.dtb \
 	r8a7778-bockw-reference.dtb \
 	r8a7740-armadillo800eva-reference.dtb \
 	r8a7779-marzen.dtb \
-	r8a7779-marzen-reference.dtb \
 	r8a7791-koelsch.dtb \
 	r8a7790-lager.dtb \
 	sh73a0-kzm9g.dtb \
arch/arm/mach-shmobile/Kconfig +0 -13
index 28d7e86..bcb83dd 100644
@@ -257,19 +257,6 @@ config MACH_MARZEN
 	select REGULATOR_FIXED_VOLTAGE if REGULATOR
 	select USE_OF
 
-config MACH_MARZEN_REFERENCE
-	bool "MARZEN board - Reference Device Tree Implementation"
-	depends on ARCH_R8A7779
-	select ARCH_REQUIRE_GPIOLIB
-	select REGULATOR_FIXED_VOLTAGE if REGULATOR
-	select USE_OF
-	---help---
-	   Use reference implementation of Marzen board support
-	   which makes use of device tree at the expense
-	   of not supporting a number of devices.
-
-	   This is intended to aid developers
-
 config MACH_LAGER
 	bool "Lager board"
 	depends on ARCH_R8A7790
arch/arm/mach-shmobile/Makefile +0 -1
index ed49315..591966e 100644
@@ -69,7 +69,6 @@ obj-$(CONFIG_MACH_BOCKW_REFERENCE)	+= board-bockw-reference.o
 obj-$(CONFIG_MACH_GENMAI)	+= board-genmai.o
 obj-$(CONFIG_MACH_GENMAI_REFERENCE)	+= board-genmai-reference.o
 obj-$(CONFIG_MACH_MARZEN)	+= board-marzen.o
-obj-$(CONFIG_MACH_MARZEN_REFERENCE)	+= board-marzen-reference.o
 obj-$(CONFIG_MACH_LAGER)	+= board-lager.o
 obj-$(CONFIG_MACH_ARMADILLO800EVA)	+= board-armadillo800eva.o
 obj-$(CONFIG_MACH_ARMADILLO800EVA_REFERENCE)	+= board-armadillo800eva-reference.o
arch/arm/mach-shmobile/Makefile.boot +0 -1
index 99455ec..4200b94 100644
@@ -14,7 +14,6 @@ loadaddr-$(CONFIG_MACH_KZM9G_REFERENCE) += 0x41008000
 loadaddr-$(CONFIG_MACH_LAGER) += 0x40008000
 loadaddr-$(CONFIG_MACH_MACKEREL) += 0x40008000
 loadaddr-$(CONFIG_MACH_MARZEN) += 0x60008000
-loadaddr-$(CONFIG_MACH_MARZEN_REFERENCE) += 0x60008000
 
 __ZRELADDR	:= $(sort $(loadaddr-y))
    zreladdr-y   += $(__ZRELADDR)
Signature · 1 line
1.8.5.2
#22 lore raw

PATCH v6 15/17 ARM: shmobile: Let Marzen multiplatform boot with Marzen DTB

In reply to Simon Horman

Let the multiplatform Marzen support boot with the legacy DTS for Marzen as well as the Marzen reference DTS.

Based on work for the Koelsch board by Laurent Pinchart.

Cc Laurent Pinchart <[email protected]>
---
 arch/arm/boot/dts/Makefile                      | 2 +-
 arch/arm/mach-shmobile/board-marzen-reference.c | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)
arch/arm/boot/dts/Makefile +1 -1
index 0d05589..840a922 100644
@@ -316,7 +316,7 @@ dtb-$(CONFIG_ARCH_SHMOBILE_MULTI) += emev2-kzm9d.dtb \
 	r8a7791-henninger.dtb \
 	r8a7791-koelsch.dtb \
 	r8a7790-lager.dtb \
-	r8a7779-marzen-reference.dtb
+	r8a7779-marzen.dtb
 dtb-$(CONFIG_ARCH_SOCFPGA) += socfpga_arria5_socdk.dtb \
 	socfpga_cyclone5_socdk.dtb \
 	socfpga_cyclone5_sockit.dtb \
arch/arm/mach-shmobile/board-marzen-reference.c +1 -0
index d09e850..21c8cee 100644
@@ -66,6 +66,7 @@ static void __init marzen_init(void)
 }
 
 static const char *marzen_boards_compat_dt[] __initdata = {
+	"renesas,marzen",
 	"renesas,marzen-reference",
 	NULL,
 };
Signature · 1 line
1.8.5.2
#23 lore raw

PATCH v6 16/17 ARM: shmobile: Remove Marzen reference DTS

In reply to Simon Horman

Now that the DTS file r8a7779-marzen.dts can be used with board-marzen.c and board-marzen-reference.c, proceed with removing r8a7779-marzen-reference.dts.

Based on work for the Koelsch board by Laurent Pinchart.

Cc Laurent Pinchart <[email protected]>

---
v6
* Rebase

v5
* As suggested by Magnus Damm
- Refer to r8a7779 instead of r8a7790 in the changelog

---
 arch/arm/boot/dts/r8a7779-marzen-reference.dts | 121 -------------------------
 1 file changed, 121 deletions(-)
 delete mode 100644 arch/arm/boot/dts/r8a7779-marzen-reference.dts
arch/arm/boot/dts/r8a7779-marzen-reference.dts deleted +0 -121
deleted file mode 100644
index b27c637..0000000
@@ -1,121 +0,0 @@
-/*
- * Reference Device Tree Source for the Marzen board
- *
- * Copyright (C) 2013 Renesas Solutions Corp.
- * Copyright (C) 2013 Simon Horman
- *
- * This file is licensed under the terms of the GNU General Public License
- * version 2.  This program is licensed "as is" without any warranty of any
- * kind, whether express or implied.
- */
-
-/dts-v1/;
-#include "r8a7779.dtsi"
-#include <dt-bindings/gpio/gpio.h>
-#include <dt-bindings/interrupt-controller/irq.h>
-
-/ {
-	model = "marzen";
-	compatible = "renesas,marzen-reference", "renesas,r8a7779";
-
-	chosen {
-		bootargs = "console=ttySC2,115200 earlyprintk=sh-sci.2,115200 ignore_loglevel root=/dev/nfs ip=on rw";
-	};
-
-	memory {
-		device_type = "memory";
-		reg = <0x60000000 0x40000000>;
-	};
-
-	fixedregulator3v3: fixedregulator at 0 {
-		compatible = "regulator-fixed";
-		regulator-name = "fixed-3.3V";
-		regulator-min-microvolt = <3300000>;
-		regulator-max-microvolt = <3300000>;
-		regulator-boot-on;
-		regulator-always-on;
-	};
-
-	lan0 at 18000000 {
-		compatible = "smsc,lan9220", "smsc,lan9115";
-		reg = <0x18000000 0x100>;
-		pinctrl-0 = <&lan0_pins>;
-		pinctrl-names = "default";
-
-		phy-mode = "mii";
-		interrupt-parent = <&irqpin0>;
-		interrupts = <1 IRQ_TYPE_EDGE_FALLING>;
-		smsc,irq-push-pull;
-		reg-io-width = <4>;
-		vddvario-supply = <&fixedregulator3v3>;
-		vdd33a-supply = <&fixedregulator3v3>;
-	};
-
-	leds {
-		compatible = "gpio-leds";
-		led2 {
-			gpios = <&gpio4 29 GPIO_ACTIVE_HIGH>;
-		};
-		led3 {
-			gpios = <&gpio4 30 GPIO_ACTIVE_HIGH>;
-		};
-		led4 {
-			gpios = <&gpio4 31 GPIO_ACTIVE_HIGH>;
-		};
-	};
-};
-
-&irqpin0 {
-	status = "okay";
-};
-
-&pfc {
-	pinctrl-0 = <&scif2_pins &scif4_pins>;
-	pinctrl-names = "default";
-
-	lan0_pins: lan0 {
-		intc {
-			renesas,groups = "intc_irq1_b";
-			renesas,function = "intc";
-		};
-		lbsc {
-			renesas,groups = "lbsc_ex_cs0";
-			renesas,function = "lbsc";
-		};
-	};
-
-	scif2_pins: serial2 {
-		renesas,groups = "scif2_data_c";
-		renesas,function = "scif2";
-	};
-
-	scif4_pins: serial4 {
-		renesas,groups = "scif4_data";
-		renesas,function = "scif4";
-	};
-
-	sdhi0_pins: sd0 {
-		renesas,groups = "sdhi0_data4", "sdhi0_ctrl", "sdhi0_cd";
-		renesas,function = "sdhi0";
-	};
-
-	hspi0_pins: hspi0 {
-		renesas,groups = "hspi0";
-		renesas,function = "hspi0";
-	};
-};
-
-&sdhi0 {
-	pinctrl-0 = <&sdhi0_pins>;
-	pinctrl-names = "default";
-
-	vmmc-supply = <&fixedregulator3v3>;
-	bus-width = <4>;
-	status = "okay";
-};
-
-&hspi0 {
-	pinctrl-0 = <&hspi0_pins>;
-	pinctrl-names = "default";
-	status = "okay";
-};
Signature · 1 line
1.8.5.2
#24 lore raw

PATCH v6 17/17 ARM: shmobile: marzen-reference: Remove legacy clock support

In reply to Simon Horman

Marzen DT reference is now only built for multiplatform which means that CCF comes with the package. Remove unused legacy code ifdefs to clean up the code.

Based on similar work for the Koelsch board by Magnus Damm.

Cc Magnus Damm <[email protected]>
Cc Laurent Pinchart <[email protected]>

---
v5, v6
* Rebase

v4
* As suggested by Geert Uytterhoeven
- Remove bogus "these" from changelog
* Rebase

---
 arch/arm/mach-shmobile/board-marzen-reference.c | 8 --------
 1 file changed, 8 deletions(-)
arch/arm/mach-shmobile/board-marzen-reference.c +0 -8
index 21c8cee..c6c133d 100644
@@ -31,13 +31,10 @@
 
 static void __init marzen_init_timer(void)
 {
-#ifdef CONFIG_COMMON_CLK
 	r8a7779_clocks_init(r8a7779_read_mode_pins());
-#endif
 	clocksource_of_init();
 }
 
-#ifdef CONFIG_COMMON_CLK
 /*
  * This is a really crude hack to provide clkdev support to platform
  * devices until they get moved to DT.
@@ -51,15 +48,10 @@ static const struct clk_name clk_names[] __initconst = {
 	{ "scif5", NULL, "sh-sci.5" },
 	{ "tmu0", "fck", "sh-tmu.0" },
 };
-#endif
 
 static void __init marzen_init(void)
 {
-#ifdef CONFIG_COMMON_CLK
 	shmobile_clk_workaround(clk_names, ARRAY_SIZE(clk_names), false);
-#else
-	r8a7779_clock_init();
-#endif
 	r8a7779_add_standard_devices_dt();
 	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 	r8a7779_init_irq_extpin_dt(1); /* IRQ1 as individual interrupt */
Signature · 1 line
1.8.5.2