From patchwork Wed Sep 24 12:30:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Krzysztof Kozlowski X-Patchwork-Id: 4965071 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 C3845BEEA5 for ; Wed, 24 Sep 2014 12:33:41 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1A0C720259 for ; Wed, 24 Sep 2014 12:33:37 +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 A8A9B20265 for ; Wed, 24 Sep 2014 12:33:35 +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 1XWljG-0001IZ-Hf; Wed, 24 Sep 2014 12:31:30 +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 1XWljA-00016O-Ap for linux-arm-kernel@lists.infradead.org; Wed, 24 Sep 2014 12:31:28 +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 <0NCE00K7WO8FLF90@mailout3.w1.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 24 Sep 2014 13:33:51 +0100 (BST) X-AuditID: cbfec7f5-b7f776d000003e54-e1-5422b9830de5 Received: from eusync3.samsung.com ( [203.254.199.213]) by eucpsbgm2.samsung.com (EUCPMTA) with SMTP id 8E.2F.15956.389B2245; Wed, 24 Sep 2014 13:30:59 +0100 (BST) Received: from AMDC1943.digital.local ([106.116.151.171]) by eusync3.samsung.com (Oracle Communications Messaging Server 7u4-23.01(7.0.4.23.0) 64bit (built Aug 10 2011)) with ESMTPA id <0NCE0032AO3KUE20@eusync3.samsung.com>; Wed, 24 Sep 2014 13:30:59 +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 v3] ARM: EXYNOS: SWRESET is needed to boot secondary CPU on Exynos3250 Date: Wed, 24 Sep 2014 14:30:51 +0200 Message-id: <1411561851-13764-1-git-send-email-k.kozlowski@samsung.com> X-Mailer: git-send-email 1.9.1 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrNJMWRmVeSWpSXmKPExsVy+t/xq7rNO5VCDJ6t1LfYOGM9q8XrF4YW vQuuslmcbXrDbrHp8TVWi8u75rBZzDi/j8ni9mVei7VH7rJbrNr1h9GBy6OluYfNY+esu+we m5fUe/RtWcXo8XmTXABrFJdNSmpOZllqkb5dAlfGw3k7WAqOiVe8+HCRvYFxg3AXIyeHhICJ xI9X25kgbDGJC/fWs3UxcnEICSxllDjRMZ0Zwuljkni54AA7SBWbgLHE5uVLwKpEBHYwSiy/ d5kdxGEWeMMo0btnIgtIlbBAhMSS9rOMXYwcHCwCqhKPlzmChHkF3CWerLvGBrFOTuLkscms Exi5FzAyrGIUTS1NLihOSs810itOzC0uzUvXS87P3cQICaCvOxiXHrM6xCjAwajEwztRXClE iDWxrLgy9xCjBAezkggvDzD8hHhTEiurUovy44tKc1KLDzEycXBKNTCKSvsVFjBN/31hS6uE bLy0q9nv+SxHNyiu+MK16tCNU48kK9t+XRc+2XbCzer1AcE+hlqFrelGPV8iPWJ4yhZ9OvNG ZPm/a6UzzH7+FP6/jnn5t5aeSfpHo/rXXc0vD3Tbw3f25aajLGoG/b/79SYdefu0U0bvGw93 Hpecp1XtJX52xnsLA74rsRRnJBpqMRcVJwIA+1CuhP4BAAA= X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140924_053124_510374_B05A7705 X-CRM114-Status: GOOD ( 12.47 ) X-Spam-Score: -5.7 (-----) Cc: Krzysztof Kozlowski , Kyungmin Park , Bartlomiej Zolnierkiewicz , Tomasz Figa , Marek Szyprowski 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=-2.6 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_NONE, 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 v2: 1. Rebase on Kukjin's for-next tree from 24th of September (v3.17-rc3-97-gbcf20e084a4b) 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 | 2 ++ 2 files changed, 25 insertions(+) diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c index 41ae28d69e6f..8543064dc445 100644 --- a/arch/arm/mach-exynos/platsmp.c +++ b/arch/arm/mach-exynos/platsmp.c @@ -121,6 +121,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 = 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)); + + pr_info("CPU%u: Software reset\n", core_id); + pmu_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. @@ -196,6 +216,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 30c03017aa6a..4ea5e320c6d1 100644 --- a/arch/arm/mach-exynos/regs-pmu.h +++ b/arch/arm/mach-exynos/regs-pmu.h @@ -21,6 +21,7 @@ #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_WAKEUP_FROM_LOWPWR (1 << 28) #define EXYNOS_SWRESET 0x0400 #define EXYNOS5440_SWRESET 0x00C4 @@ -125,6 +126,7 @@ #define S5P_PAD_RET_EBIB_OPTION 0x31A8 #define S5P_CORE_LOCAL_PWR_EN 0x3 +#define S5P_CORE_WAKEUP_FROM_LOCAL_CFG (0x3 << 8) /* Only for EXYNOS4210 */ #define S5P_CMU_CLKSTOP_LCD1_LOWPWR 0x1154