Skip to contentSkip to conversation

ARM: shmobile: Cleanups and machine descriptor rework

PATCH New Magnus Damm 2 participants 25 messages Aug 9, 2013 – Aug 30, 2013

Subsystems (4)
lore
Share & tools
lore

Magnus Damm

author maintainer
#0 lore raw

cover ARM: shmobile: Cleanups and machine descriptor rework

ARM: shmobile: Cleanups and machine descriptor rework

[PATCH 01/14] ARM: shmobile: r8a7779: Remove ->init_machine() special case [PATCH 02/14] ARM: shmobile: r8a7740: Remove ->init_machine() special case [PATCH 03/14] ARM: shmobile: sh7372: Remove ->init_machine() special case [PATCH 04/14] ARM: shmobile: sh73a0: Remove ->init_machine() special case [PATCH 05/14] ARM: shmobile: Remove r8a7740_add_early_devices_dt() [PATCH 06/14] ARM: shmobile: Remove sh73a0_init_irq_dt()
[PATCH 07/14] ARM: shmobile: Remove r8a7779 ->nr_irqs
[PATCH 08/14] ARM: shmobile: Remove sh73a0 ->nr_irqs
[PATCH 09/14] ARM: shmobile: Rename to sh7372_init_early()
[PATCH 10/14] ARM: shmobile: Rename to emev2_init_early(), use smp_set_ops() [PATCH 11/14] ARM: shmobile: Rename to r8a7779_init_early(), use smp_set_ops() [PATCH 12/14] ARM: shmobile: Rename to r8a7740_init_early() [PATCH 13/14] ARM: shmobile: Rename to r8a7778_init_early() [PATCH 14/14] ARM: shmobile: Rename to sh73a0_init_early(), use smp_set_ops()

This series contains various machine descriptor related cleanups and removal of unused code.

---

Written against renesas.git renesas-devel-20130807 and [PATCH 00/02] ARM: shmobile: Rename to r8a73a4/r8a7790_init_early()

 arch/arm/mach-shmobile/board-armadillo800eva-reference.c |    6 +-
 arch/arm/mach-shmobile/board-bockw-reference.c           |    2 
 arch/arm/mach-shmobile/board-bockw.c                     |    2 
 arch/arm/mach-shmobile/board-kzm9d-reference.c           |    3 -
 arch/arm/mach-shmobile/board-kzm9d.c                     |    3 -
 arch/arm/mach-shmobile/board-kzm9g-reference.c           |   13 +++-
 arch/arm/mach-shmobile/board-kzm9g.c                     |    1 
 arch/arm/mach-shmobile/board-marzen-reference.c          |   11 ++-
 arch/arm/mach-shmobile/board-marzen.c                    |    1 
 arch/arm/mach-shmobile/include/mach/emev2.h              |    2 
 arch/arm/mach-shmobile/include/mach/r8a7740.h            |    4 -
 arch/arm/mach-shmobile/include/mach/r8a7778.h            |    2 
 arch/arm/mach-shmobile/include/mach/r8a7779.h            |    4 -
 arch/arm/mach-shmobile/include/mach/sh7372.h             |    2 
 arch/arm/mach-shmobile/include/mach/sh73a0.h             |    5 -
 arch/arm/mach-shmobile/setup-emev2.c                     |    8 +-
 arch/arm/mach-shmobile/setup-r8a7740.c                   |   40 +++-----------
 arch/arm/mach-shmobile/setup-r8a7778.c                   |    4 -
 arch/arm/mach-shmobile/setup-r8a7779.c                   |   36 +++++-------
 arch/arm/mach-shmobile/setup-sh7372.c                    |   22 -------
 arch/arm/mach-shmobile/setup-sh73a0.c                    |   35 ++++--------
 21 files changed, 82 insertions(+), 124 deletions(-)
author maintainer
#1 lore raw

PATCH 1/14 ARM: shmobile: r8a7779: Remove ->init_machine() special case

From: Magnus Damm <[email protected]>

No need to special case r8a7779 ->init_machine(), so get rid of undesired clock setup from the generic long term r8a7779 DT support code.

Rework the code to let r8a7779_add_dt_devices() act like other SoCs and make the board DT reference code setup clocks for us.

---

 arch/arm/mach-shmobile/board-marzen-reference.c |    7 ++++++-
 arch/arm/mach-shmobile/include/mach/r8a7779.h   |    2 +-
 arch/arm/mach-shmobile/setup-r8a7779.c          |   18 ++++++------------
 3 files changed, 13 insertions(+), 14 deletions(-)
arch/arm/mach-shmobile/board-marzen-reference.c +6 -1
@@ -19,6 +19,7 @@
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
+#include <linux/of_platform.h>
 #include <mach/r8a7779.h>
 #include <mach/common.h>
 #include <mach/irqs.h>
@@ -27,7 +28,11 @@
 
 static void __init marzen_init(void)
 {
-	r8a7779_add_standard_devices_dt();
+	/* clocks are setup late during boot in the case of DT */
+	r8a7779_clock_init();
+
+	r8a7779_add_dt_devices();
+	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
 
 static const char *marzen_boards_compat_dt[] __initdata = {
arch/arm/mach-shmobile/include/mach/r8a7779.h +1 -1
@@ -30,7 +30,7 @@ extern void r8a7779_map_io(void);
 extern void r8a7779_earlytimer_init(void);
 extern void r8a7779_add_early_devices(void);
 extern void r8a7779_add_standard_devices(void);
-extern void r8a7779_add_standard_devices_dt(void);
+extern void r8a7779_add_dt_devices(void);
 extern void r8a7779_add_ether_device(struct sh_eth_plat_data *pdata);
 extern void r8a7779_init_late(void);
 extern void r8a7779_clock_init(void);
arch/arm/mach-shmobile/setup-r8a7779.c +6 -12
@@ -24,7 +24,6 @@
 #include <linux/irq.h>
 #include <linux/irqchip.h>
 #include <linux/irqchip/arm-gic.h>
-#include <linux/of_platform.h>
 #include <linux/platform_data/gpio-rcar.h>
 #include <linux/platform_data/irq-renesas-intc-irqpin.h>
 #include <linux/platform_device.h>
@@ -624,6 +623,12 @@ static struct platform_device *r8a7779_s
 	&sata_device,
 };
 
+void __init r8a7779_add_dt_devices(void)
+{
+	platform_add_devices(r8a7779_devices_dt,
+			     ARRAY_SIZE(r8a7779_devices_dt));
+}
+
 void __init r8a7779_add_standard_devices(void)
 {
 #ifdef CONFIG_CACHE_L2X0
@@ -726,16 +731,6 @@ void __init r8a7779_init_delay(void)
 	shmobile_setup_delay(1000, 2, 4); /* Cortex-A9 @ 1000MHz */
 }
 
-void __init r8a7779_add_standard_devices_dt(void)
-{
-	/* clocks are setup late during boot in the case of DT */
-	r8a7779_clock_init();
-
-	platform_add_devices(r8a7779_devices_dt,
-			     ARRAY_SIZE(r8a7779_devices_dt));
-	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
-}
-
 static const char *r8a7779_compat_dt[] __initdata = {
 	"renesas,r8a7779",
 	NULL,
@@ -746,7 +741,6 @@ DT_MACHINE_START(R8A7779_DT, "Generic R8
 	.init_early	= r8a7779_init_delay,
 	.nr_irqs	= NR_IRQS_LEGACY,
 	.init_irq	= r8a7779_init_irq_dt,
-	.init_machine	= r8a7779_add_standard_devices_dt,
 	.init_late	= r8a7779_init_late,
 	.dt_compat	= r8a7779_compat_dt,
 MACHINE_END
author maintainer
#2 lore raw

PATCH 2/14 ARM: shmobile: r8a7740: Remove ->init_machine() special case

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

No need to special case r8a7740 ->init_machine(), so get rid of undesired clock setup from the generic long term r8a7740 DT support code.

Rework the code to let r8a7740_add_dt_devices() act like other SoCs and make the board DT reference code setup clocks for us.

---

 arch/arm/mach-shmobile/board-armadillo800eva-reference.c |    4 +++-
 arch/arm/mach-shmobile/include/mach/r8a7740.h            |    2 +-
 arch/arm/mach-shmobile/setup-r8a7740.c                   |   11 +----------
 3 files changed, 5 insertions(+), 12 deletions(-)
arch/arm/mach-shmobile/board-armadillo800eva-reference.c +3 -1
@@ -24,6 +24,7 @@
 #include <linux/kernel.h>
 #include <linux/gpio.h>
 #include <linux/io.h>
+#include <linux/of_platform.h>
 #include <mach/common.h>
 #include <mach/r8a7740.h>
 #include <asm/mach/arch.h>
@@ -168,7 +169,8 @@ static void __init eva_init(void)
 	l2x0_init(IOMEM(0xf0002000), 0x40440000, 0x82000fff);
 #endif
 
-	r8a7740_add_standard_devices_dt();
+	r8a7740_add_dt_devices();
+	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 
 	r8a7740_pm_init();
 }
arch/arm/mach-shmobile/include/mach/r8a7740.h +1 -1
@@ -52,7 +52,7 @@ extern void r8a7740_init_irq_of(void);
 extern void r8a7740_map_io(void);
 extern void r8a7740_add_early_devices(void);
 extern void r8a7740_add_standard_devices(void);
-extern void r8a7740_add_standard_devices_dt(void);
+extern void r8a7740_add_dt_devices(void);
 extern void r8a7740_clock_init(u8 md_ck);
 extern void r8a7740_pinmux_init(void);
 extern void r8a7740_pm_init(void);
arch/arm/mach-shmobile/setup-r8a7740.c +1 -10
@@ -26,7 +26,6 @@
 #include <linux/irqchip/arm-gic.h>
 #include <linux/platform_data/irq-renesas-intc-irqpin.h>
 #include <linux/platform_device.h>
-#include <linux/of_platform.h>
 #include <linux/serial_sci.h>
 #include <linux/sh_dma.h>
 #include <linux/sh_timer.h>
@@ -1009,11 +1008,10 @@ void __init r8a7740_add_early_devices_dt
 	shmobile_setup_console();
 }
 
-void __init r8a7740_add_standard_devices_dt(void)
+void __init r8a7740_add_dt_devices(void)
 {
 	platform_add_devices(r8a7740_devices_dt,
 			    ARRAY_SIZE(r8a7740_devices_dt));
-	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
 }
 
 void __init r8a7740_init_delay(void)
@@ -1051,12 +1049,6 @@ void __init r8a7740_init_irq_of(void)
 	iounmap(pfc_inta_ctrl);
 }
 
