ARM: plat-omap: make OMAP_UART_INFO into a relative offset
authorNicolas Pitre <nicolas.pitre@linaro.org>
Wed, 31 Aug 2011 17:57:37 +0000 (13:57 -0400)
committerNicolas Pitre <nico@fluxnic.net>
Mon, 26 Sep 2011 14:11:25 +0000 (10:11 -0400)
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>
Tested-by: Tony Lindgren <tony@atomide.com>
Reviewed-by: Kevin Hilman <khilman@ti.com>
arch/arm/mach-omap1/include/mach/debug-macro.S
arch/arm/mach-omap2/include/mach/debug-macro.S
arch/arm/plat-omap/include/plat/serial.h
arch/arm/plat-omap/include/plat/uncompress.h

index f944ae8abc9707b4708f9adad2292ac46e38f7dc..6a171181986f5d6add5edcc3c236ea4c017fa821 100644 (file)
@@ -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?
index fbd23ec81a203babb466325b97ada6d1be04c142..745e2ff3e906c3486ea04d53f435b29bc72bb091 100644 (file)
@@ -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?
index de3b10c18127510872b3920ad42ee689e56eed47..1ab9fd6abe6de8e837e06260fbb58ff03f6b4d6f 100644 (file)
@@ -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
index a067484cc4a245c3dd28a3af46ec0ca3426f46d0..2f472e989ec6b9ee66e592c0d314a696a578c829 100644 (file)
@@ -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)