[ARM] 5276/1: ep93xx: allow selecting UART for early kernel messages
authorHartley Sweeten <hartleys@visionengravers.com>
Thu, 2 Oct 2008 16:13:02 +0000 (17:13 +0100)
committerRussell King <rmk+kernel@arm.linux.org.uk>
Fri, 3 Oct 2008 10:03:39 +0000 (11:03 +0100)
Currently on the EP93xx platform early kernel messages go to UART1.
Since this UART is the only one that has modem control signals it
might be used for another purpose and it is undesirable for those
messages to appear. This patch allows one of the other UARTs to be
selected in the kernel configuration. It is assumed that the
bootloader has configured and initialized the UART since this was the
previous assumption.

Signed-off-by: H Hartley Sweeten <hsweeten@visionengravers.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
arch/arm/mach-ep93xx/Kconfig
arch/arm/mach-ep93xx/include/mach/uncompress.h

index ea8549bfbef2fa69b9f94fc54428671df988fdeb..5a1b8c05c9584af2850076060d387ee18682b4db 100644 (file)
@@ -88,6 +88,20 @@ config MACH_TS72XX
          Say 'Y' here if you want your kernel to support the
          Technologic Systems TS-72xx board.
 
+choice
+       prompt "Select a UART for early kernel messages"
+
+config EP93XX_EARLY_UART1
+       bool "UART1"
+
+config EP93XX_EARLY_UART2
+       bool "UART2"
+
+config EP93XX_EARLY_UART3
+       bool "UART3"
+
+endchoice
+
 endmenu
 
 endif
index 1fd2f17de3255b21ed8eec3f45db7298a38f2819..16026c2b1c8c0f36843baf6378e0114a22b0fa03 100644 (file)
@@ -31,10 +31,19 @@ static void __raw_writel(unsigned int value, unsigned int ptr)
        *((volatile unsigned int *)ptr) = value;
 }
 
-
-#define PHYS_UART1_DATA                0x808c0000
-#define PHYS_UART1_FLAG                0x808c0018
-#define UART1_FLAG_TXFF                0x20
+#if defined(CONFIG_EP93XX_EARLY_UART1)
+#define UART_BASE              EP93XX_UART1_PHYS_BASE
+#elif defined(CONFIG_EP93XX_EARLY_UART2)
+#define UART_BASE              EP93XX_UART2_PHYS_BASE
+#elif defined(CONFIG_EP93XX_EARLY_UART3)
+#define UART_BASE              EP93XX_UART3_PHYS_BASE
+#else
+#define UART_BASE              EP93XX_UART1_PHYS_BASE
+#endif
+
+#define PHYS_UART_DATA         (UART_BASE + 0x00)
+#define PHYS_UART_FLAG         (UART_BASE + 0x18)
+#define UART_FLAG_TXFF         0x20
 
 static inline void putc(int c)
 {
@@ -42,11 +51,11 @@ static inline void putc(int c)
 
        for (i = 0; i < 1000; i++) {
                /* Transmit fifo not full?  */
-               if (!(__raw_readb(PHYS_UART1_FLAG) & UART1_FLAG_TXFF))
+               if (!(__raw_readb(PHYS_UART_FLAG) & UART_FLAG_TXFF))
                        break;
        }
 
-       __raw_writeb(c, PHYS_UART1_DATA);
+       __raw_writeb(c, PHYS_UART_DATA);
 }
 
 static inline void flush(void)