From patchwork Thu Mar 30 13:17:04 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Dubey X-Patchwork-Id: 9654179 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C3EA960349 for ; Thu, 30 Mar 2017 13:21:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B6DCA2094F for ; Thu, 30 Mar 2017 13:21:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ABAE028414; Thu, 30 Mar 2017 13:21:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 46AA3283B9 for ; Thu, 30 Mar 2017 13:21:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-reply-to:Message-id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=haI8V2Foe5ittSSYv2Ug430RF+DgqazUgC9l5RCa/tE=; b=OWaL2L9GAya5G/o7I3fS1ghey4 9MTZcfLouR+XDsj1x70mb3nwL1Io/lXWa5pUZLB4h/2c0N55+A5FEalZWlW+q05kp+3KFhHocm3q1 LD6MExFXvvYuliyVHP3KAdpzyubP2wF6kOOICyFMqehRzTBEBenL/z5PCsFRxzwR741BIozGkZwq9 m4jXGn2+UflPQVJ6g9aRSslNNzWBlmiTEQKMLgOWNSZ1LeDT8I+ln9ru0/qCf88aDVSHNOKfaXKBU h48rm7CRm5x+XDh+iVW+07FJzeaEHczwEmH+iFxfnbiJMeVYg+ruk8cYwGKDLr14xNdImaqRNGxp3 YdX1l6Yw==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1cta0f-0007w3-Gf; Thu, 30 Mar 2017 13:21:05 +0000 Received: from mailout4.samsung.com ([203.254.224.34]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1ctZuj-0000LE-M8 for linux-arm-kernel@lists.infradead.org; Thu, 30 Mar 2017 13:15:03 +0000 Received: from epcas1p3.samsung.com (unknown [182.195.41.47]) by mailout4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0ONM009CUQ4HF350@mailout4.samsung.com> for linux-arm-kernel@lists.infradead.org; Thu, 30 Mar 2017 22:14:41 +0900 (KST) Received: from epsmges1p2.samsung.com (unknown [182.195.42.54]) by epcas1p3.samsung.com (KnoxPortal) with ESMTP id 20170330131440epcas1p372e5d5d96f243374c2af36e8a6ea6e6d~wqyu8s_fc1120411204epcas1p3N; Thu, 30 Mar 2017 13:14:40 +0000 (GMT) Received: from epcas1p1.samsung.com ( [182.195.41.45]) by epsmges1p2.samsung.com (Symantec Messaging Gateway) with SMTP id 69.25.11213.0C40DD85; Thu, 30 Mar 2017 22:14:40 +0900 (KST) Received: from epcpsbgm1new.samsung.com (u26.gpu120.samsung.co.kr [203.254.230.26]) by epcas1p4.samsung.com (KnoxPortal) with ESMTP id 20170330131440epcas1p4f27192272761aa593b6cf083453e8adc~wqyuZCSbj0116101161epcas1p4C; Thu, 30 Mar 2017 13:14:40 +0000 (GMT) X-AuditID: b6c32a36-f79446d000002bcd-c4-58dd04c08279 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1new.samsung.com (EPCPMTA) with SMTP id 55.9B.05715.0C40DD85; Thu, 30 Mar 2017 22:14:40 +0900 (KST) Received: from pankaj.com ([107.108.83.125]) by mmp2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0ONM009R0Q3AAC60@mmp2.samsung.com>; Thu, 30 Mar 2017 22:14:40 +0900 (KST) From: Pankaj Dubey To: linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v9 10/12] ARM: EXYNOS: move power_{down, up} to per SoC struct exynos_cpu_info Date: Thu, 30 Mar 2017 18:47:04 +0530 Message-id: <1490879826-16754-11-git-send-email-pankaj.dubey@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1490879826-16754-1-git-send-email-pankaj.dubey@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrDIsWRmVeSWpSXmKPExsWy7bCmru4BlrsRBkc7rS1urTvHavF30jF2 i2dHtS3evF3DZNH/+DWzxfnzG9gtNj2+xmox4/w+JouXR34wWqw9cpfdYtHWL+wO3B6/f01i 9Lh1p95j56y77B6bVnWyeWxeUu+xpR/I69uyitHj8ya5AI4oLpuU1JzMstQifbsErozLbe1s BQdVKn4e7GRqYNwh18XIySEhYCKxYf0OdghbTOLCvfVsXYxcHEICOxglHpw+zQ7htDNJbHi7 nQWm493cF4wQiTmMEicuzGeGcN4xSnRc2MEEUsUmoCvx5P1cZhBbRMBbYvKZv2CjmAWuMUos 7F4BlODgEBaIl/h4mQ+khkVAVeJR03KwO3gFPCVuNO+D2iYncfNcJ9gcTqD4yUfTwO6TEFjG LrF0zU02kDkSArISmw4wQ9S7SJzc8ZkJwhaWeHV8C9Rv0hKr/t1igujtZpSYNf0qG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MwtLU2MlMR5G2c/CxcSSE8sSc1O TS1ILYLpY+LglGpgTAz7GvN7ye/+OfeMvhw3+eTx9V6Vya7rFnrrxNY/89S7cW5S27aTf2o9 T2kf6Niddlf3XkzZoUqfv0xSrT90FJ5dkN+0ePuDk4nX7LZfcby3w+nS0rOrT2/yXzcjOFXz ivya/5vdS/Iyy2f9fD63osx72bRd6xJzYw2kduSXKgauldoc+0EtqFGJpTgj0VCLuag4EQAc /SANoAIAAA== X-MTR: 20000000000000000@CPGS X-CMS-MailID: 20170330131440epcas1p4f27192272761aa593b6cf083453e8adc X-Msg-Generator: CA X-Sender-IP: 203.254.230.26 X-Local-Sender: =?UTF-8?B?7YyQ7Lm07KaIG1NTSVItVHVybiBLZXkgU29sdXRpb25zGw==?= =?UTF-8?B?7IK87ISx7KCE7J6QGy4vU2VuaW9yIENoaWVmIEVuZ2luZWVy?= X-Global-Sender: =?UTF-8?B?UEFOS0FKIEtVTUFSIERVQkVZG1NTSVItVHVybiBLZXkgU29s?= =?UTF-8?B?dXRpb25zG1NhbXN1bmcgRWxlY3Ryb25pY3MbLi9TZW5pb3IgQ2hpZWYgRW5n?= =?UTF-8?B?aW5lZXI=?= X-Sender-Code: =?UTF-8?B?QzEwG1NXQUhRG0MxMElEMDdJRDAxMDk5Nw==?= CMS-TYPE: 101P X-HopCount: 7 X-CMS-RootMailID: 20170330131440epcas1p4f27192272761aa593b6cf083453e8adc X-RootMTR: 20170330131440epcas1p4f27192272761aa593b6cf083453e8adc References: <1490879826-16754-1-git-send-email-pankaj.dubey@samsung.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20170330_061458_091008_2028B202 X-CRM114-Status: GOOD ( 15.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: arnd@arndb.de, javier@osg.samsung.com, Pankaj Dubey , krzk@kernel.org, m.reichl@fivetechno.de, a.hajda@samsung.com, kgene@kernel.org, cwchoi00@gmail.com, m.szyprowski@samsung.com MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP Various Exynos SoC handles CPU power_up and power_down operation differently. To handle this difference until now we were using soc_is_exynosMMM helper functions, in an attempt to remove the dependency of such helper functions specific to each SoC, let's move power_{down,up} functionality as a SoC specific function pointer hooks in struct exynos_cpu_info. Signed-off-by: Pankaj Dubey --- arch/arm/mach-exynos/platsmp.c | 61 +++++++++++++++++++++++++++++++----------- 1 file changed, 46 insertions(+), 15 deletions(-) diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c index ff369b9..6f08b15 100644 --- a/arch/arm/mach-exynos/platsmp.c +++ b/arch/arm/mach-exynos/platsmp.c @@ -37,9 +37,13 @@ extern void exynos4_secondary_startup(void); /* * struct exynos_cpu_info - Exynos CPU related info/operations * @cpu_boot_reg: computes cpu boot address for requested cpu + * @cpu_power_down: handles cpu power down routine for requested cpu + * @cpu_power_up: handles cpu power up routine for requested cpu */ struct exynos_cpu_info { void __iomem* (*cpu_boot_reg)(u32 cpu); + void (*cpu_power_down)(u32 cpu); + void (*cpu_power_up)(u32 cpu); }; static const struct exynos_cpu_info *cpu_info; @@ -92,19 +96,29 @@ static inline void platform_do_lowpower(unsigned int cpu, int *spurious) } #endif /* CONFIG_HOTPLUG_CPU */ -/** - * exynos_core_power_down : power down the specified cpu +/* + * exynos_core_power_down - power down the specified cpu * @cpu : the cpu to power down - * - * Power down the specified cpu. The sequence must be finished by a - * call to cpu_do_idle() - * + * The sequence must be finished by a call to cpu_do_idle() */ void exynos_cpu_power_down(int cpu) { + if (cpu_info && cpu_info->cpu_power_down) + cpu_info->cpu_power_down(cpu); +} + +static void exynos_common_cpu_power_down(u32 cpu) +{ u32 core_conf; - if (cpu == 0 && (soc_is_exynos5420() || soc_is_exynos5800())) { + 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)); +} + +static void exynos5420_cpu_power_down(u32 cpu) +{ + if (cpu == 0) { /* * Bypass power down for CPU0 during suspend. Check for * the SYS_PWR_REG value to decide if we are suspending @@ -116,24 +130,31 @@ void exynos_cpu_power_down(int cpu) return; } - 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)); + exynos_common_cpu_power_down(cpu); } -/** +/* * exynos_cpu_power_up : power up the specified cpu * @cpu : the cpu to power up - * - * Power up the specified cpu */ void exynos_cpu_power_up(int cpu) { + if (cpu_info && cpu_info->cpu_power_up) + cpu_info->cpu_power_up(cpu); +} + +static void exynos_common_cpu_power_up(u32 cpu) +{ u32 core_conf = S5P_CORE_LOCAL_PWR_EN; + pmu_raw_writel(core_conf, + EXYNOS_ARM_CORE_CONFIGURATION(cpu)); +} - if (soc_is_exynos3250()) - core_conf |= S5P_CORE_AUTOWAKEUP_EN; +static void exynos3250_cpu_power_up(u32 cpu) +{ + u32 core_conf = S5P_CORE_LOCAL_PWR_EN; + core_conf |= S5P_CORE_AUTOWAKEUP_EN; pmu_raw_writel(core_conf, EXYNOS_ARM_CORE_CONFIGURATION(cpu)); } @@ -339,22 +360,32 @@ int exynos_get_boot_addr(u32 core_id, unsigned long *boot_addr) static const struct exynos_cpu_info exynos3250_cpu_info = { .cpu_boot_reg = exynos_common_cpu_boot_reg, + .cpu_power_down = exynos_common_cpu_power_down, + .cpu_power_up = exynos3250_cpu_power_up, }; static const struct exynos_cpu_info exynos5420_cpu_info = { .cpu_boot_reg = exynos5420_cpu_boot_reg, + .cpu_power_down = exynos5420_cpu_power_down, + .cpu_power_up = exynos_common_cpu_power_up, }; static const struct exynos_cpu_info exynos4210_rev11_cpu_info = { .cpu_boot_reg = exynos4210_rev11_cpu_boot_reg, + .cpu_power_down = exynos_common_cpu_power_down, + .cpu_power_up = exynos_common_cpu_power_up, }; static const struct exynos_cpu_info exynos4412_cpu_info = { .cpu_boot_reg = exynos4412_cpu_boot_reg, + .cpu_power_down = exynos_common_cpu_power_down, + .cpu_power_up = exynos_common_cpu_power_up, }; static const struct exynos_cpu_info exynos_common_cpu_info = { .cpu_boot_reg = exynos_common_cpu_boot_reg, + .cpu_power_down = exynos_common_cpu_power_down, + .cpu_power_up = exynos_common_cpu_power_up, }; static const struct soc_device_attribute exynos_soc_revision[] = {