From 816a65ef4ce1848d8083d9e198922ddafbe221f2 Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Fri, 11 Jan 2013 11:24:18 -0800 Subject: ARM: OMAP2+: Limit omap initcalls to omap only on multiplatform kernels We need to make sure that multiplatform kernels don't run omap initcalls when booted on other SoCs. Do this by adding wrapper macros for the initcalls that return early if soc_is_omap() test fails. This allows us to easily change the defines later if we have SoC specific init sections available. Tested-by: Ezequiel Garcia Signed-off-by: Tony Lindgren --- arch/arm/mach-omap2/soc.h | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/arch/arm/mach-omap2/soc.h b/arch/arm/mach-omap2/soc.h index f31d90774de..092aedd7ed1 100644 --- a/arch/arm/mach-omap2/soc.h +++ b/arch/arm/mach-omap2/soc.h @@ -42,6 +42,9 @@ #undef MULTI_OMAP2 #undef OMAP_NAME +#ifdef CONFIG_ARCH_MULTIPLATFORM +#define MULTI_OMAP2 +#endif #ifdef CONFIG_SOC_OMAP2420 # ifdef OMAP_NAME # undef MULTI_OMAP2 @@ -112,6 +115,11 @@ int omap_type(void); */ unsigned int omap_rev(void); +static inline int soc_is_omap(void) +{ + return omap_rev() != 0; +} + /* * Get the CPU revision for OMAP devices */ @@ -465,5 +473,26 @@ static inline unsigned int omap4_has_ ##feat(void) \ OMAP4_HAS_FEATURE(perf_silicon, PERF_SILICON) +/* + * We need to make sure omap initcalls don't run when + * multiplatform kernels are booted on other SoCs. + */ +#define omap_initcall(level, fn) \ +static int __init __used __##fn(void) \ +{ \ + if (!soc_is_omap()) \ + return 0; \ + return fn(); \ +} \ +level(__##fn); + +#define omap_early_initcall(fn) omap_initcall(early_initcall, fn) +#define omap_core_initcall(fn) omap_initcall(core_initcall, fn) +#define omap_postcore_initcall(fn) omap_initcall(postcore_initcall, fn) +#define omap_arch_initcall(fn) omap_initcall(arch_initcall, fn) +#define omap_subsys_initcall(fn) omap_initcall(subsys_initcall, fn) +#define omap_device_initcall(fn) omap_initcall(device_initcall, fn) +#define omap_late_initcall(fn) omap_initcall(late_initcall, fn) + #endif /* __ASSEMBLY__ */ -- cgit v1.2.3-18-g5258 From b76c8b19b082c3fc84725de0d3ba5ee1f571c0ae Mon Sep 17 00:00:00 2001 From: Tony Lindgren Date: Fri, 11 Jan 2013 11:24:18 -0800 Subject: ARM: OMAP2+: Use omap initcalls This way the initcalls don't run on other SoCs on multiplatform kernels. Otherwise we'll get something like this when booting on vexpress: omap_hwmod: _ensure_mpu_hwmod_is_setup: MPU initiator hwmod mpu not yet registered ... WARNING: at arch/arm/mach-omap2/pm.c:82 _init_omap_device+0x74/0x94() _init_omap_device: could not find omap_hwmod for mpu ... omap-dma-engine omap-dma-engine: OMAP DMA engine driver ... Tested-by: Ezequiel Garcia Signed-off-by: Tony Lindgren --- arch/arm/mach-omap2/board-omap3beagle.c | 2 +- arch/arm/mach-omap2/board-rx51-video.c | 3 ++- arch/arm/mach-omap2/clock2xxx.c | 2 +- arch/arm/mach-omap2/clock3xxx.c | 2 +- arch/arm/mach-omap2/devices.c | 6 +++--- arch/arm/mach-omap2/dma.c | 2 +- arch/arm/mach-omap2/drm.c | 2 +- arch/arm/mach-omap2/emu.c | 2 +- arch/arm/mach-omap2/fb.c | 4 ++-- arch/arm/mach-omap2/gpio.c | 5 +++-- arch/arm/mach-omap2/gpmc.c | 4 ++-- arch/arm/mach-omap2/hdq1w.c | 3 ++- arch/arm/mach-omap2/hwspinlock.c | 2 +- arch/arm/mach-omap2/mcbsp.c | 3 ++- arch/arm/mach-omap2/omap-iommu.c | 2 +- arch/arm/mach-omap2/omap2-restart.c | 3 ++- arch/arm/mach-omap2/omap4-common.c | 4 ++-- arch/arm/mach-omap2/omap_device.c | 5 +++-- arch/arm/mach-omap2/omap_hwmod.c | 2 +- arch/arm/mach-omap2/omap_phy_internal.c | 2 +- arch/arm/mach-omap2/opp3xxx_data.c | 2 +- arch/arm/mach-omap2/opp4xxx_data.c | 2 +- arch/arm/mach-omap2/pm-debug.c | 2 +- arch/arm/mach-omap2/pm.c | 2 +- arch/arm/mach-omap2/pmu.c | 2 +- arch/arm/mach-omap2/prm3xxx.c | 2 +- arch/arm/mach-omap2/prm44xx.c | 2 +- arch/arm/mach-omap2/serial.c | 2 +- arch/arm/mach-omap2/smartreflex-class3.c | 2 +- arch/arm/mach-omap2/timer.c | 2 +- arch/arm/mach-omap2/wd_timer.c | 2 +- 31 files changed, 44 insertions(+), 38 deletions(-) diff --git a/arch/arm/mach-omap2/board-omap3beagle.c b/arch/arm/mach-omap2/board-omap3beagle.c index 22c483d5dfa..5c68009a979 100644 --- a/arch/arm/mach-omap2/board-omap3beagle.c +++ b/arch/arm/mach-omap2/board-omap3beagle.c @@ -494,7 +494,7 @@ static int __init beagle_opp_init(void) } return 0; } -device_initcall(beagle_opp_init); +omap_device_initcall(beagle_opp_init); static void __init omap3_beagle_init(void) { diff --git a/arch/arm/mach-omap2/board-rx51-video.c b/arch/arm/mach-omap2/board-rx51-video.c index 46f4fc98276..eb667261df0 100644 --- a/arch/arm/mach-omap2/board-rx51-video.c +++ b/arch/arm/mach-omap2/board-rx51-video.c @@ -18,6 +18,7 @@ #include