ARM: s3c64xx: prepare initcalls for multiplatform
authorArnd Bergmann <arnd@arndb.de>
Fri, 27 Feb 2015 19:31:51 +0000 (20:31 +0100)
committerArnd Bergmann <arnd@arndb.de>
Tue, 1 Dec 2015 20:50:24 +0000 (21:50 +0100)
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 <arnd@arndb.de>
Reviewed-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
arch/arm/mach-s3c64xx/common.c
arch/arm/mach-s3c64xx/cpuidle.c
arch/arm/mach-s3c64xx/irq-pm.c
arch/arm/mach-s3c64xx/mach-crag6410-module.c
arch/arm/mach-s3c64xx/pl080.c
arch/arm/mach-s3c64xx/pm.c
arch/arm/mach-s3c64xx/s3c6400.c
arch/arm/mach-s3c64xx/s3c6410.c
arch/arm/plat-samsung/gpio-samsung.c
arch/arm/plat-samsung/init.c

index ddb30b8434c539588afaebef7d08ce086e5b6726..3dea4a4ef165538b385dec240b9afed1769b2b70 100644 (file)
@@ -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++) {
index 93aa8cb701958115275cf723660fa2bbcd38008e..5322db51150e8830e81d49791b51836156383d42 100644 (file)
@@ -18,6 +18,7 @@
 
 #include <asm/cpuidle.h>
 
+#include <plat/cpu.h>
 #include <mach/map.h>
 
 #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);
index ae4ea7601f603dbeff5bf278aa6c125a345db45c..0bbf1faaee4218d5bd4fbee81852954e9f5e1490 100644 (file)
@@ -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);
index 9c00d83f7151d83ea4f8a7de6bb8bbc0fde9e34c..be21f06e6b3f4aeb4f24d3ca2f7855f1e0b47688 100644 (file)
@@ -29,6 +29,7 @@
 
 #include <linux/platform_data/spi-s3c64xx.h>
 
+#include <plat/cpu.h>
 #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);
index 901a984bddc278058b83975ae8189d67699d0b0e..89c5a62830a7023196d97491047713b34ced152b 100644 (file)
@@ -14,6 +14,7 @@
 #include <linux/amba/pl08x.h>
 #include <linux/of.h>
 
+#include <plat/cpu.h>
 #include <mach/irqs.h>
 #include <mach/map.h>
 
@@ -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);
 
index 75b14e756383859c76c65f5544f06676faba5e58..59d91b83b03d7d801a10cca757d2e9fada4be4bc 100644 (file)
@@ -22,6 +22,7 @@
 #include <mach/map.h>
 #include <mach/irqs.h>
 
+#include <plat/cpu.h>
 #include <plat/devs.h>
 #include <plat/pm.h>
 #include <plat/wakeup-mask.h>
@@ -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;
 
index 33273abef669d8d4ea46647c4c3395e2df98843b..5ea82accc773ba822a5458c5310b94eb08d6ec27 100644 (file)
@@ -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);
index eadc48dee0e49490df6d8b25b21d8d6f1f083eea..92bb927c4478c3301a358e3da63470881388ec62 100644 (file)
@@ -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);
index 7c288ba4dc87fe0ea9e6274be22d7c7719752142..37faa8eab78fdd542c0c96f0682a54d2c21f5f90 100644 (file)
@@ -1176,14 +1176,16 @@ static __init int samsung_gpiolib_init(void)
         * interfaces. For legacy (non-DT) platforms this driver is used.
         */
        if (of_have_populated_dt())
-               return -ENODEV;
-
-       samsung_gpiolib_set_cfg(samsung_gpio_cfgs, ARRAY_SIZE(samsung_gpio_cfgs));
+               return 0;
 
        if (soc_is_s3c24xx()) {
+               samsung_gpiolib_set_cfg(samsung_gpio_cfgs,
+                               ARRAY_SIZE(samsung_gpio_cfgs));
                s3c24xx_gpiolib_add_chips(s3c24xx_gpios,
                                ARRAY_SIZE(s3c24xx_gpios), S3C24XX_VA_GPIO);
        } else if (soc_is_s3c64xx()) {
+               samsung_gpiolib_set_cfg(samsung_gpio_cfgs,
+                               ARRAY_SIZE(samsung_gpio_cfgs));
                samsung_gpiolib_add_2bit_chips(s3c64xx_gpios_2bit,
                                ARRAY_SIZE(s3c64xx_gpios_2bit),
                                S3C64XX_VA_GPIO + 0xE0, 0x20);
@@ -1192,9 +1194,6 @@ static __init int samsung_gpiolib_init(void)
                                S3C64XX_VA_GPIO);
                samsung_gpiolib_add_4bit2_chips(s3c64xx_gpios_4bit2,
                                ARRAY_SIZE(s3c64xx_gpios_4bit2));
-       } else {
-               WARN(1, "Unknown SoC in gpio-samsung, no GPIOs added\n");
-               return -ENODEV;
        }
 
        return 0;
index 11fbbc26e49fdd85273edc996504a189065d94cf..3776f7e752f006a61f6b42769a11d9c4f22d0573 100644 (file)
@@ -152,6 +152,11 @@ static int __init s3c_arch_init(void)
 {
        int ret;
 
+       /* init is only needed for ATAGS based platforms */
+       if (!IS_ENABLED(CONFIG_ATAGS) ||
+           (!soc_is_s3c24xx() && !soc_is_s3c64xx()))
+               return 0;
+
        // do the correct init for cpu
 
        if (cpu == NULL) {
This page took 0.029409 seconds and 5 git commands to generate.