linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* ARM: mach-shmobile: r8a7779, marzen: Reference DT implementation
@ 2013-01-31  1:50 Simon Horman
  2013-01-31  1:50 ` [PATCH 1/4] ARM: mach-shmobile: marzen: defconfig: use regulators by default Simon Horman
                   ` (3 more replies)
  0 siblings, 4 replies; 20+ messages in thread
From: Simon Horman @ 2013-01-31  1:50 UTC (permalink / raw)
  To: linux-arm-kernel

Provide minimal DT initialisation for the r8a7779 SoC and
marzen board as a reference for developers.

In general the idea is to grow the hardware supported by this
initialisation as DT coverage of relevant drivers and other code
grows.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>

overall diffstat:
 arch/arm/boot/dts/Makefile                      |    1 
 arch/arm/boot/dts/r8a7779-marzen-reference.dts  |   41 ++++++
 arch/arm/boot/dts/r8a7779.dtsi                  |   85 ++++++++++++++
 arch/arm/configs/marzen_defconfig               |    2 
 arch/arm/mach-shmobile/Kconfig                  |   11 +
 arch/arm/mach-shmobile/Makefile                 |    1 
 arch/arm/mach-shmobile/board-marzen-reference.c |   71 +++++++++++
 arch/arm/mach-shmobile/include/mach/common.h    |    3 
 arch/arm/mach-shmobile/intc-r8a7779.c           |   27 +++-
 arch/arm/mach-shmobile/setup-r8a7779.c          |   58 ++++++++-
 10 files changed, 288 insertions(+), 12 deletions(-)

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 1/4] ARM: mach-shmobile: marzen: defconfig: use regulators by default
  2013-01-31  1:50 ARM: mach-shmobile: r8a7779, marzen: Reference DT implementation Simon Horman
@ 2013-01-31  1:50 ` Simon Horman
  2013-01-31  1:50 ` [PATCH 2/4] ARM: mach-shmobile: r8a7779: Allow initialisation of GIC by DT Simon Horman
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 20+ messages in thread
From: Simon Horman @ 2013-01-31  1:50 UTC (permalink / raw)
  To: linux-arm-kernel

Use regulators by default

This is in preparation for initialising devices using DT.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm/configs/marzen_defconfig |    2 ++
 1 file changed, 2 insertions(+)

diff --git a/arch/arm/configs/marzen_defconfig b/arch/arm/configs/marzen_defconfig
index 728a43c..afee4a2 100644
--- a/arch/arm/configs/marzen_defconfig
+++ b/arch/arm/configs/marzen_defconfig
@@ -83,6 +83,8 @@ CONFIG_USB=y
 CONFIG_USB_RCAR_PHY=y
 CONFIG_MMC=y
 CONFIG_MMC_SDHI=y
+CONFIG_REGULATOR=y
+CONFIG_REGULATOR_DUMMY=y
 CONFIG_USB=y
 CONFIG_USB_EHCI_HCD=y
 CONFIG_USB_OHCI_HCD=y
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 2/4] ARM: mach-shmobile: r8a7779: Allow initialisation of GIC by DT
  2013-01-31  1:50 ARM: mach-shmobile: r8a7779, marzen: Reference DT implementation Simon Horman
  2013-01-31  1:50 ` [PATCH 1/4] ARM: mach-shmobile: marzen: defconfig: use regulators by default Simon Horman
@ 2013-01-31  1:50 ` Simon Horman
  2013-01-31 12:32   ` Mark Rutland
  2013-01-31  1:50 ` [PATCH 3/4] ARM: mach-shmobile: r8a7779: Minimal setup using DT Simon Horman
  2013-01-31  1:50 ` [PATCH 4/4] ARM: mach-shmobile: marzen: Reference DT implementation Simon Horman
  3 siblings, 1 reply; 20+ messages in thread
From: Simon Horman @ 2013-01-31  1:50 UTC (permalink / raw)
  To: linux-arm-kernel

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

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm/boot/dts/r8a7779.dtsi               |   40 ++++++++++++++++++++++++++
 arch/arm/mach-shmobile/include/mach/common.h |    1 +
 arch/arm/mach-shmobile/intc-r8a7779.c        |   27 +++++++++++++----
 3 files changed, 62 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/boot/dts/r8a7779.dtsi

diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
new file mode 100644
index 0000000..eadc12e
--- /dev/null
+++ b/arch/arm/boot/dts/r8a7779.dtsi
@@ -0,0 +1,40 @@
+/*
+ * Device Tree Source for Renesas r8a7740
+ *
+ * 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.
+ */
+
+/include/ "skeleton.dtsi"
+
+/ {
+	compatible = "renesas,r8a7779";
+
+	cpus {
+		cpu at 0 {
+			compatible = "arm,cortex-a9";
+		};
+		cpu at 1 {
+			compatible = "arm,cortex-a9";
+		};
+		cpu at 2 {
+			compatible = "arm,cortex-a9";
+		};
+		cpu at 3 {
+			compatible = "arm,cortex-a9";
+		};
+	};
+
+        gic: interrupt-controller at f0001000 {
+                compatible = "arm,cortex-a9-gic";
+                #interrupt-cells = <3>;
+                #address-cells = <1>;
+                interrupt-controller;
+                reg = <0xf0001000 0x1000>,
+                      <0xf0000100 0x100>;
+        };
+};
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index 16dab18..8ef7ebb 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -63,6 +63,7 @@ extern void r8a7740_pinmux_init(void);
 extern void r8a7740_pm_init(void);
 
 extern void r8a7779_init_irq(void);
+extern void r8a7779_init_irq_dt(void);
 extern void r8a7779_map_io(void);
 extern void r8a7779_earlytimer_init(void);
 extern void r8a7779_add_early_devices(void);
diff --git a/arch/arm/mach-shmobile/intc-r8a7779.c b/arch/arm/mach-shmobile/intc-r8a7779.c
index 8807c27..f9cc4bc 100644
--- a/arch/arm/mach-shmobile/intc-r8a7779.c
+++ b/arch/arm/mach-shmobile/intc-r8a7779.c
@@ -24,6 +24,7 @@
 #include <linux/io.h>
 #include <linux/irqchip/arm-gic.h>
 #include <mach/common.h>
+#include <linux/irqchip.h>
 #include <mach/intc.h>
 #include <mach/r8a7779.h>
 #include <asm/mach-types.h>
@@ -43,13 +44,8 @@ static int r8a7779_set_wake(struct irq_data *data, unsigned int on)
 	return 0; /* always allow wakeup */
 }
 
-void __init r8a7779_init_irq(void)
+static void __init r8a7779_init_irq_common(void)
 {
-	void __iomem *gic_dist_base = IOMEM(0xf0001000);
-	void __iomem *gic_cpu_base = IOMEM(0xf0000100);
-
-	/* use GIC to handle interrupts */
-	gic_init(0, 29, gic_dist_base, gic_cpu_base);
 	gic_arch_extn.irq_set_wake = r8a7779_set_wake;
 
 	/* route all interrupts to ARM */
@@ -63,3 +59,22 @@ void __init r8a7779_init_irq(void)
 	__raw_writel(0xbffffffc, INT2SMSKCR3);
 	__raw_writel(0x003fee3f, INT2SMSKCR4);
 }
+
+void __init r8a7779_init_irq(void)
+{
+	void __iomem *gic_dist_base = IOMEM(0xf0001000);
+	void __iomem *gic_cpu_base = IOMEM(0xf0000100);
+
+	/* use GIC to handle interrupts */
+	gic_init(0, 29, gic_dist_base, gic_cpu_base);
+
+	r8a7779_init_irq_common();
+}
+
+#ifdef CONFIG_OF
+void __init r8a7779_init_irq_dt(void)
+{
+	irqchip_init();
+	r8a7779_init_irq_common();
+}
+#endif
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 3/4] ARM: mach-shmobile: r8a7779: Minimal setup using DT
  2013-01-31  1:50 ARM: mach-shmobile: r8a7779, marzen: Reference DT implementation Simon Horman
  2013-01-31  1:50 ` [PATCH 1/4] ARM: mach-shmobile: marzen: defconfig: use regulators by default Simon Horman
  2013-01-31  1:50 ` [PATCH 2/4] ARM: mach-shmobile: r8a7779: Allow initialisation of GIC by DT Simon Horman
@ 2013-01-31  1:50 ` Simon Horman
  2013-02-18  9:36   ` Magnus Damm
  2013-02-18 12:22   ` Magnus Damm
  2013-01-31  1:50 ` [PATCH 4/4] ARM: mach-shmobile: marzen: Reference DT implementation Simon Horman
  3 siblings, 2 replies; 20+ messages in thread
From: Simon Horman @ 2013-01-31  1:50 UTC (permalink / raw)
  To: linux-arm-kernel

Allow a minimal setup of the r8a7779 SoC using a flattened device tree.
In particular, configure the i2c and ethernet controllers using a
flattened device tree.

SCI serial controller and TMU 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.

The ethernet controller also requires a regulator which is a board property.
A sample snippet DT for the marzen board is as follows:

/dts-v1/;
/include/ "r8a7779.dtsi"

/ {
	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 {
	vddvario-supply = <&fixedregulator3v3>;
	vdd33a-supply = <&fixedregulator3v3>;
};

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm/boot/dts/r8a7779.dtsi               |   45 ++++++++++++++++++++
 arch/arm/mach-shmobile/include/mach/common.h |    2 +
 arch/arm/mach-shmobile/setup-r8a7779.c       |   58 +++++++++++++++++++++++---
 3 files changed, 99 insertions(+), 6 deletions(-)

diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
index eadc12e..9564040 100644
--- a/arch/arm/boot/dts/r8a7779.dtsi
+++ b/arch/arm/boot/dts/r8a7779.dtsi
@@ -37,4 +37,49 @@
                 reg = <0xf0001000 0x1000>,
                       <0xf0000100 0x100>;
         };
+
+	i2c0: i2c at 0xffc70000 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "renesas,rmobile-iic";
+		reg = <0xffc70000 0x1000>;
+		interrupt-parent = <&gic>;
+		interrupts = <0 79 0x4>;
+	};
+
+	i2c1: i2c at 0xffc71000 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "renesas,rmobile-iic";
+		reg = <0xffc71000 0x1000>;
+		interrupt-parent = <&gic>;
+		interrupts = <0 82 0x4>;
+	};
+
+	i2c2: i2c at 0xffc72000 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "renesas,rmobile-iic";
+		reg = <0xffc72000 0x1000>;
+		interrupt-parent = <&gic>;
+		interrupts = <0 80 0x4>;
+	};
+
+	i2c3: i2c at 0xffc73000 {
+		#address-cells = <1>;
+		#size-cells = <0>;
+		compatible = "renesas,rmobile-iic";
+		reg = <0xffc73000 0x1000>;
+		interrupt-parent = <&gic>;
+		interrupts = <0 81 0x4>;
+	};
+
+	lan0: lan0 at 18000000 {
+		compatible = "smsc,lan9220", "smsc,lan9115";
+		reg = <0x18000000 0x100>;
+		phy-mode = "mii";
+		interrupt-parent = <&gic>;
+		interrupts = <0 28 0x4>;
+		reg-io-width = <4>;
+	};
 };
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index 8ef7ebb..4b85b18 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -67,7 +67,9 @@ extern void r8a7779_init_irq_dt(void);
 extern void r8a7779_map_io(void);
 extern void r8a7779_earlytimer_init(void);
 extern void r8a7779_add_early_devices(void);
+extern void r8a7779_add_early_devices_dt(void);
 extern void r8a7779_add_standard_devices(void);
+extern void r8a7779_add_standard_devices_dt(void);
 extern void r8a7779_clock_init(void);
 extern void r8a7779_pinmux_init(void);
 extern void r8a7779_pm_init(void);
diff --git a/arch/arm/mach-shmobile/setup-r8a7779.c b/arch/arm/mach-shmobile/setup-r8a7779.c
index c54ff9b..d4818c2 100644
--- a/arch/arm/mach-shmobile/setup-r8a7779.c
+++ b/arch/arm/mach-shmobile/setup-r8a7779.c
@@ -321,7 +321,7 @@ static struct platform_device i2c3_device = {
 	.num_resources	= ARRAY_SIZE(rcar_i2c3_res),
 };
 
-static struct platform_device *r8a7779_early_devices[] __initdata = {
+static struct platform_device *r8a7779_early_devices_dt[] __initdata = {
 	&scif0_device,
 	&scif1_device,
 	&scif2_device,
@@ -330,15 +330,15 @@ static struct platform_device *r8a7779_early_devices[] __initdata = {
 	&scif5_device,
 	&tmu00_device,
 	&tmu01_device,
+};
+
+static struct platform_device *r8a7779_early_devices[] __initdata = {
 	&i2c0_device,
 	&i2c1_device,
 	&i2c2_device,
 	&i2c3_device,
 };
 
-static struct platform_device *r8a7779_late_devices[] __initdata = {
-};
-
 void __init r8a7779_add_standard_devices(void)
 {
 #ifdef CONFIG_CACHE_L2X0
@@ -349,10 +349,10 @@ void __init r8a7779_add_standard_devices(void)
 
 	r8a7779_init_pm_domains();
 
+	platform_add_devices(r8a7779_early_devices_dt,
+			    ARRAY_SIZE(r8a7779_early_devices_dt));
 	platform_add_devices(r8a7779_early_devices,
 			    ARRAY_SIZE(r8a7779_early_devices));
-	platform_add_devices(r8a7779_late_devices,
-			    ARRAY_SIZE(r8a7779_late_devices));
 }
 
 /* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
@@ -367,6 +367,8 @@ void __init r8a7779_earlytimer_init(void)
 
 void __init r8a7779_add_early_devices(void)
 {
+	early_platform_add_devices(r8a7779_early_devices_dt,
+				   ARRAY_SIZE(r8a7779_early_devices_dt));
 	early_platform_add_devices(r8a7779_early_devices,
 				   ARRAY_SIZE(r8a7779_early_devices));
 
@@ -386,3 +388,47 @@ void __init r8a7779_add_early_devices(void)
 	 * command line in case of the marzen board.
 	 */
 }
+
+#ifdef CONFIG_USE_OF
+void __init r8a7779_add_early_devices_dt(void)
+{
+	shmobile_setup_delay(1000, 2, 4); /* Cortex-A9 @ 1000MHz */
+
+	early_platform_add_devices(r8a7779_early_devices_dt,
+				   ARRAY_SIZE(r8a7779_early_devices_dt));
+
+	/* Early serial console setup is not included here.
+	 * See comment in r8a7779_add_early_devices().
+	 */
+}
+
+static const struct of_dev_auxdata r8a7779_auxdata_lookup[] __initconst = {
+	{},
+};
+
+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_early_devices_dt,
+			    ARRAY_SIZE(r8a7779_early_devices_dt));
+	of_platform_populate(NULL, of_default_bus_match_table,
+			     r8a7779_auxdata_lookup, NULL);
+}
+
+static const char *r8a7779_compat_dt[] __initdata = {
+	"renesas,r8a7779",
+	NULL,
+};
+
+DT_MACHINE_START(SH73A0_DT, "Generic R8A7779 (Flattened Device Tree)")
+	.map_io		= r8a7779_map_io,
+	.init_early	= r8a7779_add_early_devices_dt,
+	.nr_irqs	= NR_IRQS_LEGACY,
+	.init_irq	= r8a7779_init_irq_dt,
+	.init_machine	= r8a7779_add_standard_devices_dt,
+	.init_time	= shmobile_timer_init,
+	.dt_compat	= r8a7779_compat_dt,
+MACHINE_END
+#endif /* CONFIG_USE_OF */
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 4/4] ARM: mach-shmobile: marzen: Reference DT implementation
  2013-01-31  1:50 ARM: mach-shmobile: r8a7779, marzen: Reference DT implementation Simon Horman
                   ` (2 preceding siblings ...)
  2013-01-31  1:50 ` [PATCH 3/4] ARM: mach-shmobile: r8a7779: Minimal setup using DT Simon Horman
@ 2013-01-31  1:50 ` Simon Horman
  3 siblings, 0 replies; 20+ messages in thread
From: Simon Horman @ 2013-01-31  1:50 UTC (permalink / raw)
  To: linux-arm-kernel

Provide alternate board code for the marzen 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.

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm/boot/dts/Makefile                      |    1 +
 arch/arm/boot/dts/r8a7779-marzen-reference.dts  |   41 +++++++++++++
 arch/arm/mach-shmobile/Kconfig                  |   11 ++++
 arch/arm/mach-shmobile/Makefile                 |    1 +
 arch/arm/mach-shmobile/board-marzen-reference.c |   71 +++++++++++++++++++++++
 5 files changed, 125 insertions(+)
 create mode 100644 arch/arm/boot/dts/r8a7779-marzen-reference.dts
 create mode 100644 arch/arm/mach-shmobile/board-marzen-reference.c

diff --git a/arch/arm/boot/dts/Makefile b/arch/arm/boot/dts/Makefile
index 2c6f9ef..6dfa67a 100644
--- a/arch/arm/boot/dts/Makefile
+++ b/arch/arm/boot/dts/Makefile
@@ -123,6 +123,7 @@ dtb-$(CONFIG_ARCH_U8500) += snowball.dtb \
 dtb-$(CONFIG_ARCH_SHMOBILE) += emev2-kzm9d.dtb \
 	r8a7740-armadillo800eva.dtb \
 	r8a7740-armadillo800eva-reference.dtb \
+	r8a7779-marzen-reference.dtb \
 	sh73a0-kzm9g.dtb \
 	sh73a0-kzm9g-reference.dtb \
 	sh7372-mackerel.dtb \
diff --git a/arch/arm/boot/dts/r8a7779-marzen-reference.dts b/arch/arm/boot/dts/r8a7779-marzen-reference.dts
new file mode 100644
index 0000000..377d8df
--- /dev/null
+++ b/arch/arm/boot/dts/r8a7779-marzen-reference.dts
@@ -0,0 +1,41 @@
+/*
+ * 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"
+
+/ {
+	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";
+	};
+
+	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 {
+	vddvario-supply = <&fixedregulator3v3>;
+	vdd33a-supply = <&fixedregulator3v3>;
+};
diff --git a/arch/arm/mach-shmobile/Kconfig b/arch/arm/mach-shmobile/Kconfig
index 5f61e8f..4695bf8 100644
--- a/arch/arm/mach-shmobile/Kconfig
+++ b/arch/arm/mach-shmobile/Kconfig
@@ -120,6 +120,17 @@ config MACH_MARZEN
 	select ARCH_REQUIRE_GPIOLIB
 	select REGULATOR_FIXED_VOLTAGE if REGULATOR
 
+config MACH_MARZEN_REFERENCE
+	bool "MARZEN board - Reference Device Tree Implementation"
+	depends on MACH_MARZEN
+	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_KZM9D
 	bool "KZM9D board"
 	depends on ARCH_EMEV2
diff --git a/arch/arm/mach-shmobile/Makefile b/arch/arm/mach-shmobile/Makefile
index fd7ec65..6ab7ee2 100644
--- a/arch/arm/mach-shmobile/Makefile
+++ b/arch/arm/mach-shmobile/Makefile
@@ -40,6 +40,7 @@ obj-$(CONFIG_MACH_MACKEREL_REFERENCE)	+= board-mackerel-reference.o
 obj-$(CONFIG_MACH_KOTA2)	+= board-kota2.o
 obj-$(CONFIG_MACH_BONITO)	+= board-bonito.o
 obj-$(CONFIG_MACH_MARZEN)	+= board-marzen.o
+obj-$(CONFIG_MACH_MARZEN_REFERENCE)	+= board-marzen-reference.o
 obj-$(CONFIG_MACH_ARMADILLO800EVA)	+= board-armadillo800eva.o
 obj-$(CONFIG_MACH_ARMADILLO800EVA_REFERENCE)     += board-armadillo800eva-reference.o
 obj-$(CONFIG_MACH_KZM9D)	+= board-kzm9d.o
diff --git a/arch/arm/mach-shmobile/board-marzen-reference.c b/arch/arm/mach-shmobile/board-marzen-reference.c
new file mode 100644
index 0000000..012548f
--- /dev/null
+++ b/arch/arm/mach-shmobile/board-marzen-reference.c
@@ -0,0 +1,71 @@
+/*
+ * marzen board support - Reference DT implementation
+ *
+ * Copyright (C) 2011  Renesas Solutions Corp.
+ * Copyright (C) 2011  Magnus Damm
+ * Copyright (C) 2013  Simon Horman
+ *
+ * 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; version 2 of the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ */
+
+#include <linux/gpio.h>
+#include <mach/r8a7779.h>
+#include <mach/common.h>
+#include <mach/irqs.h>
+#include <asm/mach/arch.h>
+
+static void __init marzen_init(void)
+{
+	r8a7779_pinmux_init();
+
+	/* SCIF2 (CN18: DEBUG0) */
+	gpio_request(GPIO_FN_TX2_C, NULL);
+	gpio_request(GPIO_FN_RX2_C, NULL);
+
+	/* SCIF4 (CN19: DEBUG1) */
+	gpio_request(GPIO_FN_TX4, NULL);
+	gpio_request(GPIO_FN_RX4, NULL);
+
+	/* LAN89218 */
+	gpio_request(GPIO_FN_EX_CS0, NULL); /* nCS */
+	gpio_request(GPIO_FN_IRQ1_B, NULL); /* IRQ + PME */
+
+	/* SD0 (CN20) */
+	gpio_request(GPIO_FN_SD0_CLK, NULL);
+	gpio_request(GPIO_FN_SD0_CMD, NULL);
+	gpio_request(GPIO_FN_SD0_DAT0, NULL);
+	gpio_request(GPIO_FN_SD0_DAT1, NULL);
+	gpio_request(GPIO_FN_SD0_DAT2, NULL);
+	gpio_request(GPIO_FN_SD0_DAT3, NULL);
+	gpio_request(GPIO_FN_SD0_CD, NULL);
+	gpio_request(GPIO_FN_SD0_WP, NULL);
+
+	r8a7779_add_standard_devices_dt();
+}
+
+static const char *marzen_boards_compat_dt[] __initdata = {
+	"renesas,marzen-reference",
+	NULL,
+};
+
+DT_MACHINE_START(MARZEN, "marzen")
+	.smp		= smp_ops(r8a7779_smp_ops),
+	.map_io		= r8a7779_map_io,
+	.init_early	= r8a7779_add_early_devices_dt,
+	.nr_irqs	= NR_IRQS_LEGACY,
+	.init_irq	= r8a7779_init_irq_dt,
+	.init_machine	= marzen_init,
+	.init_time	= shmobile_timer_init,
+	.dt_compat	= marzen_boards_compat_dt,
+MACHINE_END
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 2/4] ARM: mach-shmobile: r8a7779: Allow initialisation of GIC by DT
  2013-01-31  1:50 ` [PATCH 2/4] ARM: mach-shmobile: r8a7779: Allow initialisation of GIC by DT Simon Horman
@ 2013-01-31 12:32   ` Mark Rutland
  2013-02-01  0:11     ` Simon Horman
  0 siblings, 1 reply; 20+ messages in thread
From: Mark Rutland @ 2013-01-31 12:32 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Simon,

On Thu, Jan 31, 2013 at 01:50:49AM +0000, Simon Horman wrote:
> This allows the GIC interrupt controller of the  r8a7779 SoC to be
> initialised using a flattened device tree blob.
> 
> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> ---
>  arch/arm/boot/dts/r8a7779.dtsi               |   40 ++++++++++++++++++++++++++
>  arch/arm/mach-shmobile/include/mach/common.h |    1 +
>  arch/arm/mach-shmobile/intc-r8a7779.c        |   27 +++++++++++++----
>  3 files changed, 62 insertions(+), 6 deletions(-)
>  create mode 100644 arch/arm/boot/dts/r8a7779.dtsi
> 
> diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
> new file mode 100644
> index 0000000..eadc12e
> --- /dev/null
> +++ b/arch/arm/boot/dts/r8a7779.dtsi
> @@ -0,0 +1,40 @@
> +/*
> + * Device Tree Source for Renesas r8a7740
> + *
> + * 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.
> + */
> +
> +/include/ "skeleton.dtsi"
> +
> +/ {
> +	compatible = "renesas,r8a7779";
> +
> +	cpus {
> +		cpu at 0 {
> +			compatible = "arm,cortex-a9";
> +		};
> +		cpu at 1 {
> +			compatible = "arm,cortex-a9";
> +		};
> +		cpu at 2 {
> +			compatible = "arm,cortex-a9";
> +		};
> +		cpu at 3 {
> +			compatible = "arm,cortex-a9";
> +		};
> +	};

Sorry to sound like a broken record, but it'd be good to see reg and
device_type set here.

> +
> +        gic: interrupt-controller at f0001000 {
> +                compatible = "arm,cortex-a9-gic";
> +                #interrupt-cells = <3>;
> +                #address-cells = <1>;

Why is #address-cells needed here (and without #size-cells)? I see it's in the
binding document example, but I can't figure out why.

> +                interrupt-controller;
> +                reg = <0xf0001000 0x1000>,
> +                      <0xf0000100 0x100>;
> +        };
> +};

[...]

Thanks,
Mark.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 2/4] ARM: mach-shmobile: r8a7779: Allow initialisation of GIC by DT
  2013-01-31 12:32   ` Mark Rutland
