Skip to contentSkip to conversation

ARM: mach-shmobile: kzm9g: Reference DT implementation

PATCH New Simon Horman 3 participants 9 messages Dec 11, 2012 – Dec 13, 2012

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

v3 cover ARM: mach-shmobile: kzm9g: Reference DT implementation

this is a third pass at at providing a refernce DT implementation for the kzm9g baord which is intended to act as a guide for mach-shmobile developers.

It provides a minimal setup of the board using as little C code as possible.

It may be used by selecting CONFIG_MACH_KZM9G_REFERENCE and using sh73a0-kzm9g-reference.dtb

*** Please note that the clock initialisation shcheme used in
this series does not currently work with SMP as there is a yet to be resolved lock-up in workqueue initialisation.

Resolving this problem is currently regarded as future-work.

CONFIG_SMP must be disabled when using this code. ***

Major difference between v2 and v3:
* Allow UP boot to complete by initialiing CMT earlier. This is achieved by changing the position of clocsources/ in drivers/Makefile

Major difference between v1 and v2:
* Drop touchscreen initialisation, it requires INTC
* Drop SDHI initialisation, the driver seems to need some work
* Add extra entries to clock-sh73a0.c:lookups[] and
remove auxdata. Ultimtely the clocks will be described
in DT, but the code isn't there yet.
* Drop MMCIF patch, it is not needed if regulators are enabled
* Drop PCF hacks, instead, the series is based on Laruent Pinchart's *
* series: [PATCH v2 00/77] SH pin control and GPIO rework with OF support
* Use shmobile_setup_delay()

Git and diffstat information provided to aid review.

----------------------------------------------------------------
The following changes since commit 940956fe1d8de5cbcc963214fe592f76d8354bef:

ARM: shmobile: kzm9g: Add LED1-LED4 to the device tree (2012-11-27 00:59:10 +0100)

are available in the git repository at:

git://git.kernel.org/pub/scm/linux/kernel/git/horms/renesas.git devel/of-kzm9g

for you to fetch changes up to e64ad872028f921a7a30be325fbdecc725958b40:

ARM: mach-shmobile: kzm9g: Reference DT implementation (2012-12-11 11:51:56 +0900)

----------------------------------------------------------------
Simon Horman (6):
ARM: clocksource: Initialise early
ARM: mach-shmobile: sh73a0: Allow initialisation of GIC by DT
ARM: mach-shmobile: sh73a0: Minimal setup using DT
ARM: mach-shmobile: sh73a0: Initialise MMCIF using DT
ARM: mach-shmobile: kzm9g: use voltage regulators by default
ARM: mach-shmobile: kzm9g: Reference DT implementation

 arch/arm/boot/dts/Makefile                     |    3 +-
 arch/arm/boot/dts/sh73a0-kzm9g-reference.dts   |   37 +++++++++
 arch/arm/boot/dts/sh73a0-reference.dtsi        |   24 ++++++
 arch/arm/boot/dts/sh73a0.dtsi                  |   69 +++++++++++++++++
 arch/arm/configs/kzm9g_defconfig               |    2 +
 arch/arm/mach-shmobile/Kconfig                 |   10 +++
 arch/arm/mach-shmobile/Makefile                |    1 +
 arch/arm/mach-shmobile/board-kzm9g-reference.c |   99 ++++++++++++++++++++++++
 arch/arm/mach-shmobile/clock-sh73a0.c          |   13 ++++
 arch/arm/mach-shmobile/include/mach/common.h   |    3 +
 arch/arm/mach-shmobile/intc-sh73a0.c           |   14 ++++
 arch/arm/mach-shmobile/setup-sh73a0.c          |   68 +++++++++++++++-
 drivers/Makefile                               |    8 +-
 13 files changed, 346 insertions(+), 5 deletions(-)
 create mode 100644 arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
 create mode 100644 arch/arm/boot/dts/sh73a0-reference.dtsi
 create mode 100644 arch/arm/mach-shmobile/board-kzm9g-reference.c
