From patchwork Tue Jun 18 15:26:31 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tomasz Figa X-Patchwork-Id: 2743011 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id CC2DCC0AB1 for ; Tue, 18 Jun 2013 15:30:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 84C06204CB for ; Tue, 18 Jun 2013 15:30:23 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 3339C204C8 for ; Tue, 18 Jun 2013 15:30:22 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uoxpm-0005nV-Gq; Tue, 18 Jun 2013 15:28:39 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uoxoj-0003Vn-Lq; Tue, 18 Jun 2013 15:27:33 +0000 Received: from mailout3.w1.samsung.com ([210.118.77.13]) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Uoxof-0003VA-Ui for linux-arm-kernel@lists.infradead.org; Tue, 18 Jun 2013 15:27:31 +0000 Received: from eucpsbgm1.samsung.com (unknown [203.254.199.244]) by mailout3.w1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0MOL00HJ8HH57RC0@mailout3.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Tue, 18 Jun 2013 16:27:02 +0100 (BST) X-AuditID: cbfec7f4-b7fd76d0000035e1-f6-51c07c46073a Received: from eusync1.samsung.com ( [203.254.199.211]) by eucpsbgm1.samsung.com (EUCPMTA) with SMTP id 6B.00.13793.64C70C15; Tue, 18 Jun 2013 16:27:02 +0100 (BST) Received: from amdc1227.digital.local ([106.116.147.199]) by eusync1.samsung.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0MOL00DFPHKYGP60@eusync1.samsung.com>; Tue, 18 Jun 2013 16:27:02 +0100 (BST) From: Tomasz Figa To: linux-samsung-soc@vger.kernel.org Subject: [PATCH] ARM: EXYNOS: Fix incorrect usage of S5P_ARM_CORE1_* registers Date: Tue, 18 Jun 2013 17:26:31 +0200 Message-id: <1371569191-2364-1-git-send-email-t.figa@samsung.com> X-Mailer: git-send-email 1.8.2.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrNJMWRmVeSWpSXmKPExsVy+t/xy7puNQcCDWasYbV4vGYxk8XlhZdY LZY0c1v0LrjKZnG26Q27xabH11gtLu+aw2Yx4/w+Jovbl3ktFmx8xGixfsZrFgduj5bmHjaP zUvqPfq2rGL0+LxJLoAlissmJTUnsyy1SN8ugSvj68+bbAU75Svu/njM2MD4S7KLkZNDQsBE YsXi1YwQtpjEhXvr2boYuTiEBJYySsx6d5oFwuljkjj/9jFYFZuAmsTnhkdsILaIgKrE57YF 7CBFzAKNzBJ/p+1nBUkIC/hJnDq/EMxmASqae3MKE4jNK+AocXr9T3aIdQoSx7dvY5zAyL2A kWEVo2hqaXJBcVJ6rqFecWJucWleul5yfu4mRkgAfdnBuPiY1SFGAQ5GJR7eBLH9gUKsiWXF lbmHGCU4mJVEeBUSDwQK8aYkVlalFuXHF5XmpBYfYmTi4JRqYHSa5bvlL8MmtuS167oMG/0c XN1t5Vl/sWenez3a9tL590lXoYB7XoxtbaabYv/Ouqy83jEzfOHlM8p/z/JdnLkkTGBiyvb+ re/eik148Yj17SM2n/QD7hqNvb2f/q6Q+Xt66ZqrvJMfZ05mbFX+8yqCNcTdXnhtx86XR+vE FNQ332z8sH2vZ7gSS3FGoqEWc1FxIgAOakwn/gEAAA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130618_112730_078172_FE313627 X-CRM114-Status: GOOD ( 13.07 ) X-Spam-Score: -8.1 (--------) Cc: Kukjin Kim , Russell King - ARM Linux , Tomasz Figa , Jingoo Han , linux-kernel@vger.kernel.org, stable@vger.kernel.org, Kyungmin Park , Abhilash Kesavan , Jonghwan Choi , 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=-5.4 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 S5P_ARM_CORE1_* registers affect only core 1. To control further cores properly another registers must be used. This patch replaces S5P_ARM_CORE1_* register definitions with S5P_ARM_CORE_*(x) macro which return addresses of registers for specified core. This fixes CPU hotplug on quad core Exynos SoCs on which currently offlining CPUs 2 or 3 caused CPU 1 to be turned off. In addition, bring-up of CPU 2 and 3 is fixed on boards where bootloader powers off secondary cores by default. Cc: stable@vger.kernel.org Signed-off-by: Tomasz Figa Signed-off-by: Kyungmin Park --- arch/arm/mach-exynos/hotplug.c | 9 +++++---- arch/arm/mach-exynos/include/mach/regs-pmu.h | 10 +++++++--- arch/arm/mach-exynos/platsmp.c | 9 +++++---- 3 files changed, 17 insertions(+), 11 deletions(-) diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c index af90cfa..c089943 100644 --- a/arch/arm/mach-exynos/hotplug.c +++ b/arch/arm/mach-exynos/hotplug.c @@ -93,10 +93,11 @@ static inline void cpu_leave_lowpower(void) static inline void platform_do_lowpower(unsigned int cpu, int *spurious) { for (;;) { + void __iomem *reg_base; + unsigned int phys_cpu = cpu_logical_map(cpu); - /* make cpu1 to be turned off at next WFI command */ - if (cpu == 1) - __raw_writel(0, S5P_ARM_CORE1_CONFIGURATION); + reg_base = S5P_ARM_CORE_CONFIGURATION(phys_cpu); + __raw_writel(0, reg_base); /* * here's the WFI @@ -106,7 +107,7 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious) : : "memory", "cc"); - if (pen_release == cpu_logical_map(cpu)) { + if (pen_release == phys_cpu) { /* * OK, proper wakeup, we're done */ diff --git a/arch/arm/mach-exynos/include/mach/regs-pmu.h b/arch/arm/mach-exynos/include/mach/regs-pmu.h index 57344b7..cf40b86 100644 --- a/arch/arm/mach-exynos/include/mach/regs-pmu.h +++ b/arch/arm/mach-exynos/include/mach/regs-pmu.h @@ -125,10 +125,14 @@ #define S5P_GPS_ALIVE_LOWPWR S5P_PMUREG(0x13A0) #define S5P_ARM_CORE0_CONFIGURATION S5P_PMUREG(0x2000) +#define S5P_ARM_CORE0_STATUS S5P_PMUREG(0x2004) #define S5P_ARM_CORE0_OPTION S5P_PMUREG(0x2008) -#define S5P_ARM_CORE1_CONFIGURATION S5P_PMUREG(0x2080) -#define S5P_ARM_CORE1_STATUS S5P_PMUREG(0x2084) -#define S5P_ARM_CORE1_OPTION S5P_PMUREG(0x2088) +#define S5P_ARM_CORE_CONFIGURATION(_nr) \ + (S5P_ARM_CORE0_CONFIGURATION + ((_nr) * 0x80)) +#define S5P_ARM_CORE_STATUS(_nr) \ + (S5P_ARM_CORE0_STATUS + ((_nr) * 0x80)) +#define S5P_ARM_CORE_OPTION(_nr) \ + (S5P_ARM_CORE0_OPTION + ((_nr) * 0x80)) #define S5P_ARM_COMMON_OPTION S5P_PMUREG(0x2408) #define S5P_TOP_PWR_OPTION S5P_PMUREG(0x2C48) diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c index d9c6d0a..2cbabc8 100644 --- a/arch/arm/mach-exynos/platsmp.c +++ b/arch/arm/mach-exynos/platsmp.c @@ -109,14 +109,15 @@ static int __cpuinit exynos_boot_secondary(unsigned int cpu, struct task_struct */ write_pen_release(phys_cpu); - if (!(__raw_readl(S5P_ARM_CORE1_STATUS) & S5P_CORE_LOCAL_PWR_EN)) { + if (!(__raw_readl(S5P_ARM_CORE_STATUS(phys_cpu)) + & S5P_CORE_LOCAL_PWR_EN)) { __raw_writel(S5P_CORE_LOCAL_PWR_EN, - S5P_ARM_CORE1_CONFIGURATION); + S5P_ARM_CORE_CONFIGURATION(phys_cpu)); timeout = 10; /* wait max 10 ms until cpu1 is on */ - while ((__raw_readl(S5P_ARM_CORE1_STATUS) + while ((__raw_readl(S5P_ARM_CORE_STATUS(phys_cpu)) & S5P_CORE_LOCAL_PWR_EN) != S5P_CORE_LOCAL_PWR_EN) { if (timeout-- == 0) break; @@ -125,7 +126,7 @@ static int __cpuinit exynos_boot_secondary(unsigned int cpu, struct task_struct } if (timeout == 0) { - printk(KERN_ERR "cpu1 power enable failed"); + printk(KERN_ERR "cpu%u power enable failed", cpu); spin_unlock(&boot_lock); return -ETIMEDOUT; }