@ 2013-02-01  0:11     ` Simon Horman
  2013-02-01  0:34       ` Simon Horman
  0 siblings, 1 reply; 20+ messages in thread
From: Simon Horman @ 2013-02-01  0:11 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jan 31, 2013 at 12:32:13PM +0000, Mark Rutland wrote:
> Hi Simon,
> 
> On Thu, Jan 31, 2013 at 01:50:49AM +0000, Simon Horman wrote:
> > This allows the GIC interrupt controller of the  r8a7779 SoC to be
> > initialised using a flattened device tree blob.
> > 
> > Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> > ---
> >  arch/arm/boot/dts/r8a7779.dtsi               |   40 ++++++++++++++++++++++++++
> >  arch/arm/mach-shmobile/include/mach/common.h |    1 +
> >  arch/arm/mach-shmobile/intc-r8a7779.c        |   27 +++++++++++++----
> >  3 files changed, 62 insertions(+), 6 deletions(-)
> >  create mode 100644 arch/arm/boot/dts/r8a7779.dtsi
> > 
> > diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
> > new file mode 100644
> > index 0000000..eadc12e
> > --- /dev/null
> > +++ b/arch/arm/boot/dts/r8a7779.dtsi
> > @@ -0,0 +1,40 @@
> > +/*
> > + * Device Tree Source for Renesas r8a7740
> > + *
> > + * 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.
> > + */
> > +
> > +/include/ "skeleton.dtsi"
> > +
> > +/ {
> > +	compatible = "renesas,r8a7779";
> > +
> > +	cpus {
> > +		cpu at 0 {
> > +			compatible = "arm,cortex-a9";
> > +		};
> > +		cpu at 1 {
> > +			compatible = "arm,cortex-a9";
> > +		};
> > +		cpu at 2 {
> > +			compatible = "arm,cortex-a9";
> > +		};
> > +		cpu at 3 {
> > +			compatible = "arm,cortex-a9";
> > +		};
> > +	};
> 
> Sorry to sound like a broken record, but it'd be good to see reg and
> device_type set here.

Sure, will do.

> > +
> > +        gic: interrupt-controller at f0001000 {
> > +                compatible = "arm,cortex-a9-gic";
> > +                #interrupt-cells = <3>;
> > +                #address-cells = <1>;
> 
> Why is #address-cells needed here (and without #size-cells)? I see it's in the
> binding document example, but I can't figure out why.

Its here because I copied the example.
I will see about removing it from here.

> > +                interrupt-controller;
> > +                reg = <0xf0001000 0x1000>,
> > +                      <0xf0000100 0x100>;
> > +        };
> > +};
> 
> [...]
> 
> Thanks,
> Mark.
> 
> --
> 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
> 

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 2/4] ARM: mach-shmobile: r8a7779: Allow initialisation of GIC by DT
  2013-02-01  0:11     ` Simon Horman
@ 2013-02-01  0:34       ` Simon Horman
  2013-02-01  1:47         ` Simon Horman
  2013-02-01 10:58         ` Mark Rutland
  0 siblings, 2 replies; 20+ messages in thread
From: Simon Horman @ 2013-02-01  0:34 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Feb 01, 2013 at 09:11:19AM +0900, Simon Horman wrote:
> On Thu, Jan 31, 2013 at 12:32:13PM +0000, Mark Rutland wrote:
> > Hi Simon,
> > 
> > On Thu, Jan 31, 2013 at 01:50:49AM +0000, Simon Horman wrote:
> > > This allows the GIC interrupt controller of the  r8a7779 SoC to be
> > > initialised using a flattened device tree blob.
> > > 
> > > Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> > > ---
> > >  arch/arm/boot/dts/r8a7779.dtsi               |   40 ++++++++++++++++++++++++++
> > >  arch/arm/mach-shmobile/include/mach/common.h |    1 +
> > >  arch/arm/mach-shmobile/intc-r8a7779.c        |   27 +++++++++++++----
> > >  3 files changed, 62 insertions(+), 6 deletions(-)
> > >  create mode 100644 arch/arm/boot/dts/r8a7779.dtsi
> > > 
> > > diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
> > > new file mode 100644
> > > index 0000000..eadc12e
> > > --- /dev/null
> > > +++ b/arch/arm/boot/dts/r8a7779.dtsi
> > > @@ -0,0 +1,40 @@
> > > +/*
> > > + * Device Tree Source for Renesas r8a7740
> > > + *
> > > + * 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.
> > > + */
> > > +
> > > +/include/ "skeleton.dtsi"
> > > +
> > > +/ {
> > > +	compatible = "renesas,r8a7779";
> > > +
> > > +	cpus {
> > > +		cpu at 0 {
> > > +			compatible = "arm,cortex-a9";
> > > +		};
> > > +		cpu at 1 {
> > > +			compatible = "arm,cortex-a9";
> > > +		};
> > > +		cpu at 2 {
> > > +			compatible = "arm,cortex-a9";
> > > +		};
> > > +		cpu at 3 {
> > > +			compatible = "arm,cortex-a9";
> > > +		};
> > > +	};
> > 
> > Sorry to sound like a broken record, but it'd be good to see reg and
> > device_type set here.
> 
> Sure, will do.
> 
> > > +
> > > +        gic: interrupt-controller at f0001000 {
> > > +                compatible = "arm,cortex-a9-gic";
> > > +                #interrupt-cells = <3>;
> > > +                #address-cells = <1>;
> > 
> > Why is #address-cells needed here (and without #size-cells)? I see it's in the
> > binding document example, but I can't figure out why.
> 
> Its here because I copied the example.
> I will see about removing it from here.
> 
> > > +                interrupt-controller;
> > > +                reg = <0xf0001000 0x1000>,
> > > +                      <0xf0000100 0x100>;
> > > +        };
> > > +};

A revised patch is below. I should also remove "#address-cells = <1>" from
gic in arch/arm/boot/dts/sh73a0.dtsi if it is indeed unnecessary.


>From f08f5df1bd6e2133232d06b8cfb847424d6d4cc8 Mon Sep 17 00:00:00 2001
From: Simon Horman <horms+renesas@verge.net.au>
Date: Tue, 29 Jan 2013 14:21:46 +0900
Subject: [PATCH] ARM: mach-shmobile: r8a7779: Allow initialisation of GIC by
 DT

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

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
---
 arch/arm/boot/dts/r8a7779.dtsi               |   50 ++++++++++++++++++++++++++
 arch/arm/mach-shmobile/include/mach/common.h |    1 +
 arch/arm/mach-shmobile/intc-r8a7779.c        |   27 ++++++++++----
 3 files changed, 72 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/boot/dts/r8a7779.dtsi

v2
As suggested by Mark Rutland
* Add reg and device_type to cpus
* Remove #address-cells from gic

diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
new file mode 100644
index 0000000..d1fde48
--- /dev/null
+++ b/arch/arm/boot/dts/r8a7779.dtsi
@@ -0,0 +1,50 @@
+/*
+ * Device Tree Source for Renesas r8a7740
+ *
+ * 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.
+ */
+
+/include/ "skeleton.dtsi"
+
+/ {
+	compatible = "renesas,r8a7779";
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		cpu at 0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a9";
+			reg = <0>;
+		};
+		cpu at 1 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a9";
+			reg = <0>;
+		};
+		cpu at 2 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a9";
+			reg = <0>;
+		};
+		cpu at 3 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a9";
+			reg = <0>;
+		};
+	};
+
+        gic: interrupt-controller at f0001000 {
+                compatible = "arm,cortex-a9-gic";
+                #interrupt-cells = <3>;
+                interrupt-controller;
+                reg = <0xf0001000 0x1000>,
+                      <0xf0000100 0x100>;
+        };
+};
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index 16dab18..8ef7ebb 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -63,6 +63,7 @@ extern void r8a7740_pinmux_init(void);
 extern void r8a7740_pm_init(void);
 
 extern void r8a7779_init_irq(void);
+extern void r8a7779_init_irq_dt(void);
 extern void r8a7779_map_io(void);
 extern void r8a7779_earlytimer_init(void);
 extern void r8a7779_add_early_devices(void);
diff --git a/arch/arm/mach-shmobile/intc-r8a7779.c b/arch/arm/mach-shmobile/intc-r8a7779.c
index 8807c27..f9cc4bc 100644
--- a/arch/arm/mach-shmobile/intc-r8a7779.c
+++ b/arch/arm/mach-shmobile/intc-r8a7779.c
@@ -24,6 +24,7 @@
 #include <linux/io.h>
 #include <linux/irqchip/arm-gic.h>
 #include <mach/common.h>
+#include <linux/irqchip.h>
 #include <mach/intc.h>
 #include <mach/r8a7779.h>
 #include <asm/mach-types.h>
@@ -43,13 +44,8 @@ static int r8a7779_set_wake(struct irq_data *data, unsigned int on)
 	return 0; /* always allow wakeup */
 }
 
-void __init r8a7779_init_irq(void)
+static void __init r8a7779_init_irq_common(void)
 {
-	void __iomem *gic_dist_base = IOMEM(0xf0001000);
-	void __iomem *gic_cpu_base = IOMEM(0xf0000100);
-
-	/* use GIC to handle interrupts */
-	gic_init(0, 29, gic_dist_base, gic_cpu_base);
 	gic_arch_extn.irq_set_wake = r8a7779_set_wake;
 
 	/* route all interrupts to ARM */
@@ -63,3 +59,22 @@ void __init r8a7779_init_irq(void)
 	__raw_writel(0xbffffffc, INT2SMSKCR3);
 	__raw_writel(0x003fee3f, INT2SMSKCR4);
 }
