From patchwork Mon Nov 14 05:02:07 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pankaj Dubey X-Patchwork-Id: 9426483 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 0BC4760484 for ; Mon, 14 Nov 2016 05:05:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id EFE66288B4 for ; Mon, 14 Nov 2016 05:05:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E19B8288F7; Mon, 14 Nov 2016 05:05:02 +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 7C2D3288B4 for ; Mon, 14 Nov 2016 05:05:01 +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 1c69Q8-0000ww-8m; Mon, 14 Nov 2016 05:03:04 +0000 Received: from mailout2.samsung.com ([203.254.224.25]) by bombadil.infradead.org with esmtps (Exim 4.85_2 #1 (Red Hat Linux)) id 1c69Mx-0005v1-PN for linux-arm-kernel@lists.infradead.org; Mon, 14 Nov 2016 04:59:50 +0000 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> for linux-arm-kernel@lists.infradead.org; Mon, 14 Nov 2016 13:59:38 +0900 (KST) X-AuditID: cbfee61a-f79916d0000062de-9f-582944b9f038 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1new.samsung.com (EPCPMTA) with SMTP id D2.33.25310.9B449285; Mon, 14 Nov 2016 13:59:37 +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:37 +0900 (KST) From: Pankaj Dubey To: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20161113_205948_150986_1A864F16 X-CRM114-Status: GOOD ( 15.04 ) 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: arnd@arndb.de, geert+renesas@glider.be, vireshk@kernel.org, magnus.damm@gmail.com, krzk@kernel.org, rmk+kernel@armlinux.org.uk, horms@verge.net.au, thomas.ab@samsung.com, Sascha Hauer , Pankaj Dubey , Shawn Guo , shiraz.linux.kernel@gmail.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 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);