wdenk | 1c43771 | 2004-01-16 00:30:56 +0000 | [diff] [blame] | 1 | /*********************************************************************** |
| 2 | * |
Detlev Zundel | 200779e | 2009-04-03 11:53:01 +0200 | [diff] [blame] | 3 | * (C) Copyright 2004-2009 |
wdenk | 1c43771 | 2004-01-16 00:30:56 +0000 | [diff] [blame] | 4 | * DENX Software Engineering |
| 5 | * Wolfgang Denk, wd@denx.de |
wdenk | 1c43771 | 2004-01-16 00:30:56 +0000 | [diff] [blame] | 6 | * |
| 7 | * Simple 16550A serial driver |
| 8 | * |
| 9 | * Originally from linux source (drivers/char/ps2ser.c) |
| 10 | * |
| 11 | * Used by the PS/2 multiplexer driver (ps2mult.c) |
| 12 | * |
| 13 | ***********************************************************************/ |
| 14 | |
| 15 | #include <common.h> |
| 16 | |
wdenk | 1c43771 | 2004-01-16 00:30:56 +0000 | [diff] [blame] | 17 | #include <asm/io.h> |
| 18 | #include <asm/atomic.h> |
| 19 | #include <ps2mult.h> |
Detlev Zundel | 200779e | 2009-04-03 11:53:01 +0200 | [diff] [blame] | 20 | /* This is needed for ns16550.h */ |
| 21 | #ifndef CONFIG_SYS_NS16550_REG_SIZE |
| 22 | #define CONFIG_SYS_NS16550_REG_SIZE 1 |
Wolfgang Denk | bc8bb6d | 2006-06-16 16:40:54 +0200 | [diff] [blame] | 23 | #endif |
Detlev Zundel | 200779e | 2009-04-03 11:53:01 +0200 | [diff] [blame] | 24 | #include <ns16550.h> |
wdenk | 1c43771 | 2004-01-16 00:30:56 +0000 | [diff] [blame] | 25 | |
Wolfgang Denk | d87080b | 2006-03-31 18:32:53 +0200 | [diff] [blame] | 26 | DECLARE_GLOBAL_DATA_PTR; |
| 27 | |
wdenk | 1c43771 | 2004-01-16 00:30:56 +0000 | [diff] [blame] | 28 | /* #define DEBUG */ |
| 29 | |
| 30 | #define PS2SER_BAUD 57600 |
| 31 | |
wdenk | 7e6bf35 | 2004-12-12 22:06:17 +0000 | [diff] [blame] | 32 | #ifdef CONFIG_MPC5xxx |
| 33 | #if CONFIG_PS2SERIAL == 1 |
| 34 | #define PSC_BASE MPC5XXX_PSC1 |
| 35 | #elif CONFIG_PS2SERIAL == 2 |
| 36 | #define PSC_BASE MPC5XXX_PSC2 |
| 37 | #elif CONFIG_PS2SERIAL == 3 |
| 38 | #define PSC_BASE MPC5XXX_PSC3 |
| 39 | #elif defined(CONFIG_MGT5100) |
| 40 | #error CONFIG_PS2SERIAL must be in 1, 2 or 3 |
| 41 | #elif CONFIG_PS2SERIAL == 4 |
| 42 | #define PSC_BASE MPC5XXX_PSC4 |
| 43 | #elif CONFIG_PS2SERIAL == 5 |
| 44 | #define PSC_BASE MPC5XXX_PSC5 |
| 45 | #elif CONFIG_PS2SERIAL == 6 |
| 46 | #define PSC_BASE MPC5XXX_PSC6 |
| 47 | #else |
| 48 | #error CONFIG_PS2SERIAL must be in 1 ... 6 |
| 49 | #endif |
Wolfgang Denk | bc8bb6d | 2006-06-16 16:40:54 +0200 | [diff] [blame] | 50 | |
Wolfgang Grandegger | 1287e0c | 2008-06-05 13:12:07 +0200 | [diff] [blame] | 51 | #elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \ |
| 52 | defined(CONFIG_MPC8548) || defined(CONFIG_MPC8555) |
Wolfgang Denk | bc8bb6d | 2006-06-16 16:40:54 +0200 | [diff] [blame] | 53 | |
| 54 | #if CONFIG_PS2SERIAL == 1 |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 55 | #define COM_BASE (CONFIG_SYS_CCSRBAR+0x4500) |
Wolfgang Denk | bc8bb6d | 2006-06-16 16:40:54 +0200 | [diff] [blame] | 56 | #elif CONFIG_PS2SERIAL == 2 |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 57 | #define COM_BASE (CONFIG_SYS_CCSRBAR+0x4600) |
Wolfgang Denk | bc8bb6d | 2006-06-16 16:40:54 +0200 | [diff] [blame] | 58 | #else |
| 59 | #error CONFIG_PS2SERIAL must be in 1 ... 2 |
| 60 | #endif |
| 61 | |
Wolfgang Denk | bd3143f | 2006-07-19 14:49:35 +0200 | [diff] [blame] | 62 | #endif /* CONFIG_MPC5xxx / CONFIG_MPC8540 / other */ |
wdenk | 7e6bf35 | 2004-12-12 22:06:17 +0000 | [diff] [blame] | 63 | |
wdenk | 1c43771 | 2004-01-16 00:30:56 +0000 | [diff] [blame] | 64 | static int ps2ser_getc_hw(void); |
| 65 | static void ps2ser_interrupt(void *dev_id); |
| 66 | |
| 67 | extern struct serial_state rs_table[]; /* in serial.c */ |
Wolfgang Grandegger | 1287e0c | 2008-06-05 13:12:07 +0200 | [diff] [blame] | 68 | #if !defined(CONFIG_MPC5xxx) && !defined(CONFIG_MPC8540) && \ |
| 69 | !defined(CONFIG_MPC8541) && !defined(CONFIG_MPC8548) && \ |
| 70 | !defined(CONFIG_MPC8555) |
wdenk | ef97873 | 2004-01-21 20:46:28 +0000 | [diff] [blame] | 71 | static struct serial_state *state; |
wdenk | 7e6bf35 | 2004-12-12 22:06:17 +0000 | [diff] [blame] | 72 | #endif |
wdenk | 1c43771 | 2004-01-16 00:30:56 +0000 | [diff] [blame] | 73 | |
| 74 | static u_char ps2buf[PS2BUF_SIZE]; |
| 75 | static atomic_t ps2buf_cnt; |
| 76 | static int ps2buf_in_idx; |
| 77 | static int ps2buf_out_idx; |
| 78 | |
wdenk | 7e6bf35 | 2004-12-12 22:06:17 +0000 | [diff] [blame] | 79 | #ifdef CONFIG_MPC5xxx |
| 80 | int ps2ser_init(void) |
| 81 | { |
wdenk | 7e6bf35 | 2004-12-12 22:06:17 +0000 | [diff] [blame] | 82 | volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE; |
| 83 | unsigned long baseclk; |
| 84 | int div; |
| 85 | |
| 86 | /* reset PSC */ |
| 87 | psc->command = PSC_SEL_MODE_REG_1; |
| 88 | |
| 89 | /* select clock sources */ |
| 90 | #if defined(CONFIG_MGT5100) |
| 91 | psc->psc_clock_select = 0xdd00; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 92 | baseclk = (CONFIG_SYS_MPC5XXX_CLKIN + 16) / 32; |
wdenk | 7e6bf35 | 2004-12-12 22:06:17 +0000 | [diff] [blame] | 93 | #elif defined(CONFIG_MPC5200) |
| 94 | psc->psc_clock_select = 0; |
| 95 | baseclk = (gd->ipb_clk + 16) / 32; |
| 96 | #endif |
| 97 | |
| 98 | /* switch to UART mode */ |
| 99 | psc->sicr = 0; |
| 100 | |
| 101 | /* configure parity, bit length and so on */ |
| 102 | #if defined(CONFIG_MGT5100) |
| 103 | psc->mode = PSC_MODE_ERR | PSC_MODE_8_BITS | PSC_MODE_PARNONE; |
| 104 | #elif defined(CONFIG_MPC5200) |
| 105 | psc->mode = PSC_MODE_8_BITS | PSC_MODE_PARNONE; |
| 106 | #endif |
| 107 | psc->mode = PSC_MODE_ONE_STOP; |
| 108 | |
| 109 | /* set up UART divisor */ |
| 110 | div = (baseclk + (PS2SER_BAUD/2)) / PS2SER_BAUD; |
| 111 | psc->ctur = (div >> 8) & 0xff; |
| 112 | psc->ctlr = div & 0xff; |
| 113 | |
| 114 | /* disable all interrupts */ |
| 115 | psc->psc_imr = 0; |
| 116 | |
| 117 | /* reset and enable Rx/Tx */ |
| 118 | psc->command = PSC_RST_RX; |
| 119 | psc->command = PSC_RST_TX; |
| 120 | psc->command = PSC_RX_ENABLE | PSC_TX_ENABLE; |
| 121 | |
| 122 | return (0); |
| 123 | } |
| 124 | |
Wolfgang Grandegger | 1287e0c | 2008-06-05 13:12:07 +0200 | [diff] [blame] | 125 | #elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \ |
| 126 | defined(CONFIG_MPC8548) || defined(CONFIG_MPC8555) |
Wolfgang Denk | bc8bb6d | 2006-06-16 16:40:54 +0200 | [diff] [blame] | 127 | int ps2ser_init(void) |
| 128 | { |
| 129 | NS16550_t com_port = (NS16550_t)COM_BASE; |
| 130 | |
| 131 | com_port->ier = 0x00; |
Detlev Zundel | 200779e | 2009-04-03 11:53:01 +0200 | [diff] [blame] | 132 | com_port->lcr = UART_LCR_BKSE | UART_LCR_8N1; |
Jean-Christophe PLAGNIOL-VILLARD | 6d0f6bc | 2008-10-16 15:01:15 +0200 | [diff] [blame] | 133 | com_port->dll = (CONFIG_SYS_NS16550_CLK / 16 / PS2SER_BAUD) & 0xff; |
| 134 | com_port->dlm = ((CONFIG_SYS_NS16550_CLK / 16 / PS2SER_BAUD) >> 8) & 0xff; |
Detlev Zundel | 200779e | 2009-04-03 11:53:01 +0200 | [diff] [blame] | 135 | com_port->lcr = UART_LCR_8N1; |
| 136 | com_port->mcr = (UART_MCR_DTR | UART_MCR_RTS); |
| 137 | com_port->fcr = (UART_FCR_FIFO_EN | UART_FCR_RXSR | UART_FCR_TXSR); |
Wolfgang Denk | bc8bb6d | 2006-06-16 16:40:54 +0200 | [diff] [blame] | 138 | |
| 139 | return (0); |
| 140 | } |
| 141 | |
Wolfgang Denk | bd3143f | 2006-07-19 14:49:35 +0200 | [diff] [blame] | 142 | #else /* !CONFIG_MPC5xxx && !CONFIG_MPC8540 / other */ |
wdenk | 1c43771 | 2004-01-16 00:30:56 +0000 | [diff] [blame] | 143 | |
| 144 | static inline unsigned int ps2ser_in(int offset) |
| 145 | { |
| 146 | return readb((unsigned long) state->iomem_base + offset); |
| 147 | } |
| 148 | |
| 149 | static inline void ps2ser_out(int offset, int value) |
| 150 | { |
| 151 | writeb(value, (unsigned long) state->iomem_base + offset); |
| 152 | } |
| 153 | |
| 154 | int ps2ser_init(void) |
| 155 | { |
wdenk | ef97873 | 2004-01-21 20:46:28 +0000 | [diff] [blame] | 156 | int quot; |
| 157 | unsigned cval; |
| 158 | |
| 159 | state = rs_table + CONFIG_PS2SERIAL; |
| 160 | |
| 161 | quot = state->baud_base / PS2SER_BAUD; |
| 162 | cval = 0x3; /* 8N1 - 8 data bits, no parity bits, 1 stop bit */ |
wdenk | 1c43771 | 2004-01-16 00:30:56 +0000 | [diff] [blame] | 163 | |
| 164 | /* Set speed, enable interrupts, enable FIFO |
| 165 | */ |
| 166 | ps2ser_out(UART_LCR, cval | UART_LCR_DLAB); |
| 167 | ps2ser_out(UART_DLL, quot & 0xff); |
| 168 | ps2ser_out(UART_DLM, quot >> 8); |
| 169 | ps2ser_out(UART_LCR, cval); |
| 170 | ps2ser_out(UART_IER, UART_IER_RDI); |
| 171 | ps2ser_out(UART_MCR, UART_MCR_OUT2 | UART_MCR_DTR | UART_MCR_RTS); |
| 172 | ps2ser_out(UART_FCR, |
| 173 | UART_FCR_ENABLE_FIFO | UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT); |
| 174 | |
| 175 | /* If we read 0xff from the LSR, there is no UART here |
| 176 | */ |
| 177 | if (ps2ser_in(UART_LSR) == 0xff) { |
| 178 | printf ("ps2ser.c: no UART found\n"); |
| 179 | return -1; |
| 180 | } |
| 181 | |
| 182 | irq_install_handler(state->irq, ps2ser_interrupt, NULL); |
| 183 | |
| 184 | return 0; |
| 185 | } |
Wolfgang Denk | bd3143f | 2006-07-19 14:49:35 +0200 | [diff] [blame] | 186 | #endif /* CONFIG_MPC5xxx / CONFIG_MPC8540 / other */ |
wdenk | 1c43771 | 2004-01-16 00:30:56 +0000 | [diff] [blame] | 187 | |
| 188 | void ps2ser_putc(int chr) |
| 189 | { |
wdenk | 7e6bf35 | 2004-12-12 22:06:17 +0000 | [diff] [blame] | 190 | #ifdef CONFIG_MPC5xxx |
| 191 | volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE; |
Wolfgang Grandegger | 1287e0c | 2008-06-05 13:12:07 +0200 | [diff] [blame] | 192 | #elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \ |
| 193 | defined(CONFIG_MPC8548) || defined(CONFIG_MPC8555) |
Wolfgang Denk | bc8bb6d | 2006-06-16 16:40:54 +0200 | [diff] [blame] | 194 | NS16550_t com_port = (NS16550_t)COM_BASE; |
wdenk | 7e6bf35 | 2004-12-12 22:06:17 +0000 | [diff] [blame] | 195 | #endif |
wdenk | 1c43771 | 2004-01-16 00:30:56 +0000 | [diff] [blame] | 196 | #ifdef DEBUG |
| 197 | printf(">>>> 0x%02x\n", chr); |
| 198 | #endif |
| 199 | |
wdenk | 7e6bf35 | 2004-12-12 22:06:17 +0000 | [diff] [blame] | 200 | #ifdef CONFIG_MPC5xxx |
| 201 | while (!(psc->psc_status & PSC_SR_TXRDY)); |
wdenk | efe2a4d | 2004-12-16 21:44:03 +0000 | [diff] [blame] | 202 | |
wdenk | 7e6bf35 | 2004-12-12 22:06:17 +0000 | [diff] [blame] | 203 | psc->psc_buffer_8 = chr; |
Wolfgang Grandegger | 1287e0c | 2008-06-05 13:12:07 +0200 | [diff] [blame] | 204 | #elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \ |
| 205 | defined(CONFIG_MPC8548) || defined(CONFIG_MPC8555) |
Detlev Zundel | 200779e | 2009-04-03 11:53:01 +0200 | [diff] [blame] | 206 | while ((com_port->lsr & UART_LSR_THRE) == 0); |
Wolfgang Denk | bc8bb6d | 2006-06-16 16:40:54 +0200 | [diff] [blame] | 207 | com_port->thr = chr; |
wdenk | 7e6bf35 | 2004-12-12 22:06:17 +0000 | [diff] [blame] | 208 | #else |
wdenk | 1c43771 | 2004-01-16 00:30:56 +0000 | [diff] [blame] | 209 | while (!(ps2ser_in(UART_LSR) & UART_LSR_THRE)); |
| 210 | |
| 211 | ps2ser_out(UART_TX, chr); |
wdenk | 7e6bf35 | 2004-12-12 22:06:17 +0000 | [diff] [blame] | 212 | #endif |
wdenk | 1c43771 | 2004-01-16 00:30:56 +0000 | [diff] [blame] | 213 | } |
| 214 | |
| 215 | static int ps2ser_getc_hw(void) |
| 216 | { |
wdenk | 7e6bf35 | 2004-12-12 22:06:17 +0000 | [diff] [blame] | 217 | #ifdef CONFIG_MPC5xxx |
| 218 | volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE; |
Wolfgang Grandegger | 1287e0c | 2008-06-05 13:12:07 +0200 | [diff] [blame] | 219 | #elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \ |
| 220 | defined(CONFIG_MPC8548) || defined(CONFIG_MPC8555) |
Wolfgang Denk | bc8bb6d | 2006-06-16 16:40:54 +0200 | [diff] [blame] | 221 | NS16550_t com_port = (NS16550_t)COM_BASE; |
wdenk | 7e6bf35 | 2004-12-12 22:06:17 +0000 | [diff] [blame] | 222 | #endif |
wdenk | 1c43771 | 2004-01-16 00:30:56 +0000 | [diff] [blame] | 223 | int res = -1; |
| 224 | |
wdenk | 7e6bf35 | 2004-12-12 22:06:17 +0000 | [diff] [blame] | 225 | #ifdef CONFIG_MPC5xxx |
| 226 | if (psc->psc_status & PSC_SR_RXRDY) { |
| 227 | res = (psc->psc_buffer_8); |
| 228 | } |
Wolfgang Grandegger | 1287e0c | 2008-06-05 13:12:07 +0200 | [diff] [blame] | 229 | #elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \ |
| 230 | defined(CONFIG_MPC8548) || defined(CONFIG_MPC8555) |
Detlev Zundel | 200779e | 2009-04-03 11:53:01 +0200 | [diff] [blame] | 231 | if (com_port->lsr & UART_LSR_DR) { |
Wolfgang Denk | bc8bb6d | 2006-06-16 16:40:54 +0200 | [diff] [blame] | 232 | res = com_port->rbr; |
| 233 | } |
wdenk | 7e6bf35 | 2004-12-12 22:06:17 +0000 | [diff] [blame] | 234 | #else |
wdenk | 1c43771 | 2004-01-16 00:30:56 +0000 | [diff] [blame] | 235 | if (ps2ser_in(UART_LSR) & UART_LSR_DR) { |
| 236 | res = (ps2ser_in(UART_RX)); |
| 237 | } |
wdenk | 7e6bf35 | 2004-12-12 22:06:17 +0000 | [diff] [blame] | 238 | #endif |
wdenk | 1c43771 | 2004-01-16 00:30:56 +0000 | [diff] [blame] | 239 | |
| 240 | return res; |
| 241 | } |
| 242 | |
| 243 | int ps2ser_getc(void) |
| 244 | { |
| 245 | volatile int chr; |
| 246 | int flags; |
| 247 | |
| 248 | #ifdef DEBUG |
| 249 | printf("<< "); |
| 250 | #endif |
| 251 | |
| 252 | flags = disable_interrupts(); |
| 253 | |
| 254 | do { |
| 255 | if (atomic_read(&ps2buf_cnt) != 0) { |
| 256 | chr = ps2buf[ps2buf_out_idx++]; |
| 257 | ps2buf_out_idx &= (PS2BUF_SIZE - 1); |
| 258 | atomic_dec(&ps2buf_cnt); |
| 259 | } else { |
| 260 | chr = ps2ser_getc_hw(); |
| 261 | } |
| 262 | } |
| 263 | while (chr < 0); |
| 264 | |
| 265 | if (flags) enable_interrupts(); |
| 266 | |
| 267 | #ifdef DEBUG |
| 268 | printf("0x%02x\n", chr); |
| 269 | #endif |
| 270 | |
| 271 | return chr; |
| 272 | } |
| 273 | |
| 274 | int ps2ser_check(void) |
| 275 | { |
| 276 | int flags; |
| 277 | |
| 278 | flags = disable_interrupts(); |
| 279 | ps2ser_interrupt(NULL); |
| 280 | if (flags) enable_interrupts(); |
| 281 | |
| 282 | return atomic_read(&ps2buf_cnt); |
| 283 | } |
| 284 | |
| 285 | static void ps2ser_interrupt(void *dev_id) |
| 286 | { |
wdenk | 7e6bf35 | 2004-12-12 22:06:17 +0000 | [diff] [blame] | 287 | #ifdef CONFIG_MPC5xxx |
| 288 | volatile struct mpc5xxx_psc *psc = (struct mpc5xxx_psc *)PSC_BASE; |
Wolfgang Grandegger | 1287e0c | 2008-06-05 13:12:07 +0200 | [diff] [blame] | 289 | #elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \ |
| 290 | defined(CONFIG_MPC8548) || defined(CONFIG_MPC8555) |
Wolfgang Denk | bc8bb6d | 2006-06-16 16:40:54 +0200 | [diff] [blame] | 291 | NS16550_t com_port = (NS16550_t)COM_BASE; |
wdenk | 7e6bf35 | 2004-12-12 22:06:17 +0000 | [diff] [blame] | 292 | #endif |
wdenk | 1c43771 | 2004-01-16 00:30:56 +0000 | [diff] [blame] | 293 | int chr; |
wdenk | 7e6bf35 | 2004-12-12 22:06:17 +0000 | [diff] [blame] | 294 | int status; |
wdenk | 1c43771 | 2004-01-16 00:30:56 +0000 | [diff] [blame] | 295 | |
| 296 | do { |
| 297 | chr = ps2ser_getc_hw(); |
wdenk | 7e6bf35 | 2004-12-12 22:06:17 +0000 | [diff] [blame] | 298 | #ifdef CONFIG_MPC5xxx |
| 299 | status = psc->psc_status; |
Wolfgang Grandegger | 1287e0c | 2008-06-05 13:12:07 +0200 | [diff] [blame] | 300 | #elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \ |
| 301 | defined(CONFIG_MPC8548) || defined(CONFIG_MPC8555) |
Wolfgang Denk | bc8bb6d | 2006-06-16 16:40:54 +0200 | [diff] [blame] | 302 | status = com_port->lsr; |
wdenk | 7e6bf35 | 2004-12-12 22:06:17 +0000 | [diff] [blame] | 303 | #else |
| 304 | status = ps2ser_in(UART_IIR); |
| 305 | #endif |
wdenk | 1c43771 | 2004-01-16 00:30:56 +0000 | [diff] [blame] | 306 | if (chr < 0) continue; |
| 307 | |
| 308 | if (atomic_read(&ps2buf_cnt) < PS2BUF_SIZE) { |
| 309 | ps2buf[ps2buf_in_idx++] = chr; |
| 310 | ps2buf_in_idx &= (PS2BUF_SIZE - 1); |
| 311 | atomic_inc(&ps2buf_cnt); |
| 312 | } else { |
| 313 | printf ("ps2ser.c: buffer overflow\n"); |
| 314 | } |
wdenk | 7e6bf35 | 2004-12-12 22:06:17 +0000 | [diff] [blame] | 315 | #ifdef CONFIG_MPC5xxx |
wdenk | efe2a4d | 2004-12-16 21:44:03 +0000 | [diff] [blame] | 316 | } while (status & PSC_SR_RXRDY); |
Wolfgang Grandegger | 1287e0c | 2008-06-05 13:12:07 +0200 | [diff] [blame] | 317 | #elif defined(CONFIG_MPC8540) || defined(CONFIG_MPC8541) || \ |
| 318 | defined(CONFIG_MPC8548) || defined(CONFIG_MPC8555) |
Detlev Zundel | 200779e | 2009-04-03 11:53:01 +0200 | [diff] [blame] | 319 | } while (status & UART_LSR_DR); |
wdenk | 7e6bf35 | 2004-12-12 22:06:17 +0000 | [diff] [blame] | 320 | #else |
| 321 | } while (status & UART_IIR_RDI); |
| 322 | #endif |
wdenk | 1c43771 | 2004-01-16 00:30:56 +0000 | [diff] [blame] | 323 | |
| 324 | if (atomic_read(&ps2buf_cnt)) { |
| 325 | ps2mult_callback(atomic_read(&ps2buf_cnt)); |
| 326 | } |
| 327 | } |