+
+void __init r8a7779_init_irq(void)
+{
+	void __iomem *gic_dist_base = IOMEM(0xf0001000);
+	void __iomem *gic_cpu_base = IOMEM(0xf0000100);
+
+	/* use GIC to handle interrupts */
+	gic_init(0, 29, gic_dist_base, gic_cpu_base);
+
+	r8a7779_init_irq_common();
+}
+
+#ifdef CONFIG_OF
+void __init r8a7779_init_irq_dt(void)
+{
+	irqchip_init();
+	r8a7779_init_irq_common();
+}
+#endif
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 2/4] ARM: mach-shmobile: r8a7779: Allow initialisation of GIC by DT
  2013-02-01  0:34       ` Simon Horman
@ 2013-02-01  1:47         ` Simon Horman
  2013-02-01  4:39           ` Simon Horman
  2013-02-01 10:58         ` Mark Rutland
  1 sibling, 1 reply; 20+ messages in thread
From: Simon Horman @ 2013-02-01  1:47 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Feb 01, 2013 at 09:34:10AM +0900, Simon Horman wrote:
> On Fri, Feb 01, 2013 at 09:11:19AM +0900, Simon Horman wrote:
> > On Thu, Jan 31, 2013 at 12:32:13PM +0000, Mark Rutland wrote:
> > > Hi Simon,
> > > 
> > > On Thu, Jan 31, 2013 at 01:50:49AM +0000, Simon Horman wrote:
> > > > This allows the GIC interrupt controller of the  r8a7779 SoC to be
> > > > initialised using a flattened device tree blob.
> > > > 
> > > > Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> > > > ---
> > > >  arch/arm/boot/dts/r8a7779.dtsi               |   40 ++++++++++++++++++++++++++
> > > >  arch/arm/mach-shmobile/include/mach/common.h |    1 +
> > > >  arch/arm/mach-shmobile/intc-r8a7779.c        |   27 +++++++++++++----
> > > >  3 files changed, 62 insertions(+), 6 deletions(-)
> > > >  create mode 100644 arch/arm/boot/dts/r8a7779.dtsi
> > > > 
> > > > diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
> > > > new file mode 100644
> > > > index 0000000..eadc12e
> > > > --- /dev/null
> > > > +++ b/arch/arm/boot/dts/r8a7779.dtsi
> > > > @@ -0,0 +1,40 @@
> > > > +/*
> > > > + * Device Tree Source for Renesas r8a7740
> > > > + *
> > > > + * 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.
> > > > + */
> > > > +
> > > > +/include/ "skeleton.dtsi"
> > > > +
> > > > +/ {
> > > > +	compatible = "renesas,r8a7779";
> > > > +
> > > > +	cpus {
> > > > +		cpu at 0 {
> > > > +			compatible = "arm,cortex-a9";
> > > > +		};
> > > > +		cpu at 1 {
> > > > +			compatible = "arm,cortex-a9";
> > > > +		};
> > > > +		cpu at 2 {
> > > > +			compatible = "arm,cortex-a9";
> > > > +		};
> > > > +		cpu at 3 {
> > > > +			compatible = "arm,cortex-a9";
> > > > +		};
> > > > +	};
> > > 
> > > Sorry to sound like a broken record, but it'd be good to see reg and
> > > device_type set here.
> > 
> > Sure, will do.
> > 
> > > > +
> > > > +        gic: interrupt-controller at f0001000 {
> > > > +                compatible = "arm,cortex-a9-gic";
> > > > +                #interrupt-cells = <3>;
> > > > +                #address-cells = <1>;
> > > 
> > > Why is #address-cells needed here (and without #size-cells)? I see it's in the
> > > binding document example, but I can't figure out why.
> > 
> > Its here because I copied the example.
> > I will see about removing it from here.
> > 
> > > > +                interrupt-controller;
> > > > +                reg = <0xf0001000 0x1000>,
> > > > +                      <0xf0000100 0x100>;
> > > > +        };
> > > > +};
> 
> A revised patch is below. I should also remove "#address-cells = <1>" from
> gic in arch/arm/boot/dts/sh73a0.dtsi if it is indeed unnecessary.
> 
> 
> >From f08f5df1bd6e2133232d06b8cfb847424d6d4cc8 Mon Sep 17 00:00:00 2001
> From: Simon Horman <horms+renesas@verge.net.au>
> Date: Tue, 29 Jan 2013 14:21:46 +0900
> Subject: [PATCH] ARM: mach-shmobile: r8a7779: Allow initialisation of GIC by
>  DT
> 
> This allows the GIC interrupt controller of the  r8a7779 SoC to be
> initialised using a flattened device tree blob.
> 
> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> ---
>  arch/arm/boot/dts/r8a7779.dtsi               |   50 ++++++++++++++++++++++++++
>  arch/arm/mach-shmobile/include/mach/common.h |    1 +
>  arch/arm/mach-shmobile/intc-r8a7779.c        |   27 ++++++++++----
>  3 files changed, 72 insertions(+), 6 deletions(-)
>  create mode 100644 arch/arm/boot/dts/r8a7779.dtsi
> 
> v2
> As suggested by Mark Rutland
> * Add reg and device_type to cpus
> * Remove #address-cells from gic
> 
> diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
> new file mode 100644
> index 0000000..d1fde48
> --- /dev/null
> +++ b/arch/arm/boot/dts/r8a7779.dtsi
> @@ -0,0 +1,50 @@
> +/*
> + * Device Tree Source for Renesas r8a7740
> + *
> + * 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.
> + */
> +
> +/include/ "skeleton.dtsi"
> +
> +/ {
> +	compatible = "renesas,r8a7779";
> +
> +	cpus {
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +
> +		cpu at 0 {
> +			device_type = "cpu";
> +			compatible = "arm,cortex-a9";
> +			reg = <0>;
> +		};
> +		cpu at 1 {
> +			device_type = "cpu";
> +			compatible = "arm,cortex-a9";
> +			reg = <0>;
> +		};
> +		cpu at 2 {
> +			device_type = "cpu";
> +			compatible = "arm,cortex-a9";
> +			reg = <0>;
> +		};
> +		cpu at 3 {
> +			device_type = "cpu";
> +			compatible = "arm,cortex-a9";
> +			reg = <0>;
> +		};
> +	};

Sorry, the above reg values are rubbish. I'll fix them and repost.

> +
> +        gic: interrupt-controller at f0001000 {
> +                compatible = "arm,cortex-a9-gic";
> +                #interrupt-cells = <3>;
> +                interrupt-controller;
> +                reg = <0xf0001000 0x1000>,
> +                      <0xf0000100 0x100>;
> +        };
> +};
> diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
> index 16dab18..8ef7ebb 100644
> --- a/arch/arm/mach-shmobile/include/mach/common.h
> +++ b/arch/arm/mach-shmobile/include/mach/common.h
> @@ -63,6 +63,7 @@ extern void r8a7740_pinmux_init(void);
>  extern void r8a7740_pm_init(void);
>  
>  extern void r8a7779_init_irq(void);
> +extern void r8a7779_init_irq_dt(void);
>  extern void r8a7779_map_io(void);
>  extern void r8a7779_earlytimer_init(void);
>  extern void r8a7779_add_early_devices(void);
> diff --git a/arch/arm/mach-shmobile/intc-r8a7779.c b/arch/arm/mach-shmobile/intc-r8a7779.c
> index 8807c27..f9cc4bc 100644
> --- a/arch/arm/mach-shmobile/intc-r8a7779.c
> +++ b/arch/arm/mach-shmobile/intc-r8a7779.c
> @@ -24,6 +24,7 @@
>  #include <linux/io.h>
>  #include <linux/irqchip/arm-gic.h>
>  #include <mach/common.h>
> +#include <linux/irqchip.h>
>  #include <mach/intc.h>
>  #include <mach/r8a7779.h>
>  #include <asm/mach-types.h>
> @@ -43,13 +44,8 @@ static int r8a7779_set_wake(struct irq_data *data, unsigned int on)
>  	return 0; /* always allow wakeup */
>  }
>  
> -void __init r8a7779_init_irq(void)
> +static void __init r8a7779_init_irq_common(void)
>  {
> -	void __iomem *gic_dist_base = IOMEM(0xf0001000);
> -	void __iomem *gic_cpu_base = IOMEM(0xf0000100);
> -
> -	/* use GIC to handle interrupts */
> -	gic_init(0, 29, gic_dist_base, gic_cpu_base);
>  	gic_arch_extn.irq_set_wake = r8a7779_set_wake;
>  
>  	/* route all interrupts to ARM */
> @@ -63,3 +59,22 @@ void __init r8a7779_init_irq(void)
>  	__raw_writel(0xbffffffc, INT2SMSKCR3);
>  	__raw_writel(0x003fee3f, INT2SMSKCR4);
>  }
> +
> +void __init r8a7779_init_irq(void)
> +{
> +	void __iomem *gic_dist_base = IOMEM(0xf0001000);
> +	void __iomem *gic_cpu_base = IOMEM(0xf0000100);
> +
> +	/* use GIC to handle interrupts */
> +	gic_init(0, 29, gic_dist_base, gic_cpu_base);
> +
> +	r8a7779_init_irq_common();
> +}
> +
> +#ifdef CONFIG_OF
> +void __init r8a7779_init_irq_dt(void)
> +{
> +	irqchip_init();
> +	r8a7779_init_irq_common();
> +}
> +#endif
> -- 
> 1.7.10.4
> 

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 2/4] ARM: mach-shmobile: r8a7779: Allow initialisation of GIC by DT
  2013-02-01  1:47         ` Simon Horman
@ 2013-02-01  4:39           ` Simon Horman
  2013-02-01 11:31             ` Mark Rutland
  0 siblings, 1 reply; 20+ messages in thread
From: Simon Horman @ 2013-02-01  4:39 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Feb 01, 2013 at 10:47:06AM +0900, Simon Horman wrote:
> On Fri, Feb 01, 2013 at 09:34:10AM +0900, Simon Horman wrote:
> > On Fri, Feb 01, 2013 at 09:11:19AM +0900, Simon Horman wrote:
> > > On Thu, Jan 31, 2013 at 12:32:13PM +0000, Mark Rutland wrote:
> > > > Hi Simon,
> > > > 
> > > > On Thu, Jan 31, 2013 at 01:50:49AM +0000, Simon Horman wrote:
> > > > > This allows the GIC interrupt controller of the  r8a7779 SoC to be
> > > > > initialised using a flattened device tree blob.
> > > > > 
> > > > > Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> > > > > ---
> > > > >  arch/arm/boot/dts/r8a7779.dtsi               |   40 ++++++++++++++++++++++++++
> > > > >  arch/arm/mach-shmobile/include/mach/common.h |    1 +
> > > > >  arch/arm/mach-shmobile/intc-r8a7779.c        |   27 +++++++++++++----
> > > > >  3 files changed, 62 insertions(+), 6 deletions(-)
> > > > >  create mode 100644 arch/arm/boot/dts/r8a7779.dtsi
> > > > > 
> > > > > diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
> > > > > new file mode 100644
> > > > > index 0000000..eadc12e
> > > > > --- /dev/null
> > > > > +++ b/arch/arm/boot/dts/r8a7779.dtsi
> > > > > @@ -0,0 +1,40 @@
> > > > > +/*
> > > > > + * Device Tree Source for Renesas r8a7740
> > > > > + *
> > > > > + * 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.
> > > > > + */
> > > > > +
> > > > > +/include/ "skeleton.dtsi"
> > > > > +
> > > > > +/ {
> > > > > +	compatible = "renesas,r8a7779";
> > > > > +
> > > > > +	cpus {
> > > > > +		cpu at 0 {
> > > > > +			compatible = "arm,cortex-a9";
> > > > > +		};
> > > > > +		cpu at 1 {
> > > > > +			compatible = "arm,cortex-a9";
> > > > > +		};
> > > > > +		cpu at 2 {
> > > > > +			compatible = "arm,cortex-a9";
> > > > > +		};
> > > > > +		cpu at 3 {
> > > > > +			compatible = "arm,cortex-a9";
> > > > > +		};
> > > > > +	};
> > > > 
> > > > Sorry to sound like a broken record, but it'd be good to see reg and
> > > > device_type set here.
> > > 
> > > Sure, will do.
> > > 
> > > > > +
> > > > > +        gic: interrupt-controller at f0001000 {
> > > > > +                compatible = "arm,cortex-a9-gic";
> > > > > +                #interrupt-cells = <3>;
> > > > > +                #address-cells = <1>;
> > > > 
> > > > Why is #address-cells needed here (and without #size-cells)? I see it's in the
> > > > binding document example, but I can't figure out why.
> > > 
> > > Its here because I copied the example.
> > > I will see about removing it from here.
> > > 
> > > > > +                interrupt-controller;
> > > > > +                reg = <0xf0001000 0x1000>,
> > > > > +                      <0xf0000100 0x100>;
> > > > > +        };
> > > > > +};
> > 
> > A revised patch is below. I should also remove "#address-cells = <1>" from
> > gic in arch/arm/boot/dts/sh73a0.dtsi if it is indeed unnecessary.

One more time:

>From 6031d5177193431a57392dfd2f38be0676bdb535 Mon Sep 17 00:00:00 2001
From: Simon Horman <horms+renesas@verge.net.au>
Date: Tue, 29 Jan 2013 14:21:46 +0900
Subject: [PATCH] ARM: mach-shmobile: r8a7779: Allow initialisation of GIC by
 DT

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

Signed-off-by: Simon Horman <horms+renesas@verge.net.au>

---

v3
* Fix copy-paste error and use unique reg values for each CPU

v2
As suggested by Mark Rutland
* Add reg and device_type to cpus
* Remove #address-cells from gic
---
 arch/arm/boot/dts/r8a7779.dtsi               |   50 ++++++++++++++++++++++++++
 arch/arm/mach-shmobile/include/mach/common.h |    1 +
 arch/arm/mach-shmobile/intc-r8a7779.c        |   27 ++++++++++----
 3 files changed, 72 insertions(+), 6 deletions(-)
 create mode 100644 arch/arm/boot/dts/r8a7779.dtsi

diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
new file mode 100644
index 0000000..8c6d52c
--- /dev/null
+++ b/arch/arm/boot/dts/r8a7779.dtsi
@@ -0,0 +1,50 @@
+/*
+ * Device Tree Source for Renesas r8a7740
+ *
+ * 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.
+ */
+
+/include/ "skeleton.dtsi"
+
+/ {
+	compatible = "renesas,r8a7779";
+
+	cpus {
+		#address-cells = <1>;
+		#size-cells = <0>;
+
+		cpu at 0 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a9";
+			reg = <0>;
+		};
+		cpu at 1 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a9";
+			reg = <1>;
+		};
+		cpu at 2 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a9";
+			reg = <2>;
+		};
+		cpu at 3 {
+			device_type = "cpu";
+			compatible = "arm,cortex-a9";
+			reg = <3>;
+		};
+	};
+
+        gic: interrupt-controller at f0001000 {
+                compatible = "arm,cortex-a9-gic";
+                #interrupt-cells = <3>;
+                interrupt-controller;
+                reg = <0xf0001000 0x1000>,
+                      <0xf0000100 0x100>;
+        };
+};
diff --git a/arch/arm/mach-shmobile/include/mach/common.h b/arch/arm/mach-shmobile/include/mach/common.h
index 16dab18..8ef7ebb 100644
--- a/arch/arm/mach-shmobile/include/mach/common.h
+++ b/arch/arm/mach-shmobile/include/mach/common.h
@@ -63,6 +63,7 @@ extern void r8a7740_pinmux_init(void);
 extern void r8a7740_pm_init(void);
 
 extern void r8a7779_init_irq(void);
+extern void r8a7779_init_irq_dt(void);
 extern void r8a7779_map_io(void);
 extern void r8a7779_earlytimer_init(void);
 extern void r8a7779_add_early_devices(void);
diff --git a/arch/arm/mach-shmobile/intc-r8a7779.c b/arch/arm/mach-shmobile/intc-r8a7779.c
index 8807c27..f9cc4bc 100644
--- a/arch/arm/mach-shmobile/intc-r8a7779.c
+++ b/arch/arm/mach-shmobile/intc-r8a7779.c
@@ -24,6 +24,7 @@
 #include <linux/io.h>
 #include <linux/irqchip/arm-gic.h>
 #include <mach/common.h>
+#include <linux/irqchip.h>
 #include <mach/intc.h>
 #include <mach/r8a7779.h>
 #include <asm/mach-types.h>
@@ -43,13 +44,8 @@ static int r8a7779_set_wake(struct irq_data *data, unsigned int on)
 	return 0; /* always allow wakeup */
 }
 
-void __init r8a7779_init_irq(void)
+static void __init r8a7779_init_irq_common(void)
 {
-	void __iomem *gic_dist_base = IOMEM(0xf0001000);
-	void __iomem *gic_cpu_base = IOMEM(0xf0000100);
-
-	/* use GIC to handle interrupts */
-	gic_init(0, 29, gic_dist_base, gic_cpu_base);
 	gic_arch_extn.irq_set_wake = r8a7779_set_wake;
 
 	/* route all interrupts to ARM */
@@ -63,3 +59,22 @@ void __init r8a7779_init_irq(void)
 	__raw_writel(0xbffffffc, INT2SMSKCR3);
 	__raw_writel(0x003fee3f, INT2SMSKCR4);
 }
+
+void __init r8a7779_init_irq(void)
+{
+	void __iomem *gic_dist_base = IOMEM(0xf0001000);
+	void __iomem *gic_cpu_base = IOMEM(0xf0000100);
+
+	/* use GIC to handle interrupts */
+	gic_init(0, 29, gic_dist_base, gic_cpu_base);
+
+	r8a7779_init_irq_common();
+}
+
+#ifdef CONFIG_OF
+void __init r8a7779_init_irq_dt(void)
+{
+	irqchip_init();
+	r8a7779_init_irq_common();
+}
+#endif
-- 
1.7.10.4

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 2/4] ARM: mach-shmobile: r8a7779: Allow initialisation of GIC by DT
  2013-02-01  0:34       ` Simon Horman
  2013-02-01  1:47         ` Simon Horman
@ 2013-02-01 10:58         ` Mark Rutland
  2013-02-01 14:15           ` Rob Herring
  1 sibling, 1 reply; 20+ messages in thread
From: Mark Rutland @ 2013-02-01 10:58 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Feb 01, 2013 at 12:34:10AM +0000, Simon Horman wrote:
> On Fri, Feb 01, 2013 at 09:11:19AM +0900, Simon Horman wrote:
> > On Thu, Jan 31, 2013 at 12:32:13PM +0000, Mark Rutland wrote:
> > > Hi Simon,
> > > 
> > > On Thu, Jan 31, 2013 at 01:50:49AM +0000, Simon Horman wrote:
> > > > This allows the GIC interrupt controller of the  r8a7779 SoC to be
> > > > initialised using a flattened device tree blob.
> > > > 
> > > > Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> > > > ---
> > > >  arch/arm/boot/dts/r8a7779.dtsi               |   40 ++++++++++++++++++++++++++
> > > >  arch/arm/mach-shmobile/include/mach/common.h |    1 +
> > > >  arch/arm/mach-shmobile/intc-r8a7779.c        |   27 +++++++++++++----
> > > >  3 files changed, 62 insertions(+), 6 deletions(-)
> > > >  create mode 100644 arch/arm/boot/dts/r8a7779.dtsi
> > > > 
> > > > diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
> > > > new file mode 100644
> > > > index 0000000..eadc12e
> > > > --- /dev/null
> > > > +++ b/arch/arm/boot/dts/r8a7779.dtsi
> > > > @@ -0,0 +1,40 @@
> > > > +/*
> > > > + * Device Tree Source for Renesas r8a7740
> > > > + *
> > > > + * 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.
> > > > + */
> > > > +
> > > > +/include/ "skeleton.dtsi"
> > > > +
> > > > +/ {
> > > > +	compatible = "renesas,r8a7779";
> > > > +
> > > > +	cpus {
> > > > +		cpu at 0 {
> > > > +			compatible = "arm,cortex-a9";
> > > > +		};
> > > > +		cpu at 1 {
> > > > +			compatible = "arm,cortex-a9";
> > > > +		};
> > > > +		cpu at 2 {
> > > > +			compatible = "arm,cortex-a9";
> > > > +		};
> > > > +		cpu at 3 {
> > > > +			compatible = "arm,cortex-a9";
> > > > +		};
> > > > +	};
> > > 
> > > Sorry to sound like a broken record, but it'd be good to see reg and
> > > device_type set here.
> > 
> > Sure, will do.
> > 
> > > > +
> > > > +        gic: interrupt-controller at f0001000 {
> > > > +                compatible = "arm,cortex-a9-gic";
> > > > +                #interrupt-cells = <3>;
> > > > +                #address-cells = <1>;
> > > 
> > > Why is #address-cells needed here (and without #size-cells)? I see it's in the
> > > binding document example, but I can't figure out why.
> > 
> > Its here because I copied the example.
> > I will see about removing it from here.

Rob, Grant, do either of you know if there's a reason for this that we've
missed?

The gic doesn't have any direct children, and this doesn't seem to be
some decvicetree interrupt-controller magic.

If this is superfluous, how about the patch below?

I took a quick look at arch/arm/boot/dts/. Some gic nodes don't have
#address-cells, some have it but not #size-cells, and some have both. These
should probably be cleaned up too.

[...]

Thanks,
Mark.

---->8----

>From dc734edb8040513785429c11e40a420870dc55a4 Mon Sep 17 00:00:00 2001
From: Mark Rutland <mark.rutland@arm.com>
Date: Fri, 1 Feb 2013 10:18:05 +0000
Subject: [PATCH] Docs: gic: remove #address-cells from example

The gic has no child nodes, and so doesn't need #address-cells. Having
the property defined in the example only serves as a source of
confusion.

Signed-off-by: Mark Rutland <mark.rutland@arm.com>
---
 Documentation/devicetree/bindings/arm/gic.txt | 1 -
 1 file changed, 1 deletion(-)

diff --git a/Documentation/devicetree/bindings/arm/gic.txt b/Documentation/devicetree/bindings/arm/gic.txt
index 62eb8df..45b99ab 100644
--- a/Documentation/devicetree/bindings/arm/gic.txt
+++ b/Documentation/devicetree/bindings/arm/gic.txt
@@ -54,7 +54,6 @@ Example:
 	intc: interrupt-controller at fff11000 {
 		compatible = "arm,cortex-a9-gic";
 		#interrupt-cells = <3>;
-		#address-cells = <1>;
 		interrupt-controller;
 		reg = <0xfff11000 0x1000>,
 		      <0xfff10100 0x100>;
-- 
1.8.1.1

^ permalink raw reply related	[flat|nested] 20+ messages in thread

* [PATCH 2/4] ARM: mach-shmobile: r8a7779: Allow initialisation of GIC by DT
  2013-02-01  4:39           ` Simon Horman