#1 lore raw

PATCH v3 1/6 ARM: clocksource: Initialise early

Initialise clock sources early, since some subsystems rely on them to initialize

---

v3
* Initial post

---
 drivers/Makefile |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/Makefile +5 -3
index a16a8d0..eba9b58 100644
@@ -37,6 +37,11 @@ obj-$(CONFIG_XEN)		+= xen/
 # regulators early, since some subsystems rely on them to initialize
 obj-$(CONFIG_REGULATOR)		+= regulator/
 
+# clocksource early, since some subsystems rely on them to initialize
+ifndef CONFIG_ARCH_USES_GETTIMEOFFSET
+obj-y				+= clocksource/
+endif
+
 # tty/ comes before char/ so that the VT console is the boot-time
 # default.
 obj-y				+= tty/
@@ -114,9 +119,6 @@ obj-y				+= firmware/
 obj-$(CONFIG_CRYPTO)		+= crypto/
 obj-$(CONFIG_SUPERH)		+= sh/
 obj-$(CONFIG_ARCH_SHMOBILE)	+= sh/
-ifndef CONFIG_ARCH_USES_GETTIMEOFFSET
-obj-y				+= clocksource/
-endif
 obj-$(CONFIG_DCA)		+= dca/
 obj-$(CONFIG_HID)		+= hid/
 obj-$(CONFIG_PPC_PS3)		+= ps3/
Signature · 1 line
1.7.10.4
#2 lore raw

PATCH 1/6 ARM: clocksource: Initialise early

Hi Simon,

Thanks for the patch.

Could you please CC LKML on this one ? It targets a wider audience than the SH-specific patches.

Quoted 39 lines · On Tuesday 11 December 2012 12:07:29 Simon Horman wrote:

Initialise clock sources early, since some subsystems rely on them to initialize

---

v3
* Initial post

---
 drivers/Makefile |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/Makefile +5 -3
index a16a8d0..eba9b58 100644
@@ -37,6 +37,11 @@ obj-$(CONFIG_XEN)		+= xen/
 # regulators early, since some subsystems rely on them to initialize
 obj-$(CONFIG_REGULATOR)		+= regulator/
 
+# clocksource early, since some subsystems rely on them to initialize
+ifndef CONFIG_ARCH_USES_GETTIMEOFFSET
+obj-y				+= clocksource/
+endif
+
 # tty/ comes before char/ so that the VT console is the boot-time
 # default.
 obj-y				+= tty/
@@ -114,9 +119,6 @@ obj-y				+= firmware/
 obj-$(CONFIG_CRYPTO)		+= crypto/
 obj-$(CONFIG_SUPERH)		+= sh/
 obj-$(CONFIG_ARCH_SHMOBILE)	+= sh/
-ifndef CONFIG_ARCH_USES_GETTIMEOFFSET
-obj-y				+= clocksource/
-endif
 obj-$(CONFIG_DCA)		+= dca/
 obj-$(CONFIG_HID)		+= hid/
 obj-$(CONFIG_PPC_PS3)		+= ps3/
Signature · 3 lines
Regards,

Laurent Pinchart
#3 lore raw

PATCH 1/6 ARM: clocksource: Initialise early

Quoted 6 lines · Laurent Pinchart

Hi Simon,

Thanks for the patch.

Could you please CC LKML on this one ? It targets a wider audience than the SH-specific patches.

Sure, good thinking.

Quoted 46 lines · On Tuesday 11 December 2012 12:07:29 Simon Horman wrote:
Quoted 39 lines

Initialise clock sources early, since some subsystems rely on them to initialize

---

v3
* Initial post

---
 drivers/Makefile |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/Makefile +5 -3
