From patchwork Thu Nov 10 12:37:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Dubey X-Patchwork-Id: 9421017 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 2AB3A60484 for ; Thu, 10 Nov 2016 12:34:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1999A2926B for ; Thu, 10 Nov 2016 12:34:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0BB0D29495; Thu, 10 Nov 2016 12:34:55 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0DFF02926B for ; Thu, 10 Nov 2016 12:34:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932617AbcKJMex (ORCPT ); Thu, 10 Nov 2016 07:34:53 -0500 Received: from mailout1.samsung.com ([203.254.224.24]:59862 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932595AbcKJMew (ORCPT ); Thu, 10 Nov 2016 07:34:52 -0500 Received: from epcas2p1.samsung.com (unknown [182.195.41.53]) by mailout1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OGF02RFEEY1QW90@mailout1.samsung.com> for linux-samsung-soc@vger.kernel.org; Thu, 10 Nov 2016 21:34:49 +0900 (KST) Received: from epsmges4p5.samsung.com (unknown [182.195.40.48]) by epcas2p3.samsung.com (KnoxPortal) with ESMTP id 20161110123449epcas2p3e496517ec2b25a6ec5123143873dfd22~Fr79X8yqd2776527765epcas2p3V; Thu, 10 Nov 2016 12:34:49 +0000 (GMT) Received: from epcas4p1.samsung.com ( [182.195.41.31]) by epsmges4p5.samsung.com (EPCPMTA) with SMTP id A7.F7.06750.86964285; Thu, 10 Nov 2016 21:34:48 +0900 (KST) Received: from epsmgmsp04.samsung.com (unknown [182.195.34.25]) by epcas4p1.samsung.com (KnoxPortal) with ESMTP id 20161110123448epcas4p1ecfa3bf0fd745934338853ed885c2e7c~Fr79I9zMR1168011680epcas4p1Z; Thu, 10 Nov 2016 12:34:48 +0000 (GMT) X-AuditID: b6c32a25-f798f6d000001a5e-3b-58246968f15d Received: from pankaj.dubey-ubuntu (Unknown_Domain [107.108.83.125]) by epsmgmsp04.samsung.com (EPCPMTA) with SMTP id 9F.D6.31923.76964285; Thu, 10 Nov 2016 21:34:48 +0900 (KST) Subject: Re: [PATCH v3 1/2] ARM: EXYNOS: Remove static mapping of SCU SFR To: Arnd Bergmann , linux-arm-kernel@lists.infradead.org Cc: linux-samsung-soc@vger.kernel.org, kgene@kernel.org, thomas.ab@samsung.com, krzk@kernel.org, Russell King From: "pankaj.dubey" Message-id: Date: Thu, 10 Nov 2016 18:07:54 +0530 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0 MIME-version: 1.0 In-reply-to: <5066943.nydi3GQ3KP@wuerfel> Content-type: text/plain; charset=windows-1252 Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA01Sa0hTcRTnv7uX4uq2lh2EdF0TfODabptOca0ocmEflkGtQuZNb9tyr3Zn WBCulywnvjLUtdQipRaWLZ8fiqUxsT5oFhZ9qGARVFSEEGH02HYN/PY75/zOOb/f4Qgx8W9e mtBid9MuO2Ul+Mnc0amcjHyzZZNBfnGxWP27PSJQt0Q/Y+rZ2SGBOhRd4Km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SSEvMTfVVilC1zckSEmhLDGnFMgzMkAD Ds4B7sFK+nYJbhlzWz8yFtzXqtj57xlLA+M95S5GTg4JAROJjQdOMULYYhIX7q1nA7GFBDYz Snx7yQViCwt4SqzqeMkKYosIuEusmz4PyOYCqvnFKHHt8np2EIdZoI9RYvf/b2CT2AT0JaY/ 3gY0iYODV8BO4tVasGYWAVWJ0+8+g9miAhESn35/AbN5BQQlTs58wgJicwpoSry/sR3MZhbQ k9hx/RcrhC0vsf3tHOYJjPyzkLTMQlI2C0nZAkbmVYxiqQXFuem5xQUGJnrFibnFpXnpesn5 uZsYgdG07bCS5A7GVSu8DjEKcDAq8fBe8FSJEGJNLCuuzD3EKMHBrCTCezgNKMSbklhZlVqU H19UmpNafIjRFOiNicxSosn5wEjPK4k3NDG1sLAwsTQ2NrYwURLnjZ3+LFxIID2xJDU7NbUg tQimj4mDU6qBcfPbEHHOgnN5PNkvfdXfbHj0RdzQb/+yR+ZL52R99YkIbTG5wtP8ZieDs7hK c/2kmuUzOA2tudkmyy3h/bVJd0+6klfl8njuFXEFMhLLtjz73V3j2NknuX9daUmfbnXnn9uV sYsWcIfvOl3RxPt4eWrCb7vsU8bhkuftn05s3/zM8oZiaN5DJZbijERDLeai4kQA4C3wxbwC AAA= X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20161110123448epcas4p1ecfa3bf0fd745934338853ed885c2e7c X-Msg-Generator: CA X-Sender-IP: 182.195.34.25 X-Local-Sender: =?UTF-8?B?7YyQ7Lm07KaIG1NTSVItVHVybiBLZXkgU29sdXRpb25zGw==?= =?UTF-8?B?7IK87ISx7KCE7J6QGy4vQ2hpZWYgRW5naW5lZXI=?= X-Global-Sender: =?UTF-8?B?UEFOS0FKIEtVTUFSIERVQkVZG1NTSVItVHVybiBLZXkgU29s?= =?UTF-8?B?dXRpb25zG1NhbXN1bmcgRWxlY3Ryb25pY3MbLi9DaGllZiBFbmdpbmVlcg==?= X-Sender-Code: =?UTF-8?B?QzEwG1NXQUhRG0MxMElEMDdJRDAxMDk5Nw==?= CMS-TYPE: 104P DLP-Filter: Pass X-CFilter-Loop: Reflected X-HopCount: 7 X-CMS-RootMailID: 20161110115456epcas2p4524185a083cd7173e354f46b94be9183 X-RootMTR: 20161110115456epcas2p4524185a083cd7173e354f46b94be9183 References: <1478693755-11953-1-git-send-email-pankaj.dubey@samsung.com> <1478693755-11953-2-git-send-email-pankaj.dubey@samsung.com> <5066943.nydi3GQ3KP@wuerfel> Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Hi Arnd, On Thursday 10 November 2016 05:24 PM, Arnd Bergmann wrote: > On Wednesday, November 9, 2016 5:45:54 PM CET Pankaj Dubey wrote: >> Lets remove static mapping of SCU SFR mainly used in CORTEX-A9 SoC based >> boards. Instead use mapping from device tree node of SCU. >> >> NOTE: This patch has dependency on DT file of any such CORTEX-A9 SoC >> based boards, in the absence of SCU device node in DTS file, only single >> CPU will boot. So if you are using OUT-OF-TREE DTS file of CORTEX-A9 based >> Exynos SoC make sure to add SCU device node to DTS file for SMP boot. >> >> Signed-off-by: Pankaj Dubey >> Reviewed-by: Alim Akhtar > > With CONFIG_SMP disabled, I now get this build failure: > Sorry, I missed this part and did not check with CONFIG_SMP disabled. > arch/arm/mach-exynos/pm.o: In function `exynos_enter_aftr': > pm.c:(.text.exynos_enter_aftr+0xec): undefined reference to `exynos_scu_enable' > arch/arm/mach-exynos/suspend.o: In function `exynos_pm_resume': > suspend.c:(.text.exynos_pm_resume+0x78): undefined reference to `exynos_scu_enable' > > Please fix. I have applied a patch locally (see below), but don't know > if that is the best solution. As we seem to duplicate that code across > several platforms, I wonder why we don't just put it into the core scu > implementation. > When I checked scu_enable declaration it is defined in arch/arm/include/asm/smp_scu.h as: #if defined(CONFIG_SMP) && defined(CONFIG_HAVE_ARM_SCU) void scu_enable(void __iomem *scu_base); #else static inline void scu_enable(void __iomem *scu_base) {} #endif So if CONFIG_SMP is disable then there is no sense of exynos_scu_enable as well. So wow about using below patch? -------------------------------------------------------- Subject: [PATCH] ARM: exynos: fix build fail due to exynos_scu_enable Build failed if we disable CONFIG_SMP as shown below: arch/arm/mach-exynos/pm.o: In function `exynos_enter_aftr': pm.c:(.text.exynos_enter_aftr+0xec): undefined reference to `exynos_scu_enable' arch/arm/mach-exynos/suspend.o: In function `exynos_pm_resume': suspend.c:(.text.exynos_pm_resume+0x78): undefined reference to `exynos_scu_enable' Since scu_enable is defined only in case CONFIG_SMP and CONFIG_HAVE_ARM_SCU lets move exynos_scu_enable also under these two macros. Reported-by: Arnd Bergmann Signed-off-by: Pankaj Dubey --- arch/arm/mach-exynos/common.h | 5 +++++ 1 file changed, 5 insertions(+) */ diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h index fb12d11..03fdb79 100644 --- a/arch/arm/mach-exynos/common.h +++ b/arch/arm/mach-exynos/common.h @@ -156,7 +156,12 @@ extern void exynos_cpu_restore_register(void); extern void exynos_pm_central_suspend(void); extern int exynos_pm_central_resume(void); extern void exynos_enter_aftr(void); +#if defined(CONFIG_SMP) && defined(CONFIG_HAVE_ARM_SCU) extern int exynos_scu_enable(void); +#else +static inline void exynos_scu_enable(void) {} +#endif + ------------------------------------------------------ Of-course your idea to move it in core SCU file is also good that we lots of duplication in different architecture can be avoided. In that case I can think of following patch: [PATCH] ARM: scu: use SCU device node to enable SCU Many platforms are duplicating code for enabling SCU, lets add common code to enable SCU using SCU device node so the duplication in each platform can be avoided. Suggested-by: Arnd Bergmann Signed-off-by: Pankaj Dubey --- arch/arm/include/asm/smp_scu.h | 2 ++ arch/arm/kernel/smp_scu.c | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/arch/arm/include/asm/smp_scu.h b/arch/arm/include/asm/smp_scu.h index bfe163c..e5e2492 100644 --- a/arch/arm/include/asm/smp_scu.h +++ b/arch/arm/include/asm/smp_scu.h @@ -38,8 +38,10 @@ static inline int scu_power_mode(void __iomem *scu_base, unsigned int mode) #endif #if defined(CONFIG_SMP) && defined(CONFIG_HAVE_ARM_SCU) +int of_scu_enable(void); void scu_enable(void __iomem *scu_base); #else +static inline int of_scu_enable(void) {return 0;} static inline void scu_enable(void __iomem *scu_base) {} #endif diff --git a/arch/arm/kernel/smp_scu.c b/arch/arm/kernel/smp_scu.c index 72f9241..7c16d16 100644 --- a/arch/arm/kernel/smp_scu.c +++ b/arch/arm/kernel/smp_scu.c @@ -34,6 +34,23 @@ unsigned int __init scu_get_core_count(void __iomem *scu_base) return (ncores & 0x03) + 1; } +int of_scu_enable(void) +{ + struct device_node *np; + void __iomem *scu_base; + + np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu"); + scu_base = of_iomap(np, 0); + of_node_put(np); + if (!scu_base) { + pr_err("%s failed to map scu_base\n", __func__); + return -ENOMEM; + } + scu_enable(scu_base); + iounmap(scu_base); + return 0; +} + /* * Enable the SCU