@ 2013-02-01 11:31             ` Mark Rutland
  0 siblings, 0 replies; 20+ messages in thread
From: Mark Rutland @ 2013-02-01 11:31 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Feb 01, 2013 at 04:39:31AM +0000, Simon Horman wrote:
> On Fri, Feb 01, 2013 at 10:47:06AM +0900, Simon Horman wrote:
> > On Fri, Feb 01, 2013 at 09:34:10AM +0900, Simon Horman wrote:
> > > On Fri, Feb 01, 2013 at 09:11:19AM +0900, Simon Horman wrote:
> > > > On Thu, Jan 31, 2013 at 12:32:13PM +0000, Mark Rutland wrote:
> > > > > Hi Simon,
> > > > > 
> > > > > On Thu, Jan 31, 2013 at 01:50:49AM +0000, Simon Horman wrote:
> > > > > > This allows the GIC interrupt controller of the  r8a7779 SoC to be
> > > > > > initialised using a flattened device tree blob.
> > > > > > 
> > > > > > Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> > > > > > ---
> > > > > >  arch/arm/boot/dts/r8a7779.dtsi               |   40 ++++++++++++++++++++++++++
> > > > > >  arch/arm/mach-shmobile/include/mach/common.h |    1 +
> > > > > >  arch/arm/mach-shmobile/intc-r8a7779.c        |   27 +++++++++++++----
> > > > > >  3 files changed, 62 insertions(+), 6 deletions(-)
> > > > > >  create mode 100644 arch/arm/boot/dts/r8a7779.dtsi
> > > > > > 
> > > > > > diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
> > > > > > new file mode 100644
> > > > > > index 0000000..eadc12e
> > > > > > --- /dev/null
> > > > > > +++ b/arch/arm/boot/dts/r8a7779.dtsi
> > > > > > @@ -0,0 +1,40 @@
> > > > > > +/*
> > > > > > + * Device Tree Source for Renesas r8a7740
> > > > > > + *
> > > > > > + * 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.
> > > > > > + */
> > > > > > +
> > > > > > +/include/ "skeleton.dtsi"
> > > > > > +
> > > > > > +/ {
> > > > > > +	compatible = "renesas,r8a7779";
> > > > > > +
> > > > > > +	cpus {
> > > > > > +		cpu at 0 {
> > > > > > +			compatible = "arm,cortex-a9";
> > > > > > +		};
> > > > > > +		cpu at 1 {
> > > > > > +			compatible = "arm,cortex-a9";
> > > > > > +		};
> > > > > > +		cpu at 2 {
> > > > > > +			compatible = "arm,cortex-a9";
> > > > > > +		};
> > > > > > +		cpu at 3 {
> > > > > > +			compatible = "arm,cortex-a9";
> > > > > > +		};
> > > > > > +	};
> > > > > 
> > > > > Sorry to sound like a broken record, but it'd be good to see reg and
> > > > > device_type set here.
> > > > 
> > > > Sure, will do.
> > > > 
> > > > > > +
> > > > > > +        gic: interrupt-controller at f0001000 {
> > > > > > +                compatible = "arm,cortex-a9-gic";
> > > > > > +                #interrupt-cells = <3>;
> > > > > > +                #address-cells = <1>;
> > > > > 
> > > > > Why is #address-cells needed here (and without #size-cells)? I see it's in the
> > > > > binding document example, but I can't figure out why.
> > > > 
> > > > Its here because I copied the example.
> > > > I will see about removing it from here.
> > > > 
> > > > > > +                interrupt-controller;
> > > > > > +                reg = <0xf0001000 0x1000>,
> > > > > > +                      <0xf0000100 0x100>;
> > > > > > +        };
> > > > > > +};
> > > 
> > > A revised patch is below. I should also remove "#address-cells = <1>" from
> > > gic in arch/arm/boot/dts/sh73a0.dtsi if it is indeed unnecessary.

I just poked Rob and Grant in another subthread. Hopefully they'll be able to
tell us if there's something we missed.

> 
> One more time:
> 
> From 6031d5177193431a57392dfd2f38be0676bdb535 Mon Sep 17 00:00:00 2001
> From: Simon Horman <horms+renesas@verge.net.au>
> Date: Tue, 29 Jan 2013 14:21:46 +0900
> Subject: [PATCH] ARM: mach-shmobile: r8a7779: Allow initialisation of GIC by
>  DT
> 
> This allows the GIC interrupt controller of the  r8a7779 SoC to be
> initialised using a flattened device tree blob.
> 
> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> 
> ---
> 
> v3
> * Fix copy-paste error and use unique reg values for each CPU
> 
> v2
> As suggested by Mark Rutland
> * Add reg and device_type to cpus
> * Remove #address-cells from gic
> ---
>  arch/arm/boot/dts/r8a7779.dtsi               |   50 ++++++++++++++++++++++++++
>  arch/arm/mach-shmobile/include/mach/common.h |    1 +
>  arch/arm/mach-shmobile/intc-r8a7779.c        |   27 ++++++++++----
>  3 files changed, 72 insertions(+), 6 deletions(-)
>  create mode 100644 arch/arm/boot/dts/r8a7779.dtsi
> 
> diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
> new file mode 100644
> index 0000000..8c6d52c
> --- /dev/null
> +++ b/arch/arm/boot/dts/r8a7779.dtsi
> @@ -0,0 +1,50 @@
> +/*
> + * Device Tree Source for Renesas r8a7740
> + *
> + * 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.
> + */
> +
> +/include/ "skeleton.dtsi"
> +
> +/ {
> +	compatible = "renesas,r8a7779";
> +
> +	cpus {
> +		#address-cells = <1>;
> +		#size-cells = <0>;
> +
> +		cpu at 0 {
> +			device_type = "cpu";
> +			compatible = "arm,cortex-a9";
> +			reg = <0>;
> +		};
> +		cpu at 1 {
> +			device_type = "cpu";
> +			compatible = "arm,cortex-a9";
> +			reg = <1>;
> +		};
> +		cpu at 2 {
> +			device_type = "cpu";
> +			compatible = "arm,cortex-a9";
> +			reg = <2>;
> +		};
> +		cpu at 3 {
> +			device_type = "cpu";
> +			compatible = "arm,cortex-a9";
> +			reg = <3>;
> +		};
> +	};
> +
> +        gic: interrupt-controller at f0001000 {
> +                compatible = "arm,cortex-a9-gic";
> +                #interrupt-cells = <3>;
> +                interrupt-controller;
> +                reg = <0xf0001000 0x1000>,
> +                      <0xf0000100 0x100>;
> +        };
> +};

Thanks, this looks much better now! :)

For the dtsi: Reviewed-by: Mark Rutland <mark.rutland@arm.com>

Thanks,
Mark.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 2/4] ARM: mach-shmobile: r8a7779: Allow initialisation of GIC by DT
  2013-02-01 10:58         ` Mark Rutland
