MIPS: JZ4740: reuse UART0 address macro for vmlinuz debug port
[linux-drm-fsl-dcu.git] / arch / mips / boot / compressed / uart-16550.c
index 1c7b739b6a1dfcc9383e403307fbca269f3d43a6..869172d0a5acf6a99c515f734ba90c5fe41fcf74 100644 (file)
 #endif
 
 #ifdef CONFIG_MACH_JZ4740
-#define UART0_BASE  0xB0030000
-#define PORT(offset) (UART0_BASE + (4 * offset))
+#include <asm/mach-jz4740/base.h>
+#define PORT(offset) (CKSEG1ADDR(JZ4740_UART0_BASE_ADDR) + (4 * offset))
+#endif
+
+#ifdef CONFIG_CPU_XLR
+#define UART0_BASE  0x1EF14000
+#define PORT(offset) (CKSEG1ADDR(UART0_BASE) + (4 * offset))
+#define IOTYPE unsigned int
+#endif
+
+#ifdef CONFIG_CPU_XLP
+#define UART0_BASE  0x18030100
+#define PORT(offset) (CKSEG1ADDR(UART0_BASE) + (4 * offset))
+#define IOTYPE unsigned int
+#endif
+
+#ifndef IOTYPE
+#define IOTYPE char
 #endif
 
 #ifndef PORT
 
 static inline unsigned int serial_in(int offset)
 {
-       return *((char *)PORT(offset));
+       return *((volatile IOTYPE *)PORT(offset)) & 0xFF;
 }
 
 static inline void serial_out(int offset, int value)
 {
-       *((char *)PORT(offset)) = value;
+       *((volatile IOTYPE *)PORT(offset)) = value & 0xFF;
 }
 
 void putc(char c)
 {
-       int timeout = 1024;
+       int timeout = 1000000;
 
        while (((serial_in(UART_LSR) & UART_LSR_THRE) == 0) && (timeout-- > 0))
                ;