From a0e157afd0c3ecb2e953eb41da04da2bf0e3d6c3 Mon Sep 17 00:00:00 2001 From: Arnd Bergmann Date: Fri, 27 Feb 2015 20:31:51 +0100 Subject: ARM: s3c64xx: prepare initcalls for multiplatform In a multiplatform kernel, each initcall is run regardless of the platform it is meant for, so it must not attempt to access SoC-specific registers. This adds 'if (soc_is_s3c64xx)' to all initcalls that are specific to the s3c64xx platform, to prevent them from breaking other platforms once we can build them into a combined kernel. Signed-off-by: Arnd Bergmann Reviewed-by: Krzysztof Kozlowski --- arch/arm/mach-s3c64xx/common.c | 4 ++-- arch/arm/mach-s3c64xx/cpuidle.c | 5 ++++- arch/arm/mach-s3c64xx/irq-pm.c | 2 +- arch/arm/mach-s3c64xx/mach-crag6410-module.c | 4 ++++ arch/arm/mach-s3c64xx/pl080.c | 4 ++++ arch/arm/mach-s3c64xx/pm.c | 4 ++++ arch/arm/mach-s3c64xx/s3c6400.c | 2 +- arch/arm/mach-s3c64xx/s3c6410.c | 2 +- 8 files changed, 21 insertions(+), 6 deletions(-) (limited to 'arch/arm/mach-s3c64xx') diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c index ddb30b8434c5..3dea4a4ef165 100644 --- a/arch/arm/mach-s3c64xx/common.c +++ b/arch/arm/mach-s3c64xx/common.c @@ -208,7 +208,7 @@ void __init s3c64xx_init_io(struct map_desc *mach_desc, int size) static __init int s3c64xx_dev_init(void) { /* Not applicable when using DT. */ - if (of_have_populated_dt()) + if (of_have_populated_dt() || !soc_is_s3c64xx()) return 0; subsys_system_register(&s3c64xx_subsys, NULL); @@ -413,7 +413,7 @@ static int __init s3c64xx_init_irq_eint(void) int irq; /* On DT-enabled systems EINTs are handled by pinctrl-s3c64xx driver. */ - if (of_have_populated_dt()) + if (of_have_populated_dt() || !soc_is_s3c64xx()) return -ENODEV; for (irq = IRQ_EINT(0); irq <= IRQ_EINT(27); irq++) { diff --git a/arch/arm/mach-s3c64xx/cpuidle.c b/arch/arm/mach-s3c64xx/cpuidle.c index 93aa8cb70195..5322db51150e 100644 --- a/arch/arm/mach-s3c64xx/cpuidle.c +++ b/arch/arm/mach-s3c64xx/cpuidle.c @@ -18,6 +18,7 @@ #include +#include #include #include "regs-sys.h" @@ -57,6 +58,8 @@ static struct cpuidle_driver s3c64xx_cpuidle_driver = { static int __init s3c64xx_init_cpuidle(void) { - return cpuidle_register(&s3c64xx_cpuidle_driver, NULL); + if (soc_is_s3c64xx()) + return cpuidle_register(&s3c64xx_cpuidle_driver, NULL); + return 0; } device_initcall(s3c64xx_init_cpuidle); diff --git a/arch/arm/mach-s3c64xx/irq-pm.c b/arch/arm/mach-s3c64xx/irq-pm.c index ae4ea7601f60..0bbf1faaee42 100644 --- a/arch/arm/mach-s3c64xx/irq-pm.c +++ b/arch/arm/mach-s3c64xx/irq-pm.c @@ -113,7 +113,7 @@ static struct syscore_ops s3c64xx_irq_syscore_ops = { static __init int s3c64xx_syscore_init(void) { /* Appropriate drivers (pinctrl, uart) handle this when using DT. */ - if (of_have_populated_dt()) + if (of_have_populated_dt() || !soc_is_s3c64xx()) return 0; register_syscore_ops(&s3c64xx_irq_syscore_ops); diff --git a/arch/arm/mach-s3c64xx/mach-crag6410-module.c b/arch/arm/mach-s3c64xx/mach-crag6410-module.c index 9c00d83f7151..be21f06e6b3f 100644 --- a/arch/arm/mach-s3c64xx/mach-crag6410-module.c +++ b/arch/arm/mach-s3c64xx/mach-crag6410-module.c @@ -29,6 +29,7 @@ #include +#include #include "crag6410.h" static struct s3c64xx_spi_csinfo wm0010_spi_csinfo = { @@ -399,6 +400,9 @@ static struct i2c_driver wlf_gf_module_driver = { static int __init wlf_gf_module_register(void) { + if (!soc_is_s3c64xx()) + return 0; + return i2c_add_driver(&wlf_gf_module_driver); } device_initcall(wlf_gf_module_register); diff --git a/arch/arm/mach-s3c64xx/pl080.c b/arch/arm/mach-s3c64xx/pl080.c index 901a984bddc2..89c5a62830a7 100644 --- a/arch/arm/mach-s3c64xx/pl080.c +++ b/arch/arm/mach-s3c64xx/pl080.c @@ -14,6 +14,7 @@ #include #include +#include #include #include @@ -230,6 +231,9 @@ static AMBA_AHB_DEVICE(s3c64xx_dma1, "dma-pl080s.1", 0, static int __init s3c64xx_pl080_init(void) { + if (!soc_is_s3c64xx()) + return 0; + /* Set all DMA configuration to be DMA, not SDMA */ writel(0xffffff, S3C64XX_SDMA_SEL); diff --git a/arch/arm/mach-s3c64xx/pm.c b/arch/arm/mach-s3c64xx/pm.c index 75b14e756383..59d91b83b03d 100644 --- a/arch/arm/mach-s3c64xx/pm.c +++ b/arch/arm/mach-s3c64xx/pm.c @@ -22,6 +22,7 @@ #include #include +#include #include #include #include @@ -332,6 +333,9 @@ int __init s3c64xx_pm_init(void) static __init int s3c64xx_pm_initcall(void) { + if (!soc_is_s3c64xx()) + return 0; + pm_cpu_prep = s3c64xx_pm_prepare; pm_cpu_sleep = s3c64xx_cpu_suspend; diff --git a/arch/arm/mach-s3c64xx/s3c6400.c b/arch/arm/mach-s3c64xx/s3c6400.c index 33273abef669..5ea82accc773 100644 --- a/arch/arm/mach-s3c64xx/s3c6400.c +++ b/arch/arm/mach-s3c64xx/s3c6400.c @@ -81,7 +81,7 @@ static struct device s3c6400_dev = { static int __init s3c6400_core_init(void) { /* Not applicable when using DT. */ - if (of_have_populated_dt()) + if (of_have_populated_dt() || soc_is_s3c64xx()) return 0; return subsys_system_register(&s3c6400_subsys, NULL); diff --git a/arch/arm/mach-s3c64xx/s3c6410.c b/arch/arm/mach-s3c64xx/s3c6410.c index eadc48dee0e4..92bb927c4478 100644 --- a/arch/arm/mach-s3c64xx/s3c6410.c +++ b/arch/arm/mach-s3c64xx/s3c6410.c @@ -84,7 +84,7 @@ static struct device s3c6410_dev = { static int __init s3c6410_core_init(void) { /* Not applicable when using DT. */ - if (of_have_populated_dt()) + if (of_have_populated_dt() || !soc_is_s3c64xx()) return 0; return subsys_system_register(&s3c6410_subsys, NULL); -- cgit