@ 2013-02-01 14:15           ` Rob Herring
  2013-02-04 17:37             ` Mark Rutland
  0 siblings, 1 reply; 20+ messages in thread
From: Rob Herring @ 2013-02-01 14:15 UTC (permalink / raw)
  To: linux-arm-kernel

On 02/01/2013 04:58 AM, Mark Rutland wrote:
> On Fri, Feb 01, 2013 at 12:34:10AM +0000, Simon Horman wrote:
>> On Fri, Feb 01, 2013 at 09:11:19AM +0900, Simon Horman wrote:
>>> On Thu, Jan 31, 2013 at 12:32:13PM +0000, Mark Rutland wrote:
>>>> Hi Simon,
>>>>
>>>> On Thu, Jan 31, 2013 at 01:50:49AM +0000, Simon Horman wrote:

>>>>> +
>>>>> +        gic: interrupt-controller at f0001000 {
>>>>> +                compatible = "arm,cortex-a9-gic";
>>>>> +                #interrupt-cells = <3>;
>>>>> +                #address-cells = <1>;
>>>>
>>>> Why is #address-cells needed here (and without #size-cells)? I see it's in the
>>>> binding document example, but I can't figure out why.
>>>
>>> Its here because I copied the example.
>>> I will see about removing it from here.
> 
> Rob, Grant, do either of you know if there's a reason for this that we've
> missed?
> 
> The gic doesn't have any direct children, and this doesn't seem to be
> some decvicetree interrupt-controller magic.

If you look at of_irq_map_raw, there are cases that look at
#address-cells. Those appear to be only when you have an interrupt-map
though.
> 
> If this is superfluous, how about the patch below?

The docs probably should state #addr-cells is only required with
interrupt-map.

> 
> I took a quick look at arch/arm/boot/dts/. Some gic nodes don't have
> #address-cells, some have it but not #size-cells, and some have both. These
> should probably be cleaned up too.

Some boards are using interrupt-map, so they may need #address-cells. So
I'm inclined to leave things alone.

Rob

> 
> [...]
> 
> Thanks,
> Mark.
> 
> ---->8----
> 
> From dc734edb8040513785429c11e40a420870dc55a4 Mon Sep 17 00:00:00 2001
> From: Mark Rutland <mark.rutland@arm.com>
> Date: Fri, 1 Feb 2013 10:18:05 +0000
> Subject: [PATCH] Docs: gic: remove #address-cells from example
> 
> The gic has no child nodes, and so doesn't need #address-cells. Having
> the property defined in the example only serves as a source of
> confusion.
> 
> Signed-off-by: Mark Rutland <mark.rutland@arm.com>
> ---
>  Documentation/devicetree/bindings/arm/gic.txt | 1 -
>  1 file changed, 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/arm/gic.txt b/Documentation/devicetree/bindings/arm/gic.txt
> index 62eb8df..45b99ab 100644
> --- a/Documentation/devicetree/bindings/arm/gic.txt
> +++ b/Documentation/devicetree/bindings/arm/gic.txt
> @@ -54,7 +54,6 @@ Example:
>  	intc: interrupt-controller at fff11000 {
>  		compatible = "arm,cortex-a9-gic";
>  		#interrupt-cells = <3>;
> -		#address-cells = <1>;
>  		interrupt-controller;
>  		reg = <0xfff11000 0x1000>,
>  		      <0xfff10100 0x100>;
> 

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 2/4] ARM: mach-shmobile: r8a7779: Allow initialisation of GIC by DT
  2013-02-01 14:15           ` Rob Herring
@ 2013-02-04 17:37             ` Mark Rutland
  0 siblings, 0 replies; 20+ messages in thread
From: Mark Rutland @ 2013-02-04 17:37 UTC (permalink / raw)
  To: linux-arm-kernel

On Fri, Feb 01, 2013 at 02:15:37PM +0000, Rob Herring wrote:
> On 02/01/2013 04:58 AM, Mark Rutland wrote:
> > On Fri, Feb 01, 2013 at 12:34:10AM +0000, Simon Horman wrote:
> >> On Fri, Feb 01, 2013 at 09:11:19AM +0900, Simon Horman wrote:
> >>> On Thu, Jan 31, 2013 at 12:32:13PM +0000, Mark Rutland wrote:
> >>>> Hi Simon,
> >>>>
> >>>> On Thu, Jan 31, 2013 at 01:50:49AM +0000, Simon Horman wrote:
> 
> >>>>> +
> >>>>> +        gic: interrupt-controller at f0001000 {
> >>>>> +                compatible = "arm,cortex-a9-gic";
> >>>>> +                #interrupt-cells = <3>;
> >>>>> +                #address-cells = <1>;
> >>>>
> >>>> Why is #address-cells needed here (and without #size-cells)? I see it's in the
> >>>> binding document example, but I can't figure out why.
> >>>
> >>> Its here because I copied the example.
> >>> I will see about removing it from here.
> > 
> > Rob, Grant, do either of you know if there's a reason for this that we've
> > missed?
> > 
> > The gic doesn't have any direct children, and this doesn't seem to be
> > some decvicetree interrupt-controller magic.
> 
> If you look at of_irq_map_raw, there are cases that look at
> #address-cells. Those appear to be only when you have an interrupt-map
> though.

Aah. So this is some devicetree magic after all. Thanks for looking into it.

> > 
> > If this is superfluous, how about the patch below?
> 
> The docs probably should state #addr-cells is only required with
> interrupt-map.

That'd be nice. It might limit the confusion we had here.

> 
> > 
> > I took a quick look at arch/arm/boot/dts/. Some gic nodes don't have
> > #address-cells, some have it but not #size-cells, and some have both. These
> > should probably be cleaned up too.
> 
> Some boards are using interrupt-map, so they may need #address-cells. So
> I'm inclined to leave things alone.

That would make sense.

Thanks,
Mark.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 3/4] ARM: mach-shmobile: r8a7779: Minimal setup using DT
  2013-01-31  1:50 ` [PATCH 3/4] ARM: mach-shmobile: r8a7779: Minimal setup using DT Simon Horman
@ 2013-02-18  9:36   ` Magnus Damm
  2013-02-18 11:37     ` Simon Horman
  2013-02-18 12:22   ` Magnus Damm
  1 sibling, 1 reply; 20+ messages in thread
From: Magnus Damm @ 2013-02-18  9:36 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Simon,

Here's some feedback on your r8a7779 DT code.

On Thu, Jan 31, 2013 at 10:50 AM, Simon Horman
<horms+renesas@verge.net.au> wrote:
> Allow a minimal setup of the r8a7779 SoC using a flattened device tree.
> In particular, configure the i2c and ethernet controllers using a
> flattened device tree.
>
> SCI serial controller and TMU 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.
>
> The ethernet controller also requires a regulator which is a board property.
> A sample snippet DT for the marzen board is as follows:
>
> /dts-v1/;
> /include/ "r8a7779.dtsi"
>
> / {
>         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 {
>         vddvario-supply = <&fixedregulator3v3>;
>         vdd33a-supply = <&fixedregulator3v3>;
> };
>
> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> ---

> --- a/arch/arm/mach-shmobile/setup-r8a7779.c
> +++ b/arch/arm/mach-shmobile/setup-r8a7779.c
> @@ -321,7 +321,7 @@ static struct platform_device i2c3_device = {
>         .num_resources  = ARRAY_SIZE(rcar_i2c3_res),
>  };
>
> -static struct platform_device *r8a7779_early_devices[] __initdata = {
> +static struct platform_device *r8a7779_early_devices_dt[] __initdata = {
>         &scif0_device,
>         &scif1_device,
>         &scif2_device,
> @@ -330,15 +330,15 @@ static struct platform_device *r8a7779_early_devices[] __initdata = {
>         &scif5_device,
>         &tmu00_device,
>         &tmu01_device,
> +};
> +
> +static struct platform_device *r8a7779_early_devices[] __initdata = {
>         &i2c0_device,
>         &i2c1_device,
>         &i2c2_device,
>         &i2c3_device,
>  };
>
> -static struct platform_device *r8a7779_late_devices[] __initdata = {
> -};
> -

Thanks for your work on this. Two things with early/late devices on r8a7779:

1)  Same thing as sh73a0 applies here, please refrain from using early
devices with DT.
2) The i2c devices as early devices look incorrect. Can you make them
late devices?

Cheers,

/ magnus

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 3/4] ARM: mach-shmobile: r8a7779: Minimal setup using DT
  2013-02-18  9:36   ` Magnus Damm
@ 2013-02-18 11:37     ` Simon Horman
  2013-02-18 12:14       ` Magnus Damm
  0 siblings, 1 reply; 20+ messages in thread
From: Simon Horman @ 2013-02-18 11:37 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Feb 18, 2013 at 06:36:12PM +0900, Magnus Damm wrote:
> Hi Simon,
> 
> Here's some feedback on your r8a7779 DT code.
> 
> On Thu, Jan 31, 2013 at 10:50 AM, Simon Horman
> <horms+renesas@verge.net.au> wrote:
> > Allow a minimal setup of the r8a7779 SoC using a flattened device tree.
> > In particular, configure the i2c and ethernet controllers using a
> > flattened device tree.
> >
> > SCI serial controller and TMU 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.
> >
> > The ethernet controller also requires a regulator which is a board property.
> > A sample snippet DT for the marzen board is as follows:
> >
> > /dts-v1/;
> > /include/ "r8a7779.dtsi"
> >
> > / {
> >         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 {
> >         vddvario-supply = <&fixedregulator3v3>;
> >         vdd33a-supply = <&fixedregulator3v3>;
> > };
> >
> > Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> > ---
> 
> > --- a/arch/arm/mach-shmobile/setup-r8a7779.c
> > +++ b/arch/arm/mach-shmobile/setup-r8a7779.c
> > @@ -321,7 +321,7 @@ static struct platform_device i2c3_device = {
> >         .num_resources  = ARRAY_SIZE(rcar_i2c3_res),
> >  };
> >
> > -static struct platform_device *r8a7779_early_devices[] __initdata = {
> > +static struct platform_device *r8a7779_early_devices_dt[] __initdata = {
> >         &scif0_device,
> >         &scif1_device,
> >         &scif2_device,
> > @@ -330,15 +330,15 @@ static struct platform_device *r8a7779_early_devices[] __initdata = {
> >         &scif5_device,
> >         &tmu00_device,
> >         &tmu01_device,
> > +};
> > +
> > +static struct platform_device *r8a7779_early_devices[] __initdata = {
> >         &i2c0_device,
> >         &i2c1_device,
> >         &i2c2_device,
> >         &i2c3_device,
> >  };
> >
> > -static struct platform_device *r8a7779_late_devices[] __initdata = {
> > -};
> > -
> 
> Thanks for your work on this. Two things with early/late devices on r8a7779:
> 
> 1)  Same thing as sh73a0 applies here, please refrain from using early
> devices with DT.

I guess you are referring to tmu.
If so, yes, I can move them to r8a7779_early_devices.

> 2) The i2c devices as early devices look incorrect. Can you make them
> late devices?

r8a7779_early_devices is only used for the non-DT case.
For the non-DT case i2c was set up as early devices before this patch-set.
Would you like me to change them to late devices for non-DT,
a change that is orthogonal to this patch-set?

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 3/4] ARM: mach-shmobile: r8a7779: Minimal setup using DT
  2013-02-18 11:37     ` Simon Horman
@ 2013-02-18 12:14       ` Magnus Damm
  2013-02-18 12:37         ` Simon Horman
  0 siblings, 1 reply; 20+ messages in thread
From: Magnus Damm @ 2013-02-18 12:14 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Feb 18, 2013 at 8:37 PM, Simon Horman <horms@verge.net.au> wrote:
> On Mon, Feb 18, 2013 at 06:36:12PM +0900, Magnus Damm wrote:
>> Hi Simon,
>>
>> Here's some feedback on your r8a7779 DT code.
>>
>> On Thu, Jan 31, 2013 at 10:50 AM, Simon Horman
>> <horms+renesas@verge.net.au> wrote:
>> > Allow a minimal setup of the r8a7779 SoC using a flattened device tree.
>> > In particular, configure the i2c and ethernet controllers using a
>> > flattened device tree.
>> >
>> > SCI serial controller and TMU 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.
>> >
>> > The ethernet controller also requires a regulator which is a board property.
>> > A sample snippet DT for the marzen board is as follows:
>> >
>> > /dts-v1/;
>> > /include/ "r8a7779.dtsi"
>> >
>> > / {
>> >         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 {
>> >         vddvario-supply = <&fixedregulator3v3>;
>> >         vdd33a-supply = <&fixedregulator3v3>;
>> > };
>> >
>> > Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
>> > ---
>>
>> > --- a/arch/arm/mach-shmobile/setup-r8a7779.c
>> > +++ b/arch/arm/mach-shmobile/setup-r8a7779.c
>> > @@ -321,7 +321,7 @@ static struct platform_device i2c3_device = {
>> >         .num_resources  = ARRAY_SIZE(rcar_i2c3_res),
>> >  };
>> >
>> > -static struct platform_device *r8a7779_early_devices[] __initdata = {
>> > +static struct platform_device *r8a7779_early_devices_dt[] __initdata = {
>> >         &scif0_device,
>> >         &scif1_device,
>> >         &scif2_device,
>> > @@ -330,15 +330,15 @@ static struct platform_device *r8a7779_early_devices[] __initdata = {
>> >         &scif5_device,
>> >         &tmu00_device,
>> >         &tmu01_device,
>> > +};
>> > +
>> > +static struct platform_device *r8a7779_early_devices[] __initdata = {
>> >         &i2c0_device,
>> >         &i2c1_device,
>> >         &i2c2_device,
>> >         &i2c3_device,
>> >  };
>> >
>> > -static struct platform_device *r8a7779_late_devices[] __initdata = {
>> > -};
>> > -
>>
>> Thanks for your work on this. Two things with early/late devices on r8a7779:
>>
>> 1)  Same thing as sh73a0 applies here, please refrain from using early
>> devices with DT.
>
> I guess you are referring to tmu.
> If so, yes, I can move them to r8a7779_early_devices.

As we talked about last Friday, please try to avoid using early
devices in general. It is enough to add SCIF and TMU as late devices.
This goes for both sh73a0 and r8a7779. The only thing you need to do
early is to setup the delay. Please look at the emev2 implementation
for what is needed.

>> 2) The i2c devices as early devices look incorrect. Can you make them
>> late devices?
>
> r8a7779_early_devices is only used for the non-DT case.
> For the non-DT case i2c was set up as early devices before this patch-set.
> Would you like me to change them to late devices for non-DT,
> a change that is orthogonal to this patch-set?

Yes. I realize it is not really related to this DT feature, but it
certainly looks incorrect.

Thanks,

/ magnus

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 3/4] ARM: mach-shmobile: r8a7779: Minimal setup using DT
  2013-01-31  1:50 ` [PATCH 3/4] ARM: mach-shmobile: r8a7779: Minimal setup using DT Simon Horman
  2013-02-18  9:36   ` Magnus Damm
@ 2013-02-18 12:22   ` Magnus Damm
  2013-02-18 12:37     ` Simon Horman
  1 sibling, 1 reply; 20+ messages in thread
From: Magnus Damm @ 2013-02-18 12:22 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Simon,

On Thu, Jan 31, 2013 at 10:50 AM, Simon Horman
<horms+renesas@verge.net.au> wrote:
> Allow a minimal setup of the r8a7779 SoC using a flattened device tree.
> In particular, configure the i2c and ethernet controllers using a
> flattened device tree.
>
> SCI serial controller and TMU 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.
>
> The ethernet controller also requires a regulator which is a board property.
> A sample snippet DT for the marzen board is as follows:
>
> /dts-v1/;
> /include/ "r8a7779.dtsi"
>
> / {
>         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 {
>         vddvario-supply = <&fixedregulator3v3>;
>         vdd33a-supply = <&fixedregulator3v3>;
> };
>
> Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> ---
>  arch/arm/boot/dts/r8a7779.dtsi               |   45 ++++++++++++++++++++
>  arch/arm/mach-shmobile/include/mach/common.h |    2 +
>  arch/arm/mach-shmobile/setup-r8a7779.c       |   58 +++++++++++++++++++++++---
>  3 files changed, 99 insertions(+), 6 deletions(-)
>
> diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
> index eadc12e..9564040 100644
> --- a/arch/arm/boot/dts/r8a7779.dtsi
> +++ b/arch/arm/boot/dts/r8a7779.dtsi
> @@ -37,4 +37,49 @@
>                  reg = <0xf0001000 0x1000>,
>                        <0xf0000100 0x100>;
>          };
> +
> +       i2c0: i2c at 0xffc70000 {
> +               #address-cells = <1>;
> +               #size-cells = <0>;
> +               compatible = "renesas,rmobile-iic";
> +               reg = <0xffc70000 0x1000>;
> +               interrupt-parent = <&gic>;
> +               interrupts = <0 79 0x4>;
> +       };
> +
> +       i2c1: i2c at 0xffc71000 {
> +               #address-cells = <1>;
> +               #size-cells = <0>;
> +               compatible = "renesas,rmobile-iic";
> +               reg = <0xffc71000 0x1000>;
> +               interrupt-parent = <&gic>;
> +               interrupts = <0 82 0x4>;
> +       };
> +
> +       i2c2: i2c at 0xffc72000 {
> +               #address-cells = <1>;
> +               #size-cells = <0>;
> +               compatible = "renesas,rmobile-iic";
> +               reg = <0xffc72000 0x1000>;
> +               interrupt-parent = <&gic>;
> +               interrupts = <0 80 0x4>;
> +       };
> +
> +       i2c3: i2c at 0xffc73000 {
> +               #address-cells = <1>;
> +               #size-cells = <0>;
> +               compatible = "renesas,rmobile-iic";
> +               reg = <0xffc73000 0x1000>;
> +               interrupt-parent = <&gic>;
> +               interrupts = <0 81 0x4>;
> +       };
> +
> +       lan0: lan0 at 18000000 {
> +               compatible = "smsc,lan9220", "smsc,lan9115";
> +               reg = <0x18000000 0x100>;
> +               phy-mode = "mii";
> +               interrupt-parent = <&gic>;
> +               interrupts = <0 28 0x4>;
> +               reg-io-width = <4>;
> +       };
>  };

