diff mbox

ARM: prima2: return rather than panic on missing DT nodes

Message ID 5195CFB3.4090905@st.com (mailing list archive)
State New, archived
Headers show

Commit Message

Srinivas KANDAGATLA May 17, 2013, 6:35 a.m. UTC
On 17/05/13 01:30, Barry Song wrote:
> then it turns out that moving the codes to callbacks of machine is the
> right way. i will take care the init ordering issues.

Not sure if this helps but, I have done a patch for this yesterday to
fix few more issues when booting with multi_v7_defconfig then the one
pointed out by Rob .

--srini
diff mbox

Patch

From 49a3fd50b24426b59a5811f0dd11c32e737ef245 Mon Sep 17 00:00:00 2001
From: Srinivas Kandagatla <srinivas.kandagatla@st.com>
Date: Thu, 16 May 2013 17:52:25 +0100
Subject: [RFC] ARM: prima2: remove early and postcore initcalls.

This patch removes early_init and postcore_initcalls from the mach
layer to MACHINE callbacks.

Signed-off-by: Srinivas Kandagatla <srinivas.kandagatla@st.com>
---
 arch/arm/mach-prima2/common.c |    6 ++++++
 arch/arm/mach-prima2/common.h |    1 +
 arch/arm/mach-prima2/pm.c     |    6 ++----
 arch/arm/mach-prima2/pm.h     |    2 ++
 arch/arm/mach-prima2/rstc.c   |    5 +----
 5 files changed, 12 insertions(+), 8 deletions(-)

diff --git a/arch/arm/mach-prima2/common.c b/arch/arm/mach-prima2/common.c
index 4f94cd8..52833a6 100644
--- a/arch/arm/mach-prima2/common.c
+++ b/arch/arm/mach-prima2/common.c
@@ -16,6 +16,7 @@ 
 #include <linux/of.h>
 #include <linux/of_platform.h>
 #include "common.h"
+#include "pm.h"
 
 static struct of_device_id sirfsoc_of_bus_ids[] __initdata = {
 	{ .compatible = "simple-bus", },
@@ -24,6 +25,8 @@  static struct of_device_id sirfsoc_of_bus_ids[] __initdata = {
 
 void __init sirfsoc_mach_init(void)
 {
+	sirfsoc_of_pwrc_init();
+	sirfsoc_memc_init();
 	of_platform_bus_probe(NULL, sirfsoc_of_bus_ids, NULL);
 }
 
@@ -61,6 +64,7 @@  DT_MACHINE_START(ATLAS6_DT, "Generic ATLAS6 (Flattened Device Tree)")
 	.init_late	= sirfsoc_init_late,
 	.dt_compat      = atlas6_dt_match,
 	.restart	= sirfsoc_restart,
+	.init_early 	= sirfsoc_of_rstc_init,
 MACHINE_END
 #endif
 
@@ -81,6 +85,7 @@  DT_MACHINE_START(PRIMA2_DT, "Generic PRIMA2 (Flattened Device Tree)")
 	.init_late	= sirfsoc_init_late,
 	.dt_compat      = prima2_dt_match,
 	.restart	= sirfsoc_restart,
+	.init_early 	= sirfsoc_of_rstc_init,
 MACHINE_END
 #endif
 
@@ -100,5 +105,6 @@  DT_MACHINE_START(MARCO_DT, "Generic MARCO (Flattened Device Tree)")
 	.init_late	= sirfsoc_init_late,
 	.dt_compat      = marco_dt_match,
 	.restart	= sirfsoc_restart,
+	.init_early 	= sirfsoc_of_rstc_init,
 MACHINE_END
 #endif
diff --git a/arch/arm/mach-prima2/common.h b/arch/arm/mach-prima2/common.h
index 81135cd..65703a4 100644
--- a/arch/arm/mach-prima2/common.h
+++ b/arch/arm/mach-prima2/common.h
@@ -20,6 +20,7 @@  extern struct smp_operations   sirfsoc_smp_ops;
 extern void sirfsoc_secondary_startup(void);
 extern void sirfsoc_cpu_die(unsigned int cpu);
 
+extern void sirfsoc_of_rstc_init(void);
 extern void __init sirfsoc_of_irq_init(void);
 extern void __init sirfsoc_of_clk_init(void);
 extern void sirfsoc_restart(char, const char *);
diff --git a/arch/arm/mach-prima2/pm.c b/arch/arm/mach-prima2/pm.c
index 9936c18..8850e3b 100644
--- a/arch/arm/mach-prima2/pm.c
+++ b/arch/arm/mach-prima2/pm.c
@@ -96,7 +96,7 @@  static const struct of_device_id pwrc_ids[] = {
 	{}
 };
 
-static int __init sirfsoc_of_pwrc_init(void)
+int __init sirfsoc_of_pwrc_init(void)
 {
 	struct device_node *np;
 
@@ -116,7 +116,6 @@  static int __init sirfsoc_of_pwrc_init(void)
 
 	return 0;
 }
-postcore_initcall(sirfsoc_of_pwrc_init);
 
 static const struct of_device_id memc_ids[] = {
 	{ .compatible = "sirf,prima2-memc" },
@@ -143,8 +142,7 @@  static struct platform_driver sirfsoc_memc_driver = {
 	},
 };
 
-static int __init sirfsoc_memc_init(void)
+int __init sirfsoc_memc_init(void)
 {
 	return platform_driver_register(&sirfsoc_memc_driver);
 }
-postcore_initcall(sirfsoc_memc_init);
diff --git a/arch/arm/mach-prima2/pm.h b/arch/arm/mach-prima2/pm.h
index bae6d77..b658d66 100644
--- a/arch/arm/mach-prima2/pm.h
+++ b/arch/arm/mach-prima2/pm.h
@@ -23,6 +23,8 @@ 
 
 #ifndef __ASSEMBLY__
 extern int sirfsoc_finish_suspend(unsigned long);
+extern int __init sirfsoc_of_pwrc_init(void);
+extern int __init sirfsoc_memc_init(void);
 #endif
 
 #endif
diff --git a/arch/arm/mach-prima2/rstc.c b/arch/arm/mach-prima2/rstc.c
index 435019c..5506425 100644
--- a/arch/arm/mach-prima2/rstc.c
+++ b/arch/arm/mach-prima2/rstc.c
@@ -23,7 +23,7 @@  static struct of_device_id rstc_ids[]  = {
 	{},
 };
 
-static int __init sirfsoc_of_rstc_init(void)
+void sirfsoc_of_rstc_init(void)
 {
 	struct device_node *np;
 
@@ -36,10 +36,7 @@  static int __init sirfsoc_of_rstc_init(void)
 		panic("unable to map rstc cpu registers\n");
 
 	of_node_put(np);
-
-	return 0;
 }
-early_initcall(sirfsoc_of_rstc_init);
 
 int sirfsoc_reset_device(struct device *dev)
 {
-- 
1.7.6.5