From patchwork Fri Jun 6 08:16:30 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 4310631 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 91DA39F387 for ; Fri, 6 Jun 2014 08:19:14 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 7B5352018B for ; Fri, 6 Jun 2014 08:19:13 +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 8CCB32018A for ; Fri, 6 Jun 2014 08:19:12 +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 1WspKm-00089T-Sb; Fri, 06 Jun 2014 08:17:08 +0000 Received: from mailout3.w1.samsung.com ([210.118.77.13]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WspKg-00087C-48 for linux-arm-kernel@lists.infradead.org; Fri, 06 Jun 2014 08:17:03 +0000 Received: from eucpsbgm2.samsung.com (unknown [203.254.199.245]) 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 <0N6Q008MMMZMEO40@mailout3.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Fri, 06 Jun 2014 09:16:34 +0100 (BST) X-AuditID: cbfec7f5-b7f626d000004b39-fa-539178e22259 Received: from eusync2.samsung.com ( [203.254.199.212]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 58.23.19257.2E871935; Fri, 06 Jun 2014 09:16:34 +0100 (BST) Received: from AMDC1943.digital.local ([106.116.151.171]) by eusync2.samsung.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0N6Q00AIHMZIJY90@eusync2.samsung.com>; Fri, 06 Jun 2014 09:16:34 +0100 (BST) From: Krzysztof Kozlowski To: Russell King , Kukjin Kim , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2] ARM: EXYNOS: SWRESET is needed to boot secondary CPU on Exynos3250 Date: Fri, 06 Jun 2014 10:16:30 +0200 Message-id: <1402042590-8056-1-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrAJMWRmVeSWpSXmKPExsVy+t/xK7qPKiYGG/yfzm6xccZ6VovXLwwt ehdcZbM42/SG3WLT42usFpd3zWGzmHF+H5PF7cu8FmuP3GW3WD/jNYvFql1/GB24PVqae9g8 ds66y+6xeUm9R9+WVYwenzfJBbBGcdmkpOZklqUW6dslcGUs3bOYpeC0WMXvpUkNjGeEuhg5 OSQETCTuPp7NAmGLSVy4t56ti5GLQ0hgKaPE1cnvmCGcPiaJm3f2MoJUsQkYS2xevgSsSkRg B6PE8nuX2UEcZpCql/9XMYFUCQtESJw8dQXMZhFQlZi6bTEziM0r4Cbx/fg/Noh9chInj01m ncDIvYCRYRWjaGppckFxUnqukV5xYm5xaV66XnJ+7iZGSCh93cG49JjVIUYBDkYlHt6M9xOC hVgTy4orcw8xSnAwK4nw7o+ZGCzEm5JYWZValB9fVJqTWnyIkYmDU6qBceb+PyH1kS2/uA7c kPXg7ch88mPKxQWn11hfCGR9uibw4rnfqksOvlwlO02jvSvDKKFe12D9pTkSH3aGnzLbJPB4 +QSJQ0vONWWnHb53p+W0NbdTwlzVt68KuBbYBG/0VXSZHpDBv/VJV4/+9d06ykkT6xcpOlWe XsHLsOmVzzPmGwUsVb8bWZVYijMSDbWYi4oTAQVsLJcDAgAA X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140606_011702_313567_391E9994 X-CRM114-Status: GOOD ( 12.22 ) X-Spam-Score: -5.7 (-----) Cc: Krzysztof Kozlowski , Bartlomiej Zolnierkiewicz , Tomasz Figa , Tomasz Figa , Kyungmin Park , Marek Szyprowski 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 Without software reset the secondary CPU does not power up and exynos_boot_secondary() ends with pen_release equal to 1. This can be observed in dmesg: CPU1: failed to come online Brought up 1 CPUs SMP: Total of 1 processors activated. CPU: All CPU(s) started in SVC mode. When booting the secondary CPU on Exynos3250 execute also software reset for core 1. Signed-off-by: Krzysztof Kozlowski Reviewed-by: Tomasz Figa --- Changes since v1: 1. Removed inline keyword and change if statement to early return as Tomasz suggested. 2. Added reviewed-by Tomasz Figa. --- arch/arm/mach-exynos/platsmp.c | 23 +++++++++++++++++++++++ arch/arm/mach-exynos/regs-pmu.h | 3 +++ 2 files changed, 26 insertions(+) diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c index 7071e49197c3..4031b0ed8057 100644 --- a/arch/arm/mach-exynos/platsmp.c +++ b/arch/arm/mach-exynos/platsmp.c @@ -76,6 +76,26 @@ static inline void __iomem *cpu_boot_reg(int cpu) } /* + * Set wake up by local power mode and execute software reset for given core. + * + * Currently this is needed only when booting secondary CPU on Exynos3250. + */ +static void exynos_core_restart(u32 core_id) +{ + u32 val; + + if (!of_machine_is_compatible("samsung,exynos3250")) + return; + + val = __raw_readl(EXYNOS_ARM_CORE_STATUS(core_id)); + val |= S5P_CORE_WAKEUP_FROM_LOCAL_CFG; + __raw_writel(val, EXYNOS_ARM_CORE_STATUS(core_id)); + + pr_info("CPU%u: Software reset\n", core_id); + __raw_writel(EXYNOS_CORE_PO_RESET(core_id), EXYNOS_SWRESET); +} + +/* * Write pen_release in a way that is guaranteed to be visible to all * observers, irrespective of whether they're taking part in coherency * or not. This is necessary for the hotplug code to work reliably. @@ -150,6 +170,9 @@ static int exynos_boot_secondary(unsigned int cpu, struct task_struct *idle) return -ETIMEDOUT; } } + + exynos_core_restart(core_id); + /* * Send the secondary CPU a soft interrupt, thereby causing * the boot monitor to read the system wide flags register, diff --git a/arch/arm/mach-exynos/regs-pmu.h b/arch/arm/mach-exynos/regs-pmu.h index 4179f6a6d595..4f578ddd4d8b 100644 --- a/arch/arm/mach-exynos/regs-pmu.h +++ b/arch/arm/mach-exynos/regs-pmu.h @@ -26,6 +26,8 @@ #define S5P_USE_STANDBY_WFI0 (1 << 16) #define S5P_USE_STANDBY_WFE0 (1 << 24) +#define EXYNOS_CORE_PO_RESET(n) ((1 << 4) << n) + #define EXYNOS_SWRESET S5P_PMUREG(0x0400) #define EXYNOS5440_SWRESET S5P_PMUREG(0x00C4) @@ -127,6 +129,7 @@ #define S5P_PAD_RET_EBIB_OPTION S5P_PMUREG(0x31A8) #define S5P_CORE_LOCAL_PWR_EN 0x3 +#define S5P_CORE_WAKEUP_FROM_LOCAL_CFG (0x3 << 8) #define S5P_INT_LOCAL_PWR_EN 0x7 #define S5P_CHECK_SLEEP 0x00000BAD