From patchwork Mon Nov 14 05:01:57 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Dubey X-Patchwork-Id: 9426471 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 7AE7B60756 for ; Mon, 14 Nov 2016 05:03:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6B639288F7 for ; Mon, 14 Nov 2016 05:03:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 50EF5288B4; Mon, 14 Nov 2016 05:03:32 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CAC4A288FA for ; Mon, 14 Nov 2016 05:03:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934981AbcKNE7b (ORCPT ); Sun, 13 Nov 2016 23:59:31 -0500 Received: from mailout2.samsung.com ([203.254.224.25]:51703 "EHLO mailout2.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932388AbcKNE72 (ORCPT ); Sun, 13 Nov 2016 23:59:28 -0500 Received: from epcpsbgm1new.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout2.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OGM00LQ78IMQU50@mailout2.samsung.com>; Mon, 14 Nov 2016 13:59:16 +0900 (KST) X-AuditID: cbfee61a-f79916d0000062de-7d-582944a4a386 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1new.samsung.com (EPCPMTA) with SMTP id 19.23.25310.4A449285; Mon, 14 Nov 2016 13:59:16 +0900 (KST) Received: from pankaj.sisodomain.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 <0OGM009SR8IFBJ70@mmp2.samsung.com>; Mon, 14 Nov 2016 13:59:16 +0900 (KST) From: Pankaj Dubey To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Cc: rmk+kernel@armlinux.org.uk, arnd@arndb.de, horms@verge.net.au, magnus.damm@gmail.com, geert+renesas@glider.be, vireshk@kernel.org, shiraz.linux.kernel@gmail.com, krzk@kernel.org, thomas.ab@samsung.com, Pankaj Dubey , linux-samsung-soc@vger.kernel.org Subject: [PATCH 02/16] ARM: EXYNOS: use generic API to enable SCU Date: Mon, 14 Nov 2016 10:31:57 +0530 Message-id: <1479099731-28108-3-git-send-email-pankaj.dubey@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1479099731-28108-1-git-send-email-pankaj.dubey@samsung.com> References: <1479099731-28108-1-git-send-email-pankaj.dubey@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprDIsWRmVeSWpSXmKPExsVy+t9jQd0lLpoRBkeWqlv8nXSM3WLu7EmM Fs1bvzJanD+/gd1i0+NrrBaXd81hs5hxfh+TxYPVb9ksFm39wm5xqX8ik8X8bydZLTqWMVps fnCMzYHX4/K1i8wev39NYvSYeFbXY+esu+wem1Z1snlsXlLv0bdlFaPHnJ/fWDw+b5IL4Ixy s8lITUxJLVJIzUvOT8nMS7dVCg1x07VQUshLzE21VYrQ9Q0JUlIoS8wpBfKMDNCAg3OAe7CS vl2CW8avD4+YCn4qVsye8JaxgXGbTBcjJ4eEgInE4113mCFsMYkL99azdTFycQgJzGKU2LV8 LwuE85NRYsmvNYwgVWwCuhJP3s8F6xARcJO40djBBGIzC8xjklj5mBPEFhZwBIpPYQexWQRU JZ40XgCr5xXwkJj99Sk7xDY5iZvnOsHinAKeEnM6z7CB2EJANc9vXGecwMi7gJFhFaNEakFy QXFSeq5hXmq5XnFibnFpXrpecn7uJkZwzDyT2sF4cJf7IUYBDkYlHt4DZpoRQqyJZcWVuYcY JTiYlUR4XW2AQrwpiZVVqUX58UWlOanFhxhNgQ6byCwlmpwPjOe8knhDE3MTc2MDC3NLSxMj JXHextnPwoUE0hNLUrNTUwtSi2D6mDg4pRoYi6yPPTmVn595bOHf2Yp7U2UlvJJnip3j43M5 33nF0KpG9FxCkW1GX7Vo74eJ+u/cNuSf5nOozPLN2sUXnl32Zrr7P32nCVWNy029DNxddz// wbGo7aFvdC8Pi5SUyWe514civx/O9vqVJmh3bwnHta+vDFTnvpxsKC2qFLnXIe6zoOuGhe+V WIozEg21mIuKEwHalsqNrwIAAA== X-MTR: 20000000000000000@CPGS Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Now as we have of_scu_enable which takes care of mapping scu base from DT, lets use it. This patch also fixes build failure in case !SMP caused by commit SHA ID: 94210b1abb2 which is already merged in krzk/for-next branch CC: Krzysztof Kozlowski CC: linux-samsung-soc@vger.kernel.org Signed-off-by: Pankaj Dubey Reviewed-by: Krzysztof Kozlowski --- arch/arm/mach-exynos/common.h | 1 - arch/arm/mach-exynos/platsmp.c | 30 ++++-------------------------- arch/arm/mach-exynos/pm.c | 4 ++-- arch/arm/mach-exynos/suspend.c | 14 ++++---------- 4 files changed, 10 insertions(+), 39 deletions(-) diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h index fb12d11..d19064b 100644 --- a/arch/arm/mach-exynos/common.h +++ b/arch/arm/mach-exynos/common.h @@ -156,7 +156,6 @@ extern void exynos_cpu_restore_register(void); extern void exynos_pm_central_suspend(void); extern int exynos_pm_central_resume(void); extern void exynos_enter_aftr(void); -extern int exynos_scu_enable(void); extern struct cpuidle_exynos_data cpuidle_coupled_exynos_data; diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c index 94405c7..2e5ecc1 100644 --- a/arch/arm/mach-exynos/platsmp.c +++ b/arch/arm/mach-exynos/platsmp.c @@ -168,27 +168,6 @@ int exynos_cluster_power_state(int cluster) S5P_CORE_LOCAL_PWR_EN); } -/** - * exynos_scu_enable : enables SCU for Cortex-A9 based system - * returns 0 on success else non-zero error code - */ -int exynos_scu_enable(void) -{ - struct device_node *np; - void __iomem *scu_base; - - np = of_find_compatible_node(NULL, NULL, "arm,cortex-a9-scu"); - scu_base = of_iomap(np, 0); - of_node_put(np); - if (!scu_base) { - pr_err("%s failed to map scu_base\n", __func__); - return -ENOMEM; - } - scu_enable(scu_base); - iounmap(scu_base); - return 0; -} - static void __iomem *cpu_boot_reg_base(void) { if (soc_is_exynos4210() && samsung_rev() == EXYNOS4210_REV_1_1) @@ -409,11 +388,10 @@ static void __init exynos_smp_prepare_cpus(unsigned int max_cpus) exynos_set_delayed_reset_assertion(true); - if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9) { - /* if exynos_scu_enable fails, return */ - if (exynos_scu_enable()) - return; - } + /* if of_scu_enable fails, return */ + if (scu_a9_has_base() && of_scu_enable()) + return; + /* * Write the address of secondary startup into the * system-wide flags register. The boot monitor waits diff --git a/arch/arm/mach-exynos/pm.c b/arch/arm/mach-exynos/pm.c index c0b46c3..9678438 100644 --- a/arch/arm/mach-exynos/pm.c +++ b/arch/arm/mach-exynos/pm.c @@ -174,8 +174,8 @@ void exynos_enter_aftr(void) cpu_suspend(0, exynos_aftr_finisher); - if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9) { - exynos_scu_enable(); + if (scu_a9_has_base()) { + of_scu_enable(); if (call_firmware_op(resume) == -ENOSYS) exynos_cpu_restore_register(); } diff --git a/arch/arm/mach-exynos/suspend.c b/arch/arm/mach-exynos/suspend.c index 73df9f3..5414282 100644 --- a/arch/arm/mach-exynos/suspend.c +++ b/arch/arm/mach-exynos/suspend.c @@ -451,19 +451,16 @@ static void exynos_pm_release_retention(void) static void exynos_pm_resume(void) { - u32 cpuid = read_cpuid_part(); - if (exynos_pm_central_resume()) goto early_wakeup; /* For release retention */ exynos_pm_release_retention(); - if (cpuid == ARM_CPU_PART_CORTEX_A9) - exynos_scu_enable(); + if (scu_a9_has_base()) + of_scu_enable(); - if (call_firmware_op(resume) == -ENOSYS - && cpuid == ARM_CPU_PART_CORTEX_A9) + if (call_firmware_op(resume) == -ENOSYS && scu_a9_has_base()) exynos_cpu_restore_register(); early_wakeup: @@ -475,8 +472,6 @@ static void exynos_pm_resume(void) static void exynos3250_pm_resume(void) { - u32 cpuid = read_cpuid_part(); - if (exynos_pm_central_resume()) goto early_wakeup; @@ -485,8 +480,7 @@ static void exynos3250_pm_resume(void) pmu_raw_writel(S5P_USE_STANDBY_WFI_ALL, S5P_CENTRAL_SEQ_OPTION); - if (call_firmware_op(resume) == -ENOSYS - && cpuid == ARM_CPU_PART_CORTEX_A9) + if (call_firmware_op(resume) == -ENOSYS && scu_a9_has_base()) exynos_cpu_restore_register(); early_wakeup: