msm: board-copper: Add the ability to probe devices in order
Add a mechanism to allow for select devices to be probed early
and in order. This works by invoking specific driver init
routines in arch_init, before the vast majority of the drivers
are added in device_init. Invoke this new init routine after all
devices are added, and thus probe devices mapped to these
drivers before any others.
This approach does not solve the problem where multiple devices
using the same driver have dependencies between them.
Also add the stub-regulator driver to be the first member of this
new init routine. This driver supports devices that are required
early on.
Change-Id: Ib39e3111c8feb407eb8283b991ffe796dbbb5b90
Signed-off-by: Michael Bohan <mbohan@codeaurora.org>
diff --git a/arch/arm/mach-msm/board-copper.c b/arch/arm/mach-msm/board-copper.c
index e08c807..b074809 100644
--- a/arch/arm/mach-msm/board-copper.c
+++ b/arch/arm/mach-msm/board-copper.c
@@ -369,6 +369,17 @@
msm_copper_stub_regulator_devices_len);
}
+/*
+ * Used to satisfy dependencies for devices that need to be
+ * run early or in a particular order. Most likely your device doesn't fall
+ * into this category, and thus the driver should not be added here. The
+ * EPROBE_DEFER can satisfy most dependency problems.
+ */
+void __init msm_copper_add_drivers(void)
+{
+ regulator_stub_init();
+}
+
static struct of_device_id irq_match[] __initdata = {
{ .compatible = "qcom,msm-qgic2", .data = gic_of_init, },
{ .compatible = "qcom,msm-gpio", .data = msm_gpio_of_init, },
diff --git a/arch/arm/mach-msm/board-dt.c b/arch/arm/mach-msm/board-dt.c
index 5d04786..52f3de6 100644
--- a/arch/arm/mach-msm/board-dt.c
+++ b/arch/arm/mach-msm/board-dt.c
@@ -55,8 +55,10 @@
msm_copper_init(&adata);
of_platform_populate(NULL, of_default_bus_match_table, adata, NULL);
- if (machine_is_copper())
+ if (machine_is_copper()) {
msm_copper_add_devices();
+ msm_copper_add_drivers();
+ }
}
static const char *msm_dt_match[] __initdata = {
diff --git a/arch/arm/mach-msm/include/mach/board.h b/arch/arm/mach-msm/include/mach/board.h
index 7b74f1e..98fa233 100644
--- a/arch/arm/mach-msm/include/mach/board.h
+++ b/arch/arm/mach-msm/include/mach/board.h
@@ -499,6 +499,7 @@
#endif
void msm_add_devices(void);
void msm_copper_add_devices(void);
+void msm_copper_add_drivers(void);
void msm_map_common_io(void);
void msm_map_qsd8x50_io(void);
void msm_map_msm8x60_io(void);