2 *This file is licensed under
3 * the terms of the GNU General Public License version 2. This program
4 * is licensed "as is" without any warranty of any kind, whether express
8 * originally from linux source (arch/ppc/boot/ns16550.h)
10 * have addresses as offsets from CFG_ISA_BASE
11 * added a few more definitions
12 * added prototypes for ns16550.c
13 * reduced no of com ports to 2
14 * modifications (c) Rob Taylor, Flying Pig Systems. 2000.
17 #if (CFG_NS16550_REG_SIZE == 1)
19 unsigned char rbr; /* 0 */
20 unsigned char ier; /* 1 */
21 unsigned char fcr; /* 2 */
22 unsigned char lcr; /* 3 */
23 unsigned char mcr; /* 4 */
24 unsigned char lsr; /* 5 */
25 unsigned char msr; /* 6 */
26 unsigned char scr; /* 7 */
27 } __attribute__ ((packed));
28 #elif (CFG_NS16550_REG_SIZE == 2)
30 unsigned short rbr; /* 0 */
31 unsigned short ier; /* 1 */
32 unsigned short fcr; /* 2 */
33 unsigned short lcr; /* 3 */
34 unsigned short mcr; /* 4 */
35 unsigned short lsr; /* 5 */
36 unsigned short msr; /* 6 */
37 unsigned short scr; /* 7 */
38 } __attribute__ ((packed));
39 #elif (CFG_NS16550_REG_SIZE == 4)
41 unsigned long rbr; /* 0 */
42 unsigned long ier; /* 1 */
43 unsigned long fcr; /* 2 */
44 unsigned long lcr; /* 3 */
45 unsigned long mcr; /* 4 */
46 unsigned long lsr; /* 5 */
47 unsigned long msr; /* 6 */
48 unsigned long scr; /* 7 */
49 } __attribute__ ((packed));
50 #elif (CFG_NS16550_REG_SIZE == -4)
52 unsigned char rbr; /* 0 */
54 unsigned char ier; /* 1 */
56 unsigned char fcr; /* 2 */
58 unsigned char lcr; /* 3 */
60 unsigned char mcr; /* 4 */
62 unsigned char lsr; /* 5 */
64 unsigned char msr; /* 6 */
66 unsigned char scr; /* 7 */
68 #if defined(CONFIG_OMAP)
69 unsigned char mdr1; /* mode select reset TL16C750*/
71 #ifdef CONFIG_OMAP1510
73 unsigned long pad[10];
74 unsigned char osc_12m_sel;
77 } __attribute__ ((packed));
79 #error "Please define NS16550 registers size."
87 typedef volatile struct NS16550 *NS16550_t;
89 #define FCR_FIFO_EN 0x01 /* Fifo enable */
90 #define FCR_RXSR 0x02 /* Receiver soft reset */
91 #define FCR_TXSR 0x04 /* Transmitter soft reset */
95 #define MCR_DMA_EN 0x04
96 #define MCR_TX_DFR 0x08
98 #define LCR_WLS_MSK 0x03 /* character length slect mask */
99 #define LCR_WLS_5 0x00 /* 5 bit character length */
100 #define LCR_WLS_6 0x01 /* 6 bit character length */
101 #define LCR_WLS_7 0x02 /* 7 bit character length */
102 #define LCR_WLS_8 0x03 /* 8 bit character length */
103 #define LCR_STB 0x04 /* Number of stop Bits, off = 1, on = 1.5 or 2) */
104 #define LCR_PEN 0x08 /* Parity eneble */
105 #define LCR_EPS 0x10 /* Even Parity Select */
106 #define LCR_STKP 0x20 /* Stick Parity */
107 #define LCR_SBRK 0x40 /* Set Break */
108 #define LCR_BKSE 0x80 /* Bank select enable */
110 #define LSR_DR 0x01 /* Data ready */
111 #define LSR_OE 0x02 /* Overrun */
112 #define LSR_PE 0x04 /* Parity error */
113 #define LSR_FE 0x08 /* Framing error */
114 #define LSR_BI 0x10 /* Break */
115 #define LSR_THRE 0x20 /* Xmit holding register empty */
116 #define LSR_TEMT 0x40 /* Xmitter empty */
117 #define LSR_ERR 0x80 /* Error */
119 #ifdef CONFIG_OMAP1510
120 #define OSC_12M_SEL 0x01 /* selects 6.5 * current clk div */
123 /* useful defaults for LCR */
126 void NS16550_init (NS16550_t com_port, int baud_divisor);
127 void NS16550_putc (NS16550_t com_port, char c);
128 char NS16550_getc (NS16550_t com_port);
129 int NS16550_tstc (NS16550_t com_port);
130 void NS16550_reinit (NS16550_t com_port, int baud_divisor);