index a16a8d0..eba9b58 100644
@@ -37,6 +37,11 @@ obj-$(CONFIG_XEN)		+= xen/
 # regulators early, since some subsystems rely on them to initialize
 obj-$(CONFIG_REGULATOR)		+= regulator/
 
+# clocksource early, since some subsystems rely on them to initialize
+ifndef CONFIG_ARCH_USES_GETTIMEOFFSET
+obj-y				+= clocksource/
+endif
+
 # tty/ comes before char/ so that the VT console is the boot-time
 # default.
 obj-y				+= tty/
@@ -114,9 +119,6 @@ obj-y				+= firmware/
 obj-$(CONFIG_CRYPTO)		+= crypto/
 obj-$(CONFIG_SUPERH)		+= sh/
 obj-$(CONFIG_ARCH_SHMOBILE)	+= sh/
-ifndef CONFIG_ARCH_USES_GETTIMEOFFSET
-obj-y				+= clocksource/
-endif
 obj-$(CONFIG_DCA)		+= dca/
 obj-$(CONFIG_HID)		+= hid/
 obj-$(CONFIG_PPC_PS3)		+= ps3/
Signature · 3 lines
Regards,

Laurent Pinchart
#4 lore raw

PATCH v3 2/6 ARM: mach-shmobile: sh73a0: Allow initialisation of GIC by DT

In reply to Simon Horman

This allows the GIC interrupt controller of the sh73a0 SoC to be initialised using a flattened device tree blob.

It does not allow the INTC interrupt controller which is also present on the sh73a0 SoC to be enabled via device tree. Nor does it handle sharing of interrupts between the GIC and INTC interrupt controllers.

This limits the usefulness of this code to applications which only wish to access devices which use interrupts that can be handled by the GIC interrupt controller. Other applications should, for now, continue using non-device tree initialisation of the sh72a0 interrupt controllers.

---

v3
* No change

v2
* No change

---
 arch/arm/boot/dts/sh73a0.dtsi                |    9 +++++++++
 arch/arm/mach-shmobile/include/mach/common.h |    1 +
 arch/arm/mach-shmobile/intc-sh73a0.c         |   14 ++++++++++++++
 3 files changed, 24 insertions(+)
arch/arm/boot/dts/sh73a0.dtsi +9 -0
index 6b374ff..77c8e43 100644
@@ -29,4 +29,13 @@
 		gpio-controller;
 		#gpio-cells = <2>;
 	};
+
+	gic: interrupt-controller at f0001000 {
+		compatible = "arm,cortex-a9-gic";
+		#interrupt-cells = <3>;
+		#address-cells = <1>;
+		interrupt-controller;
+		reg = <0xf0001000 0x1000>,
+		      <0xf0000100 0x100>;
+	};
 };
arch/arm/mach-shmobile/include/mach/common.h +1 -0
index d47e215..b50447e 100644
@@ -49,6 +49,7 @@ extern struct clk sh7372_extal1_clk;
 extern struct clk sh7372_extal2_clk;
 
 extern void sh73a0_init_irq(void);
+extern void sh73a0_init_irq_dt(void);
 extern void sh73a0_map_io(void);
 extern void sh73a0_add_early_devices(void);
 extern void sh73a0_add_standard_devices(void);
arch/arm/mach-shmobile/intc-sh73a0.c +14 -0
index f0c5e51..e492350 100644
@@ -21,6 +21,7 @@
 #include <linux/interrupt.h>
 #include <linux/module.h>
 #include <linux/irq.h>
+#include <linux/of_irq.h>
 #include <linux/io.h>
 #include <linux/sh_intc.h>
 #include <mach/intc.h>
@@ -464,3 +465,16 @@ void __init sh73a0_init_irq(void)
 	sh73a0_pint1_cascade.handler = sh73a0_pint1_demux;
 	setup_irq(gic_spi(34), &sh73a0_pint1_cascade);
 }
