From patchwork Wed Nov 9 12:15:54 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Dubey X-Patchwork-Id: 9419101 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 6EE856022E for ; Wed, 9 Nov 2016 12:15:08 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6034A29261 for ; Wed, 9 Nov 2016 12:15:08 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 52F8D29264; Wed, 9 Nov 2016 12:15:08 +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=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id D7FEC29261 for ; Wed, 9 Nov 2016 12:15:07 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.85_2 #1 (Red Hat Linux)) id 1c4RlB-000403-7G; Wed, 09 Nov 2016 12:13:45 +0000 Received: from mailout1.samsung.com ([203.254.224.24]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c4Rks-0003lM-Ov for linux-arm-kernel@lists.infradead.org; Wed, 09 Nov 2016 12:13:28 +0000 Received: from epcpsbgm1new.samsung.com (epcpsbgm1 [203.254.230.26]) by mailout1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0OGD01BR9J9NVA70@mailout1.samsung.com> for linux-arm-kernel@lists.infradead.org; Wed, 09 Nov 2016 21:13:08 +0900 (KST) X-AuditID: cbfee61a-f79916d0000062de-75-582312d42ff6 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1new.samsung.com (EPCPMTA) with SMTP id 96.10.25310.4D213285; Wed, 9 Nov 2016 21:13:08 +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 <0OGD0016JJ9DAO40@mmp2.samsung.com>; Wed, 09 Nov 2016 21:13:08 +0900 (KST) From: Pankaj Dubey To: linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH v3 1/2] ARM: EXYNOS: Remove static mapping of SCU SFR Date: Wed, 09 Nov 2016 17:45:54 +0530 Message-id: <1478693755-11953-2-git-send-email-pankaj.dubey@samsung.com> X-Mailer: git-send-email 2.7.4 In-reply-to: <1478693755-11953-1-git-send-email-pankaj.dubey@samsung.com> References: <1478693755-11953-1-git-send-email-pankaj.dubey@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrALMWRmVeSWpSXmKPExsVy+t9jQd0rQsoRBhsWSFj0P37NbHH+/AZ2 i02Pr7FazDi/j8li0dYv7BYdyxgd2Dw2repk89i8pN6jb8sqRo/Pm+QCWKLcbDJSE1NSixRS 85LzUzLz0m2VQkPcdC2UFPISc1NtlSJ0fUOClBTKEnNKgTwjAzTg4BzgHqykb5fglvH00iW2 gvnGFffeT2ZsYNys1cXIySEhYCJxfNIjNghbTOLCvfVANheHkMAsRonlzxayQzg/GSUaeh+A VbEJ6Eo8eT+XGcQWEfCWmHzmLzuIzSyQLjH/0xWwGmEBV4m3W2+B1bAIqEqs3D6DFcTmFfCQ 6Hr5mxVim5zEzXOdQDUcHJwCnhJ3pkaAhIWASr6e/8k6gZF3ASPDKkaJ1ILkguKk9FzDvNRy veLE3OLSvHS95PzcTYzg0H0mtYPx4C73Q4wCHIxKPLwZvMoRQqyJZcWVuYcYJTiYlUR4PwgC hXhTEiurUovy44tKc1KLDzGaAt01kVlKNDkfGFd5JfGGJuYm5sYGFuaWliZGSuK8jbOfhQsJ pCeWpGanphakFsH0MXFwSjUwWiXZn6zqVDyeax553PSpIHvADBnZZnG2pO/LL3476X9RY/mB R+a81+ZH3p7mPUe2POBejcTjVMHwpCu38huqubKOhhm0/TtYcIfF0qlT/+i37ZKHItemnm38 9fThamUPh3eBO3OMPihssdrjILAulLXbxZQjMNDrjLKwoaWGYd/896dYttxUYinOSDTUYi4q TgQAfuojB3MCAAA= X-MTR: 20000000000000000@CPGS X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161109_041327_075479_6B4D5046 X-CRM114-Status: GOOD ( 19.07 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Pankaj Dubey , kgene@kernel.org, thomas.ab@samsung.com, krzk@kernel.org 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 Lets remove static mapping of SCU SFR mainly used in CORTEX-A9 SoC based boards. Instead use mapping from device tree node of SCU. NOTE: This patch has dependency on DT file of any such CORTEX-A9 SoC based boards, in the absence of SCU device node in DTS file, only single CPU will boot. So if you are using OUT-OF-TREE DTS file of CORTEX-A9 based Exynos SoC make sure to add SCU device node to DTS file for SMP boot. Signed-off-by: Pankaj Dubey Reviewed-by: Alim Akhtar --- arch/arm/mach-exynos/common.h | 1 + arch/arm/mach-exynos/exynos.c | 22 ------------------ arch/arm/mach-exynos/include/mach/map.h | 2 -- arch/arm/mach-exynos/platsmp.c | 34 +++++++++++++++++++++------- arch/arm/mach-exynos/pm.c | 4 +--- arch/arm/mach-exynos/suspend.c | 4 +--- arch/arm/plat-samsung/include/plat/map-s5p.h | 4 ---- 7 files changed, 29 insertions(+), 42 deletions(-) diff --git a/arch/arm/mach-exynos/common.h b/arch/arm/mach-exynos/common.h index 9424a8a..dd5d8e8 100644 --- a/arch/arm/mach-exynos/common.h +++ b/arch/arm/mach-exynos/common.h @@ -161,6 +161,7 @@ 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/exynos.c b/arch/arm/mach-exynos/exynos.c index 757fc11..fa08ef9 100644 --- a/arch/arm/mach-exynos/exynos.c +++ b/arch/arm/mach-exynos/exynos.c @@ -28,15 +28,6 @@ #include "common.h" -static struct map_desc exynos4_iodesc[] __initdata = { - { - .virtual = (unsigned long)S5P_VA_COREPERI_BASE, - .pfn = __phys_to_pfn(EXYNOS4_PA_COREPERI), - .length = SZ_8K, - .type = MT_DEVICE, - }, -}; - static struct platform_device exynos_cpuidle = { .name = "exynos_cpuidle", #ifdef CONFIG_ARM_EXYNOS_CPUIDLE @@ -99,17 +90,6 @@ static int __init exynos_fdt_map_chipid(unsigned long node, const char *uname, return 1; } -/* - * exynos_map_io - * - * register the standard cpu IO areas - */ -static void __init exynos_map_io(void) -{ - if (soc_is_exynos4()) - iotable_init(exynos4_iodesc, ARRAY_SIZE(exynos4_iodesc)); -} - static void __init exynos_init_io(void) { debug_ll_io_init(); @@ -118,8 +98,6 @@ static void __init exynos_init_io(void) /* detect cpu id and rev. */ s5p_init_cpu(S5P_VA_CHIPID); - - exynos_map_io(); } /* diff --git a/arch/arm/mach-exynos/include/mach/map.h b/arch/arm/mach-exynos/include/mach/map.h index 5fb0040..0eef407 100644 --- a/arch/arm/mach-exynos/include/mach/map.h +++ b/arch/arm/mach-exynos/include/mach/map.h @@ -18,6 +18,4 @@ #define EXYNOS_PA_CHIPID 0x10000000 -#define EXYNOS4_PA_COREPERI 0x10500000 - #endif /* __ASM_ARCH_MAP_H */ diff --git a/arch/arm/mach-exynos/platsmp.c b/arch/arm/mach-exynos/platsmp.c index a5d6841..94405c7 100644 --- a/arch/arm/mach-exynos/platsmp.c +++ b/arch/arm/mach-exynos/platsmp.c @@ -168,6 +168,27 @@ 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) @@ -224,11 +245,6 @@ static void write_pen_release(int val) sync_cache_w(&pen_release); } -static void __iomem *scu_base_addr(void) -{ - return (void __iomem *)(S5P_VA_SCU); -} - static DEFINE_SPINLOCK(boot_lock); static void exynos_secondary_init(unsigned int cpu) @@ -393,9 +409,11 @@ 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) - scu_enable(scu_base_addr()); - + if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9) { + /* if exynos_scu_enable fails, return */ + if (exynos_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 487295f..c0b46c3 100644 --- a/arch/arm/mach-exynos/pm.c +++ b/arch/arm/mach-exynos/pm.c @@ -26,8 +26,6 @@ #include #include -#include - #include "common.h" static inline void __iomem *exynos_boot_vector_addr(void) @@ -177,7 +175,7 @@ void exynos_enter_aftr(void) cpu_suspend(0, exynos_aftr_finisher); if (read_cpuid_part() == ARM_CPU_PART_CORTEX_A9) { - scu_enable(S5P_VA_SCU); + exynos_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 06332f6..73df9f3 100644 --- a/arch/arm/mach-exynos/suspend.c +++ b/arch/arm/mach-exynos/suspend.c @@ -34,8 +34,6 @@ #include #include -#include - #include #include "common.h" @@ -462,7 +460,7 @@ static void exynos_pm_resume(void) exynos_pm_release_retention(); if (cpuid == ARM_CPU_PART_CORTEX_A9) - scu_enable(S5P_VA_SCU); + exynos_scu_enable(); if (call_firmware_op(resume) == -ENOSYS && cpuid == ARM_CPU_PART_CORTEX_A9) diff --git a/arch/arm/plat-samsung/include/plat/map-s5p.h b/arch/arm/plat-samsung/include/plat/map-s5p.h index 0fe2828..512ed1f 100644 --- a/arch/arm/plat-samsung/include/plat/map-s5p.h +++ b/arch/arm/plat-samsung/include/plat/map-s5p.h @@ -15,10 +15,6 @@ #define S5P_VA_CHIPID S3C_ADDR(0x02000000) -#define S5P_VA_COREPERI_BASE S3C_ADDR(0x02800000) -#define S5P_VA_COREPERI(x) (S5P_VA_COREPERI_BASE + (x)) -#define S5P_VA_SCU S5P_VA_COREPERI(0x0) - #define VA_VIC(x) (S3C_VA_IRQ + ((x) * 0x10000)) #define VA_VIC0 VA_VIC(0) #define VA_VIC1 VA_VIC(1)