From patchwork Wed Mar 18 12:51:50 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bartlomiej Zolnierkiewicz X-Patchwork-Id: 6038881 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.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 247E29F314 for ; Wed, 18 Mar 2015 12:56:21 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 43C5F203F7 for ; Wed, 18 Mar 2015 12:56:19 +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 5081A20502 for ; Wed, 18 Mar 2015 12:56:18 +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 1YYDTf-0006z5-Rv; Wed, 18 Mar 2015 12:53:39 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1YYDSj-0006Wk-Vj for linux-arm-kernel@lists.infradead.org; Wed, 18 Mar 2015 12:52:43 +0000 Received: from epcpsbgm1.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0NLE00IU1RR632B0@mailout4.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 18 Mar 2015 21:52:18 +0900 (KST) X-AuditID: cbfee61a-f79c06d000004e71-20-55097502b591 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 17.98.20081.20579055; Wed, 18 Mar 2015 21:52:18 +0900 (KST) Received: from mcdsrvbld02.digital.local ([106.116.37.23]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0NLE0090BRQJ9L30@mmp1.samsung.com>; Wed, 18 Mar 2015 21:52:18 +0900 (KST) From: Bartlomiej Zolnierkiewicz To: Kukjin Kim , Kukjin Kim Subject: [PATCH v3 1/4] ARM: EXYNOS: fix CPU1 hotplug for AFTR mode on Exynos3250 Date: Wed, 18 Mar 2015 13:51:50 +0100 Message-id: <1426683113-31209-2-git-send-email-b.zolnierkie@samsung.com> X-Mailer: git-send-email 1.7.10.4 In-reply-to: <1426683113-31209-1-git-send-email-b.zolnierkie@samsung.com> References: <1426683113-31209-1-git-send-email-b.zolnierkie@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFtrALMWRmVeSWpSXmKPExsVy+t9jAV2mUs5QgxXrRSw2zljPanH9y3NW i3mfZS1evzC06F1wlc2i//FrZouzTW/YLTY9vsZqcXnXHDaLz71HGC1mnN/HZLFq1x9GBx6P nbPusntsWtXJ5nHn2h42j81L6j36tqxi9Pi8SS6ALYrLJiU1J7MstUjfLoEro3HvIpaCh1IV p+bcYm1g3CHWxcjJISFgIrHv2REmCFtM4sK99WxdjFwcQgKLGCVWbn3LDuF0MUk0LZ3HClLF JmAlMbF9FSOILSLgKjHnyiRGkCJmgV9MEleuPgYrEhYIlvg69TnYWBYBVYl73w6ANfAKeEj0 HfjGDrFOUaL72QQ2EJtTwFNi3vFZLCC2EFDNtgsdTBMYeRcwMqxiFE0tSC4oTkrPNdQrTswt Ls1L10vOz93ECA7HZ1I7GFc2WBxiFOBgVOLhlbjKESrEmlhWXJl7iFGCg1lJhJc7izNUiDcl sbIqtSg/vqg0J7X4EKM0B4uSOK+SfVuIkEB6YklqdmpqQWoRTJaJg1OqgdG0KYW79NmpmTMk rNe+tz57X3XOvtR2Q3fNS78fWxnF5lU9bX9gcpr75r0Tq44lTajJsNzUrclm9k2txG5yQ9C+ HGUWC9Y7kzbNOjQ3/dvff1Yxv/re+Kv5BbyJZFt0kv1NbEqa5pRCkY+6Pqp5YY7HJqxf/+XF vI3Z9cv+vtt8U7ri9u67wsJKLMUZiYZazEXFiQB0uzLcQwIAAA== X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20150318_055242_248205_3F4712CD X-CRM114-Status: GOOD ( 12.68 ) X-Spam-Score: -5.0 (-----) Cc: Krzysztof Kozlowski , linux-samsung-soc@vger.kernel.org, linux-pm@vger.kernel.org, Daniel Lezcano , Tomasz Figa , linux-kernel@vger.kernel.org, Chanwoo Choi , Kyungmin Park , linux-arm-kernel@lists.infradead.org, b.zolnierkie@samsung.com X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.18-1 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=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 CPU1 hotplug may hang when AFTR is used. Fix it by: - setting AUTOWAKEUP_EN bit in ARM_COREx_CONFIGURATION register in exynos_cpu_power_up() - not clearing reserved bits of ARM_COREx_CONFIGURATION register in exynos_cpu_power_down() - waiting while an undocumented register 0x0908 becomes non-zero in exynos_core_restart() - using dsb_sev() instead of IPI in exynos_boot_secondary() on Exynos3250 Cc: Daniel Lezcano Signed-off-by: Chanwoo Choi Signed-off-by: Krzysztof Kozlowski Signed-off-by: Bartlomiej Zolnierkiewicz Acked-by: Kyungmin Park Reviewed-by: Krzysztof Kozlowski Tested-by: Krzysztof Kozlowski --- arch/arm/mach-exynos/platsmp.c | 23 ++++++++++++++++++++--- arch/arm/mach-exynos/regs-pmu.h | 2 ++ 2 files changed, 22 insertions(+), 3 deletions(-) diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c index d2e9f12..ebd135b 100644 --- a/arch/arm/mach-exynos/platsmp.c +++ b/arch/arm/mach-exynos/platsmp.c @@ -126,6 +126,8 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious) */ void exynos_cpu_power_down(int cpu) { + u32 core_conf; + if (cpu == 0 && (soc_is_exynos5420() || soc_is_exynos5800())) { /* * Bypass power down for CPU0 during suspend. Check for @@ -137,7 +139,10 @@ void exynos_cpu_power_down(int cpu) if (!(val & S5P_CORE_LOCAL_PWR_EN)) return; } - pmu_raw_writel(0, EXYNOS_ARM_CORE_CONFIGURATION(cpu)); + + core_conf = pmu_raw_readl(EXYNOS_ARM_CORE_CONFIGURATION(cpu)); + core_conf &= ~S5P_CORE_LOCAL_PWR_EN; + pmu_raw_writel(core_conf, EXYNOS_ARM_CORE_CONFIGURATION(cpu)); } /** @@ -148,7 +153,12 @@ void exynos_cpu_power_down(int cpu) */ void exynos_cpu_power_up(int cpu) { - pmu_raw_writel(S5P_CORE_LOCAL_PWR_EN, + u32 core_conf = S5P_CORE_LOCAL_PWR_EN; + + if (soc_is_exynos3250()) + core_conf |= S5P_CORE_AUTOWAKEUP_EN; + + pmu_raw_writel(core_conf, EXYNOS_ARM_CORE_CONFIGURATION(cpu)); } @@ -226,6 +236,10 @@ static void exynos_core_restart(u32 core_id) if (!of_machine_is_compatible("samsung,exynos3250")) return; + while (!pmu_raw_readl(S5P_PMU_SPARE2)) + udelay(10); + udelay(10); + val = pmu_raw_readl(EXYNOS_ARM_CORE_STATUS(core_id)); val |= S5P_CORE_WAKEUP_FROM_LOCAL_CFG; pmu_raw_writel(val, EXYNOS_ARM_CORE_STATUS(core_id)); @@ -346,7 +360,10 @@ static int exynos_boot_secondary(unsigned int cpu, struct task_struct *idle) call_firmware_op(cpu_boot, core_id); - arch_send_wakeup_ipi_mask(cpumask_of(cpu)); + if (soc_is_exynos3250()) + dsb_sev(); + else + arch_send_wakeup_ipi_mask(cpumask_of(cpu)); if (pen_release == -1) break; diff --git a/arch/arm/mach-exynos/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h index eb461e1..84ddce1 100644 --- a/arch/arm/mach-exynos/regs-pmu.h +++ b/arch/arm/mach-exynos/regs-pmu.h @@ -49,6 +49,7 @@ #define S5P_INFORM5 0x0814 #define S5P_INFORM6 0x0818 #define S5P_INFORM7 0x081C +#define S5P_PMU_SPARE2 0x0908 #define S5P_PMU_SPARE3 0x090C #define EXYNOS_IROM_DATA2 0x0988 @@ -182,6 +183,7 @@ #define S5P_CORE_LOCAL_PWR_EN 0x3 #define S5P_CORE_WAKEUP_FROM_LOCAL_CFG (0x3 << 8) +#define S5P_CORE_AUTOWAKEUP_EN (1 << 31) /* Only for EXYNOS4210 */ #define S5P_CMU_CLKSTOP_LCD1_LOWPWR 0x1154