ARM: at91: uncompress Store UART address in a variable
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Wed, 15 Feb 2012 10:35:40 +0000 (18:35 +0800)
committerNicolas Ferre <nicolas.ferre@atmel.com>
Tue, 17 Apr 2012 08:58:03 +0000 (10:58 +0200)
This will allow a future change to auto-detect which UART to use.

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
arch/arm/mach-at91/include/mach/uncompress.h

index 4218647c1fcd3279a39bb83b8b38eb7cdb5aa743..d985af7c94bd571b42813df87d50490c09ef7f83 100644 (file)
 #define UART_OFFSET AT91_USART5
 #endif
 
+void __iomem *at91_uart;
+
+static inline void arch_decomp_setup(void)
+{
+#ifdef UART_OFFSET
+       at91_uart = (void __iomem *) UART_OFFSET;       /* physical address */
+#endif
+}
 /*
  * The following code assumes the serial port has already been
  * initialized by the bootloader.  If you didn't setup a port in
 static void putc(int c)
 {
 #ifdef UART_OFFSET
-       void __iomem *sys = (void __iomem *) UART_OFFSET;       /* physical address */
-
-       while (!(__raw_readl(sys + ATMEL_US_CSR) & ATMEL_US_TXRDY))
+       while (!(__raw_readl(at91_uart + ATMEL_US_CSR) & ATMEL_US_TXRDY))
                barrier();
-       __raw_writel(c, sys + ATMEL_US_THR);
+       __raw_writel(c, at91_uart + ATMEL_US_THR);
 #endif
 }
 
 static inline void flush(void)
 {
 #ifdef UART_OFFSET
-       void __iomem *sys = (void __iomem *) UART_OFFSET;       /* physical address */
-
        /* wait for transmission to complete */
-       while (!(__raw_readl(sys + ATMEL_US_CSR) & ATMEL_US_TXEMPTY))
+       while (!(__raw_readl(at91_uart + ATMEL_US_CSR) & ATMEL_US_TXEMPTY))
                barrier();
 #endif
 }
 
-#define arch_decomp_setup()
-
 #define arch_decomp_wdog()
 
 #endif
This page took 0.026613 seconds and 5 git commands to generate.