-static void __init r8a7740_generic_init(void)
-{
-	r8a7740_clock_init(0);
-	r8a7740_add_standard_devices_dt();
-}
-
 static const char *r8a7740_boards_compat_dt[] __initdata = {
 	"renesas,r8a7740",
 	NULL,
@@ -1066,7 +1058,6 @@ DT_MACHINE_START(R8A7740_DT, "Generic R8
 	.map_io		= r8a7740_map_io,
 	.init_early	= r8a7740_init_delay,
 	.init_irq	= r8a7740_init_irq_of,
-	.init_machine	= r8a7740_generic_init,
 	.dt_compat	= r8a7740_boards_compat_dt,
 MACHINE_END
 
author maintainer
#3 lore raw

PATCH 3/14 ARM: shmobile: sh7372: Remove ->init_machine() special case

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

No need to special case sh7372 ->init_machine(),
so get rid of undesired clock setup from the
generic long term sh7372 DT support code.

Remove sh7372_add_standard_devices_dt() since we have no DT reference implementation for sh7372.

---

 arch/arm/mach-shmobile/include/mach/sh7372.h |    1 -
 arch/arm/mach-shmobile/setup-sh7372.c        |   12 ------------
 2 files changed, 13 deletions(-)
arch/arm/mach-shmobile/include/mach/sh7372.h +0 -1
@@ -64,7 +64,6 @@ extern void sh7372_earlytimer_init(void)
 extern void sh7372_add_early_devices(void);
 extern void sh7372_add_standard_devices(void);
 extern void sh7372_add_early_devices_dt(void);
-extern void sh7372_add_standard_devices_dt(void);
 extern void sh7372_clock_init(void);
 extern void sh7372_pinmux_init(void);
 extern void sh7372_pm_init(void);
arch/arm/mach-shmobile/setup-sh7372.c +0 -12
@@ -1146,17 +1146,6 @@ void __init sh7372_add_early_devices_dt(
 	shmobile_setup_console();
 }
 
-void __init sh7372_add_standard_devices_dt(void)
-{
-	/* clocks are setup late during boot in the case of DT */
-	sh7372_clock_init();
-
-	platform_add_devices(sh7372_early_devices,
-			    ARRAY_SIZE(sh7372_early_devices));
-
-	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
-}
-
 static const char *sh7372_boards_compat_dt[] __initdata = {
 	"renesas,sh7372",
 	NULL,
@@ -1168,7 +1157,6 @@ DT_MACHINE_START(SH7372_DT, "Generic SH7
 	.nr_irqs	= NR_IRQS_LEGACY,
 	.init_irq	= sh7372_init_irq,
 	.handle_irq	= shmobile_handle_irq_intc,
-	.init_machine	= sh7372_add_standard_devices_dt,
 	.dt_compat	= sh7372_boards_compat_dt,
 MACHINE_END
 
author maintainer
#4 lore raw

PATCH 4/14 ARM: shmobile: sh73a0: Remove ->init_machine() special case

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

No need to special case sh73a0 ->init_machine(), so get rid of undesired cpufreq platform device from the generic long term sh73a0 DT support code.

For short term support on KZM9D the DT reference implementation now adds a "cpufreq-cpu0" platform device so that can be used for development.

---

 arch/arm/mach-shmobile/board-kzm9g-reference.c |    9 ++++++++-
 arch/arm/mach-shmobile/include/mach/sh73a0.h   |    2 +-
 arch/arm/mach-shmobile/setup-sh73a0.c          |   23 ++++++-----------------
 3 files changed, 15 insertions(+), 19 deletions(-)
arch/arm/mach-shmobile/board-kzm9g-reference.c +8 -1
@@ -33,7 +33,14 @@
 
 static void __init kzm_init(void)
 {
-	sh73a0_add_standard_devices_dt();
+	/* clocks are setup late during boot in the case of DT */
+	sh73a0_clock_init();
+
+	sh73a0_add_dt_devices();
+
+	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+
+	platform_device_register_simple("cpufreq-cpu0", -1, NULL, 0);
 
 #ifdef CONFIG_CACHE_L2X0
 	/* Early BRESP enable, Shared attribute override enable, 64K*8way */
arch/arm/mach-shmobile/include/mach/sh73a0.h +1 -1
@@ -78,7 +78,7 @@ extern void sh73a0_map_io(void);
 extern void sh73a0_earlytimer_init(void);
 extern void sh73a0_add_early_devices(void);
 extern void sh73a0_add_standard_devices(void);
-extern void sh73a0_add_standard_devices_dt(void);
+extern void sh73a0_add_dt_devices(void);
 extern void sh73a0_clock_init(void);
 extern void sh73a0_pinmux_init(void);
 extern void sh73a0_pm_init(void);
arch/arm/mach-shmobile/setup-sh73a0.c +6 -17
@@ -23,7 +23,6 @@
 #include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/platform_device.h>
-#include <linux/of_platform.h>
 #include <linux/delay.h>
 #include <linux/input.h>
 #include <linux/io.h>
@@ -901,6 +900,12 @@ static struct platform_device *sh73a0_la
 
 #define SRCR2          IOMEM(0xe61580b0)
 
+void __init sh73a0_add_dt_devices(void)
+{
+	platform_add_devices(sh73a0_devices_dt,
+			     ARRAY_SIZE(sh73a0_devices_dt));
+}
+
 void __init sh73a0_add_standard_devices(void)
 {
 	/* Clear software reset bit on SY-DMAC module */
@@ -943,21 +948,6 @@ void __init sh73a0_add_early_devices(voi
 
 #ifdef CONFIG_USE_OF
 
-void __init sh73a0_add_standard_devices_dt(void)
-{
-	struct platform_device_info devinfo = { .name = "cpufreq-cpu0", .id = -1, };
-
-	/* clocks are setup late during boot in the case of DT */
-	sh73a0_clock_init();
-
-	platform_add_devices(sh73a0_devices_dt,
-			     ARRAY_SIZE(sh73a0_devices_dt));
-	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
-
-	/* Instantiate cpufreq-cpu0 */
-	platform_device_register_full(&devinfo);
-}
-
 static const char *sh73a0_boards_compat_dt[] __initdata = {
 	"renesas,sh73a0",
 	NULL,
@@ -968,7 +958,6 @@ DT_MACHINE_START(SH73A0_DT, "Generic SH7
 	.map_io		= sh73a0_map_io,
 	.init_early	= sh73a0_init_delay,
 	.nr_irqs	= NR_IRQS_LEGACY,
-	.init_machine	= sh73a0_add_standard_devices_dt,
 	.dt_compat	= sh73a0_boards_compat_dt,
 MACHINE_END
 #endif /* CONFIG_USE_OF */
#5 lore raw

PATCH 4/14 ARM: shmobile: sh73a0: Remove ->init_machine() special case

Hi Magnus,

Thank you for the patch.

Quoted 9 lines · On Friday 09 August 2013 18:48:32 Magnus Damm wrote:

From: Magnus Damm <[email protected]>

No need to special case sh73a0 ->init_machine(), so get rid of undesired cpufreq platform device from the generic long term sh73a0 DT support code.

For short term support on KZM9D the DT reference implementation now adds a "cpufreq-cpu0" platform device so that can be used for development.

Doesn't this go against the spirit of the -reference platforms that don't use DT devices in board code ? I don't see an urgent need for this, how far along are the DT cpufreq-related bindings ?

arch/arm/mach-shmobile/setup-sh73a0.c

Quoted 39 lines

---

 arch/arm/mach-shmobile/board-kzm9g-reference.c |    9 ++++++++-
 arch/arm/mach-shmobile/include/mach/sh73a0.h   |    2 +- 
 arch/arm/mach-shmobile/setup-sh73a0.c          |   23  ++++++--------------
 3 files changed, 15 insertions(+), 19 deletions(-)
arch/arm/mach-shmobile/board-kzm9g-reference.c +0 -0

15:56:28.000000000 +0900 @@ -33,7 +33,14 @@

static void __init kzm_init(void)
{

arch/arm/mach-shmobile/board-kzm9g-reference.c +8 -1
-	sh73a0_add_standard_devices_dt();
+	/* clocks are setup late during boot in the case of DT */
+	sh73a0_clock_init();
+
+	sh73a0_add_dt_devices();
+
+	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
+
+	platform_device_register_simple("cpufreq-cpu0", -1, NULL, 0);
 
 #ifdef CONFIG_CACHE_L2X0
 	/* Early BRESP enable, Shared attribute override enable, 64K*8way */
arch/arm/mach-shmobile/include/mach/sh73a0.h +0 -0

15:54:26.000000000 +0900 @@ -78,7 +78,7 @@ extern void sh73a0_map_io(void);
extern void sh73a0_earlytimer_init(void);
extern void sh73a0_add_early_devices(void);
extern void sh73a0_add_standard_devices(void);

arch/arm/mach-shmobile/include/mach/sh73a0.h +1 -1
-extern void sh73a0_add_standard_devices_dt(void);
+extern void sh73a0_add_dt_devices(void);
 extern void sh73a0_clock_init(void);
 extern void sh73a0_pinmux_init(void);
 extern void sh73a0_pm_init(void);
arch/arm/mach-shmobile/setup-sh73a0.c +0 -0

15:57:42.000000000

Quoted 51 lines

+0900 @@ -23,7 +23,6 @@
#include <linux/interrupt.h>
#include <linux/irq.h>
#include <linux/platform_device.h>

arch/arm/mach-shmobile/setup-sh73a0.c +6 -16
-#include <linux/of_platform.h>
 #include <linux/delay.h>
 #include <linux/input.h>
 #include <linux/io.h>
@@ -901,6 +900,12 @@ static struct platform_device *sh73a0_la
 
 #define SRCR2          IOMEM(0xe61580b0)
 
+void __init sh73a0_add_dt_devices(void)
+{
+	platform_add_devices(sh73a0_devices_dt,
+			     ARRAY_SIZE(sh73a0_devices_dt));
+}
+
 void __init sh73a0_add_standard_devices(void)
 {
 	/* Clear software reset bit on SY-DMAC module */
@@ -943,21 +948,6 @@ void __init sh73a0_add_early_devices(voi
 
 #ifdef CONFIG_USE_OF
 
-void __init sh73a0_add_standard_devices_dt(void)
-{
-	struct platform_device_info devinfo = { .name = "cpufreq-cpu0", .id = -1,
 }; -
-	/* clocks are setup late during boot in the case of DT */
-	sh73a0_clock_init();
-
-	platform_add_devices(sh73a0_devices_dt,
-			     ARRAY_SIZE(sh73a0_devices_dt));
-	of_platform_populate(NULL, of_default_bus_match_table, NULL, NULL);
-
-	/* Instantiate cpufreq-cpu0 */
-	platform_device_register_full(&devinfo);
-}
-
 static const char *sh73a0_boards_compat_dt[] __initdata = {
 	"renesas,sh73a0",
 	NULL,
@@ -968,7 +958,6 @@ DT_MACHINE_START(SH73A0_DT, "Generic SH7
 	.map_io		= sh73a0_map_io,
 	.init_early	= sh73a0_init_delay,
 	.nr_irqs	= NR_IRQS_LEGACY,
-	.init_machine	= sh73a0_add_standard_devices_dt,
 	.dt_compat	= sh73a0_boards_compat_dt,
 MACHINE_END
 #endif /* CONFIG_USE_OF */
Signature · 3 lines
Regards,

Laurent Pinchart
author maintainer
#6 lore raw

PATCH 4/14 ARM: shmobile: sh73a0: Remove ->init_machine() special case

Hi Laurent,

Quoted 11 lines · Laurent Pinchart

Hi Magnus,

Thank you for the patch.

Quoted 6 lines · On Friday 09 August 2013 18:48:32 Magnus Damm wrote:

From: Magnus Damm <[email protected]>

No need to special case sh73a0 ->init_machine(), so get rid of undesired cpufreq platform device from the generic long term sh73a0 DT support code.

Quoted 7 lines
Quoted 3 lines

For short term support on KZM9D the DT reference implementation now adds a "cpufreq-cpu0" platform device so that can be used for development.

Doesn't this go against the spirit of the -reference platforms that don't use DT devices in board code ? I don't see an urgent need for this, how far along are the DT cpufreq-related bindings ?

I'm not sure what the latest state of DT cpufreq bindings are. Actually, it seems to me that the cpufreq platform device is a software policy that shouldn't be described with DT. And to be honest, I can't really see how this policy has anything to do with any particular SoC.

Regarding MACHINE_START on mach-shmobile I'd like to have 3 levels:

1) MACHINE_START in setup-xxxx.c

This is where we aim to be in the long term. We should be as theoretically correct as ever possible here. I'd like to avoid all platform devices here. Also, I'd like to avoid short term random policy setting here.

2) MACHINE_START in board-xxx-reference.c

This is where we build DT support for the board. In case we don't have DT bindings for a certain device then using platform device here is acceptable. Other short term workarounds are also acceptable here.

3) MACHINE_START in board-xxx.c

This is the location of the C-based board support. Some SoC-specific bits like CPU cores and interrupt controllers may be initialized via DT. Otherwise platform devices are used.

Hope this clarifies my view!

Cheers,

/ magnus

#7 lore raw

PATCH 4/14 ARM: shmobile: sh73a0: Remove ->init_machine() special case

Hi Magnus,

Quoted 12 lines · On Wednesday 28 August 2013 15:40:50 Magnus Damm wrote:
Quoted 11 lines · Laurent Pinchart
Quoted 9 lines · On Friday 09 August 2013 18:48:32 Magnus Damm wrote:

From: Magnus Damm <[email protected]>

No need to special case sh73a0 ->init_machine(), so get rid of undesired cpufreq platform device from the generic long term sh73a0 DT support code.

For short term support on KZM9D the DT reference implementation now adds a "cpufreq-cpu0" platform device so that can be used for development.

Quoted 8 lines
Quoted 3 lines

Doesn't this go against the spirit of the -reference platforms that don't use DT devices in board code ? I don't see an urgent need for this, how far along are the DT cpufreq-related bindings ?

I'm not sure what the latest state of DT cpufreq bindings are. Actually, it seems to me that the cpufreq platform device is a software policy that shouldn't be described with DT. And to be honest, I can't really see how this policy has anything to do with any particular SoC.

I'm no cpufreq expert, but if we need to register the device in C code, I'm pretty uneasy with having that code in board files. One of the DT goals is to get rid of most board files.

Quoted 22 lines

Regarding MACHINE_START on mach-shmobile I'd like to have 3 levels:

1) MACHINE_START in setup-xxxx.c

This is where we aim to be in the long term. We should be as theoretically correct as ever possible here. I'd like to avoid all platform devices here. Also, I'd like to avoid short term random policy setting here.

2) MACHINE_START in board-xxx-reference.c

This is where we build DT support for the board. In case we don't have DT bindings for a certain device then using platform device here is acceptable. Other short term workarounds are also acceptable here.

3) MACHINE_START in board-xxx.c

This is the location of the C-based board support. Some SoC-specific bits like CPU cores and interrupt controllers may be initialized via DT. Otherwise platform devices are used.

Hope this clarifies my view!

Signature · 3 lines
Regards,

Laurent Pinchart
author maintainer
#8 lore raw

PATCH 4/14 ARM: shmobile: sh73a0: Remove ->init_machine() special case

Hi Laurent,

Quoted 19 lines · Laurent Pinchart

Hi Magnus,

Quoted 16 lines · On Wednesday 28 August 2013 15:40:50 Magnus Damm wrote:
Quoted 14 lines · Laurent Pinchart
Quoted 9 lines · On Friday 09 August 2013 18:48:32 Magnus Damm wrote:

From: Magnus Damm <[email protected]>

No need to special case sh73a0 ->init_machine(), so get rid of undesired cpufreq platform device from the generic long term sh73a0 DT support code.

For short term support on KZM9D the DT reference implementation now adds a "cpufreq-cpu0" platform device so that can be used for development.

Doesn't this go against the spirit of the -reference platforms that don't use DT devices in board code ? I don't see an urgent need for this, how far along are the DT cpufreq-related bindings ?

Quoted 8 lines
Quoted 4 lines

I'm not sure what the latest state of DT cpufreq bindings are. Actually, it seems to me that the cpufreq platform device is a software policy that shouldn't be described with DT. And to be honest, I can't really see how this policy has anything to do with any particular SoC.

I'm no cpufreq expert, but if we need to register the device in C code, I'm pretty uneasy with having that code in board files. One of the DT goals is to get rid of most board files.

I'm not sure if we actually _have_to_ register via the platform device, or if it just happens to be like that today because no one has bothered creating a better abstraction. It is a mystery to me that both a platform device is used to select actual driver, and then DT is used to provide frequency and voltage information.

The cpufreq software policy is neither board nor SoC specific. It must be application specific. I can understand that putting it in a board file seems odd, but putting it in a SoC file is IMO equally odd, and with the added damage that people starting to write generic DT code may assume that the SoC will keep on using the same cpufreq software policy in the future.

Perhaps the cpufreq registration interface should be reworked somehow?

Cheers,

/ magnus

#9 lore raw

PATCH 4/14 ARM: shmobile: sh73a0: Remove ->init_machine() special case

Hi Magnus,

Quoted 33 lines · On Wednesday 28 August 2013 21:19:50 Magnus Damm wrote:
Quoted 17 lines · Laurent Pinchart
Quoted 16 lines · On Wednesday 28 August 2013 15:40:50 Magnus Damm wrote:
Quoted 14 lines · Laurent Pinchart
Quoted 9 lines · On Friday 09 August 2013 18:48:32 Magnus Damm wrote:

From: Magnus Damm <[email protected]>

No need to special case sh73a0 ->init_machine(), so get rid of undesired cpufreq platform device from the generic long term sh73a0 DT support code.

For short term support on KZM9D the DT reference implementation now adds a "cpufreq-cpu0" platform device so that can be used for development.

Doesn't this go against the spirit of the -reference platforms that don't use DT devices in board code ? I don't see an urgent need for this, how far along are the DT cpufreq-related bindings ?

Quoted 8 lines
Quoted 4 lines

I'm not sure what the latest state of DT cpufreq bindings are. Actually, it seems to me that the cpufreq platform device is a software policy that shouldn't be described with DT. And to be honest, I can't really see how this policy has anything to do with any particular SoC.

I'm no cpufreq expert, but if we need to register the device in C code, I'm pretty uneasy with having that code in board files. One of the DT goals is to get rid of most board files.

I'm not sure if we actually _have_to_ register via the platform device, or if it just happens to be like that today because no one has bothered creating a better abstraction. It is a mystery to me that both a platform device is used to select actual driver, and then DT is used to provide frequency and voltage information.

Quoted 7 lines

The cpufreq software policy is neither board nor SoC specific. It must be application specific. I can understand that putting it in a board file seems odd, but putting it in a SoC file is IMO equally odd, and with the added damage that people starting to write generic DT code may assume that the SoC will keep on using the same cpufreq software policy in the future.

Perhaps the cpufreq registration interface should be reworked somehow?

Perhaps :-) The situation needs to be at least clarified. Feel free to CC me :-)

Signature · 3 lines
Regards,

Laurent Pinchart
author maintainer
#10 lore raw

PATCH 4/14 ARM: shmobile: sh73a0: Remove ->init_machine() special case

Hi Laurent,

Quoted 42 lines · Laurent Pinchart

Hi Magnus,

Quoted 39 lines · On Wednesday 28 August 2013 21:19:50 Magnus Damm wrote:
Quoted 17 lines · Laurent Pinchart
Quoted 16 lines · On Wednesday 28 August 2013 15:40:50 Magnus Damm wrote:
Quoted 14 lines · Laurent Pinchart
Quoted 9 lines · On Friday 09 August 2013 18:48:32 Magnus Damm wrote:

From: Magnus Damm <[email protected]>

No need to special case sh73a0 ->init_machine(), so get rid of undesired cpufreq platform device from the generic long term sh73a0 DT support code.

For short term support on KZM9D the DT reference implementation now adds a "cpufreq-cpu0" platform device so that can be used for development.

Doesn't this go against the spirit of the -reference platforms that don't use DT devices in board code ? I don't see an urgent need for this, how far along are the DT cpufreq-related bindings ?

Quoted 8 lines
Quoted 4 lines

I'm not sure what the latest state of DT cpufreq bindings are. Actually, it seems to me that the cpufreq platform device is a software policy that shouldn't be described with DT. And to be honest, I can't really see how this policy has anything to do with any particular SoC.

I'm no cpufreq expert, but if we need to register the device in C code, I'm pretty uneasy with having that code in board files. One of the DT goals is to get rid of most board files.

I'm not sure if we actually _have_to_ register via the platform device, or if it just happens to be like that today because no one has bothered creating a better abstraction. It is a mystery to me that both a platform device is used to select actual driver, and then DT is used to provide frequency and voltage information.

The cpufreq software policy is neither board nor SoC specific. It must be application specific. I can understand that putting it in a board file seems odd, but putting it in a SoC file is IMO equally odd, and with the added damage that people starting to write generic DT code may assume that the SoC will keep on using the same cpufreq software policy in the future.

Quoted 4 lines
Quoted 1 line

Perhaps the cpufreq registration interface should be reworked somehow?

Perhaps :-) The situation needs to be at least clarified. Feel free to CC me :-)

Thanks. =)

There are CPUFreq dependencies on SMP and multi-cluster frequency scaling for some SoCs, so to begin with I prefer to allow selected boards use whatever old interface that is available now and over time incrementally improve the situation. I don't however want the shared per-SoC DT_MACHINE code in setup-xxx.c to enable anything by default for now though - this portion we can modify when we have SMP and multi-cluster working.

Cheers,

/ magnus

author maintainer
#11 lore raw

PATCH 5/14 ARM: shmobile: Remove r8a7740_add_early_devices_dt()

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Remove the unused r8a7740_add_early_devices_dt() function.

---

 arch/arm/mach-shmobile/setup-r8a7740.c |   15 ++-------------
 1 file changed, 2 insertions(+), 13 deletions(-)
arch/arm/mach-shmobile/setup-r8a7740.c +2 -13
@@ -995,25 +995,14 @@ void __init r8a7740_add_early_devices(vo
 	shmobile_setup_console();
 }
 
-#ifdef CONFIG_USE_OF
-
-void __init r8a7740_add_early_devices_dt(void)
-{
-	shmobile_setup_delay(800, 1, 3); /* Cortex-A9 @ 800MHz */
-
-	early_platform_add_devices(r8a7740_early_devices,
-				   ARRAY_SIZE(r8a7740_early_devices));
-
-	/* setup early console here as well */
-	shmobile_setup_console();
-}
-
 void __init r8a7740_add_dt_devices(void)
 {
 	platform_add_devices(r8a7740_devices_dt,
 			    ARRAY_SIZE(r8a7740_devices_dt));
 }
 
+#ifdef CONFIG_USE_OF
+
 void __init r8a7740_init_delay(void)
 {
 	shmobile_setup_delay(800, 1, 3); /* Cortex-A9 @ 800MHz */
author maintainer
#12 lore raw

PATCH 6/14 ARM: shmobile: Remove sh73a0_init_irq_dt()

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Remove left over function prototype sh73a0_init_irq_dt().

---

 arch/arm/mach-shmobile/include/mach/sh73a0.h |    1 -
 1 file changed, 1 deletion(-)
arch/arm/mach-shmobile/include/mach/sh73a0.h +0 -1
@@ -73,7 +73,6 @@ enum {
 
 extern void sh73a0_init_delay(void);
 extern void sh73a0_init_irq(void);
-extern void sh73a0_init_irq_dt(void);
 extern void sh73a0_map_io(void);
 extern void sh73a0_earlytimer_init(void);
 extern void sh73a0_add_early_devices(void);
author maintainer
#13 lore raw

PATCH 7/14 ARM: shmobile: Remove r8a7779 ->nr_irqs

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Remove .nr_irqs for r8a7779 DT cases.

---

 arch/arm/mach-shmobile/board-marzen-reference.c |    1 -
 arch/arm/mach-shmobile/setup-r8a7779.c          |    1 -
 2 files changed, 2 deletions(-)
arch/arm/mach-shmobile/board-marzen-reference.c +0 -1
@@ -44,7 +44,6 @@ DT_MACHINE_START(MARZEN, "marzen")
 	.smp		= smp_ops(r8a7779_smp_ops),
 	.map_io		= r8a7779_map_io,
 	.init_early	= r8a7779_init_delay,
-	.nr_irqs	= NR_IRQS_LEGACY,
 	.init_irq	= r8a7779_init_irq_dt,
 	.init_machine	= marzen_init,
 	.dt_compat	= marzen_boards_compat_dt,
arch/arm/mach-shmobile/setup-r8a7779.c +0 -1
@@ -739,7 +739,6 @@ static const char *r8a7779_compat_dt[] _
 DT_MACHINE_START(R8A7779_DT, "Generic R8A7779 (Flattened Device Tree)")
 	.map_io		= r8a7779_map_io,
 	.init_early	= r8a7779_init_delay,
-	.nr_irqs	= NR_IRQS_LEGACY,
 	.init_irq	= r8a7779_init_irq_dt,
 	.init_late	= r8a7779_init_late,
 	.dt_compat	= r8a7779_compat_dt,
author maintainer
#14 lore raw

PATCH 8/14 ARM: shmobile: Remove sh73a0 ->nr_irqs

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Remove .nr_irqs for sh73a0 DT cases.

---

 arch/arm/mach-shmobile/board-kzm9g-reference.c |    1 -
 arch/arm/mach-shmobile/setup-sh73a0.c          |    1 -
 2 files changed, 2 deletions(-)
arch/arm/mach-shmobile/board-kzm9g-reference.c +0 -1
@@ -57,7 +57,6 @@ DT_MACHINE_START(KZM9G_DT, "kzm9g-refere
 	.smp		= smp_ops(sh73a0_smp_ops),
 	.map_io		= sh73a0_map_io,
 	.init_early	= sh73a0_init_delay,
-	.nr_irqs	= NR_IRQS_LEGACY,
 	.init_machine	= kzm_init,
 	.dt_compat	= kzm9g_boards_compat_dt,
 MACHINE_END
arch/arm/mach-shmobile/setup-sh73a0.c +0 -1
@@ -957,7 +957,6 @@ DT_MACHINE_START(SH73A0_DT, "Generic SH7
 	.smp		= smp_ops(sh73a0_smp_ops),
 	.map_io		= sh73a0_map_io,
 	.init_early	= sh73a0_init_delay,
-	.nr_irqs	= NR_IRQS_LEGACY,
 	.dt_compat	= sh73a0_boards_compat_dt,
 MACHINE_END
 #endif /* CONFIG_USE_OF */
author maintainer
#15 lore raw

PATCH 9/14 ARM: shmobile: Rename to sh7372_init_early()

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Rename sh7372_add_early_device_dt() into sh7372_init_early() and make it static since we have no sh7372 DT reference board code. Also, in case of DT we do not use any early console or early timers, so get rid of early platform stuff and early console for the DT case.

---

 arch/arm/mach-shmobile/include/mach/sh7372.h |    1 -
 arch/arm/mach-shmobile/setup-sh7372.c        |   10 ++--------
 2 files changed, 2 insertions(+), 9 deletions(-)
arch/arm/mach-shmobile/include/mach/sh7372.h +0 -1
@@ -63,7 +63,6 @@ extern void sh7372_map_io(void);
 extern void sh7372_earlytimer_init(void);
 extern void sh7372_add_early_devices(void);
 extern void sh7372_add_standard_devices(void);
-extern void sh7372_add_early_devices_dt(void);
 extern void sh7372_clock_init(void);
 extern void sh7372_pinmux_init(void);
 extern void sh7372_pm_init(void);
arch/arm/mach-shmobile/setup-sh7372.c +2 -8
@@ -1135,15 +1135,9 @@ void __init sh7372_add_early_devices(voi
 
 #ifdef CONFIG_USE_OF
 
-void __init sh7372_add_early_devices_dt(void)
+static void __init sh7372_init_early(void)
 {
 	shmobile_setup_delay(800, 1, 3); /* Cortex-A8 @ 800MHz */
-
-	early_platform_add_devices(sh7372_early_devices,
-				   ARRAY_SIZE(sh7372_early_devices));
-
-	/* setup early console here as well */
-	shmobile_setup_console();
 }
 
 static const char *sh7372_boards_compat_dt[] __initdata = {
@@ -1153,7 +1147,7 @@ static const char *sh7372_boards_compat_
 
 DT_MACHINE_START(SH7372_DT, "Generic SH7372 (Flattened Device Tree)")
 	.map_io		= sh7372_map_io,
-	.init_early	= sh7372_add_early_devices_dt,
+	.init_early	= sh7372_init_early,
 	.nr_irqs	= NR_IRQS_LEGACY,
 	.init_irq	= sh7372_init_irq,
 	.handle_irq	= shmobile_handle_irq_intc,
#16 lore raw

PATCH 9/14 ARM: shmobile: Rename to sh7372_init_early()

Hi Magnus,

Thank you for the patch.

Shouldn't the subject line mention what you rename ? :-) Same comment for the other patches in this series.

arch/arm/mach-shmobile/setup-sh7372.c

Quoted 27 lines · On Friday 09 August 2013 18:49:26 Magnus Damm wrote:

From: Magnus Damm <[email protected]>

Rename sh7372_add_early_device_dt() into sh7372_init_early() and make it static since we have no sh7372 DT reference board code. Also, in case of DT we do not use any early console or early timers, so get rid of early platform stuff and early console for the DT case.

---

 arch/arm/mach-shmobile/include/mach/sh7372.h |    1 -
 arch/arm/mach-shmobile/setup-sh7372.c        |   10 ++--------
 2 files changed, 2 insertions(+), 9 deletions(-)
arch/arm/mach-shmobile/include/mach/sh7372.h +0 -0

15:46:38.000000000 +0900 @@ -63,7 +63,6 @@ extern void sh7372_map_io(void);
extern void sh7372_earlytimer_init(void);
extern void sh7372_add_early_devices(void);
extern void sh7372_add_standard_devices(void);

arch/arm/mach-shmobile/include/mach/sh7372.h +0 -1
-extern void sh7372_add_early_devices_dt(void);
 extern void sh7372_clock_init(void);
 extern void sh7372_pinmux_init(void);
 extern void sh7372_pm_init(void);
arch/arm/mach-shmobile/setup-sh7372.c +0 -0

15:48:51.000000000

Quoted 26 lines

+0900 @@ -1135,15 +1135,9 @@ void __init sh7372_add_early_devices(voi

#ifdef CONFIG_USE_OF

arch/arm/mach-shmobile/setup-sh7372.c +2 -8
-void __init sh7372_add_early_devices_dt(void)
+static void __init sh7372_init_early(void)
 {
 	shmobile_setup_delay(800, 1, 3); /* Cortex-A8 @ 800MHz */
-
-	early_platform_add_devices(sh7372_early_devices,
-				   ARRAY_SIZE(sh7372_early_devices));
-
-	/* setup early console here as well */
-	shmobile_setup_console();
 }
 
 static const char *sh7372_boards_compat_dt[] __initdata = {
@@ -1153,7 +1147,7 @@ static const char *sh7372_boards_compat_
 
 DT_MACHINE_START(SH7372_DT, "Generic SH7372 (Flattened Device Tree)")
 	.map_io		= sh7372_map_io,
-	.init_early	= sh7372_add_early_devices_dt,
+	.init_early	= sh7372_init_early,
 	.nr_irqs	= NR_IRQS_LEGACY,
 	.init_irq	= sh7372_init_irq,
 	.handle_irq	= shmobile_handle_irq_intc,
Signature · 3 lines
Regards,

Laurent Pinchart
author maintainer
#17 lore raw

PATCH 10/14 ARM: shmobile: Rename to emev2_init_early(), use smp_set_ops()

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Rename emev2_init_delay() into emev2_init_early() to make the function name show that more than just delay setup will happen.

Also, instead of specifying the smp ops in DT_MACHINE convert the EMEV2 SoC code to install the smp ops from emev2_init_early().

---

 arch/arm/mach-shmobile/board-kzm9d-reference.c |    3 +--
 arch/arm/mach-shmobile/board-kzm9d.c           |    3 +--
 arch/arm/mach-shmobile/include/mach/emev2.h    |    2 +-
 arch/arm/mach-shmobile/setup-emev2.c           |    8 +++++---
 4 files changed, 8 insertions(+), 8 deletions(-)
arch/arm/mach-shmobile/board-kzm9d-reference.c +1 -2
@@ -38,9 +38,8 @@ 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_init_delay,
+	.init_early	= emev2_init_early,
 	.init_machine	= kzm9d_add_standard_devices,
 	.init_late	= shmobile_init_late,
 	.dt_compat	= kzm9d_boards_compat_dt,
arch/arm/mach-shmobile/board-kzm9d.c +1 -2
@@ -83,9 +83,8 @@ 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_init_delay,
+	.init_early	= emev2_init_early,
 	.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 +1 -1
@@ -2,7 +2,7 @@
 #define __ASM_EMEV2_H__
 
 extern void emev2_map_io(void);
-extern void emev2_init_delay(void);
+extern void emev2_init_early(void);
 extern void emev2_add_standard_devices(void);
 extern void emev2_clock_init(void);
 
arch/arm/mach-shmobile/setup-emev2.c +5 -3
@@ -190,9 +190,12 @@ void __init emev2_add_standard_devices(v
 	emev2_register_pmu();
 }
 
-void __init emev2_init_delay(void)
+void __init emev2_init_early(void)
 {
 	shmobile_setup_delay(533, 1, 3); /* Cortex-A9 @ 533MHz */
+#ifdef CONFIG_SMP
+	smp_set_ops(&emev2_smp_ops);
+#endif
 }
 
 #ifdef CONFIG_USE_OF
@@ -203,9 +206,8 @@ 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_early	= emev2_init_early,
 	.dt_compat	= emev2_boards_compat_dt,
 MACHINE_END
 
#18 lore raw

PATCH 10/14 ARM: shmobile: Rename to emev2_init_early(), use smp_set_ops()

Hi Magnus,

Thank you for the patch.

Quoted 9 lines · On Friday 09 August 2013 18:49:36 Magnus Damm wrote:

From: Magnus Damm <[email protected]>

Rename emev2_init_delay() into emev2_init_early() to make the function name show that more than just delay setup will happen.

Also, instead of specifying the smp ops in DT_MACHINE convert the EMEV2 SoC code to install the smp ops from emev2_init_early().

Could you please explain in the commit message why this is needed ? Same comment for the other patches in this series.

arch/arm/mach-shmobile/board-kzm9d.c

Quoted 25 lines

---

 arch/arm/mach-shmobile/board-kzm9d-reference.c |    3 +--
 arch/arm/mach-shmobile/board-kzm9d.c           |    3 +--
 arch/arm/mach-shmobile/include/mach/emev2.h    |    2 +-
 arch/arm/mach-shmobile/setup-emev2.c           |    8 +++++---
 4 files changed, 8 insertions(+), 8 deletions(-)
arch/arm/mach-shmobile/board-kzm9d-reference.c +0 -0

16:18:34.000000000 +0900 @@ -38,9 +38,8 @@ static const char *kzm9d_boards_compat_d
};

DT_MACHINE_START(KZM9D_DT, "kzm9d")

arch/arm/mach-shmobile/board-kzm9d-reference.c +1 -2
-	.smp		= smp_ops(emev2_smp_ops),
 	.map_io		= emev2_map_io,
-	.init_early	= emev2_init_delay,
+	.init_early	= emev2_init_early,
 	.init_machine	= kzm9d_add_standard_devices,
 	.init_late	= shmobile_init_late,
 	.dt_compat	= kzm9d_boards_compat_dt,
arch/arm/mach-shmobile/board-kzm9d.c +0 -0

16:18:17.000000000

arch/arm/mach-shmobile/setup-emev2.c

Quoted 24 lines

+0900 @@ -83,9 +83,8 @@ static const char *kzm9d_boards_compat_d
};

DT_MACHINE_START(KZM9D_DT, "kzm9d")

arch/arm/mach-shmobile/board-kzm9d.c +1 -2
-	.smp		= smp_ops(emev2_smp_ops),
 	.map_io		= emev2_map_io,
-	.init_early	= emev2_init_delay,
+	.init_early	= emev2_init_early,
 	.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 -0

16:17:57.000000000 +0900 @@ -2,7 +2,7 @@
#define __ASM_EMEV2_H__

extern void emev2_map_io(void);

arch/arm/mach-shmobile/include/mach/emev2.h +1 -1
-extern void emev2_init_delay(void);
+extern void emev2_init_early(void);
 extern void emev2_add_standard_devices(void);
 extern void emev2_clock_init(void);
arch/arm/mach-shmobile/setup-emev2.c +0 -0

16:17:47.000000000

Quoted 25 lines

+0900 @@ -190,9 +190,12 @@ void __init emev2_add_standard_devices(v

arch/arm/mach-shmobile/setup-emev2.c +5 -2
 	emev2_register_pmu();
 }
 
-void __init emev2_init_delay(void)
+void __init emev2_init_early(void)
 {
 	shmobile_setup_delay(533, 1, 3); /* Cortex-A9 @ 533MHz */
+#ifdef CONFIG_SMP
+	smp_set_ops(&emev2_smp_ops);
+#endif
 }
 
 #ifdef CONFIG_USE_OF
@@ -203,9 +206,8 @@ 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_early	= emev2_init_early,
 	.dt_compat	= emev2_boards_compat_dt,
 MACHINE_END
Signature · 3 lines
Regards,

Laurent Pinchart
author maintainer
#19 lore raw

PATCH 10/14 ARM: shmobile: Rename to emev2_init_early(), use smp_set_ops()

Hi Laurent,

Quoted 11 lines · Laurent Pinchart

Hi Magnus,

Thank you for the patch.

Quoted 6 lines · On Friday 09 August 2013 18:49:36 Magnus Damm wrote:

From: Magnus Damm <[email protected]>

Rename emev2_init_delay() into emev2_init_early() to make the function name show that more than just delay setup will happen.

Quoted 6 lines
Quoted 3 lines

Also, instead of specifying the smp ops in DT_MACHINE convert the EMEV2 SoC code to install the smp ops from emev2_init_early().

Could you please explain in the commit message why this is needed ? Same comment for the other patches in this series.

I personally think it is neat to use as few callbacks as possible in the DT_MACHINE. Hooking in SMP ops in ->init_early() means that the boards now are unaware if SMP is used or not - and it makes sense to me to write board code that is independent of SMP.

Anyway, I suspect that Olof prefers to use smp_ops() instead, so I think these patches just should be dropped.

Cheers,
/ magnus

#20 lore raw

PATCH 10/14 ARM: shmobile: Rename to emev2_init_early(), use smp_set_ops()

Hi Magnus,

Quoted 12 lines · On Wednesday 28 August 2013 16:03:23 Magnus Damm wrote:
Quoted 11 lines · Laurent Pinchart
Quoted 9 lines · On Friday 09 August 2013 18:49:36 Magnus Damm wrote:

From: Magnus Damm <[email protected]>

Rename emev2_init_delay() into emev2_init_early() to make the function name show that more than just delay setup will happen.

Also, instead of specifying the smp ops in DT_MACHINE convert the EMEV2 SoC code to install the smp ops from emev2_init_early().

Quoted 7 lines
Quoted 2 lines

Could you please explain in the commit message why this is needed ? Same comment for the other patches in this series.

I personally think it is neat to use as few callbacks as possible in the DT_MACHINE. Hooking in SMP ops in ->init_early() means that the boards now are unaware if SMP is used or not - and it makes sense to me to write board code that is independent of SMP.

That's a good enough explanation, I'd just like it to be included in the commit message.

Quoted 2 lines

Anyway, I suspect that Olof prefers to use smp_ops() instead, so I think these patches just should be dropped.

I suppose that's for you to sort out with him :-)

Signature · 3 lines
Regards,

Laurent Pinchart
author maintainer
#21 lore raw

PATCH 11/14 ARM: shmobile: Rename to r8a7779_init_early(), use smp_set_ops()

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Rename r8a7779_init_delay() into r8a7779_init_early() to make the function name show that more than just delay setup will happen.

Also, instead of specifying the smp ops in DT_MACHINE convert the r8a7779 SoC code to install the smp ops from r8a7779_init_early().

The r8a7779_add_early_devices() function also gets updated to call r8a7779_init_early(). This way the smp ops will be installed in both DT and C cases.

---

 arch/arm/mach-shmobile/board-marzen-reference.c |    3 +--
 arch/arm/mach-shmobile/board-marzen.c           |    1 -
 arch/arm/mach-shmobile/include/mach/r8a7779.h   |    2 +-
 arch/arm/mach-shmobile/setup-r8a7779.c          |   17 +++++++++++------
 4 files changed, 13 insertions(+), 10 deletions(-)
arch/arm/mach-shmobile/board-marzen-reference.c +1 -2
@@ -41,9 +41,8 @@ static const char *marzen_boards_compat_
 };
 
 DT_MACHINE_START(MARZEN, "marzen")
-	.smp		= smp_ops(r8a7779_smp_ops),
 	.map_io		= r8a7779_map_io,
-	.init_early	= r8a7779_init_delay,
+	.init_early	= r8a7779_init_early,
 	.init_irq	= r8a7779_init_irq_dt,
 	.init_machine	= marzen_init,
 	.dt_compat	= marzen_boards_compat_dt,
arch/arm/mach-shmobile/board-marzen.c +0 -1
@@ -263,7 +263,6 @@ static const char *marzen_boards_compat_
 };
 
 DT_MACHINE_START(MARZEN, "marzen")
-	.smp		= smp_ops(r8a7779_smp_ops),
 	.map_io		= r8a7779_map_io,
 	.init_early	= r8a7779_add_early_devices,
 	.init_irq	= r8a7779_init_irq_dt,
arch/arm/mach-shmobile/include/mach/r8a7779.h +1 -1
@@ -23,7 +23,7 @@ static inline struct r8a7779_pm_ch *to_r
 	return &container_of(d, struct r8a7779_pm_domain, genpd)->ch;
 }
 
-extern void r8a7779_init_delay(void);
+extern void r8a7779_init_early(void);
 extern void r8a7779_init_irq_extpin(int irlm);
 extern void r8a7779_init_irq_dt(void);
 extern void r8a7779_map_io(void);
arch/arm/mach-shmobile/setup-r8a7779.c +11 -6
@@ -663,8 +663,18 @@ void __init r8a7779_earlytimer_init(void
 	r8a7779_register_twd();
 }
 
+void __init r8a7779_init_early(void)
+{
+	shmobile_setup_delay(1000, 2, 4); /* Cortex-A9 @ 1000MHz */
+#ifdef CONFIG_SMP
+	smp_set_ops(&r8a7779_smp_ops);
+#endif
+}
+
 void __init r8a7779_add_early_devices(void)
 {
+	r8a7779_init_early();
+
 	early_platform_add_devices(r8a7779_devices_dt,
 				   ARRAY_SIZE(r8a7779_devices_dt));
 
@@ -726,11 +736,6 @@ void __init r8a7779_init_irq_dt(void)
 	__raw_writel(0x003fee3f, INT2SMSKCR4);
 }
 
-void __init r8a7779_init_delay(void)
-{
-	shmobile_setup_delay(1000, 2, 4); /* Cortex-A9 @ 1000MHz */
-}
-
 static const char *r8a7779_compat_dt[] __initdata = {
 	"renesas,r8a7779",
 	NULL,
@@ -738,7 +743,7 @@ static const char *r8a7779_compat_dt[] _
 
 DT_MACHINE_START(R8A7779_DT, "Generic R8A7779 (Flattened Device Tree)")
 	.map_io		= r8a7779_map_io,
-	.init_early	= r8a7779_init_delay,
+	.init_early	= r8a7779_init_early,
 	.init_irq	= r8a7779_init_irq_dt,
 	.init_late	= r8a7779_init_late,
 	.dt_compat	= r8a7779_compat_dt,
author maintainer
#22 lore raw

PATCH 12/14 ARM: shmobile: Rename to r8a7740_init_early()

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Rename r8a7740_init_delay() into r8a7740_init_early() to make the function name show that more than just delay setup may happen in the future.

Also, make sure shmobile_setup_delay() gets executed for both DT and C board code by updating r8a7740_add_early_devices() to call r8a7740_init_early().

---

 arch/arm/mach-shmobile/board-armadillo800eva-reference.c |    2 +-
 arch/arm/mach-shmobile/include/mach/r8a7740.h            |    2 +-
 arch/arm/mach-shmobile/setup-r8a7740.c                   |   14 ++++++++------
 3 files changed, 10 insertions(+), 8 deletions(-)
arch/arm/mach-shmobile/board-armadillo800eva-reference.c +1 -1
@@ -189,7 +189,7 @@ static const char *eva_boards_compat_dt[
 
 DT_MACHINE_START(ARMADILLO800EVA_DT, "armadillo800eva-reference")
 	.map_io		= r8a7740_map_io,
-	.init_early	= r8a7740_init_delay,
+	.init_early	= r8a7740_init_early,
 	.init_irq	= r8a7740_init_irq_of,
 	.init_machine	= eva_init,
 	.init_late	= shmobile_init_late,
arch/arm/mach-shmobile/include/mach/r8a7740.h +1 -1
@@ -47,7 +47,7 @@ enum {
 };
 
 extern void r8a7740_meram_workaround(void);
-extern void r8a7740_init_delay(void);
+extern void r8a7740_init_early(void);
 extern void r8a7740_init_irq_of(void);
 extern void r8a7740_map_io(void);
 extern void r8a7740_add_early_devices(void);
arch/arm/mach-shmobile/setup-r8a7740.c +8 -6
@@ -984,8 +984,15 @@ void __init r8a7740_add_standard_devices
 	rmobile_add_device_to_domain("A3SP",	&i2c1_device);
 }
 
+void __init r8a7740_init_early(void)
+{
+	shmobile_setup_delay(800, 1, 3); /* Cortex-A9 @ 800MHz */
+};
+
 void __init r8a7740_add_early_devices(void)
 {
+	r8a7740_init_early();
+
 	early_platform_add_devices(r8a7740_early_devices,
 				   ARRAY_SIZE(r8a7740_early_devices));
 	early_platform_add_devices(r8a7740_devices_dt,
@@ -1003,11 +1010,6 @@ void __init r8a7740_add_dt_devices(void)
 
 #ifdef CONFIG_USE_OF
 
-void __init r8a7740_init_delay(void)
-{
-	shmobile_setup_delay(800, 1, 3); /* Cortex-A9 @ 800MHz */
-};
-
 void __init r8a7740_init_irq_of(void)
 {
 	void __iomem *intc_prio_base = ioremap_nocache(0xe6900010, 0x10);
@@ -1045,7 +1047,7 @@ static const char *r8a7740_boards_compat
 
 DT_MACHINE_START(R8A7740_DT, "Generic R8A7740 (Flattened Device Tree)")
 	.map_io		= r8a7740_map_io,
-	.init_early	= r8a7740_init_delay,
+	.init_early	= r8a7740_init_early,
 	.init_irq	= r8a7740_init_irq_of,
 	.dt_compat	= r8a7740_boards_compat_dt,
 MACHINE_END
author maintainer
#23 lore raw

PATCH 13/14 ARM: shmobile: Rename to r8a7778_init_early()

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Rename r8a7778_init_delay() into r8a7778_init_early() to make the function name show that more than just delay setup may happen in the future.

---

 arch/arm/mach-shmobile/board-bockw-reference.c |    2 +-
 arch/arm/mach-shmobile/board-bockw.c           |    2 +-
 arch/arm/mach-shmobile/include/mach/r8a7778.h  |    2 +-
 arch/arm/mach-shmobile/setup-r8a7778.c         |    4 ++--
 4 files changed, 5 insertions(+), 5 deletions(-)
arch/arm/mach-shmobile/board-bockw-reference.c +1 -1
@@ -54,7 +54,7 @@ static const char *bockw_boards_compat_d
 };
 
 DT_MACHINE_START(BOCKW_DT, "bockw")
-	.init_early	= r8a7778_init_delay,
+	.init_early	= r8a7778_init_early,
 	.init_irq	= r8a7778_init_irq_dt,
 	.init_machine	= bockw_init,
 	.dt_compat	= bockw_boards_compat_dt,
arch/arm/mach-shmobile/board-bockw.c +1 -1
@@ -276,7 +276,7 @@ static const char *bockw_boards_compat_d
 };
 
 DT_MACHINE_START(BOCKW_DT, "bockw")
-	.init_early	= r8a7778_init_delay,
+	.init_early	= r8a7778_init_early,
 	.init_irq	= r8a7778_init_irq_dt,
 	.init_machine	= bockw_init,
 	.dt_compat	= bockw_boards_compat_dt,
arch/arm/mach-shmobile/include/mach/r8a7778.h +1 -1
@@ -26,7 +26,7 @@ extern void r8a7778_add_ether_device(str
 extern void r8a7778_add_dt_devices(void);
 
 extern void r8a7778_init_late(void);
-extern void r8a7778_init_delay(void);
+extern void r8a7778_init_early(void);
 extern void r8a7778_init_irq_dt(void);
 extern void r8a7778_clock_init(void);
 extern void r8a7778_init_irq_extpin(int irlm);
arch/arm/mach-shmobile/setup-r8a7778.c +2 -2
@@ -368,7 +368,7 @@ void __init r8a7778_init_irq_extpin(int
 			&irqpin_platform_data, sizeof(irqpin_platform_data));
 }
 
-void __init r8a7778_init_delay(void)
+void __init r8a7778_init_early(void)
 {
 	shmobile_setup_delay(800, 1, 3); /* Cortex-A9 @ 800MHz */
 }
@@ -404,7 +404,7 @@ static const char *r8a7778_compat_dt[] _
 };
 
 DT_MACHINE_START(R8A7778_DT, "Generic R8A7778 (Flattened Device Tree)")
-	.init_early	= r8a7778_init_delay,
+	.init_early	= r8a7778_init_early,
 	.init_irq	= r8a7778_init_irq_dt,
 	.dt_compat	= r8a7778_compat_dt,
 	.init_late      = r8a7778_init_late,
author maintainer
#24 lore raw

PATCH 14/14 ARM: shmobile: Rename to sh73a0_init_early(), use smp_set_ops()

In reply to Magnus Damm

From: Magnus Damm <[email protected]>

Rename sh73a0_init_delay() into sh73a0_init_early() to make the function name show that more than just delay setup will happen.

Also, instead of specifying the smp ops in DT_MACHINE convert the sh73a0 SoC code to install the smp ops from sh73a0_init_early().

The sh73a0_add_early_devices() function also gets updated to call sh73a0_init_early(). This way the smp ops will be installed in both DT and C cases.

---

 arch/arm/mach-shmobile/board-kzm9g-reference.c |    3 +--
 arch/arm/mach-shmobile/board-kzm9g.c           |    1 -
 arch/arm/mach-shmobile/include/mach/sh73a0.h   |    2 +-
 arch/arm/mach-shmobile/setup-sh73a0.c          |   11 +++++++----
 4 files changed, 9 insertions(+), 8 deletions(-)
arch/arm/mach-shmobile/board-kzm9g-reference.c +1 -2
@@ -54,9 +54,8 @@ static const char *kzm9g_boards_compat_d
 };
 
 DT_MACHINE_START(KZM9G_DT, "kzm9g-reference")
-	.smp		= smp_ops(sh73a0_smp_ops),
 	.map_io		= sh73a0_map_io,
-	.init_early	= sh73a0_init_delay,
+	.init_early	= sh73a0_init_early,
 	.init_machine	= kzm_init,
 	.dt_compat	= kzm9g_boards_compat_dt,
 MACHINE_END
arch/arm/mach-shmobile/board-kzm9g.c +0 -1
@@ -904,7 +904,6 @@ static const char *kzm9g_boards_compat_d
 };
 
 DT_MACHINE_START(KZM9G_DT, "kzm9g")
-	.smp		= smp_ops(sh73a0_smp_ops),
 	.map_io		= sh73a0_map_io,
 	.init_early	= sh73a0_add_early_devices,
 	.nr_irqs	= NR_IRQS_LEGACY,
arch/arm/mach-shmobile/include/mach/sh73a0.h +1 -1
@@ -71,7 +71,7 @@ enum {
 #define SH73A0_PINT0_IRQ(irq) ((irq) + 700)
 #define SH73A0_PINT1_IRQ(irq) ((irq) + 732)
 
-extern void sh73a0_init_delay(void);
+extern void sh73a0_init_early(void);
 extern void sh73a0_init_irq(void);
 extern void sh73a0_map_io(void);
 extern void sh73a0_earlytimer_init(void);
arch/arm/mach-shmobile/setup-sh73a0.c +7 -4
@@ -919,9 +919,12 @@ void __init sh73a0_add_standard_devices(
 			    ARRAY_SIZE(sh73a0_late_devices));
 }
 
-void __init sh73a0_init_delay(void)
+void __init sh73a0_init_early(void)
 {
 	shmobile_setup_delay(1196, 44, 46); /* Cortex-A9 @ 1196MHz */
+#ifdef CONFIG_SMP
+	smp_set_ops(&sh73a0_smp_ops);
+#endif
 }
 
 /* do nothing for !CONFIG_SMP or !CONFIG_HAVE_TWD */
@@ -929,7 +932,6 @@ void __init __weak sh73a0_register_twd(v
 
 void __init sh73a0_earlytimer_init(void)
 {
-	sh73a0_init_delay();
 	sh73a0_clock_init();
 	shmobile_earlytimer_init();
 	sh73a0_register_twd();
@@ -937,6 +939,8 @@ void __init sh73a0_earlytimer_init(void)
 
 void __init sh73a0_add_early_devices(void)
 {
+	sh73a0_init_early();
+
 	early_platform_add_devices(sh73a0_devices_dt,
 				   ARRAY_SIZE(sh73a0_devices_dt));
 	early_platform_add_devices(sh73a0_early_devices,
@@ -954,9 +958,8 @@ static const char *sh73a0_boards_compat_
 };
 
 DT_MACHINE_START(SH73A0_DT, "Generic SH73A0 (Flattened Device Tree)")
-	.smp		= smp_ops(sh73a0_smp_ops),
 	.map_io		= sh73a0_map_io,
-	.init_early	= sh73a0_init_delay,
+	.init_early	= sh73a0_init_early,
 	.dt_compat	= sh73a0_boards_compat_dt,
 MACHINE_END
 #endif /* CONFIG_USE_OF */