Simon, thanks for your efforts on this DT reference implementation.

The lan0 snippet above seems incorrect. If I understand the code above
correctly then it is written to be specific to the r8a7779 SoC. I
suspect so because it is located in the SoC-specific dtsi file. The
smsc ethernet controller is a board specific property - so it should
instead be located in r8a7779-marzen-reference.dts.

In the future, feel free to ask if you are unsure which bits that are
SoC specific properties and which that belong to the board.

Thanks,

/ magnus

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 3/4] ARM: mach-shmobile: r8a7779: Minimal setup using DT
  2013-02-18 12:22   ` Magnus Damm
@ 2013-02-18 12:37     ` Simon Horman
  0 siblings, 0 replies; 20+ messages in thread
From: Simon Horman @ 2013-02-18 12:37 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Feb 18, 2013 at 09:22:24PM +0900, Magnus Damm wrote:
> Hi Simon,
> 
> On Thu, Jan 31, 2013 at 10:50 AM, Simon Horman
> <horms+renesas@verge.net.au> wrote:
> > Allow a minimal setup of the r8a7779 SoC using a flattened device tree.
> > In particular, configure the i2c and ethernet controllers using a
> > flattened device tree.
> >
> > SCI serial controller and TMU 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.
> >
> > The ethernet controller also requires a regulator which is a board property.
> > A sample snippet DT for the marzen board is as follows:
> >
> > /dts-v1/;
> > /include/ "r8a7779.dtsi"
> >
> > / {
> >         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 {
> >         vddvario-supply = <&fixedregulator3v3>;
> >         vdd33a-supply = <&fixedregulator3v3>;
> > };
> >
> > Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> > ---
> >  arch/arm/boot/dts/r8a7779.dtsi               |   45 ++++++++++++++++++++
> >  arch/arm/mach-shmobile/include/mach/common.h |    2 +
> >  arch/arm/mach-shmobile/setup-r8a7779.c       |   58 +++++++++++++++++++++++---
> >  3 files changed, 99 insertions(+), 6 deletions(-)
> >
> > diff --git a/arch/arm/boot/dts/r8a7779.dtsi b/arch/arm/boot/dts/r8a7779.dtsi
> > index eadc12e..9564040 100644
> > --- a/arch/arm/boot/dts/r8a7779.dtsi
> > +++ b/arch/arm/boot/dts/r8a7779.dtsi
> > @@ -37,4 +37,49 @@
> >                  reg = <0xf0001000 0x1000>,
> >                        <0xf0000100 0x100>;
> >          };
> > +
> > +       i2c0: i2c at 0xffc70000 {
> > +               #address-cells = <1>;
> > +               #size-cells = <0>;
> > +               compatible = "renesas,rmobile-iic";
> > +               reg = <0xffc70000 0x1000>;
> > +               interrupt-parent = <&gic>;
> > +               interrupts = <0 79 0x4>;
> > +       };
> > +
> > +       i2c1: i2c at 0xffc71000 {
> > +               #address-cells = <1>;
> > +               #size-cells = <0>;
> > +               compatible = "renesas,rmobile-iic";
> > +               reg = <0xffc71000 0x1000>;
> > +               interrupt-parent = <&gic>;
> > +               interrupts = <0 82 0x4>;
> > +       };
> > +
> > +       i2c2: i2c at 0xffc72000 {
> > +               #address-cells = <1>;
> > +               #size-cells = <0>;
> > +               compatible = "renesas,rmobile-iic";
> > +               reg = <0xffc72000 0x1000>;
> > +               interrupt-parent = <&gic>;
> > +               interrupts = <0 80 0x4>;
> > +       };
> > +
> > +       i2c3: i2c at 0xffc73000 {
> > +               #address-cells = <1>;
> > +               #size-cells = <0>;
> > +               compatible = "renesas,rmobile-iic";
> > +               reg = <0xffc73000 0x1000>;
> > +               interrupt-parent = <&gic>;
> > +               interrupts = <0 81 0x4>;
> > +       };
> > +
> > +       lan0: lan0 at 18000000 {
> > +               compatible = "smsc,lan9220", "smsc,lan9115";
> > +               reg = <0x18000000 0x100>;
> > +               phy-mode = "mii";
> > +               interrupt-parent = <&gic>;
> > +               interrupts = <0 28 0x4>;
> > +               reg-io-width = <4>;
> > +       };
> >  };
> 
> Simon, thanks for your efforts on this DT reference implementation.
> 
> The lan0 snippet above seems incorrect. If I understand the code above
> correctly then it is written to be specific to the r8a7779 SoC. I
> suspect so because it is located in the SoC-specific dtsi file. The
> smsc ethernet controller is a board specific property - so it should
> instead be located in r8a7779-marzen-reference.dts.
> 
> In the future, feel free to ask if you are unsure which bits that are
> SoC specific properties and which that belong to the board.