+
+#ifdef CONFIG_OF
+static const struct of_device_id irq_of_match[] __initconst = {
+	{ .compatible = "arm,cortex-a9-gic", .data = gic_of_init, },
+	{ },
+};
+
+void __init sh73a0_init_irq_dt(void)
+{
+	of_irq_init(irq_of_match);
+	gic_arch_extn.irq_set_wake = sh73a0_set_wake;
+}
+#endif
Signature · 1 line
1.7.10.4
#5 lore raw

PATCH v3 3/6 ARM: mach-shmobile: sh73a0: Minimal setup using DT

In reply to Simon Horman

Allow a minimal setup of the sh73a0 SoC using a flattened device tree. In particular, Configure the i2c controllers using a flattened device tree.

SCI serial controller and CMT clock source, whose drivers do not yet support configuration using a flattened device tree, are still configured using C code in order to allow booting of a board with this SoC.

*** Please note that the clock initialisation shcheme used in
this patch does not currently work with SMP as there is a yet to be resolved lock-up in workqueue initialisation.

CONFIG_SMP must be disabled when using this code. ***

---

v3
* Late initialisation of clocks
* Add DT_MACHINE_START()
* Add comment about duplicate entries in clock-sh73a0.c:lookups[]

v2
* Add extra entries to clock-sh73a0.c:lookups[] and
remove auxdata. Ultimtely the clocks will be described
in DT, but the code isn't there yet.
* Use shmobile_setup_delay() and perform late initialisation of clocks

---
 arch/arm/boot/dts/sh73a0.dtsi                |   60 +++++++++++++++++++++++
 arch/arm/mach-shmobile/clock-sh73a0.c        |   12 +++++
 arch/arm/mach-shmobile/include/mach/common.h |    2 +
 arch/arm/mach-shmobile/setup-sh73a0.c        |   68 +++++++++++++++++++++++++-
 4 files changed, 141 insertions(+), 1 deletion(-)
arch/arm/boot/dts/sh73a0.dtsi +60 -0
index 77c8e43..fc7f0fd 100644
@@ -38,4 +38,64 @@
 		reg = <0xf0001000 0x1000>,
 		      <0xf0000100 0x100>;
 	};
+
+	i2c0: i2c at 0xe6820000 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "renesas,rmobile-iic";
+		reg = <0xe6820000 0x425>;
+		interrupt-parent = <&gic>;
+		interrupts = <0 167 0x4
+			      0 168 0x4
+			      0 169 0x4
+			      0 170 0x4>;
+	};
+
+	i2c1: i2c at 0xe6822000 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "renesas,rmobile-iic";
+		reg = <0xe6822000 0x425>;
+		interrupt-parent = <&gic>;
+		interrupts = <0 51 0x4
+			      0 52 0x4
+			      0 53 0x4
+			      0 54 0x4>;
+	};
+
+	i2c2: i2c at 0xe6824000 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "renesas,rmobile-iic";
+		reg = <0xe6824000 0x425>;
+		interrupt-parent = <&gic>;
+		interrupts = <0 171 0x4
+			      0 172 0x4
+			      0 173 0x4
+			      0 174 0x4>;
+	};
+
+	i2c3: i2c at 0xe6826000 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "renesas,rmobile-iic";
+		reg = <0xe6826000 0x425>;
+		interrupt-parent = <&gic>;
+		interrupts = <0 183 0x4
+			      0 184 0x4
+			      0 185 0x4
+			      0 186 0x4>;
+	};
+
+	i2c4: i2c at 0xe6828000 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "renesas,rmobile-iic";
+		reg = <0xe6828000 0x425>;
+		interrupt-parent = <&gic>;
+		interrupts = <0 187 0x4
+			      0 188 0x4
+			      0 189 0x4
+			      0 190 0x4>;
+	};
 };
