From patchwork Mon Mar 2 12:35:57 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 5912101 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id C0DF6BF440 for ; Mon, 2 Mar 2015 12:37:32 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id AFB73201CD for ; Mon, 2 Mar 2015 12:37:31 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 79804201D3 for ; Mon, 2 Mar 2015 12:37:30 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752602AbbCBMh3 (ORCPT ); Mon, 2 Mar 2015 07:37:29 -0500 Received: from mout.kundenserver.de ([212.227.17.10]:59868 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751556AbbCBMh2 (ORCPT ); Mon, 2 Mar 2015 07:37:28 -0500 Received: from wuerfel.lan. ([149.172.15.242]) by mrelayeu.kundenserver.de (mreue104) with ESMTPSA (Nemesis) id 0LqU6b-1XpD1i21RJ-00e5It; Mon, 02 Mar 2015 13:36:55 +0100 From: Arnd Bergmann To: linux-arm-kernel@lists.infradead.org Cc: Kukjin Kim , linux-samsung-soc@vger.kernel.org, Maurus Cuelenaere , Mark Brown , Liam Girdwood , dmitry.torokhov@gmail.com, ch.naveen@samsung.com, a.kesavan@samsung.com, cw00.choi@samsung.com, jic23@kernel.org, Tomasz Figa , padma.v@samsung.com, Arnd Bergmann Subject: [PATCH 04/10] ARM: s3c64xx: prepare initcalls for multiplatform Date: Mon, 2 Mar 2015 13:35:57 +0100 Message-Id: <1425299763-4066822-5-git-send-email-arnd@arndb.de> X-Mailer: git-send-email 2.1.0.rc2 In-Reply-To: <1425299763-4066822-1-git-send-email-arnd@arndb.de> References: <1425299763-4066822-1-git-send-email-arnd@arndb.de> X-Provags-ID: V03:K0:Jvw1LeGwFnVjk1llT8E7aYT441Zlv9y/cPb4qlsOUpRlhOWwBFM y40cisynLQ3ul4otI0vGTxMXFqCOVYa2j+q2GVUh2MWEd8MQS0ZuPCHKp/H2W/FSE8BhVQz s2wafNFbixWlnPG94Ie9gjcA7GYUZ630JES6m6yJuxVv1MZpWo4IQtqARMfLabsZ3VPBBjg BkaC5FjFJwSi6mHCcUxkw== X-UI-Out-Filterresults: notjunk:1; Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 --- 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 +- arch/arm/plat-samsung/gpio-samsung.c | 11 +++++------ arch/arm/plat-samsung/init.c | 5 +++++ 10 files changed, 31 insertions(+), 12 deletions(-) diff --git a/arch/arm/mach-s3c64xx/common.c b/arch/arm/mach-s3c64xx/common.c index 16547f2641a3..cca29aa49fd3 100644 --- a/arch/arm/mach-s3c64xx/common.c +++ b/arch/arm/mach-s3c64xx/common.c @@ -209,7 +209,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); @@ -414,7 +414,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 2eb072440dfa..92b41c2b7314 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 aaf7bea4032f..1451d4cda324 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 @@ -330,6 +331,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 1ce48c54cd9c..0789d59e6302 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 b2a7930548d9..273f8a1518b2 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); diff --git a/arch/arm/plat-samsung/gpio-samsung.c b/arch/arm/plat-samsung/gpio-samsung.c index 7c288ba4dc87..37faa8eab78f 100644 --- a/arch/arm/plat-samsung/gpio-samsung.c +++ b/arch/arm/plat-samsung/gpio-samsung.c @@ -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; diff --git a/arch/arm/plat-samsung/init.c b/arch/arm/plat-samsung/init.c index 11fbbc26e49f..3776f7e752f0 100644 --- a/arch/arm/plat-samsung/init.c +++ b/arch/arm/plat-samsung/init.c @@ -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) {