Thanks, I will move it.

^ permalink raw reply	[flat|nested] 20+ messages in thread

* [PATCH 3/4] ARM: mach-shmobile: r8a7779: Minimal setup using DT
  2013-02-18 12:14       ` Magnus Damm
@ 2013-02-18 12:37         ` Simon Horman
  0 siblings, 0 replies; 20+ messages in thread
From: Simon Horman @ 2013-02-18 12:37 UTC (permalink / raw)
  To: linux-arm-kernel

On Mon, Feb 18, 2013 at 09:14:05PM +0900, Magnus Damm wrote:
> On Mon, Feb 18, 2013 at 8:37 PM, Simon Horman <horms@verge.net.au> wrote:
> > On Mon, Feb 18, 2013 at 06:36:12PM +0900, Magnus Damm wrote:
> >> Hi Simon,
> >>
> >> Here's some feedback on your r8a7779 DT code.
> >>
> >> On Thu, Jan 31, 2013 at 10:50 AM, Simon Horman
> >> <horms+renesas@verge.net.au> wrote:
> >> > Allow a minimal setup of the r8a7779 SoC using a flattened device tree.
> >> > In particular, configure the i2c and ethernet controllers using a
> >> > flattened device tree.
> >> >
> >> > SCI serial controller and TMU 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.
> >> >
> >> > The ethernet controller also requires a regulator which is a board property.
> >> > A sample snippet DT for the marzen board is as follows:
> >> >
> >> > /dts-v1/;
> >> > /include/ "r8a7779.dtsi"
> >> >
> >> > / {
> >> >         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 {
> >> >         vddvario-supply = <&fixedregulator3v3>;
> >> >         vdd33a-supply = <&fixedregulator3v3>;
> >> > };
> >> >
> >> > Signed-off-by: Simon Horman <horms+renesas@verge.net.au>
> >> > ---
> >>
> >> > --- a/arch/arm/mach-shmobile/setup-r8a7779.c
> >> > +++ b/arch/arm/mach-shmobile/setup-r8a7779.c
> >> > @@ -321,7 +321,7 @@ static struct platform_device i2c3_device = {
> >> >         .num_resources  = ARRAY_SIZE(rcar_i2c3_res),
> >> >  };
> >> >
> >> > -static struct platform_device *r8a7779_early_devices[] __initdata = {
> >> > +static struct platform_device *r8a7779_early_devices_dt[] __initdata = {
> >> >         &scif0_device,
> >> >         &scif1_device,
> >> >         &scif2_device,
> >> > @@ -330,15 +330,15 @@ static struct platform_device *r8a7779_early_devices[] __initdata = {
> >> >         &scif5_device,
> >> >         &tmu00_device,
> >> >         &tmu01_device,
> >> > +};
> >> > +
> >> > +static struct platform_device *r8a7779_early_devices[] __initdata = {
> >> >         &i2c0_device,
> >> >         &i2c1_device,
> >> >         &i2c2_device,
> >> >         &i2c3_device,
> >> >  };
> >> >
> >> > -static struct platform_device *r8a7779_late_devices[] __initdata = {
> >> > -};
> >> > -
> >>
> >> Thanks for your work on this. Two things with early/late devices on r8a7779:
> >>
> >> 1)  Same thing as sh73a0 applies here, please refrain from using early
> >> devices with DT.
> >
> > I guess you are referring to tmu.
> > If so, yes, I can move them to r8a7779_early_devices.
> 
> As we talked about last Friday, please try to avoid using early
> devices in general. It is enough to add SCIF and TMU as late devices.
> This goes for both sh73a0 and r8a7779. The only thing you need to do
> early is to setup the delay. Please look at the emev2 implementation
> for what is needed.

Thanks, I understand.

> >> 2) The i2c devices as early devices look incorrect. Can you make them
> >> late devices?
> >
> > r8a7779_early_devices is only used for the non-DT case.
> > For the non-DT case i2c was set up as early devices before this patch-set.
> > Would you like me to change them to late devices for non-DT,
> > a change that is orthogonal to this patch-set?
> 
> Yes. I realize it is not really related to this DT feature, but it
> certainly looks incorrect.

Got it. I will see about making it so.

^ permalink raw reply	[flat|nested] 20+ messages in thread

end of thread, other threads:[~2013-02-18 12:37 UTC | newest]

Thread overview: 20+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-31  1:50 ARM: mach-shmobile: r8a7779, marzen: Reference DT implementation Simon Horman
2013-01-31  1:50 ` [PATCH 1/4] ARM: mach-shmobile: marzen: defconfig: use regulators by default Simon Horman
2013-01-31  1:50 ` [PATCH 2/4] ARM: mach-shmobile: r8a7779: Allow initialisation of GIC by DT Simon Horman
2013-01-31 12:32   ` Mark Rutland
2013-02-01  0:11     ` Simon Horman
2013-02-01  0:34       ` Simon Horman
2013-02-01  1:47         ` Simon Horman
2013-02-01  4:39           ` Simon Horman
2013-02-01 11:31             ` Mark Rutland
2013-02-01 10:58         ` Mark Rutland
2013-02-01 14:15           ` Rob Herring
2013-02-04 17:37             ` Mark Rutland
2013-01-31  1:50 ` [PATCH 3/4] ARM: mach-shmobile: r8a7779: Minimal setup using DT Simon Horman
2013-02-18  9:36   ` Magnus Damm
2013-02-18 11:37     ` Simon Horman
2013-02-18 12:14       ` Magnus Damm
2013-02-18 12:37         ` Simon Horman
2013-02-18 12:22   ` Magnus Damm
2013-02-18 12:37     ` Simon Horman
2013-01-31  1:50 ` [PATCH 4/4] ARM: mach-shmobile: marzen: Reference DT implementation Simon Horman

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).