All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: linux-arm-kernel@lists.infradead.org
Cc: linux-omap@vger.kernel.org
Subject: [PATCH 3/5] omap: Add support for CONFIG_AUTO_ZRELADDR for DEBUG_LL
Date: Thu, 03 Feb 2011 17:27:09 -0800	[thread overview]
Message-ID: <20110204012709.26410.78100.stgit@baageli.muru.com> (raw)
In-Reply-To: <20110204012317.26410.55157.stgit@baageli.muru.com>

This way we can have the debug-macro.S be common for omap1 and omap2+
and get sensible error messages booting the wrong zImage with
CONFIG_AUTO_ZRELADDR selected. Note that this does not seem to work
with u-boot and uImage.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap1/include/mach/debug-macro.S |   36 ++++++++++++++++++++----
 arch/arm/mach-omap2/include/mach/debug-macro.S |   27 +++++++++++++++++-
 2 files changed, 56 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-omap1/include/mach/debug-macro.S b/arch/arm/mach-omap1/include/mach/debug-macro.S
index 80dcf18..bae924e 100644
--- a/arch/arm/mach-omap1/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap1/include/mach/debug-macro.S
@@ -27,7 +27,15 @@
 		.macro	inituart, id, a, v
 		mrc	p15, 0, \a, c1, c0
 		tst	\a, #1			@ MMU enabled?
+#ifdef CONFIG_AUTO_ZRELADDR
+		ldreq	\a, =omap_uart_phys
+		biceq	\a, \a, #0xf8000000	@ clear top bits of virt addr
+		moveq	\v, pc			@ copy pc
+		andeq	\v, \v, #0xf8000000	@ clear lower bits
+		orreq	\a, \v			@ combile to get phys addr
+#else
 		ldreq	\a, =omap_uart_v2p(omap_uart_phys)
