Skip to contentSkip to conversation

ARM: shmobile: EMEV2 and KZM9D update

PATCH New Magnus Damm 3 participants 11 messages Jul 2, 2013 – Jul 4, 2013

Subsystems (5)
lore
Share & tools
lore

Magnus Damm

author maintainer
#0 lore raw

cover ARM: shmobile: EMEV2 and KZM9D update

ARM: shmobile: EMEV2 and KZM9D update

[PATCH 01/08] ARM: shmobile: Remove unused EMEV2/KZM9D early console [PATCH 02/08] ARM: shmobile: Update KZM9D dts command line [PATCH 03/08] ARM: shmobile: Make EMEV2 platform devices more compact [PATCH 04/08] ARM: shmobile: Add GIO to EMEV2 dtsi
[PATCH 05/08] ARM: shmobile: Use DT for GIC on EMEV2 and KZM9D [PATCH 06/08] ARM: shmobile: Use DT for SMP on EMEV2 and KZM9D [PATCH 07/08] ARM: shmobile: EMEV2 map_io update
[PATCH 08/08] ARM: shmobile: Disconnect EMEV2 SMP code from clocks

Several minor updates for the EMEV2 SoC and the KZM9D board:
- Get rid of early console - the 8250-em driver does not support it
- Update command line in DTS and remove old cruft
- Make the EMEV2 platform devices more compact
- Add GIO device nodes to the EMEV2 dtsi
- Use DT for GIC and SMP for both regular KZM9D board code and DT
- Reduce the size of the EMEV2 map_io - SCU is still however needed
- Allow EMEV2 SMP to operate without legacy clock bits

---

Written against renesas.git renesas-next-20130702

 arch/arm/boot/dts/emev2-kzm9d.dts           |    2 
 arch/arm/boot/dts/emev2.dtsi                |   59 ++++
 arch/arm/mach-shmobile/board-kzm9d.c        |    4 
 arch/arm/mach-shmobile/clock-emev2.c        |   18 -
 arch/arm/mach-shmobile/include/mach/emev2.h |    4 
 arch/arm/mach-shmobile/setup-emev2.c        |  374 ++++-----------------------
 arch/arm/mach-shmobile/smp-emev2.c          |   28 --
 7 files changed, 142 insertions(+), 347 deletions(-)
author maintainer
#1 lore raw

PATCH 1/8 ARM: shmobile: Remove unused EMEV2/KZM9D early console

From: Magnus Damm <[email protected]>

Remove EMEV2 early console code from KZM9D and instead rely on console setup during regular platform device probe time. This makes the DT code and the KZM9D board support behave the same.

---

 arch/arm/mach-shmobile/board-kzm9d.c        |    2 +-
 arch/arm/mach-shmobile/include/mach/emev2.h |    2 +-
 arch/arm/mach-shmobile/setup-emev2.c        |   24 +++---------------------
 3 files changed, 5 insertions(+), 23 deletions(-)
arch/arm/mach-shmobile/board-kzm9d.c +1 -1
@@ -85,7 +85,7 @@ static const char *kzm9d_boards_compat_d
 DT_MACHINE_START(KZM9D_DT, "kzm9d")
 	.smp		= smp_ops(emev2_smp_ops),
 	.map_io		= emev2_map_io,
-	.init_early	= emev2_add_early_devices,
+	.init_early	= emev2_init_delay,
 	.nr_irqs	= NR_IRQS_LEGACY,
 	.init_irq	= emev2_init_irq,
 	.init_machine	= kzm9d_add_standard_devices,
arch/arm/mach-shmobile/include/mach/emev2.h +1 -1
@@ -3,7 +3,7 @@
 
 extern void emev2_map_io(void);
 extern void emev2_init_irq(void);
-extern void emev2_add_early_devices(void);
+extern void emev2_init_delay(void);
 extern void emev2_add_standard_devices(void);
 extern void emev2_clock_init(void);
 extern void emev2_set_boot_vector(unsigned long value);
arch/arm/mach-shmobile/setup-emev2.c +3 -21
@@ -375,14 +375,11 @@ static struct platform_device pmu_device
 	.resource	= pmu_resources,
 };
 
