Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S938259AbcKNFAC (ORCPT ); Mon, 14 Nov 2016 00:00:02 -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 S936135AbcKNE7v (ORCPT ); Sun, 13 Nov 2016 23:59:51 -0500 X-AuditID: cbfee61a-f79916d0000062de-9f-582944b9f038 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 , Shawn Guo , Sascha Hauer Subject: [PATCH 12/16] ARM: imx: use generic API for enabling SCU Date: Mon, 14 Nov 2016 10:32:07 +0530 Message-id: <1479099731-28108-13-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+NgFlrEIsWRmVeSWpSXmKPExsVy+t9jQd2dLpoRBiev21j8nXSM3WLu7EmM Fs1bvzJarJq6k8Xi/PkN7BabHl9jtbi8aw6bxYPVb9ksFm39wm5xqX8ik8WLLeIW87+dZLXo WMZosfnBMTYHPo/L1y4ye/z+NYnRY+JZXY+ds+6ye2xa1cnmsXlJvUf/XwOPvi2rGD3m/PzG 4vF5k1wAV5SbTUZqYkpqkUJqXnJ+SmZeuq1SaIibroWSQl5ibqqtUoSub0iQkkJZYk4pkGdk gAYcnAPcg5X07RLcMrYuFiy4JF+xfoZgA+NiqS5GTg4JAROJ03O7mCFsMYkL99azdTFycQgJ zGKU+P1uDxOE85NR4v73v+wgVWwCuhJP3s8F6xARcJO40djBBGIzCxxhkvh6wRDEFhZwlNj3 /RJYPYuAqsS3rd9YQGxeAU+J5/NmsEJsk5O4ea4TbA4nUHxO5xk2EFtIwEPi+Y3rjBMYeRcw MqxilEgtSC4oTkrPNcxLLdcrTswtLs1L10vOz93ECI6fZ1I7GA/ucj/EKMDBqMTDe8BMM0KI NbGsuDL3EKMEB7OSCK+rDVCINyWxsiq1KD++qDQntfgQoynQYROZpUST84GxnVcSb2hibmJu bGBhbmlpYqQkzts4+1m4kEB6YklqdmpqQWoRTB8TB6dUAyODzL07jJ23dmTXh11o0S/aJyTN 9Zct4iRHzVODfZO1n88qU6vvXq6Yt+50P+/XlzwT1urUXRY71LVriSrn+r5W3aYqtZ/RuexO 9Xm3ujTfGz/T33E9YdXs6z636y00ao5qTo1TXuK4b9KKvVu9Vnf4fUrT2C8x/6nUimN7cj8d vZWbsrZ583wlluKMREMt5qLiRAA253PmtQIAAA== X-MTR: 20000000000000000@CPGS Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 3910 Lines: 138 Now as we have of_scu_enable which takes care of mapping scu base from DT, lets use it. At the same time this patch cleans up mach-imx platform files by removing static mapping of SCU and dropping imx_scu_map_io function. CC: Shawn Guo CC: Sascha Hauer Signed-off-by: Pankaj Dubey --- arch/arm/mach-imx/common.h | 5 ----- arch/arm/mach-imx/mach-imx6q.c | 8 +------- arch/arm/mach-imx/platsmp.c | 32 +++++--------------------------- arch/arm/mach-imx/pm-imx6.c | 3 ++- 4 files changed, 8 insertions(+), 40 deletions(-) diff --git a/arch/arm/mach-imx/common.h b/arch/arm/mach-imx/common.h index c4436d9..9787d5f 100644 --- a/arch/arm/mach-imx/common.h +++ b/arch/arm/mach-imx/common.h @@ -87,11 +87,6 @@ u32 imx_get_cpu_arg(int cpu); void imx_set_cpu_arg(int cpu, u32 arg); #ifdef CONFIG_SMP void v7_secondary_startup(void); -void imx_scu_map_io(void); -void imx_smp_prepare(void); -#else -static inline void imx_scu_map_io(void) {} -static inline void imx_smp_prepare(void) {} #endif void imx_src_init(void); void imx_gpc_pre_suspend(bool arm_power_off); diff --git a/arch/arm/mach-imx/mach-imx6q.c b/arch/arm/mach-imx/mach-imx6q.c index 45801b2..1c6cc9f 100644 --- a/arch/arm/mach-imx/mach-imx6q.c +++ b/arch/arm/mach-imx/mach-imx6q.c @@ -383,12 +383,6 @@ static void __init imx6q_init_late(void) } } -static void __init imx6q_map_io(void) -{ - debug_ll_io_init(); - imx_scu_map_io(); -} - static void __init imx6q_init_irq(void) { imx_gpc_check_dt(); @@ -410,7 +404,7 @@ DT_MACHINE_START(IMX6Q, "Freescale i.MX6 Quad/DualLite (Device Tree)") .l2c_aux_val = 0, .l2c_aux_mask = ~0, .smp = smp_ops(imx_smp_ops), - .map_io = imx6q_map_io, + .map_io = debug_ll_io_init, .init_irq = imx6q_init_irq, .init_machine = imx6q_init_machine, .init_late = imx6q_init_late, diff --git a/arch/arm/mach-imx/platsmp.c b/arch/arm/mach-imx/platsmp.c index 711dbbd..c032369 100644 --- a/arch/arm/mach-imx/platsmp.c +++ b/arch/arm/mach-imx/platsmp.c @@ -26,26 +26,6 @@ u32 g_diag_reg; static void __iomem *scu_base; -static struct map_desc scu_io_desc __initdata = { - /* .virtual and .pfn are run-time assigned */ - .length = SZ_4K, - .type = MT_DEVICE, -}; - -void __init imx_scu_map_io(void) -{ - unsigned long base; - - /* Get SCU base */ - asm("mrc p15, 4, %0, c15, c0, 0" : "=r" (base)); - - scu_io_desc.virtual = IMX_IO_P2V(base); - scu_io_desc.pfn = __phys_to_pfn(base); - iotable_init(&scu_io_desc, 1); - - scu_base = IMX_IO_ADDRESS(base); -} - static int imx_boot_secondary(unsigned int cpu, struct task_struct *idle) { imx_set_cpu_jump(cpu, v7_secondary_startup); @@ -61,20 +41,18 @@ static void __init imx_smp_init_cpus(void) { int i, ncores; - ncores = scu_get_core_count(scu_base); + if (!IS_ERR(scu_base)) + ncores = scu_get_core_count(scu_base); for (i = ncores; i < NR_CPUS; i++) set_cpu_possible(i, false); } -void imx_smp_prepare(void) -{ - scu_enable(scu_base); -} - static void __init imx_smp_prepare_cpus(unsigned int max_cpus) { - imx_smp_prepare(); + scu_base = of_scu_get_base(); + if (!IS_ERR(scu_base)) + scu_enable(scu_base); /* * The diagnostic register holds the errata bits. Mostly bootloader diff --git a/arch/arm/mach-imx/pm-imx6.c b/arch/arm/mach-imx/pm-imx6.c index 1515e49..859aacb 100644 --- a/arch/arm/mach-imx/pm-imx6.c +++ b/arch/arm/mach-imx/pm-imx6.c @@ -26,6 +26,7 @@ #include #include #include +#include #include #include "common.h" @@ -393,7 +394,7 @@ static int imx6q_pm_enter(suspend_state_t state) /* Zzz ... */ cpu_suspend(0, imx6q_suspend_finish); if (cpu_is_imx6q() || cpu_is_imx6dl()) - imx_smp_prepare(); + of_scu_enable(); imx_anatop_post_resume(); imx_gpc_post_resume(); imx6_enable_rbc(false); -- 2.7.4