2 * 16550 compatible uart based serial debug support for zboot
5 #include <linux/types.h>
6 #include <linux/serial_reg.h>
8 #include <asm/addrspace.h>
10 #if defined(CONFIG_MACH_LOONGSON64) || defined(CONFIG_MIPS_MALTA)
11 #define UART_BASE 0x1fd003f8
12 #define PORT(offset) (CKSEG1ADDR(UART_BASE) + (offset))
17 #define PORT(offset) (CKSEG1ADDR(AR7_REGS_UART0) + (4 * offset))
20 #ifdef CONFIG_MACH_JZ4740
21 #include <asm/mach-jz4740/base.h>
22 #define PORT(offset) (CKSEG1ADDR(JZ4740_UART0_BASE_ADDR) + (4 * offset))
26 #define UART0_BASE 0x1EF14000
27 #define PORT(offset) (CKSEG1ADDR(UART0_BASE) + (4 * offset))
28 #define IOTYPE unsigned int
32 #define UART0_BASE 0x18030100
33 #define PORT(offset) (CKSEG1ADDR(UART0_BASE) + (4 * offset))
34 #define IOTYPE unsigned int
42 #error please define the serial port address for your own machine
45 static inline unsigned int serial_in(int offset
)
47 return *((volatile IOTYPE
*)PORT(offset
)) & 0xFF;
50 static inline void serial_out(int offset
, int value
)
52 *((volatile IOTYPE
*)PORT(offset
)) = value
& 0xFF;
57 int timeout
= 1000000;
59 while (((serial_in(UART_LSR
) & UART_LSR_THRE
) == 0) && (timeout
-- > 0))
62 serial_out(UART_TX
, c
);