From patchwork Tue Jun 3 04:47:46 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Olof Johansson X-Patchwork-Id: 4285041 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id E48BB9F326 for ; Tue, 3 Jun 2014 04:48:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 0ABE02021A for ; Tue, 3 Jun 2014 04:48:53 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1AA1620218 for ; Tue, 3 Jun 2014 04:48:52 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WrgcL-0001u2-Nn; Tue, 03 Jun 2014 04:46:33 +0000 Received: from mail-pd0-f178.google.com ([209.85.192.178]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WrgcI-0001tI-J9 for linux-arm-kernel@lists.infradead.org; Tue, 03 Jun 2014 04:46:31 +0000 Received: by mail-pd0-f178.google.com with SMTP id v10so4144802pde.23 for ; Mon, 02 Jun 2014 21:46:08 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=9y+GkT/SG2tOAt51ft3cBx92pFxfijztK+5IUKQZR2c=; b=XjhLXhFMG6xv2zxle+XLIFX0BvvEJ5RHSMTiwFcau0bVWYAvhEWeMi8VD0vrzpvcrg YwPO+YOW8ZAj9GPSE05LY/Xdn29UOXsfzJSqPt6jRsfUXIo9ZYD/Y4s9hBp9b9nygaan BezAR+5EXOQz9ojQjOFf0K4oa82VFCleHS2itxw5ittnsRup/gGGQIwvITPjH5Pj4A8L W+obigticXvDxdq9o/yYLPxlU25eIvi7R81Kg1e64aQDQERKY03i/0bZPxWBiT1IAyJY qheOlZ37Oj6M7Lz9lJNgeURQF3YpofyjjqkASTu8uPHA9NpA/9H7G+A0+xOC9mJ7bhUL Ls3Q== X-Gm-Message-State: ALoCoQnuo2ivrLYDb3QXww0TGXR46DhwXanP70mr+6KM7/8heZ0M8BL3VnOUKlIIB9PHqEoUWjLw X-Received: by 10.66.233.73 with SMTP id tu9mr46426329pac.78.1401770768537; Mon, 02 Jun 2014 21:46:08 -0700 (PDT) Received: from brutus.lixom.net (173-13-129-225-sfba.hfc.comcastbusiness.net. [173.13.129.225]) by mx.google.com with ESMTPSA id ek2sm23294339pbd.30.2014.06.02.21.46.07 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 02 Jun 2014 21:46:07 -0700 (PDT) From: Olof Johansson To: kgene.kim@samsung.com Subject: [PATCH] ARM: exynos: move sysram info to exynos.c Date: Mon, 2 Jun 2014 21:47:46 -0700 Message-Id: <1401770866-1975-1-git-send-email-olof@lixom.net> X-Mailer: git-send-email 1.7.10.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140602_214630_646810_E083382B X-CRM114-Status: GOOD ( 19.37 ) X-Spam-Score: 0.0 (/) Cc: linux-samsung-soc@vger.kernel.org, linux@arm.linux.org.uk, Tomasz Figa , Daniel Lezcano , arm@kernel.org, Olof Johansson , linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-2.5 required=5.0 tests=BAYES_00,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 This solves a problem with building with CONFIG_SMP=n due to missing sysram_base_addr (or sysram_ns_base_addr) variables. The new setup method is more awkward than I'd like for it to be, but it can't be done in init_early() since ioremap is not yet available, but it needs to happen before SMP. Reported-by: Russell King Cc: Kukjin Kim Cc: Tomasz Figa Cc: Daniel Lezcano Signed-off-by: Olof Johansson --- I'm not entirely happy with the solution here, especially the dual call path. The platsmp.c->exynos.c call isn't ideal either but I'm less worried about that. Seemed overkill to create a new c file just for this. I've tested to make sure this still works on arndale, and the build errors as reported by Russell are definitely gone. Better ideas welcome. arch/arm/mach-exynos/common.h | 1 + arch/arm/mach-exynos/exynos.c | 29 +++++++++++++++++++++++++++++ arch/arm/mach-exynos/platsmp.c | 26 ++------------------------ 3 files changed, 32 insertions(+), 24 deletions(-) diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h index 80b90e3..5a3a1ec 100644 --- a/arch/arm/mach-exynos/common.h +++ b/arch/arm/mach-exynos/common.h @@ -118,6 +118,7 @@ extern void __iomem *sysram_ns_base_addr; extern void __iomem *sysram_base_addr; void exynos_init_io(void); void exynos_restart(enum reboot_mode mode, const char *cmd); +void exynos_sysram_init(void); void exynos_cpuidle_init(void); void exynos_cpufreq_init(void); void exynos_init_late(void); diff --git a/arch/arm/mach-exynos/exynos.c b/arch/arm/mach-exynos/exynos.c index bc43e22..9183675 100644 --- a/arch/arm/mach-exynos/exynos.c +++ b/arch/arm/mach-exynos/exynos.c @@ -187,6 +187,28 @@ void __init exynos_cpufreq_init(void) platform_device_register_simple("exynos-cpufreq", -1, NULL, 0); } +void __iomem *sysram_base_addr; +void __iomem *sysram_ns_base_addr; + +void __init exynos_sysram_init(void) +{ + struct device_node *node; + + for_each_compatible_node(node, NULL, "samsung,exynos4210-sysram") { + if (!of_device_is_available(node)) + continue; + sysram_base_addr = of_iomap(node, 0); + break; + } + + for_each_compatible_node(node, NULL, "samsung,exynos4210-sysram-ns") { + if (!of_device_is_available(node)) + continue; + sysram_ns_base_addr = of_iomap(node, 0); + break; + } +} + void __init exynos_init_late(void) { if (of_machine_is_compatible("samsung,exynos5440")) @@ -293,6 +315,13 @@ static void __init exynos_dt_machine_init(void) } } + /* + * This is called from smp_prepare_cpus if we've built for SMP, but + * we still need to set it up for PM and firmware ops if not. + */ + if (!IS_ENABLED(SMP)) + exynos_sysram_init(); + exynos_cpuidle_init(); exynos_cpufreq_init(); diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c index ec02422..1c8d31e 100644 --- a/arch/arm/mach-exynos/platsmp.c +++ b/arch/arm/mach-exynos/platsmp.c @@ -32,28 +32,6 @@ extern void exynos4_secondary_startup(void); -void __iomem *sysram_base_addr; -void __iomem *sysram_ns_base_addr; - -static void __init exynos_smp_prepare_sysram(void) -{ - struct device_node *node; - - for_each_compatible_node(node, NULL, "samsung,exynos4210-sysram") { - if (!of_device_is_available(node)) - continue; - sysram_base_addr = of_iomap(node, 0); - break; - } - - for_each_compatible_node(node, NULL, "samsung,exynos4210-sysram-ns") { - if (!of_device_is_available(node)) - continue; - sysram_ns_base_addr = of_iomap(node, 0); - break; - } -} - static inline void __iomem *cpu_boot_reg_base(void) { if (soc_is_exynos4210() && samsung_rev() == EXYNOS4210_REV_1_1) @@ -234,11 +212,11 @@ static void __init exynos_smp_prepare_cpus(unsigned int max_cpus) { int i; + exynos_sysram_init(); + if (read_cpuid_part_number() == ARM_CPU_PART_CORTEX_A9) scu_enable(scu_base_addr()); - exynos_smp_prepare_sysram(); - /* * Write the address of secondary startup into the * system-wide flags register. The boot monitor waits