arch/arm/mach-shmobile/clock-sh73a0.c +12 -0
index 516ff7f..22af74f2 100644
@@ -525,6 +525,13 @@ static struct clk mstp_clks[MSTP_NR] = {
 	[MSTP403] = MSTP(&r_clk, SMSTPCR4, 3, 0), /* KEYSC */
 };
 
+/* The lookups structure below includes duplicate entries for some clocks
+ * with alternate names.
+ * - The traditional name used when a device is initialised with platform data
+ * - The name used when a device is initialised using device tree
+ * The longer-term aim is to remove these duplicates, and indeed the
+ * lookups table entirely, by describing clocks using device tree.
+ */
 static struct clk_lookup lookups[] = {
 	/* main clocks */
 	CLKDEV_CON_ID("r_clk", &r_clk),
@@ -545,6 +552,7 @@ static struct clk_lookup lookups[] = {
 
 	/* MSTP32 clocks */
 	CLKDEV_DEV_ID("i2c-sh_mobile.2", &mstp_clks[MSTP001]), /* I2C2 */
+	CLKDEV_DEV_ID("e6824000.i2c", &mstp_clks[MSTP001]), /* I2C2 */
 	CLKDEV_DEV_ID("sh_mobile_ceu.1", &mstp_clks[MSTP129]), /* CEU1 */
 	CLKDEV_DEV_ID("sh-mobile-csi2.1", &mstp_clks[MSTP128]), /* CSI2-RX1 */
 	CLKDEV_DEV_ID("sh_mobile_ceu.0", &mstp_clks[MSTP127]), /* CEU0 */
@@ -553,6 +561,7 @@ static struct clk_lookup lookups[] = {
 	CLKDEV_DEV_ID("sh_tmu.1", &mstp_clks[MSTP125]), /* TMU01 */
 	CLKDEV_DEV_ID("sh-mipi-dsi.0", &mstp_clks[MSTP118]), /* DSITX */
 	CLKDEV_DEV_ID("i2c-sh_mobile.0", &mstp_clks[MSTP116]), /* I2C0 */
+	CLKDEV_DEV_ID("e6820000.i2c", &mstp_clks[MSTP116]), /* I2C0 */
 	CLKDEV_DEV_ID("sh_mobile_lcdc_fb.0", &mstp_clks[MSTP100]), /* LCDC0 */
 	CLKDEV_DEV_ID("sh-sci.7", &mstp_clks[MSTP219]), /* SCIFA7 */
 	CLKDEV_DEV_ID("sh-dma-engine.0", &mstp_clks[MSTP218]), /* SY-DMAC */
@@ -569,6 +578,7 @@ static struct clk_lookup lookups[] = {
 	CLKDEV_DEV_ID("sh_fsi2", &mstp_clks[MSTP328]), /* FSI */
 	CLKDEV_DEV_ID("sh_irda.0", &mstp_clks[MSTP325]), /* IrDA */
 	CLKDEV_DEV_ID("i2c-sh_mobile.1", &mstp_clks[MSTP323]), /* I2C1 */
+	CLKDEV_DEV_ID("e6822000.i2c", &mstp_clks[MSTP323]), /* I2C1 */
 	CLKDEV_DEV_ID("renesas_usbhs", &mstp_clks[MSTP322]), /* USB */
 	CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), /* SDHI0 */
 	CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */
@@ -579,7 +589,9 @@ static struct clk_lookup lookups[] = {
 	CLKDEV_DEV_ID("leds-renesas-tpu.30", &mstp_clks[MSTP301]), /* TPU3 */
 	CLKDEV_DEV_ID("leds-renesas-tpu.41", &mstp_clks[MSTP300]), /* TPU4 */
 	CLKDEV_DEV_ID("i2c-sh_mobile.3", &mstp_clks[MSTP411]), /* I2C3 */
+	CLKDEV_DEV_ID("e6826000.i2c", &mstp_clks[MSTP411]), /* I2C3 */
 	CLKDEV_DEV_ID("i2c-sh_mobile.4", &mstp_clks[MSTP410]), /* I2C4 */
+	CLKDEV_DEV_ID("e6828000.i2c", &mstp_clks[MSTP410]), /* I2C4 */
 	CLKDEV_DEV_ID("sh_keysc.0", &mstp_clks[MSTP403]), /* KEYSC */
 };
 
arch/arm/mach-shmobile/include/mach/common.h +2 -0
index b50447e..06b905e 100644
@@ -52,7 +52,9 @@ extern void sh73a0_init_irq(void);
 extern void sh73a0_init_irq_dt(void);
 extern void sh73a0_map_io(void);
 extern void sh73a0_add_early_devices(void);
+extern void sh73a0_add_early_devices_dt(void);
 extern void sh73a0_add_standard_devices(void);
+extern void sh73a0_add_standard_devices_dt(void);
 extern void sh73a0_clock_init(void);
 extern void sh73a0_pinmux_init(void);
 extern struct clk sh73a0_extal1_clk;
arch/arm/mach-shmobile/setup-sh73a0.c +67 -1

107 lines not on this page · raw message

Signature · 1 line
1.7.10.4
#6 lore raw

PATCH v3 4/6 ARM: mach-shmobile: sh73a0: Initialise MMCIF using DT

In reply to Simon Horman

This device also requires a voltage regulator which should be defined in a board-specific maner. An example dts snipped follows.

/ {
	fixedregulator1v8: fixedregulator at 0 {
		compatible = "regulator-fixed";
		regulator-name = "fixed-1.8V";
		regulator-min-microvolt = <1800000>;
		regulator-max-microvolt = <1800000>;
	};
};
&mmcif {
	vmmc-supply = <&fixedregulator1v8>;
	vqmmc-supply = <&fixedregulator1v8>;
};

---

v3
* No change

v2
* Removed SDHI initialisation as the driver needs updating first
* Moved MMC DT from sh73a0.dtsi to sh73a0-reference.dtsi as it is not appropriate for use by sh73a0-kzm9g.dts yet. This is because sh73a0-kzm9g.dts and board-kzm9g.c use both the GIC and INTC interrupt controllers to provide access to a rich set of devices. This is achieved by initialising the interrupt controllers using C code. Work on allowing the INC controller to be initialised using DT is in progress, however, until that is complete only GIC may be initialised using DT.
* Add extra entries to clock-sh73a0.c:lookups[] and remove auxdata. Ultimately the clocks will be described in DT, but the code isn't there yet.

---
 arch/arm/boot/dts/sh73a0-reference.dtsi |   24 ++++++++++++++++++++++++
 arch/arm/mach-shmobile/clock-sh73a0.c   |    1 +
 2 files changed, 25 insertions(+)
 create mode 100644 arch/arm/boot/dts/sh73a0-reference.dtsi
arch/arm/boot/dts/sh73a0-reference.dtsi new file +24 -0
new file mode 100644
index 0000000..d4bb012
@@ -0,0 +1,24 @@
+/*
+ * Device Tree Source for the SH73A0 SoC
+ *
+ * Copyright (C) 2012 Renesas Solutions Corp.
+ *
+ * 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.
+ */
+
+/include/ "sh73a0.dtsi"
+
+/ {
+	compatible = "renesas,sh73a0";
+
+	mmcif: mmcif at 0x10010000 {
+		compatible = "renesas,sh-mmcif";
+		reg = <0xe6bd0000 0x100>;
+		interrupt-parent = <&gic>;
+		interrupts = <0 140 0x4
+			      0 141 0x4>;
+		reg-io-width = <4>;
+	};
+};
arch/arm/mach-shmobile/clock-sh73a0.c +1 -0
index 22af74f2..2216b6b 100644
@@ -583,6 +583,7 @@ static struct clk_lookup lookups[] = {
 	CLKDEV_DEV_ID("sh_mobile_sdhi.0", &mstp_clks[MSTP314]), /* SDHI0 */
 	CLKDEV_DEV_ID("sh_mobile_sdhi.1", &mstp_clks[MSTP313]), /* SDHI1 */
 	CLKDEV_DEV_ID("sh_mmcif.0", &mstp_clks[MSTP312]), /* MMCIF0 */
+	CLKDEV_DEV_ID("e6bd0000.mmcif", &mstp_clks[MSTP312]), /* MMCIF0 */
 	CLKDEV_DEV_ID("sh_mobile_sdhi.2", &mstp_clks[MSTP311]), /* SDHI2 */
 	CLKDEV_DEV_ID("leds-renesas-tpu.12", &mstp_clks[MSTP303]), /* TPU1 */
 	CLKDEV_DEV_ID("leds-renesas-tpu.21", &mstp_clks[MSTP302]), /* TPU2 */
Signature · 1 line
1.7.10.4
#7 lore raw

PATCH v3 5/6 ARM: mach-shmobile: kzm9g: use voltage regulators by default

In reply to Simon Horman

This is needed to initialise the MMCIF device in the absence of platform data.

---

v3
* Also enable CONFIG_REGULATOR_DUMMY.
This is needed for SMSC.

v2
* First post

---
 arch/arm/configs/kzm9g_defconfig |    2 ++
 1 file changed, 2 insertions(+)
arch/arm/configs/kzm9g_defconfig +2 -0
index c88b578..8c31b44 100644
@@ -83,6 +83,8 @@ CONFIG_I2C_CHARDEV=y
 CONFIG_I2C_SH_MOBILE=y
 CONFIG_GPIO_PCF857X=y
 # CONFIG_HWMON is not set
+CONFIG_REGULATOR=y
+CONFIG_REGULATOR_DUMMY=y
 CONFIG_FB=y
 CONFIG_FB_SH_MOBILE_LCDC=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
Signature · 1 line
1.7.10.4
#8 lore raw

PATCH v3 6/6 ARM: mach-shmobile: kzm9g: Reference DT implementation

In reply to Simon Horman

Provide alternate board code for the kzm9g to demonstrate how DT may be used given the current state of driver device tree support. This is intended to act as a reference for mach-shmobile developers.

Some notes:

* Brings up the GIC interrupt handler using device tree
* Brings up the following device using device tree:
- MMCIF (MMC)
* Does not bring up the INTC interrupt controller at all, thus external devices may not be used. In particular,
the SMSC ethernet device may not be used and thus
NFS root may not be used.
* Uses existing C code and not device tree to initialise the following, which are needed for a working board:
- SCIF (Serial)
- CMT (Clock)
- PFC (GPIO)

To use this alternate board code instead of the normal board code, CONFIG_MACH_KZM9G_REFERENCE should be selected in the kernel config. And the sh73a0-kzm9g-reference.dtb flattened device tree blob should be used.

*** Please note that the clock initialisation shcheme used in
this patch does not currently work with SMP as there is a yet to be resolved lock-up in workqueue initialisation.

CONFIG_SMP must be disabled when using this code. ***

---

v3
* Compile board-kzm9g.c even if CONFIG_MACH_KZM9G_REFERENCE is selected, it can co-exist with board-kzm9g-reference.c

v2
* Do not initialise touchscreen, it requires the INTC interrupt controller but for now this configuration only has the GIC interrupt controller.
* Define mmcif and sdhi in SoC dtsi and reference in board dts.
* Do not initialise SDHI, the driver needs to be updated

---
 arch/arm/boot/dts/Makefile                     |    3 +-
 arch/arm/boot/dts/sh73a0-kzm9g-reference.dts   |   37 +++++++++
 arch/arm/mach-shmobile/Kconfig                 |   10 +++
 arch/arm/mach-shmobile/Makefile                |    1 +
 arch/arm/mach-shmobile/board-kzm9g-reference.c |   99 ++++++++++++++++++++++++
 5 files changed, 149 insertions(+), 1 deletion(-)
 create mode 100644 arch/arm/boot/dts/sh73a0-kzm9g-reference.dts
 create mode 100644 arch/arm/mach-shmobile/board-kzm9g-reference.c
arch/arm/boot/dts/Makefile +2 -1
index f37cf9f..c606375 100644
@@ -77,7 +77,8 @@ dtb-$(CONFIG_ARCH_PRIMA2) += prima2-evb.dtb
 dtb-$(CONFIG_ARCH_U8500) += snowball.dtb
 dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \
 	r8a7740-armadillo800eva.dtb \
-	sh73a0-kzm9g.dtb
+	sh73a0-kzm9g.dtb \
+	sh73a0-kzm9g-reference.dtb
 dtb-$(CONFIG_ARCH_SPEAR13XX) += spear1310-evb.dtb \
 	spear1340-evb.dtb
 dtb-$(CONFIG_ARCH_SPEAR3XX)+= spear300-evb.dtb \
arch/arm/boot/dts/sh73a0-kzm9g-reference.dts new file +37 -0
new file mode 100644
index 0000000..588016e
@@ -0,0 +1,37 @@
+/*
+ * Device Tree Source for the KZM-A9-GT board
+ *
+ * Copyright (C) 2012 Horms Solutions Ltd.
+ *
+ * Based on sh73a0-kzm9g.dts
+ * Copyright (C) 2012 Renesas Solutions Corp.
+ *
+ * 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/ "sh73a0-reference.dtsi"
+
+/ {
+	model = "KZM-A9-GT";
+	compatible = "renesas,kzm9g-reference", "renesas,sh73a0";
+
+	memory {
+		device_type = "memory";
+		reg = <0x41000000 0x1e800000>;
+	};
+
+	fixedregulator1v8: fixedregulator at 0 {
+		compatible = "regulator-fixed";
+		regulator-name = "fixed-1.8V";
+		regulator-min-microvolt = <1800000>;
+		regulator-max-microvolt = <1800000>;
+	};
+};
+
+&mmcif {
+	vmmc-supply = <&fixedregulator1v8>;
+	vqmmc-supply = <&fixedregulator1v8>;
+};
arch/arm/mach-shmobile/Kconfig +10 -0
index 8ae100c..ca95c2b 100644
@@ -136,6 +136,16 @@ config MACH_KZM9G
 	select SND_SOC_AK4642 if SND_SIMPLE_CARD
 	select USE_OF
 
+config MACH_KZM9G_REFERENCE
+	bool "KZM-A9-GT board - Reference Device Tree Implementation"
+	depends on MACH_KZM9G
+	---help---
+	   Use reference implementation of KZM-A9-GT board support
+	   which makes as greater use of device tree at the expense
+	   of not supporting a number of devices.
+
+	   This is intended to aid developers
+
 comment "SH-Mobile System Configuration"
 
 config CPU_HAS_INTEVT
arch/arm/mach-shmobile/Makefile +1 -0
index e3556c6..b4d3920 100644
@@ -52,6 +52,7 @@ obj-$(CONFIG_MACH_MARZEN)	+= board-marzen.o
 obj-$(CONFIG_MACH_ARMADILLO800EVA)	+= board-armadillo800eva.o
 obj-$(CONFIG_MACH_KZM9D)	+= board-kzm9d.o
 obj-$(CONFIG_MACH_KZM9G)	+= board-kzm9g.o
+obj-$(CONFIG_MACH_KZM9G_REFERENCE)	+= board-kzm9g-reference.o
 
 # Framework support
 obj-$(CONFIG_SMP)		+= $(smp-y)
arch/arm/mach-shmobile/board-kzm9g-reference.c new file +99 -0

99 lines not on this page · raw message

Signature · 1 line
1.7.10.4