From patchwork Thu Jan 17 02:53:24 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 1994421 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-process-083081@patchwork1.kernel.org Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by patchwork1.kernel.org (Postfix) with ESMTP id F31683FDD1 for ; Thu, 17 Jan 2013 02:57:33 +0000 (UTC) Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1TvfcH-00032z-5j; Thu, 17 Jan 2013 02:54:09 +0000 Received: from mail-ob0-f179.google.com ([209.85.214.179]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1Tvfc2-00030g-4W for linux-arm-kernel@lists.infradead.org; Thu, 17 Jan 2013 02:53:56 +0000 Received: by mail-ob0-f179.google.com with SMTP id x4so2133539obh.10 for ; Wed, 16 Jan 2013 18:53:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:from:to:cc:subject:date:message-id:x-mailer:in-reply-to :references; bh=EdN4JAge/iEj9SmtaQBFnDv2gmMEEu14dEgu/5u2svg=; b=0zDJKUZ/bkjPx1pQyLzmLDKlWvkVJ8qeNx7pKxU55RwDlMukjZ0VTTn8yxZxbnKCdk SXCkyEHnzJh1oiqocfpxwN6x9Fann9o/UZr42jFXc5WKfb+vePQy/DK14lpuqFC9KhV/ EGMIgB/IIPB4bCPgVvgGntmhGjzYcGw1JltpjQ5QoUR4MwvEt+A9K4bObbwwLA2bVX2Y SeAUcW0eMzK0dWQPlp/Ci4wSWsBE+C9CAqNJMkYZ3OGrXmelbRRWKRnKAMvaWZm1nqej o6MWU+qhMXZz4ew4Tpq3DMVbma/HlepgnJym6WGthCsJOvYooR52I1yuXGHoeaRQHv6B qV0A== X-Received: by 10.60.24.161 with SMTP id v1mr2638524oef.115.1358391232926; Wed, 16 Jan 2013 18:53:52 -0800 (PST) Received: from rob-laptop.grandenetworks.net (65-36-73-129.dyn.grandenetworks.net. [65.36.73.129]) by mx.google.com with ESMTPS id y4sm137749oea.7.2013.01.16.18.53.50 (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 16 Jan 2013 18:53:51 -0800 (PST) From: Rob Herring To: Nicolas Pitre , Russell King , linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/3] ARM: convert platform hotplug inline assembly to C Date: Wed, 16 Jan 2013 20:53:24 -0600 Message-Id: <1358391205-23943-2-git-send-email-robherring2@gmail.com> X-Mailer: git-send-email 1.7.10.4 In-Reply-To: <1358391205-23943-1-git-send-email-robherring2@gmail.com> References: <1358391205-23943-1-git-send-email-robherring2@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20130116_215354_419268_48A3D654 X-CRM114-Status: GOOD ( 11.73 ) X-Spam-Score: -2.5 (--) X-Spam-Report: SpamAssassin version 3.3.2 on merlin.infradead.org summary: Content analysis details: (-2.5 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.7 RCVD_IN_DNSWL_LOW RBL: Sender listed at http://www.dnswl.org/, low trust [209.85.214.179 listed in list.dnswl.org] 0.0 FREEMAIL_FROM Sender email is commonly abused enduser mail provider (robherring2[at]gmail.com) -0.0 SPF_PASS SPF: sender matches SPF record 0.2 FREEMAIL_ENVFROM_END_DIGIT Envelope-from freemail username ends in digit (robherring2[at]gmail.com) -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature Cc: Kukjin Kim , Viresh Kumar , Sascha Hauer , Rob Herring X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org From: Rob Herring With the addition of set_auxcr/get_auxcr, all the hotplug inline assembly code for exynos, imx, realview, spear13xx and vexpress can be converted to C code. Signed-off-by: Rob Herring Cc: Kukjin Kim Cc: Russell King Cc: Sascha Hauer Cc: Viresh Kumar Cc: Shiraz Hashim --- arch/arm/mach-exynos/hotplug.c | 57 ++++++------------------------------- arch/arm/mach-imx/hotplug.c | 19 ++++--------- arch/arm/mach-realview/hotplug.c | 32 +++++---------------- arch/arm/mach-spear13xx/hotplug.c | 32 +++++---------------- arch/arm/mach-vexpress/hotplug.c | 33 +++++---------------- 5 files changed, 35 insertions(+), 138 deletions(-) diff --git a/arch/arm/mach-exynos/hotplug.c b/arch/arm/mach-exynos/hotplug.c index c3f825b..5548fa3 100644 --- a/arch/arm/mach-exynos/hotplug.c +++ b/arch/arm/mach-exynos/hotplug.c @@ -26,69 +26,30 @@ static inline void cpu_enter_lowpower_a9(void) { - unsigned int v; - flush_cache_all(); - asm volatile( - " mcr p15, 0, %1, c7, c5, 0\n" - " mcr p15, 0, %1, c7, c10, 4\n" + __flush_icache_all(); + dsb(); + /* * Turn off coherency */ - " mrc p15, 0, %0, c1, c0, 1\n" - " bic %0, %0, %3\n" - " mcr p15, 0, %0, c1, c0, 1\n" - " mrc p15, 0, %0, c1, c0, 0\n" - " bic %0, %0, %2\n" - " mcr p15, 0, %0, c1, c0, 0\n" - : "=&r" (v) - : "r" (0), "Ir" (CR_C), "Ir" (0x40) - : "cc"); + set_auxcr(get_auxcr() & ~0x40); + set_cr(get_cr() & ~CR_C); } static inline void cpu_enter_lowpower_a15(void) { - unsigned int v; - - asm volatile( - " mrc p15, 0, %0, c1, c0, 0\n" - " bic %0, %0, %1\n" - " mcr p15, 0, %0, c1, c0, 0\n" - : "=&r" (v) - : "Ir" (CR_C) - : "cc"); - + set_cr(get_cr() & ~CR_C); flush_cache_louis(); + set_auxcr(get_auxcr() & ~0x40); - asm volatile( - /* - * Turn off coherency - */ - " mrc p15, 0, %0, c1, c0, 1\n" - " bic %0, %0, %1\n" - " mcr p15, 0, %0, c1, c0, 1\n" - : "=&r" (v) - : "Ir" (0x40) - : "cc"); - - isb(); dsb(); } static inline void cpu_leave_lowpower(void) { - unsigned int v; - - asm volatile( - "mrc p15, 0, %0, c1, c0, 0\n" - " orr %0, %0, %1\n" - " mcr p15, 0, %0, c1, c0, 0\n" - " mrc p15, 0, %0, c1, c0, 1\n" - " orr %0, %0, %2\n" - " mcr p15, 0, %0, c1, c0, 1\n" - : "=&r" (v) - : "Ir" (CR_C), "Ir" (0x40) - : "cc"); + set_cr(get_cr() | CR_C); + set_auxcr(get_auxcr() | 0x40); } static inline void platform_do_lowpower(unsigned int cpu, int *spurious) diff --git a/arch/arm/mach-imx/hotplug.c b/arch/arm/mach-imx/hotplug.c index 3dec962..1470c75 100644 --- a/arch/arm/mach-imx/hotplug.c +++ b/arch/arm/mach-imx/hotplug.c @@ -18,24 +18,15 @@ static inline void cpu_enter_lowpower(void) { - unsigned int v; - flush_cache_all(); - asm volatile( - "mcr p15, 0, %1, c7, c5, 0\n" - " mcr p15, 0, %1, c7, c10, 4\n" + __flush_icache_all(); + dsb(); + /* * Turn off coherency */ - " mrc p15, 0, %0, c1, c0, 1\n" - " bic %0, %0, %3\n" - " mcr p15, 0, %0, c1, c0, 1\n" - " mrc p15, 0, %0, c1, c0, 0\n" - " bic %0, %0, %2\n" - " mcr p15, 0, %0, c1, c0, 0\n" - : "=&r" (v) - : "r" (0), "Ir" (CR_C), "Ir" (0x40) - : "cc"); + set_auxcr(get_auxcr() & ~0x40); + set_cr(get_cr() & ~CR_C); } /* diff --git a/arch/arm/mach-realview/hotplug.c b/arch/arm/mach-realview/hotplug.c index 53818e5..c17c8c0 100644 --- a/arch/arm/mach-realview/hotplug.c +++ b/arch/arm/mach-realview/hotplug.c @@ -18,39 +18,21 @@ static inline void cpu_enter_lowpower(void) { - unsigned int v; - flush_cache_all(); - asm volatile( - " mcr p15, 0, %1, c7, c5, 0\n" - " mcr p15, 0, %1, c7, c10, 4\n" + __flush_icache_all(); + dsb(); + /* * Turn off coherency */ - " mrc p15, 0, %0, c1, c0, 1\n" - " bic %0, %0, #0x20\n" - " mcr p15, 0, %0, c1, c0, 1\n" - " mrc p15, 0, %0, c1, c0, 0\n" - " bic %0, %0, %2\n" - " mcr p15, 0, %0, c1, c0, 0\n" - : "=&r" (v) - : "r" (0), "Ir" (CR_C) - : "cc"); + set_auxcr(get_auxcr() & ~0x40); + set_cr(get_cr() & ~CR_C); } static inline void cpu_leave_lowpower(void) { - unsigned int v; - - asm volatile( "mrc p15, 0, %0, c1, c0, 0\n" - " orr %0, %0, %1\n" - " mcr p15, 0, %0, c1, c0, 0\n" - " mrc p15, 0, %0, c1, c0, 1\n" - " orr %0, %0, #0x20\n" - " mcr p15, 0, %0, c1, c0, 1\n" - : "=&r" (v) - : "Ir" (CR_C) - : "cc"); + set_cr(get_cr() | CR_C); + set_auxcr(get_auxcr() | 0x40); } static inline void platform_do_lowpower(unsigned int cpu, int *spurious) diff --git a/arch/arm/mach-spear13xx/hotplug.c b/arch/arm/mach-spear13xx/hotplug.c index a7d2dd1..a38a087 100644 --- a/arch/arm/mach-spear13xx/hotplug.c +++ b/arch/arm/mach-spear13xx/hotplug.c @@ -19,39 +19,21 @@ static inline void cpu_enter_lowpower(void) { - unsigned int v; - flush_cache_all(); - asm volatile( - " mcr p15, 0, %1, c7, c5, 0\n" - " dsb\n" + __flush_icache_all(); + dsb(); + /* * Turn off coherency */ - " mrc p15, 0, %0, c1, c0, 1\n" - " bic %0, %0, #0x20\n" - " mcr p15, 0, %0, c1, c0, 1\n" - " mrc p15, 0, %0, c1, c0, 0\n" - " bic %0, %0, %2\n" - " mcr p15, 0, %0, c1, c0, 0\n" - : "=&r" (v) - : "r" (0), "Ir" (CR_C) - : "cc", "memory"); + set_auxcr(get_auxcr() & ~0x40); + set_cr(get_cr() & ~CR_C); } static inline void cpu_leave_lowpower(void) { - unsigned int v; - - asm volatile("mrc p15, 0, %0, c1, c0, 0\n" - " orr %0, %0, %1\n" - " mcr p15, 0, %0, c1, c0, 0\n" - " mrc p15, 0, %0, c1, c0, 1\n" - " orr %0, %0, #0x20\n" - " mcr p15, 0, %0, c1, c0, 1\n" - : "=&r" (v) - : "Ir" (CR_C) - : "cc"); + set_cr(get_cr() | CR_C); + set_auxcr(get_auxcr() | 0x40); } static inline void spear13xx_do_lowpower(unsigned int cpu, int *spurious) diff --git a/arch/arm/mach-vexpress/hotplug.c b/arch/arm/mach-vexpress/hotplug.c index a141b98..74a9eb5 100644 --- a/arch/arm/mach-vexpress/hotplug.c +++ b/arch/arm/mach-vexpress/hotplug.c @@ -18,40 +18,21 @@ static inline void cpu_enter_lowpower(void) { - unsigned int v; - flush_cache_all(); - asm volatile( - "mcr p15, 0, %1, c7, c5, 0\n" - " mcr p15, 0, %1, c7, c10, 4\n" + __flush_icache_all(); + dsb(); + /* * Turn off coherency */ - " mrc p15, 0, %0, c1, c0, 1\n" - " bic %0, %0, %3\n" - " mcr p15, 0, %0, c1, c0, 1\n" - " mrc p15, 0, %0, c1, c0, 0\n" - " bic %0, %0, %2\n" - " mcr p15, 0, %0, c1, c0, 0\n" - : "=&r" (v) - : "r" (0), "Ir" (CR_C), "Ir" (0x40) - : "cc"); + set_auxcr(get_auxcr() & ~0x40); + set_cr(get_cr() & ~CR_C); } static inline void cpu_leave_lowpower(void) { - unsigned int v; - - asm volatile( - "mrc p15, 0, %0, c1, c0, 0\n" - " orr %0, %0, %1\n" - " mcr p15, 0, %0, c1, c0, 0\n" - " mrc p15, 0, %0, c1, c0, 1\n" - " orr %0, %0, %2\n" - " mcr p15, 0, %0, c1, c0, 1\n" - : "=&r" (v) - : "Ir" (CR_C), "Ir" (0x40) - : "cc"); + set_cr(get_cr() | CR_C); + set_auxcr(get_auxcr() | 0x40); } static inline void platform_do_lowpower(unsigned int cpu, int *spurious)