From patchwork Mon Sep 5 09:49:28 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Tony Lindgren X-Patchwork-Id: 1124762 Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) by demeter2.kernel.org (8.14.4/8.14.4) with ESMTP id p859oRQ5002291 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO) for ; Mon, 5 Sep 2011 09:50:49 GMT Received: from canuck.infradead.org ([2001:4978:20e::1]) by merlin.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1R0Vo9-0002mr-3O; Mon, 05 Sep 2011 09:49:37 +0000 Received: from localhost ([127.0.0.1] helo=canuck.infradead.org) by canuck.infradead.org with esmtp (Exim 4.76 #1 (Red Hat Linux)) id 1R0Vo8-0001DH-MG; Mon, 05 Sep 2011 09:49:36 +0000 Received: from mho-03-ewr.mailhop.org ([204.13.248.66] helo=mho-01-ewr.mailhop.org) by canuck.infradead.org with esmtps (Exim 4.76 #1 (Red Hat Linux)) id 1R0Vo2-0001Cq-5W for linux-arm-kernel@lists.infradead.org; Mon, 05 Sep 2011 09:49:33 +0000 Received: from c-98-234-237-12.hsd1.ca.comcast.net ([98.234.237.12] helo=localhost.localdomain) by mho-01-ewr.mailhop.org with esmtpa (Exim 4.72) (envelope-from ) id 1R0Vo1-0000mJ-9L; Mon, 05 Sep 2011 09:49:29 +0000 Received: from Mutt by mutt-smtp-wrapper.pl 1.2 (www.zdo.com/articles/mutt-smtp-wrapper.shtml) X-Mail-Handler: MailHop Outbound by DynDNS X-Originating-IP: 98.234.237.12 X-Report-Abuse-To: abuse@dyndns.com (see http://www.dyndns.com/services/mailhop/outbound_abuse.html for abuse reporting information) X-MHO-User: U2FsdGVkX1+pqjycnuHFJUDV+YpfR+1H Date: Mon, 5 Sep 2011 02:49:28 -0700 From: Tony Lindgren To: Nicolas Pitre Subject: Re: [PATCH 3/6] ARM: mach-omap1: clean up debug-macro.S Message-ID: <20110905094928.GC1903@atomide.com> References: <1314932353-24813-1-git-send-email-nico@fluxnic.net> <1314932353-24813-4-git-send-email-nico@fluxnic.net> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <1314932353-24813-4-git-send-email-nico@fluxnic.net> User-Agent: Mutt/1.5.20 (2009-06-14) X-CRM114-Version: 20090807-BlameThorstenAndJenny ( TRE 0.7.6 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20110905_054930_277351_CA15EF73 X-CRM114-Status: GOOD ( 15.09 ) X-Spam-Score: 0.0 (/) X-Spam-Report: SpamAssassin version 3.3.1 on canuck.infradead.org summary: Content analysis details: (0.0 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [204.13.248.66 listed in list.dnswl.org] 0.0 UNPARSEABLE_RELAY Informational: message has unparseable relay lines Cc: linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: linux-arm-kernel-bounces@lists.infradead.org Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Mon, 05 Sep 2011 09:50:49 +0000 (UTC) * Nicolas Pitre [110901 19:26]: > --- a/arch/arm/mach-omap1/include/mach/debug-macro.S > +++ b/arch/arm/mach-omap1/include/mach/debug-macro.S > @@ -34,13 +29,13 @@ omap_uart_virt: .word 0x0 > .macro addruart, rp, rv, tmp > > /* Use omap_uart_phys/virt if already configured */ > -9: mrc p15, 0, \rp, c1, c0 > - tst \rp, #1 @ MMU enabled? > - ldreq \rp, =omap_uart_v2p(omap_uart_phys) @ MMU disabled > - ldrne \rp, =omap_uart_phys @ MMU enabled > - add \rv, \rp, #4 @ omap_uart_virt > - ldr \rp, [\rp, #0] > - ldr \rv, [\rv, #0] > +9: adr \rp, 11f @ get effective addr of 11f > + ldr \rv, [\rp] @ get absolute addr of 11f > + sub \rv, \rv, \rp @ offset between the two > + ldr \rp, [\rp, #4] @ abs addr of omap_uart_phys > + sub \tmp, \rp, \rv @ make it effective > + ldr \rp, [\tmp, #0] @ omap_uart_phys > + ldr \rv, [\tmp, #4] @ omap_uart_virt > cmp \rp, #0 @ is port configured? > cmpne \rv, #0 > bne 99f @ already configured The 11f above will fail for omap1 as we already have 11 defined there for omap1 uart1. The prepare patch I posted as 2.5/6 fixes that issue. This will also allow further clean-up to combine omap1 and omap2+ debug-macro.S. Below is updated version of your patch to use 99f instead of 11f. Tony From: Nicolas Pitre Date: Thu, 1 Sep 2011 22:59:10 -0400 Subject: [PATCH] ARM: mach-omap1: clean up debug-macro.S This achieves two goals: 1) Get rid of omap_uart_v2p() and omap_uart_p2v() which were the last users of PLAT_PHYS_OFFSET. 2) Remove the probing of the M bit in the CP15 control reg and make the access to the .data variables completely position independent. Signed-off-by: Nicolas Pitre Tested-by: Tony Lindgren diff --git a/arch/arm/mach-omap1/include/mach/debug-macro.S b/arch/arm/mach-omap1/include/mach/debug-macro.S index 77a7202..2b36a28 100644 --- a/arch/arm/mach-omap1/include/mach/debug-macro.S +++ b/arch/arm/mach-omap1/include/mach/debug-macro.S @@ -13,13 +13,8 @@ #include -#include - #include -#define omap_uart_v2p(x) ((x) - PAGE_OFFSET + PLAT_PHYS_OFFSET) -#define omap_uart_p2v(x) ((x) - PLAT_PHYS_OFFSET + PAGE_OFFSET) - .pushsection .data omap_uart_phys: .word 0x0 omap_uart_virt: .word 0x0 @@ -34,13 +29,13 @@ omap_uart_virt: .word 0x0 .macro addruart, rp, rv, tmp /* Use omap_uart_phys/virt if already configured */ -9: mrc p15, 0, \rp, c1, c0 - tst \rp, #1 @ MMU enabled? - ldreq \rp, =omap_uart_v2p(omap_uart_phys) @ MMU disabled - ldrne \rp, =omap_uart_phys @ MMU enabled - add \rv, \rp, #4 @ omap_uart_virt - ldr \rp, [\rp, #0] - ldr \rv, [\rv, #0] +9: adr \rp, 99f @ get effective addr of 99f + ldr \rv, [\rp] @ get absolute addr of 99f + sub \rv, \rv, \rp @ offset between the two + ldr \rp, [\rp, #4] @ abs addr of omap_uart_phys + sub \tmp, \rp, \rv @ make it effective + ldr \rp, [\tmp, #0] @ omap_uart_phys + ldr \rv, [\tmp, #4] @ omap_uart_virt cmp \rp, #0 @ is port configured? cmpne \rv, #0 bne 100f @ already configured @@ -72,16 +67,17 @@ omap_uart_virt: .word 0x0 /* Store both phys and virt address for the uart */ 98: add \rp, \rp, #0xff000000 @ phys base - mrc p15, 0, \rv, c1, c0 - tst \rv, #1 @ MMU enabled? - ldreq \rv, =omap_uart_v2p(omap_uart_phys) @ MMU disabled - ldrne \rv, =omap_uart_phys @ MMU enabled - str \rp, [\rv, #0] + str \rp, [\tmp, #0] @ omap_uart_phys sub \rp, \rp, #0xff000000 @ phys base add \rp, \rp, #0xfe000000 @ virt base - add \rv, \rv, #4 @ omap_uart_lsr - str \rp, [\rv, #0] + str \rp, [\tmp, #4] @ omap_uart_virt b 9b + + .align +99: .word . + .word omap_uart_phys + .ltorg + 100: .endm