-static struct platform_device *emev2_early_devices[] __initdata = {
+static struct platform_device *emev2_devices[] __initdata = {
 	&uart0_device,
 	&uart1_device,
 	&uart2_device,
 	&uart3_device,
-};
-
-static struct platform_device *emev2_late_devices[] __initdata = {
 	&sti_device,
 	&gio0_device,
 	&gio1_device,
@@ -396,29 +393,14 @@ void __init emev2_add_standard_devices(v
 {
 	emev2_clock_init();
 
-	platform_add_devices(emev2_early_devices,
-			     ARRAY_SIZE(emev2_early_devices));
-
-	platform_add_devices(emev2_late_devices,
-			     ARRAY_SIZE(emev2_late_devices));
+	platform_add_devices(emev2_devices, ARRAY_SIZE(emev2_devices));
 }
 
-static void __init emev2_init_delay(void)
+void __init emev2_init_delay(void)
 {
 	shmobile_setup_delay(533, 1, 3); /* Cortex-A9 @ 533MHz */
 }
 
-void __init emev2_add_early_devices(void)
-{
-	emev2_init_delay();
-
-	early_platform_add_devices(emev2_early_devices,
-				   ARRAY_SIZE(emev2_early_devices));
-
-	/* setup early console here as well */
-	shmobile_setup_console();
-}
-
 void __init emev2_init_irq(void)
 {
 	void __iomem *gic_dist_base;
author maintainer
#2 lore raw

PATCH 2/8 ARM: shmobile: Update KZM9D dts command line

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Update the KZM9D DTS command line to remove following cruft:
- console=tty0 - no graphic support upstream anyway
- earlyprintk= - not supported by the 8250-em driver anyway
- mem= - this is provided via DT anyway

---

 arch/arm/boot/dts/emev2-kzm9d.dts |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/boot/dts/emev2-kzm9d.dts +1 -1
@@ -21,6 +21,6 @@
 	};
 
 	chosen {
-		bootargs = "console=tty0 console=ttyS1,115200n81 earlyprintk=serial8250-em.1,115200n81 mem=128M at 0x40000000 ignore_loglevel root=/dev/nfs ip=dhcp nfsroot=,rsize=4096,wsize=4096";
+		bootargs = "console=ttyS1,115200n81 ignore_loglevel root=/dev/nfs ip=dhcp nfsroot=,rsize=4096,wsize=4096";
 	};
 };
author maintainer
#3 lore raw

PATCH 3/8 ARM: shmobile: Make EMEV2 platform devices more compact

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Convert the EMEV2 SoC device setup code from using very verbose resources and static platform devices to the same style as more recent boards. This reduces the size of the code.

---

Depends on "[PATCH] ARM: shmobile: emev2 GIO3 resource fix"

 arch/arm/mach-shmobile/setup-emev2.c |  327 ++++++----------------------------
 1 file changed, 64 insertions(+), 263 deletions(-)
arch/arm/mach-shmobile/setup-emev2.c +64 -263
@@ -62,102 +62,40 @@ void __init emev2_map_io(void)
 
 /* UART */
 static struct resource uart0_resources[] = {
-	[0]	= {
-		.start	= 0xe1020000,
-		.end	= 0xe1020037,
-		.flags	= IORESOURCE_MEM,
-	},
-	[1]	= {
-		.start	= 40,
-		.flags	= IORESOURCE_IRQ,
-	}
-};
-
-static struct platform_device uart0_device = {
-	.name		= "serial8250-em",
-	.id		= 0,
-	.num_resources	= ARRAY_SIZE(uart0_resources),
-	.resource	= uart0_resources,
+	DEFINE_RES_MEM(0xe1020000, 0x38),
+	DEFINE_RES_IRQ(40),
 };
 
 static struct resource uart1_resources[] = {
-	[0]	= {
-		.start	= 0xe1030000,
-		.end	= 0xe1030037,
-		.flags	= IORESOURCE_MEM,
-	},
-	[1]	= {
-		.start	= 41,
-		.flags	= IORESOURCE_IRQ,
-	}
-};
-
-static struct platform_device uart1_device = {
-	.name		= "serial8250-em",
-	.id		= 1,
-	.num_resources	= ARRAY_SIZE(uart1_resources),
-	.resource	= uart1_resources,
+	DEFINE_RES_MEM(0xe1030000, 0x38),
+	DEFINE_RES_IRQ(41),
 };
 
 static struct resource uart2_resources[] = {
-	[0]	= {
-		.start	= 0xe1040000,
-		.end	= 0xe1040037,
-		.flags	= IORESOURCE_MEM,
-	},
-	[1]	= {
-		.start	= 42,
-		.flags	= IORESOURCE_IRQ,
-	}
-};
-
-static struct platform_device uart2_device = {
-	.name		= "serial8250-em",
-	.id		= 2,
-	.num_resources	= ARRAY_SIZE(uart2_resources),
-	.resource	= uart2_resources,
+	DEFINE_RES_MEM(0xe1040000, 0x38),
+	DEFINE_RES_IRQ(42),
 };
 
 static struct resource uart3_resources[] = {
-	[0]	= {
-		.start	= 0xe1050000,
-		.end	= 0xe1050037,
-		.flags	= IORESOURCE_MEM,
-	},
-	[1]	= {
-		.start	= 43,
-		.flags	= IORESOURCE_IRQ,
-	}
-};
-
-static struct platform_device uart3_device = {
-	.name		= "serial8250-em",
-	.id		= 3,
-	.num_resources	= ARRAY_SIZE(uart3_resources),
-	.resource	= uart3_resources,
+	DEFINE_RES_MEM(0xe1050000, 0x38),
+	DEFINE_RES_IRQ(43),
 };
 
+#define emev2_register_uart(idx)					\
+	platform_device_register_simple("serial8250-em", idx,		\
+					uart##idx##_resources,		\
+					ARRAY_SIZE(uart##idx##_resources))
+
 /* STI */
 static struct resource sti_resources[] = {
-	[0] = {
-		.name	= "STI",
-		.start	= 0xe0180000,
-		.end	= 0xe0180053,
-		.flags	= IORESOURCE_MEM,
-	},
-	[1] = {
-		.start	= 157,
-		.flags	= IORESOURCE_IRQ,
-	},
-};
-
-static struct platform_device sti_device = {
-	.name		= "em_sti",
-	.id		= 0,
-	.resource	= sti_resources,
-	.num_resources	= ARRAY_SIZE(sti_resources),
+	DEFINE_RES_MEM(0xe0180000, 0x54),
+	DEFINE_RES_IRQ(157),
 };
 
+#define emev2_register_sti()					\
+	platform_device_register_simple("em_sti", 0,		\
+					sti_resources,		\
+					ARRAY_SIZE(sti_resources))
 
 /* GIO */
 static struct gpio_em_config gio0_config = {
@@ -167,36 +105,10 @@ static struct gpio_em_config gio0_config
 };
 
 static struct resource gio0_resources[] = {
-	[0] = {
-		.name	= "GIO_000",
-		.start	= 0xe0050000,
-		.end	= 0xe005002b,
-		.flags	= IORESOURCE_MEM,
-	},
-	[1] = {
-		.name	= "GIO_000",
-		.start	= 0xe0050040,
-		.end	= 0xe005005f,
-		.flags	= IORESOURCE_MEM,
-	},
-	[2] = {
-		.start	= 99,
-		.flags	= IORESOURCE_IRQ,
-	},
-	[3] = {
-		.start	= 100,
-		.flags	= IORESOURCE_IRQ,
-	},
-};
-
-static struct platform_device gio0_device = {
-	.name		= "em_gio",
-	.id		= 0,
-	.resource	= gio0_resources,
-	.num_resources	= ARRAY_SIZE(gio0_resources),
-	.dev		= {
-		.platform_data	= &gio0_config,
-	},
+	DEFINE_RES_MEM(0xe0050000, 0x2c),
+	DEFINE_RES_MEM(0xe0050040, 0x20),
+	DEFINE_RES_IRQ(99),
+	DEFINE_RES_IRQ(100),
 };
 
 static struct gpio_em_config gio1_config = {
@@ -206,36 +118,10 @@ static struct gpio_em_config gio1_config
 };
 
 static struct resource gio1_resources[] = {
-	[0] = {
-		.name	= "GIO_032",
-		.start	= 0xe0050080,
-		.end	= 0xe00500ab,
-		.flags	= IORESOURCE_MEM,
-	},
-	[1] = {
-		.name	= "GIO_032",
-		.start	= 0xe00500c0,
-		.end	= 0xe00500df,
-		.flags	= IORESOURCE_MEM,
-	},
-	[2] = {
-		.start	= 101,
-		.flags	= IORESOURCE_IRQ,
-	},
-	[3] = {
-		.start	= 102,
-		.flags	= IORESOURCE_IRQ,
-	},
-};
-
-static struct platform_device gio1_device = {
-	.name		= "em_gio",
-	.id		= 1,
-	.resource	= gio1_resources,
-	.num_resources	= ARRAY_SIZE(gio1_resources),
-	.dev		= {
-		.platform_data	= &gio1_config,
-	},
+	DEFINE_RES_MEM(0xe0050080, 0x2c),
+	DEFINE_RES_MEM(0xe00500c0, 0x20),
+	DEFINE_RES_IRQ(101),
+	DEFINE_RES_IRQ(102),
 };
 
 static struct gpio_em_config gio2_config = {
@@ -245,36 +131,10 @@ static struct gpio_em_config gio2_config
 };
 
 static struct resource gio2_resources[] = {
-	[0] = {
-		.name	= "GIO_064",
-		.start	= 0xe0050100,
-		.end	= 0xe005012b,
-		.flags	= IORESOURCE_MEM,
-	},
-	[1] = {
-		.name	= "GIO_064",
-		.start	= 0xe0050140,
-		.end	= 0xe005015f,
-		.flags	= IORESOURCE_MEM,
-	},
-	[2] = {
-		.start	= 103,
-		.flags	= IORESOURCE_IRQ,
-	},
-	[3] = {
-		.start	= 104,
-		.flags	= IORESOURCE_IRQ,
-	},
-};
-
-static struct platform_device gio2_device = {
-	.name		= "em_gio",
-	.id		= 2,
-	.resource	= gio2_resources,
-	.num_resources	= ARRAY_SIZE(gio2_resources),
-	.dev		= {
-		.platform_data	= &gio2_config,
-	},
+	DEFINE_RES_MEM(0xe0050100, 0x2c),
+	DEFINE_RES_MEM(0xe0050140, 0x20),
+	DEFINE_RES_IRQ(103),
+	DEFINE_RES_IRQ(104),
 };
 
 static struct gpio_em_config gio3_config = {
@@ -284,36 +144,10 @@ static struct gpio_em_config gio3_config
 };
 
 static struct resource gio3_resources[] = {
-	[0] = {
-		.name	= "GIO_096",
-		.start	= 0xe0050180,
-		.end	= 0xe00501ab,
-		.flags	= IORESOURCE_MEM,
-	},
-	[1] = {
-		.name	= "GIO_096",
-		.start	= 0xe00501c0,
-		.end	= 0xe00501df,
-		.flags	= IORESOURCE_MEM,
-	},
-	[2] = {
-		.start	= 105,
-		.flags	= IORESOURCE_IRQ,
-	},
-	[3] = {
-		.start	= 106,
-		.flags	= IORESOURCE_IRQ,
-	},
-};
-
-static struct platform_device gio3_device = {
-	.name		= "em_gio",
-	.id		= 3,
-	.resource	= gio3_resources,
-	.num_resources	= ARRAY_SIZE(gio3_resources),
-	.dev		= {
-		.platform_data	= &gio3_config,
-	},
+	DEFINE_RES_MEM(0xe0050180, 0x2c),
+	DEFINE_RES_MEM(0xe00501c0, 0x20),
+	DEFINE_RES_IRQ(105),
+	DEFINE_RES_IRQ(106),
 };
 
 static struct gpio_em_config gio4_config = {
@@ -323,77 +157,44 @@ static struct gpio_em_config gio4_config
 };
 
 static struct resource gio4_resources[] = {
-	[0] = {
-		.name	= "GIO_128",
-		.start	= 0xe0050200,
-		.end	= 0xe005022b,
-		.flags	= IORESOURCE_MEM,
-	},
-	[1] = {
-		.name	= "GIO_128",
-		.start	= 0xe0050240,
-		.end	= 0xe005025f,
-		.flags	= IORESOURCE_MEM,
-	},
-	[2] = {
-		.start	= 107,
-		.flags	= IORESOURCE_IRQ,
-	},
-	[3] = {
-		.start	= 108,
-		.flags	= IORESOURCE_IRQ,
-	},
-};
-
-static struct platform_device gio4_device = {
-	.name		= "em_gio",
-	.id		= 4,
-	.resource	= gio4_resources,
-	.num_resources	= ARRAY_SIZE(gio4_resources),
-	.dev		= {
-		.platform_data	= &gio4_config,
-	},
+	DEFINE_RES_MEM(0xe0050200, 0x2c),
+	DEFINE_RES_MEM(0xe0050240, 0x20),
+	DEFINE_RES_IRQ(107),
+	DEFINE_RES_IRQ(108),
 };
 
+#define emev2_register_gio(idx)						\
+	platform_device_register_resndata(&platform_bus, "em_gio",	\
+					  idx, gio##idx##_resources,	\
+					  ARRAY_SIZE(gio##idx##_resources), \
+					  &gio##idx##_config,		\
+					  sizeof(struct gpio_em_config))
+
 static struct resource pmu_resources[] = {
-	[0] = {
-		.start	= 152,
-		.end	= 152,
-		.flags	= IORESOURCE_IRQ,
-	},
-	[1] = {
-		.start	= 153,
-		.end	= 153,
-		.flags	= IORESOURCE_IRQ,
-	},
-};
-
-static struct platform_device pmu_device = {
-	.name		= "arm-pmu",
-	.id		= -1,
-	.num_resources	= ARRAY_SIZE(pmu_resources),
-	.resource	= pmu_resources,
-};
-
-static struct platform_device *emev2_devices[] __initdata = {
-	&uart0_device,
-	&uart1_device,
-	&uart2_device,
-	&uart3_device,
-	&sti_device,
-	&gio0_device,
-	&gio1_device,
-	&gio2_device,
-	&gio3_device,
-	&gio4_device,
-	&pmu_device,
+	DEFINE_RES_IRQ(152),
+	DEFINE_RES_IRQ(153),
 };
 
+#define emev2_register_pmu()					\
+	platform_device_register_simple("arm-pmu", -1,		\
+					pmu_resources,		\
+					ARRAY_SIZE(pmu_resources))
+
 void __init emev2_add_standard_devices(void)
 {
 	emev2_clock_init();
 
-	platform_add_devices(emev2_devices, ARRAY_SIZE(emev2_devices));
+	emev2_register_uart(0);
+	emev2_register_uart(1);
+	emev2_register_uart(2);
+	emev2_register_uart(3);
+	emev2_register_sti();
+	emev2_register_gio(0);
+	emev2_register_gio(1);
+	emev2_register_gio(2);
+	emev2_register_gio(3);
+	emev2_register_gio(4);
+	emev2_register_pmu();
 }
 
 void __init emev2_init_delay(void)
author maintainer
#4 lore raw

PATCH 4/8 ARM: shmobile: Add GIO to EMEV2 dtsi

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Add GIO0->GIO4 device nodes to the EMEV2 dtsi file.

---

 arch/arm/boot/dts/emev2.dtsi |   59 ++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 59 insertions(+)
arch/arm/boot/dts/emev2.dtsi +59 -0
@@ -14,6 +14,14 @@
 	compatible = "renesas,emev2";
 	interrupt-parent = <&gic>;
 
+	aliases {
+		gpio0 = &gpio0;
+		gpio1 = &gpio1;
+		gpio2 = &gpio2;
+		gpio3 = &gpio3;
+		gpio4 = &gpio4;
+	};
+
 	cpus {
 		#address-cells = <1>;
 		#size-cells = <0>;
@@ -67,4 +75,55 @@
 		reg = <0xe1050000 0x38>;
 		interrupts = <0 11 0>;
 	};
+
+	gpio0: gpio at e0050000 {
+		compatible = "renesas,em-gio";
+		reg = <0xe0050000 0x2c>, <0xe0050040 0x20>;
+		interrupts = <0 67 0>, <0 68 0>;
+		gpio-controller;
+		#gpio-cells = <2>;
+		ngpios = <32>;
+		interrupt-controller;
+		#interrupt-cells = <2>;
+	};
+	gpio1: gpio at e0050080 {
+		compatible = "renesas,em-gio";
+		reg = <0xe0050080 0x2c>, <0xe00500c0 0x20>;
+		interrupts = <0 69 0>, <0 70 0>;
+		gpio-controller;
+		#gpio-cells = <2>;
+		ngpios = <32>;
+		interrupt-controller;
+		#interrupt-cells = <2>;
+	};
+	gpio2: gpio at e0050100 {
+		compatible = "renesas,em-gio";
+		reg = <0xe0050100 0x2c>, <0xe0050140 0x20>;
+		interrupts = <0 71 0>, <0 72 0>;
+		gpio-controller;
+		#gpio-cells = <2>;
+		ngpios = <32>;
+		interrupt-controller;
+		#interrupt-cells = <2>;
+	};
+	gpio3: gpio at e0050180 {
+		compatible = "renesas,em-gio";
+		reg = <0xe0050180 0x2c>, <0xe00501c0 0x20>;
+		interrupts = <0 73 0>, <0 74 0>;
+		gpio-controller;
+		#gpio-cells = <2>;
+		ngpios = <32>;
+		interrupt-controller;
+		#interrupt-cells = <2>;
+	};
+	gpio4: gpio at e0050200 {
+		compatible = "renesas,em-gio";
+		reg = <0xe0050200 0x2c>, <0xe0050240 0x20>;
+		interrupts = <0 75 0>, <0 76 0>;
+		gpio-controller;
+		#gpio-cells = <2>;
+		ngpios = <31>;
+		interrupt-controller;
+		#interrupt-cells = <2>;
+	};
 };
author maintainer
#5 lore raw

PATCH 5/8 ARM: shmobile: Use DT for GIC on EMEV2 and KZM9D

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Remove the C version of the EMEV2 GIC setup code,
instead rely on GIC information provided by DT.

---

 arch/arm/mach-shmobile/board-kzm9d.c        |    2 --
 arch/arm/mach-shmobile/include/mach/emev2.h |    1 -
 arch/arm/mach-shmobile/setup-emev2.c        |   15 ---------------
 3 files changed, 18 deletions(-)
arch/arm/mach-shmobile/board-kzm9d.c +0 -2
@@ -86,8 +86,6 @@ DT_MACHINE_START(KZM9D_DT, "kzm9d")
 	.smp		= smp_ops(emev2_smp_ops),
 	.map_io		= emev2_map_io,
 	.init_early	= emev2_init_delay,
-	.nr_irqs	= NR_IRQS_LEGACY,
-	.init_irq	= emev2_init_irq,
 	.init_machine	= kzm9d_add_standard_devices,
 	.init_late	= shmobile_init_late,
 	.dt_compat	= kzm9d_boards_compat_dt,
arch/arm/mach-shmobile/include/mach/emev2.h +0 -1
@@ -2,7 +2,6 @@
 #define __ASM_EMEV2_H__
 
 extern void emev2_map_io(void);
-extern void emev2_init_irq(void);
 extern void emev2_init_delay(void);
 extern void emev2_add_standard_devices(void);
 extern void emev2_clock_init(void);
arch/arm/mach-shmobile/setup-emev2.c +0 -15
@@ -202,20 +202,6 @@ void __init emev2_init_delay(void)
 	shmobile_setup_delay(533, 1, 3); /* Cortex-A9 @ 533MHz */
 }
 
-void __init emev2_init_irq(void)
-{
-	void __iomem *gic_dist_base;
-	void __iomem *gic_cpu_base;
-
-	/* Static mappings, never released */
-	gic_dist_base = ioremap(0xe0028000, PAGE_SIZE);
-	gic_cpu_base = ioremap(0xe0020000, PAGE_SIZE);
-	BUG_ON(!gic_dist_base || !gic_cpu_base);
-
-	/* Use GIC to handle interrupts */
-	gic_init(0, 29, gic_dist_base, gic_cpu_base);
-}
-
 #ifdef CONFIG_USE_OF
 static const struct of_dev_auxdata emev2_auxdata_lookup[] __initconst = {
 	{ }
@@ -235,7 +221,6 @@ static const char *emev2_boards_compat_d
 DT_MACHINE_START(EMEV2_DT, "Generic Emma Mobile EV2 (Flattened Device Tree)")
 	.smp		= smp_ops(emev2_smp_ops),
 	.init_early	= emev2_init_delay,
-	.nr_irqs	= NR_IRQS_LEGACY,
 	.init_machine	= emev2_add_standard_devices_dt,
 	.dt_compat	= emev2_boards_compat_dt,
 MACHINE_END
author maintainer
#6 lore raw

PATCH 6/8 ARM: shmobile: Use DT for SMP on EMEV2 and KZM9D

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Rework the EMEV2 SMP code to rely on DT for CPU information instead of reading out number of CPU cores from the SCU.

---

 arch/arm/mach-shmobile/smp-emev2.c |   17 +++--------------
 1 file changed, 3 insertions(+), 14 deletions(-)
arch/arm/mach-shmobile/smp-emev2.c +3 -14
@@ -38,9 +38,12 @@ static int __cpuinit emev2_boot_secondar
 
 static void __init emev2_smp_prepare_cpus(unsigned int max_cpus)
 {
+	/* setup EMEV2 specific SCU base, enable */
+	shmobile_scu_base = ioremap(EMEV2_SCU_BASE, PAGE_SIZE);
 	scu_enable(shmobile_scu_base);
 
 	/* Tell ROM loader about our vector (in headsmp-scu.S, headsmp.S) */
+	emev2_clock_init(); /* need ioremapped SMU */
 	emev2_set_boot_vector(__pa(shmobile_boot_vector));
 	shmobile_boot_fn = virt_to_phys(shmobile_boot_scu);
 	shmobile_boot_arg = (unsigned long)shmobile_scu_base;
@@ -49,21 +52,7 @@ static void __init emev2_smp_prepare_cpu
 	scu_power_mode(shmobile_scu_base, SCU_PM_NORMAL);
 }
 
-static void __init emev2_smp_init_cpus(void)
-{
-	unsigned int ncores;
-
-	/* setup EMEV2 specific SCU base */
-	shmobile_scu_base = ioremap(EMEV2_SCU_BASE, PAGE_SIZE);
-	emev2_clock_init(); /* need ioremapped SMU */
-
-	ncores = shmobile_scu_base ? scu_get_core_count(shmobile_scu_base) : 1;
-
-	shmobile_smp_init_cpus(ncores);
-}
-
 struct smp_operations emev2_smp_ops __initdata = {
-	.smp_init_cpus		= emev2_smp_init_cpus,
 	.smp_prepare_cpus	= emev2_smp_prepare_cpus,
 	.smp_boot_secondary	= emev2_boot_secondary,
 };
author maintainer
#7 lore raw

PATCH 7/8 ARM: shmobile: EMEV2 map_io update

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Update the EMEV2 struct map_desc to exclude the SMU and also include the ->map_io() callback in the DT version of EMEV2 board support.

The EMEV2 SMP code can these days perform ioremap() early on without the SMU information in the io_desc[].

To correctly support SMP in case of DT-only board support then the ->map_io() callback is needed.

---

 arch/arm/mach-shmobile/setup-emev2.c |    8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
arch/arm/mach-shmobile/setup-emev2.c +1 -7
@@ -38,13 +38,6 @@
 
 static struct map_desc emev2_io_desc[] __initdata = {
 #ifdef CONFIG_SMP
-	/* 128K entity map for 0xe0100000 (SMU) */
-	{
-		.virtual	= 0xe0100000,
-		.pfn		= __phys_to_pfn(0xe0100000),
-		.length		= SZ_128K,
-		.type		= MT_DEVICE
-	},
 	/* 2M mapping for SCU + L2 controller */
 	{
 		.virtual	= 0xf0000000,
@@ -220,6 +213,7 @@ static const char *emev2_boards_compat_d
 
 DT_MACHINE_START(EMEV2_DT, "Generic Emma Mobile EV2 (Flattened Device Tree)")
 	.smp		= smp_ops(emev2_smp_ops),
+	.map_io		= emev2_map_io,
 	.init_early	= emev2_init_delay,
 	.init_machine	= emev2_add_standard_devices_dt,
 	.dt_compat	= emev2_boards_compat_dt,
author maintainer
#8 lore raw

PATCH 8/8 ARM: shmobile: Disconnect EMEV2 SMP code from clocks

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Update the EMEV2 SMP code to access the SMU directly instead of relying on help from the legacy clock code.

This change moves us one step closer to common clocks.

---

 arch/arm/mach-shmobile/clock-emev2.c        |   18 ------------------
 arch/arm/mach-shmobile/include/mach/emev2.h |    1 -
 arch/arm/mach-shmobile/smp-emev2.c          |   11 +++++++++--
 3 files changed, 9 insertions(+), 21 deletions(-)
arch/arm/mach-shmobile/clock-emev2.c +0 -18
@@ -40,7 +40,6 @@
 #define USIB2SCLKDIV 0x65c
 #define USIB3SCLKDIV 0x660
 #define STI_CLKSEL 0x688
-#define SMU_GENERAL_REG0 0x7c0
 
 /* not pretty, but hey */
 static void __iomem *smu_base;
@@ -51,11 +50,6 @@ static void emev2_smu_write(unsigned lon
 	iowrite32(value, smu_base + offs);
 }
 
-void emev2_set_boot_vector(unsigned long value)
-{
-	emev2_smu_write(value, SMU_GENERAL_REG0);
-}
-
 static struct clk_mapping smu_mapping = {
 	.phys	= EMEV2_SMU_BASE,
 	.len	= PAGE_SIZE,
@@ -205,18 +199,6 @@ static struct clk_lookup lookups[] = {
 void __init emev2_clock_init(void)
 {
 	int k, ret = 0;
-	static int is_setup;
-
-	/* yuck, this is ugly as hell, but the non-smp case of clocks
-	 * code is now designed to rely on ioremap() instead of static
-	 * entity maps. in the case of smp we need access to the SMU
-	 * register earlier than ioremap() is actually working without
-	 * any static maps. to enable SMP in ugly but with dynamic
-	 * mappings we have to call emev2_clock_init() from different
-	 * places depending on UP and SMP...
-	 */
-	if (is_setup++)
-		return;
 
 	smu_base = ioremap(EMEV2_SMU_BASE, PAGE_SIZE);
 	BUG_ON(!smu_base);
arch/arm/mach-shmobile/include/mach/emev2.h +0 -1
@@ -5,7 +5,6 @@ extern void emev2_map_io(void);
 extern void emev2_init_delay(void);
 extern void emev2_add_standard_devices(void);
 extern void emev2_clock_init(void);
-extern void emev2_set_boot_vector(unsigned long value);
 
 #define EMEV2_GPIO_BASE 200
 #define EMEV2_GPIO_IRQ(n) (EMEV2_GPIO_BASE + (n))
arch/arm/mach-shmobile/smp-emev2.c +9 -2
@@ -29,6 +29,8 @@
 #include <asm/smp_scu.h>
 
 #define EMEV2_SCU_BASE 0x1e000000
+#define EMEV2_SMU_BASE 0xe0110000
+#define SMU_GENERAL_REG0 0x7c0
 
 static int __cpuinit emev2_boot_secondary(unsigned int cpu, struct task_struct *idle)
 {
@@ -38,13 +40,18 @@ static int __cpuinit emev2_boot_secondar
 
 static void __init emev2_smp_prepare_cpus(unsigned int max_cpus)
 {
+	void __iomem *smu;
+
 	/* setup EMEV2 specific SCU base, enable */
 	shmobile_scu_base = ioremap(EMEV2_SCU_BASE, PAGE_SIZE);
 	scu_enable(shmobile_scu_base);
 
 	/* Tell ROM loader about our vector (in headsmp-scu.S, headsmp.S) */
-	emev2_clock_init(); /* need ioremapped SMU */
-	emev2_set_boot_vector(__pa(shmobile_boot_vector));
+	smu = ioremap(EMEV2_SMU_BASE, PAGE_SIZE);
+	if (smu) {
+		iowrite32(__pa(shmobile_boot_vector), smu + SMU_GENERAL_REG0);
+		iounmap(smu);
+	}
 	shmobile_boot_fn = virt_to_phys(shmobile_boot_scu);
 	shmobile_boot_arg = (unsigned long)shmobile_scu_base;
 
#9 lore raw

cover ARM: shmobile: EMEV2 and KZM9D update

In reply to Magnus Damm
Quoted 11 lines · Magnus Damm

ARM: shmobile: EMEV2 and KZM9D update

[PATCH 01/08] ARM: shmobile: Remove unused EMEV2/KZM9D early console [PATCH 02/08] ARM: shmobile: Update KZM9D dts command line [PATCH 03/08] ARM: shmobile: Make EMEV2 platform devices more compact [PATCH 04/08] ARM: shmobile: Add GIO to EMEV2 dtsi
[PATCH 05/08] ARM: shmobile: Use DT for GIC on EMEV2 and KZM9D [PATCH 06/08] ARM: shmobile: Use DT for SMP on EMEV2 and KZM9D [PATCH 07/08] ARM: shmobile: EMEV2 map_io update
[PATCH 08/08] ARM: shmobile: Disconnect EMEV2 SMP code from clocks

Quoted 8 lines

Several minor updates for the EMEV2 SoC and the KZM9D board:
- Get rid of early console - the 8250-em driver does not support it
- Update command line in DTS and remove old cruft
- Make the EMEV2 platform devices more compact
- Add GIO device nodes to the EMEV2 dtsi
- Use DT for GIC and SMP for both regular KZM9D board code and DT
- Reduce the size of the EMEV2 map_io - SCU is still however needed
- Allow EMEV2 SMP to operate without legacy clock bits

Looks all good to me,

#10 lore raw

cover ARM: shmobile: EMEV2 and KZM9D update

In reply to Magnus Damm
Quoted 20 lines · Magnus Damm

ARM: shmobile: EMEV2 and KZM9D update

[PATCH 01/08] ARM: shmobile: Remove unused EMEV2/KZM9D early console [PATCH 02/08] ARM: shmobile: Update KZM9D dts command line [PATCH 03/08] ARM: shmobile: Make EMEV2 platform devices more compact [PATCH 04/08] ARM: shmobile: Add GIO to EMEV2 dtsi
[PATCH 05/08] ARM: shmobile: Use DT for GIC on EMEV2 and KZM9D [PATCH 06/08] ARM: shmobile: Use DT for SMP on EMEV2 and KZM9D [PATCH 07/08] ARM: shmobile: EMEV2 map_io update
[PATCH 08/08] ARM: shmobile: Disconnect EMEV2 SMP code from clocks

Several minor updates for the EMEV2 SoC and the KZM9D board:
- Get rid of early console - the 8250-em driver does not support it
- Update command line in DTS and remove old cruft
- Make the EMEV2 platform devices more compact
- Add GIO device nodes to the EMEV2 dtsi
- Use DT for GIC and SMP for both regular KZM9D board code and DT
- Reduce the size of the EMEV2 map_io - SCU is still however needed
- Allow EMEV2 SMP to operate without legacy clock bits

Quoted 1 line

Thanks, I have queued up all these patches for v3.12.