+#endif
 		ldrne	\a, =omap_uart_phys
 		mov	\v, #(UART_LSR << OMAP_PORT_SHIFT)
 		str	\v, [\a, #8]		@ save lsr, different for 7xx
@@ -101,7 +109,15 @@
 		/* Use omap_uart_phys/virt if already configured */
 		mrc	p15, 0, \rp, c1, c0
 		tst	\rp, #1			@ MMU enabled?
+#ifdef CONFIG_AUTO_ZRELADDR
+		ldreq	\rp, =omap_uart_phys	@ MMU disabled
+		biceq	\rp, \rp, #0xf8000000	@ clear top bits of virt addr
+		moveq	\rv, pc			@ copy pc
+		andeq	\rv, \rv, #0xf8000000	@ clear lower bits
+		orreq	\rp, \rv		@ combine to get phys addr
+#else
 		ldreq	\rp, =omap_uart_v2p(omap_uart_phys)	@ MMU disabled
+#endif
 		ldrne	\rp, =omap_uart_phys	@ MMU enabled
 		add	\rv, \rp, #4		@ omap_uart_virt
 		ldr	\rp, [\rp, #0]
@@ -113,15 +129,23 @@
 		.endm
 
 		.macro	busyuart,rd,rx
-1001:		ldrb	\rd, [\rx, #(UART_LSR << OMAP_PORT_SHIFT)]
-		and	\rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
-		teq	\rd, #(UART_LSR_TEMT | UART_LSR_THRE)
-		beq	1002f
-		ldrb	\rd, [\rx, #(UART_LSR << OMAP7XX_PORT_SHIFT)]
+1001:		mrc	p15, 0, \rd, c1, c0
+		tst	\rd, #1			@ MMU enabled?
+#ifdef CONFIG_AUTO_ZRELADDR
+		ldreq	\rd, =omap_uart_lsr	@ MMU disabled
+		biceq	\rd, \rd, #0xf8000000	@ clear top bits of virt addr
+		roreq	\rd, \rd, #27		@ rotate bits
+		orreq	\rd, pc, lsr #27	@ orr with top bits of pc
+		roreq	\rd, \rd, #5		@ rotate bits back
+#else
+		ldreq	\rd, =omap_uart_v2p(omap_uart_lsr)	@ MMU disabled
+#endif
+		ldrne	\rd, =omap_uart_lsr	@ MMU enabled
+		ldr	\rd, [\rd, #0]
+		ldrb	\rd, [\rx, \rd]
 		and	\rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
 		teq	\rd, #(UART_LSR_TEMT | UART_LSR_THRE)
 		bne	1001b
-1002:
 		.endm
 
 		.macro	waituart,rd,rx
diff --git a/arch/arm/mach-omap2/include/mach/debug-macro.S b/arch/arm/mach-omap2/include/mach/debug-macro.S
index 45c29e3..80e0bdc 100644
--- a/arch/arm/mach-omap2/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap2/include/mach/debug-macro.S
@@ -27,8 +27,17 @@
 		.macro	inituart, id, a, v
 		mrc	p15, 0, \a, c1, c0
 		tst	\a, #1			@ MMU enabled?
+		ldreq	\a, =omap_uart_phys
+#ifdef CONFIG_AUTO_ZRELADDR
+		ldreq	\a, =omap_uart_phys
+		biceq	\a, \a, #0xf8000000	@ clear top bits of virt addr
+		moveq	\v, pc			@ copy pc
+		andeq	\v, \v, #0xf8000000	@ clear lower bits
+		orreq	\a, \v			@ combile to get phys addr
+#else
 		ldreq	\a, =omap_uart_v2p(omap_uart_phys)
-		ldrne	\a, =omap_uart_phys
+#endif
+		ldrne	\a, =omap_uart_phys	@ MMU enabled
 		mov	\v, #(UART_LSR << OMAP_PORT_SHIFT)
 		str	\v, [\a, #8]		@ save lsr, different for zoom
 
@@ -151,7 +160,15 @@
 		/* Use omap_uart_phys/virt if already configured */
 		mrc	p15, 0, \rp, c1, c0
 		tst	\rp, #1			@ MMU enabled?
+#ifdef CONFIG_AUTO_ZRELADDR
+		ldreq	\rp, =omap_uart_phys	@ MMU disabled
+		biceq	\rp, \rp, #0xf8000000	@ clear top bits of virt addr
+		moveq	\rv, pc			@ copy pc
+		andeq	\rv, \rv, #0xf8000000	@ clear lower bits
+		orreq	\rp, \rv		@ combine to get phys addr
+#else
 		ldreq	\rp, =omap_uart_v2p(omap_uart_phys)	@ MMU disabled
+#endif
 		ldrne	\rp, =omap_uart_phys	@ MMU enabled
 		add	\rv, \rp, #4		@ omap_uart_virt
 		ldr	\rp, [\rp, #0]
@@ -165,7 +182,15 @@
 		.macro	busyuart,rd,rx
 1001:		mrc	p15, 0, \rd, c1, c0
 		tst	\rd, #1			@ MMU enabled?
+#ifdef CONFIG_AUTO_ZRELADDR
+		ldreq	\rd, =omap_uart_lsr	@ MMU disabled
+		biceq	\rd, \rd, #0xf8000000	@ clear top bits of virt addr
+		roreq	\rd, \rd, #27		@ rotate bits
+		orreq	\rd, pc, lsr #27	@ orr with top bits of pc
+		roreq	\rd, \rd, #5		@ rotate bits back
+#else
 		ldreq	\rd, =omap_uart_v2p(omap_uart_lsr)	@ MMU disabled
+#endif
 		ldrne	\rd, =omap_uart_lsr	@ MMU enabled
 		ldr	\rd, [\rd, #0]
 		ldrb	\rd, [\rx, \rd]


WARNING: multiple messages have this Message-ID (diff)
From: tony@atomide.com (Tony Lindgren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 3/5] omap: Add support for CONFIG_AUTO_ZRELADDR for DEBUG_LL
Date: Thu, 03 Feb 2011 17:27:09 -0800	[thread overview]
Message-ID: <20110204012709.26410.78100.stgit@baageli.muru.com> (raw)
In-Reply-To: <20110204012317.26410.55157.stgit@baageli.muru.com>

This way we can have the debug-macro.S be common for omap1 and omap2+
and get sensible error messages booting the wrong zImage with
CONFIG_AUTO_ZRELADDR selected. Note that this does not seem to work
with u-boot and uImage.

Signed-off-by: Tony Lindgren <tony@atomide.com>
---
 arch/arm/mach-omap1/include/mach/debug-macro.S |   36 ++++++++++++++++++++----
 arch/arm/mach-omap2/include/mach/debug-macro.S |   27 +++++++++++++++++-
 2 files changed, 56 insertions(+), 7 deletions(-)

diff --git a/arch/arm/mach-omap1/include/mach/debug-macro.S b/arch/arm/mach-omap1/include/mach/debug-macro.S
index 80dcf18..bae924e 100644
--- a/arch/arm/mach-omap1/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap1/include/mach/debug-macro.S
@@ -27,7 +27,15 @@
 		.macro	inituart, id, a, v
 		mrc	p15, 0, \a, c1, c0
 		tst	\a, #1			@ MMU enabled?
+#ifdef CONFIG_AUTO_ZRELADDR
+		ldreq	\a, =omap_uart_phys
+		biceq	\a, \a, #0xf8000000	@ clear top bits of virt addr
+		moveq	\v, pc			@ copy pc
+		andeq	\v, \v, #0xf8000000	@ clear lower bits
+		orreq	\a, \v			@ combile to get phys addr
+#else
 		ldreq	\a, =omap_uart_v2p(omap_uart_phys)
+#endif
 		ldrne	\a, =omap_uart_phys
 		mov	\v, #(UART_LSR << OMAP_PORT_SHIFT)
 		str	\v, [\a, #8]		@ save lsr, different for 7xx
@@ -101,7 +109,15 @@
 		/* Use omap_uart_phys/virt if already configured */
 		mrc	p15, 0, \rp, c1, c0
 		tst	\rp, #1			@ MMU enabled?
+#ifdef CONFIG_AUTO_ZRELADDR
+		ldreq	\rp, =omap_uart_phys	@ MMU disabled
+		biceq	\rp, \rp, #0xf8000000	@ clear top bits of virt addr
+		moveq	\rv, pc			@ copy pc
+		andeq	\rv, \rv, #0xf8000000	@ clear lower bits
+		orreq	\rp, \rv		@ combine to get phys addr
+#else
 		ldreq	\rp, =omap_uart_v2p(omap_uart_phys)	@ MMU disabled
+#endif
 		ldrne	\rp, =omap_uart_phys	@ MMU enabled
 		add	\rv, \rp, #4		@ omap_uart_virt
 		ldr	\rp, [\rp, #0]
@@ -113,15 +129,23 @@
 		.endm
 
 		.macro	busyuart,rd,rx
-1001:		ldrb	\rd, [\rx, #(UART_LSR << OMAP_PORT_SHIFT)]
-		and	\rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
-		teq	\rd, #(UART_LSR_TEMT | UART_LSR_THRE)
-		beq	1002f
-		ldrb	\rd, [\rx, #(UART_LSR << OMAP7XX_PORT_SHIFT)]
+1001:		mrc	p15, 0, \rd, c1, c0
+		tst	\rd, #1			@ MMU enabled?
+#ifdef CONFIG_AUTO_ZRELADDR
+		ldreq	\rd, =omap_uart_lsr	@ MMU disabled
+		biceq	\rd, \rd, #0xf8000000	@ clear top bits of virt addr
+		roreq	\rd, \rd, #27		@ rotate bits
+		orreq	\rd, pc, lsr #27	@ orr with top bits of pc
+		roreq	\rd, \rd, #5		@ rotate bits back
+#else
+		ldreq	\rd, =omap_uart_v2p(omap_uart_lsr)	@ MMU disabled
+#endif
+		ldrne	\rd, =omap_uart_lsr	@ MMU enabled
+		ldr	\rd, [\rd, #0]
+		ldrb	\rd, [\rx, \rd]
 		and	\rd, \rd, #(UART_LSR_TEMT | UART_LSR_THRE)
 		teq	\rd, #(UART_LSR_TEMT | UART_LSR_THRE)
 		bne	1001b
-1002:
 		.endm
 
 		.macro	waituart,rd,rx
diff --git a/arch/arm/mach-omap2/include/mach/debug-macro.S b/arch/arm/mach-omap2/include/mach/debug-macro.S
index 45c29e3..80e0bdc 100644
--- a/arch/arm/mach-omap2/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap2/include/mach/debug-macro.S
@@ -27,8 +27,17 @@
 		.macro	inituart, id, a, v
 		mrc	p15, 0, \a, c1, c0
 		tst	\a, #1			@ MMU enabled?
+		ldreq	\a, =omap_uart_phys
+#ifdef CONFIG_AUTO_ZRELADDR
+		ldreq	\a, =omap_uart_phys
+		biceq	\a, \a, #0xf8000000	@ clear top bits of virt addr
+		moveq	\v, pc			@ copy pc
+		andeq	\v, \v, #0xf8000000	@ clear lower bits
+		orreq	\a, \v			@ combile to get phys addr
+#else
 		ldreq	\a, =omap_uart_v2p(omap_uart_phys)
-		ldrne	\a, =omap_uart_phys
+#endif
+		ldrne	\a, =omap_uart_phys	@ MMU enabled
 		mov	\v, #(UART_LSR << OMAP_PORT_SHIFT)
 		str	\v, [\a, #8]		@ save lsr, different for zoom
 
@@ -151,7 +160,15 @@
 		/* Use omap_uart_phys/virt if already configured */
 		mrc	p15, 0, \rp, c1, c0
 		tst	\rp, #1			@ MMU enabled?
+#ifdef CONFIG_AUTO_ZRELADDR
+		ldreq	\rp, =omap_uart_phys	@ MMU disabled
+		biceq	\rp, \rp, #0xf8000000	@ clear top bits of virt addr
+		moveq	\rv, pc			@ copy pc
+		andeq	\rv, \rv, #0xf8000000	@ clear lower bits
+		orreq	\rp, \rv		@ combine to get phys addr
+#else
 		ldreq	\rp, =omap_uart_v2p(omap_uart_phys)	@ MMU disabled
+#endif
 		ldrne	\rp, =omap_uart_phys	@ MMU enabled
 		add	\rv, \rp, #4		@ omap_uart_virt
 		ldr	\rp, [\rp, #0]
@@ -165,7 +182,15 @@
 		.macro	busyuart,rd,rx
 1001:		mrc	p15, 0, \rd, c1, c0
 		tst	\rd, #1			@ MMU enabled?
+#ifdef CONFIG_AUTO_ZRELADDR
+		ldreq	\rd, =omap_uart_lsr	@ MMU disabled
+		biceq	\rd, \rd, #0xf8000000	@ clear top bits of virt addr
+		roreq	\rd, \rd, #27		@ rotate bits
+		orreq	\rd, pc, lsr #27	@ orr with top bits of pc
+		roreq	\rd, \rd, #5		@ rotate bits back
+#else
 		ldreq	\rd, =omap_uart_v2p(omap_uart_lsr)	@ MMU disabled
+#endif
 		ldrne	\rd, =omap_uart_lsr	@ MMU enabled
 		ldr	\rd, [\rd, #0]
 		ldrb	\rd, [\rx, \rd]

  parent reply	other threads:[~2011-02-04  1:27 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-02-04  1:26 [PATCH 0/5] Change omap DEBUG_LL code to use inituart for AUTO_ZRELADDR and ARM_PATCH_PHYS_VIRT Tony Lindgren
2011-02-04  1:26 ` Tony Lindgren
2011-02-04  1:27 ` [PATCH 1/5] omap: Remove code configuring the DEBUG_LL serial port using uncompress code Tony Lindgren
2011-02-04  1:27   ` Tony Lindgren
2011-02-04  1:27 ` [PATCH 2/5] omap: Use inituart to configure the debug serial port based on machine ID Tony Lindgren
2011-02-04  1:27   ` Tony Lindgren
2011-02-04 12:04   ` Grazvydas Ignotas
2011-02-04 12:04     ` Grazvydas Ignotas
2011-02-04 16:49     ` Tony Lindgren
2011-02-04 16:49       ` Tony Lindgren
2011-02-04  1:27 ` Tony Lindgren [this message]
2011-02-04  1:27   ` [PATCH 3/5] omap: Add support for CONFIG_AUTO_ZRELADDR for DEBUG_LL Tony Lindgren
2011-02-04  3:33   ` Nicolas Pitre
2011-02-04  3:33     ` Nicolas Pitre
2011-02-04 17:02     ` Tony Lindgren
2011-02-04 17:02       ` Tony Lindgren
2011-02-04 20:16       ` Nicolas Pitre
2011-02-04 20:16         ` Nicolas Pitre
2011-02-04 20:24         ` Tony Lindgren
2011-02-04 20:24           ` Tony Lindgren
2011-02-04 20:33           ` Nicolas Pitre
2011-02-04 20:33             ` Nicolas Pitre
2011-02-04 17:15     ` Russell King - ARM Linux
2011-02-04 17:15       ` Russell King - ARM Linux
2011-02-04 18:36       ` Tony Lindgren
2011-02-04 18:36         ` Tony Lindgren
2011-02-04  1:27 ` [PATCH 4/5] omap: Combine debug-macro.S for omap1 and omap2+ Tony Lindgren
2011-02-04  1:27   ` Tony Lindgren
2011-02-04  1:27 ` [PATCH 5/5] omap: Add CONFIG_AUTO_ZRELADDR and CONFIG_ARM_PATCH_PHYS_VIRT to defconfigs Tony Lindgren
2011-02-04  1:27   ` Tony Lindgren
2011-02-09  6:08 ` [PATCH 0/5] Change omap DEBUG_LL code to use inituart for AUTO_ZRELADDR and ARM_PATCH_PHYS_VIRT Poddar, Sourav
2011-02-09  6:08   ` Poddar, Sourav

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20110204012709.26410.78100.stgit@baageli.muru.com \
    --to=tony@atomide.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-omap@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.