All of lore.kernel.org
 help / color / mirror / Atom feed
From: nico@fluxnic.net (Nicolas Pitre)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH 2/6] ARM: plat-omap: make OMAP_UART_INFO into a relative offset
Date: Thu, 01 Sep 2011 22:59:09 -0400	[thread overview]
Message-ID: <1314932353-24813-3-git-send-email-nico@fluxnic.net> (raw)
In-Reply-To: <1314932353-24813-1-git-send-email-nico@fluxnic.net>

This is the first step to remove PLAT_PHYS_OFFSET usage from the debug
UART code.

Signed-off-by: Nicolas Pitre <nicolas.pitre@linaro.org>
---
 arch/arm/mach-omap1/include/mach/debug-macro.S |    8 +++-----
 arch/arm/mach-omap2/include/mach/debug-macro.S |    9 ++++-----
 arch/arm/plat-omap/include/plat/serial.h       |    6 +++---
 arch/arm/plat-omap/include/plat/uncompress.h   |    8 +++++++-
 4 files changed, 17 insertions(+), 14 deletions(-)

diff --git a/arch/arm/mach-omap1/include/mach/debug-macro.S b/arch/arm/mach-omap1/include/mach/debug-macro.S
index f944ae8..6a17118 100644
--- a/arch/arm/mach-omap1/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap1/include/mach/debug-macro.S
@@ -46,11 +46,9 @@ omap_uart_virt:	.word	0x0
 		bne	99f			@ already configured
 
 		/* Check the debug UART configuration set in uncompress.h */
-		mrc	p15, 0, \rp, c1, c0
-		tst	\rp, #1			@ MMU enabled?
-		ldreq	\rp, =OMAP_UART_INFO	@ MMU not enabled
-		ldrne	\rp, =omap_uart_p2v(OMAP_UART_INFO)	@ MMU enabled
-		ldr	\rp, [\rp, #0]
+		and	\rp, pc, #0xff000000
+		ldr	\rv, =OMAP_UART_INFO_OFS
+		ldr	\rp, [\rp, \rv]
 
 		/* Select the UART to use based on the UART1 scratchpad value */
 10:		cmp	\rp, #0			@ no port configured?
diff --git a/arch/arm/mach-omap2/include/mach/debug-macro.S b/arch/arm/mach-omap2/include/mach/debug-macro.S
index fbd23ec..745e2ff 100644
--- a/arch/arm/mach-omap2/include/mach/debug-macro.S
+++ b/arch/arm/mach-omap2/include/mach/debug-macro.S
@@ -49,11 +49,10 @@ omap_uart_lsr:	.word	0
 		bne	99f			@ already configured
 
 		/* Check the debug UART configuration set in uncompress.h */
-		mrc	p15, 0, \rp, c1, c0
-		tst	\rp, #1			@ MMU enabled?
-		ldreq	\rp, =OMAP_UART_INFO	@ MMU not enabled
-		ldrne	\rp, =omap_uart_p2v(OMAP_UART_INFO)	@ MMU enabled
-		ldr	\rp, [\rp, #0]
+		mov	\rp, pc
+		ldr	\rv, =OMAP_UART_INFO_OFS
+		and	\rp, \rp, #0xff000000
+		ldr	\rp, [\rp, \rv]
 
 		/* Select the UART to use based on the UART1 scratchpad value */
 		cmp	\rp, #0			@ no port configured?
diff --git a/arch/arm/plat-omap/include/plat/serial.h b/arch/arm/plat-omap/include/plat/serial.h
index de3b10c..1ab9fd6 100644
--- a/arch/arm/plat-omap/include/plat/serial.h
+++ b/arch/arm/plat-omap/include/plat/serial.h
@@ -16,8 +16,8 @@
 #include <linux/init.h>
 
 /*
- * Memory entry used for the DEBUG_LL UART configuration. See also
- * uncompress.h and debug-macro.S.
+ * Memory entry used for the DEBUG_LL UART configuration, relative to
+ * start of RAM. See also uncompress.h and debug-macro.S.
  *
  * Note that using a memory location for storing the UART configuration
  * has at least two limitations:
@@ -27,7 +27,7 @@
  * 2. We assume printascii is called at least once before paging_init,
  *    and addruart has a chance to read OMAP_UART_INFO
  */
-#define OMAP_UART_INFO		(PLAT_PHYS_OFFSET + 0x3ffc)
+#define OMAP_UART_INFO_OFS	0x3ffc
 
 /* OMAP1 serial ports */
 #define OMAP1_UART1_BASE	0xfffb0000
diff --git a/arch/arm/plat-omap/include/plat/uncompress.h b/arch/arm/plat-omap/include/plat/uncompress.h
index a067484..71763db 100644
--- a/arch/arm/plat-omap/include/plat/uncompress.h
+++ b/arch/arm/plat-omap/include/plat/uncompress.h
@@ -36,7 +36,13 @@ int uart_shift;
  */
 static void set_omap_uart_info(unsigned char port)
 {
-	*(volatile u32 *)OMAP_UART_INFO = port;
+	/* 
+	 * Get address of some.bss variable and round it down 
+	 * a la CONFIG_AUTO_ZRELADDR.
+	 */
+	u32 ram_start = (u32)&uart_shift & 0xf8000000;
+	u32 *uart_info = (u32 *)(ram_start + OMAP_UART_INFO_OFS);
+	*uart_info = port;
 }
 
 static void putc(int c)
-- 
1.7.4

  parent reply	other threads:[~2011-09-02  2:59 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-09-02  2:59 [PATCH 0/6] OMAP/Davinci debug UART code cleanup Nicolas Pitre
2011-09-02  2:59 ` [PATCH 1/6] ARM: add an extra temp register to the addruart low level debugging macro Nicolas Pitre
2011-09-02  2:59 ` Nicolas Pitre [this message]
2011-09-05  9:44   ` [PATCH 2/6] ARM: plat-omap: make OMAP_UART_INFO into a relative offset Tony Lindgren
2011-09-05 19:24     ` Nicolas Pitre
2011-09-05  9:46   ` [PATCH 2.5/6] ARM: omap: prepare debug-macro.S for offset based calculation of omap_uart_phys and virt Tony Lindgren
2011-09-06 18:30     ` Nicolas Pitre
2011-09-02  2:59 ` [PATCH 3/6] ARM: mach-omap1: clean up debug-macro.S Nicolas Pitre
2011-09-05  9:49   ` Tony Lindgren
2011-09-05  9:51     ` Tony Lindgren
2011-09-06 18:33     ` Nicolas Pitre
2011-09-02  2:59 ` [PATCH 4/6] ARM: mach-omap2: " Nicolas Pitre
2011-09-05  9:51   ` Tony Lindgren
2011-09-05 15:07   ` [PATCH 4.5/6] ARM: omap: pass phys, virt and lsr from uncompress.h to debug-macro.S Tony Lindgren
2011-09-06 18:45     ` Nicolas Pitre
2011-09-02  2:59 ` [PATCH 5/6] ARM: mach-davinci: make DAVINCI_UART_INFO into a relative offset Nicolas Pitre
2011-09-02  2:59 ` [PATCH 6/6] ARM: mach-davinci: clean up debug-macro.S Nicolas Pitre

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=1314932353-24813-3-git-send-email-nico@fluxnic.net \
    --to=nico@fluxnic.net \
    --cc=linux-arm-kernel@lists.infradead.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.