3 * originally from linux source (arch/ppc/boot/ns16550.h)
5 * have addresses as offsets from CFG_ISA_BASE
6 * added a few more definitions
7 * added prototypes for ns16550.c
8 * reduced no of com ports to 2
9 * modifications (c) Rob Taylor, Flying Pig Systems. 2000.
11 * added support for port on 64-bit bus
12 * by Richard Danter (richard.danter@windriver.com), (C) 2005 Wind River Systems
15 #if (CFG_NS16550_REG_SIZE == 1)
17 unsigned char rbr
; /* 0 */
18 unsigned char ier
; /* 1 */
19 unsigned char fcr
; /* 2 */
20 unsigned char lcr
; /* 3 */
21 unsigned char mcr
; /* 4 */
22 unsigned char lsr
; /* 5 */
23 unsigned char msr
; /* 6 */
24 unsigned char scr
; /* 7 */
25 #if defined(CONFIG_OMAP730)
26 unsigned char mdr1
; /* 8 */
27 unsigned char reg9
; /* 9 */
28 unsigned char regA
; /* A */
29 unsigned char regB
; /* B */
30 unsigned char regC
; /* C */
31 unsigned char regD
; /* D */
32 unsigned char regE
; /* E */
33 unsigned char regF
; /* F */
34 unsigned char reg10
; /* 10 */
35 unsigned char ssr
; /* 11*/
37 } __attribute__ ((packed
));
38 #elif (CFG_NS16550_REG_SIZE == 2)
40 unsigned short rbr
; /* 0 */
41 unsigned short ier
; /* 1 */
42 unsigned short fcr
; /* 2 */
43 unsigned short lcr
; /* 3 */
44 unsigned short mcr
; /* 4 */
45 unsigned short lsr
; /* 5 */
46 unsigned short msr
; /* 6 */
47 unsigned short scr
; /* 7 */
48 } __attribute__ ((packed
));
49 #elif (CFG_NS16550_REG_SIZE == 4)
51 unsigned long rbr
; /* 0 r */
52 unsigned long ier
; /* 1 rw */
53 unsigned long fcr
; /* 2 w */
54 unsigned long lcr
; /* 3 rw */
55 unsigned long mcr
; /* 4 rw */
56 unsigned long lsr
; /* 5 r */
57 unsigned long msr
; /* 6 r */
58 unsigned long scr
; /* 7 rw */
59 }; /* No need to pack an already aligned struct */
60 #elif (CFG_NS16550_REG_SIZE == -4)
62 unsigned char rbr
; /* 0 */
64 unsigned char ier
; /* 1 */
66 unsigned char fcr
; /* 2 */
68 unsigned char lcr
; /* 3 */
70 unsigned char mcr
; /* 4 */
72 unsigned char lsr
; /* 5 */
74 unsigned char msr
; /* 6 */
76 unsigned char scr
; /* 7 */
78 #if defined(CONFIG_OMAP)
79 unsigned char mdr1
; /* mode select reset TL16C750*/
81 #ifdef CONFIG_OMAP1510
83 unsigned long pad
[10];
84 unsigned char osc_12m_sel
;
87 } __attribute__ ((packed
));
88 #elif (CFG_NS16550_REG_SIZE == -8)
90 unsigned char rbr
; /* 0 */
91 unsigned char pad0
[7];
92 unsigned char ier
; /* 1 */
93 unsigned char pad1
[7];
94 unsigned char fcr
; /* 2 */
95 unsigned char pad2
[7];
96 unsigned char lcr
; /* 3 */
97 unsigned char pad3
[7];
98 unsigned char mcr
; /* 4 */
99 unsigned char pad4
[7];
100 unsigned char lsr
; /* 5 */
101 unsigned char pad5
[7];
102 unsigned char msr
; /* 6 */
103 unsigned char pad6
[7];
104 unsigned char scr
; /* 7 */
105 unsigned char pad7
[7];
106 } __attribute__ ((packed
));
108 #error "Please define NS16550 registers size."
116 typedef volatile struct NS16550
*NS16550_t
;
118 #define FCR_FIFO_EN 0x01 /* Fifo enable */
119 #define FCR_RXSR 0x02 /* Receiver soft reset */
120 #define FCR_TXSR 0x04 /* Transmitter soft reset */
124 #define MCR_DMA_EN 0x04
125 #define MCR_TX_DFR 0x08
127 #define LCR_WLS_MSK 0x03 /* character length select mask */
128 #define LCR_WLS_5 0x00 /* 5 bit character length */
129 #define LCR_WLS_6 0x01 /* 6 bit character length */
130 #define LCR_WLS_7 0x02 /* 7 bit character length */
131 #define LCR_WLS_8 0x03 /* 8 bit character length */
132 #define LCR_STB 0x04 /* Number of stop Bits, off = 1, on = 1.5 or 2) */
133 #define LCR_PEN 0x08 /* Parity eneble */
134 #define LCR_EPS 0x10 /* Even Parity Select */
135 #define LCR_STKP 0x20 /* Stick Parity */
136 #define LCR_SBRK 0x40 /* Set Break */
137 #define LCR_BKSE 0x80 /* Bank select enable */
139 #define LSR_DR 0x01 /* Data ready */
140 #define LSR_OE 0x02 /* Overrun */
141 #define LSR_PE 0x04 /* Parity error */
142 #define LSR_FE 0x08 /* Framing error */
143 #define LSR_BI 0x10 /* Break */
144 #define LSR_THRE 0x20 /* Xmit holding register empty */
145 #define LSR_TEMT 0x40 /* Xmitter empty */
146 #define LSR_ERR 0x80 /* Error */
148 #ifdef CONFIG_OMAP1510
149 #define OSC_12M_SEL 0x01 /* selects 6.5 * current clk div */
152 /* useful defaults for LCR */
155 void NS16550_init (NS16550_t com_port
, int baud_divisor
);
156 void NS16550_putc (NS16550_t com_port
, char c
);
157 char NS16550_getc (NS16550_t com_port
);
158 int NS16550_tstc (NS16550_t com_port
);
159 void NS16550_reinit (NS16550_t com_port
, int baud_divisor
);