From patchwork Mon Mar 11 10:57:02 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Amit Kachhap X-Patchwork-Id: 2247911 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork2.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork2.kernel.org (Postfix) with ESMTP id 3C2F3DF5B1 for ; Mon, 11 Mar 2013 11:00:40 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1UF0QH-000207-3t; Mon, 11 Mar 2013 10:57:41 +0000 Received: from mail-ie0-x22e.google.com ([2607:f8b0:4001:c03::22e]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1UF0Q3-0001xk-M4 for linux-arm-kernel@lists.infradead.org; Mon, 11 Mar 2013 10:57:28 +0000 Received: by mail-ie0-f174.google.com with SMTP id k10so4483369iea.5 for ; Mon, 11 Mar 2013 03:57:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:sender:from:to:cc:subject:date:message-id:x-mailer :in-reply-to:references; bh=HFODNEZ+PmrZDw2GlKyqwL+HGiSymdMb3mgy6u2I+po=; b=L0bEuIMlnpcfUoHBR8XNgm5WiSzLe5inYiCYDC1gQxhcun6iPtZLgR14VaDH3SIBcg Tkty/dA/NnxqNOYUb8R8kOet92SE68e3sEiQmkYC92JyOUsi5lrt5noAuojOVTKHBXkA qKuCj2bva/9YEqe0EbjiflYlYjQLNoJcntVH6aBBI/pFbWCNLhsnx87ltd1A0VYyBvbq iQmV3vGFD+LBMIVBKD8CmUeiw95b/TeYQOnLVwPnj2/QY9QC2uEhxCilNXkIlNeo/Zvb 0HIbSZsmxRUU2bNjbxUkfwglA6N0GSvOk08VvGkQ2cukq4dyMldw+Lxwgb733HIk75mb UIZw== X-Received: by 10.50.41.167 with SMTP id g7mr6934708igl.47.1362999446662; Mon, 11 Mar 2013 03:57:26 -0700 (PDT) Received: from localhost.localdomain ([115.113.119.130]) by mx.google.com with ESMTPS id wn10sm12540035igb.2.2013.03.11.03.57.23 (version=TLSv1 cipher=RC4-SHA bits=128/128); Mon, 11 Mar 2013 03:57:25 -0700 (PDT) From: Amit Daniel Kachhap To: linux-samsung-soc@vger.kernel.org, Kukjin Kim Subject: [PATCH 2/2] ARM: EXYNOS: Support CPU hotplug for exynos5440 Date: Mon, 11 Mar 2013 16:27:02 +0530 Message-Id: <1362999422-24655-2-git-send-email-amit.daniel@samsung.com> X-Mailer: git-send-email 1.7.1 In-Reply-To: <1362999422-24655-1-git-send-email-amit.daniel@samsung.com> References: <1362999422-24655-1-git-send-email-amit.daniel@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130311_065727_783621_6C73F934 X-CRM114-Status: GOOD ( 16.71 ) X-Spam-Score: -1.9 (-) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-1.9 points) pts rule name description ---- ---------------------- -------------------------------------------------- 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (amitdanielk[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Kukjin Kim , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.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 This patch adds support for CPU hotlpug for the 3 secondary cores of the exynos5440 SOC. The command to hotplug out/in is, echo 0 > /sys/devices/system/cpu/cpu[1-3]/online echo 1 > /sys/devices/system/cpu/cpu[1-3]/online Cc: Kukjin Kim Signed-off-by: Amit Daniel Kachhap --- arch/arm/mach-exynos/hotplug.c | 14 +++++++++++--- arch/arm/mach-exynos/platsmp.c | 26 +++++++++++++++++++++++++- 2 files changed, 36 insertions(+), 4 deletions(-) diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c index c3f825b..fbee967 100644 --- a/arch/arm/mach-exynos/hotplug.c +++ b/arch/arm/mach-exynos/hotplug.c @@ -93,11 +93,19 @@ static inline void cpu_leave_lowpower(void) static inline void platform_do_lowpower(unsigned int cpu, int *spurious) { + unsigned int val; for (;;) { - /* make cpu1 to be turned off at next WFI command */ - if (cpu == 1) - __raw_writel(0, S5P_ARM_CORE1_CONFIGURATION); + /* make cpu to be turned off at next WFI command */ + if (soc_is_exynos5440()) { + void __iomem *pmu_ctrl2_reg = S5P_VA_CHIPID + 0xc4; + val = __raw_readl(pmu_ctrl2_reg); + val |= (1 << (cpu + 8)); + __raw_writel(val, pmu_ctrl2_reg); + } else { + if (cpu == 1) + __raw_writel(0, S5P_ARM_CORE1_CONFIGURATION); + } /* * here's the WFI diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c index 087b73f..8a5eb80 100644 --- a/arch/arm/mach-exynos/platsmp.c +++ b/arch/arm/mach-exynos/platsmp.c @@ -101,6 +101,7 @@ static int __cpuinit exynos_boot_secondary(unsigned int cpu, struct task_struct { unsigned long timeout; unsigned long phys_cpu = cpu_logical_map(cpu); + unsigned int val; /* * Set synchronisation state between this boot processor @@ -119,7 +120,30 @@ static int __cpuinit exynos_boot_secondary(unsigned int cpu, struct task_struct write_pen_release(phys_cpu); timeout = 10; - if (!soc_is_exynos5440()) { + if (soc_is_exynos5440()) { + void __iomem *pmu_status_reg = S5P_VA_CHIPID + 0xbc; + void __iomem *pmu_ctrl_reg = S5P_VA_CHIPID + 0xc0; + void __iomem *pmu_ctrl2_reg = S5P_VA_CHIPID + 0xc4; + + if (!(__raw_readl(pmu_status_reg) & (1 << cpu))) { + val = __raw_readl(pmu_ctrl_reg); + val |= (1 << cpu); + __raw_writel(val, pmu_ctrl_reg); + /* wait max 10 ms until cpu1 is on */ + while (!(__raw_readl(pmu_status_reg) & (1 << cpu))) { + if (timeout-- == 0) + break; + + mdelay(1); + } + } + /* clear the ctrl2 powerdown */ + val = __raw_readl(pmu_ctrl2_reg); + if (val & (1 << (cpu + 8))) { + val &= ~(1 << (cpu + 8)); + __raw_writel(val, pmu_ctrl2_reg); + } + } else { if (!(__raw_readl(S5P_ARM_CORE1_STATUS) & S5P_CORE_LOCAL_PWR_EN)) {