aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/serial/8250.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/serial/8250.c')
-rw-r--r--drivers/serial/8250.c31
1 files changed, 31 insertions, 0 deletions
diff --git a/drivers/serial/8250.c b/drivers/serial/8250.c
index 90621c3312bc..194362d9f5a3 100644
--- a/drivers/serial/8250.c
+++ b/drivers/serial/8250.c
@@ -308,6 +308,7 @@ static unsigned int serial_in(struct uart_8250_port *up, int offset)
308 return inb(up->port.iobase + 1); 308 return inb(up->port.iobase + 1);
309 309
310 case UPIO_MEM: 310 case UPIO_MEM:
311 case UPIO_DWAPB:
311 return readb(up->port.membase + offset); 312 return readb(up->port.membase + offset);
312 313
313 case UPIO_MEM32: 314 case UPIO_MEM32:
@@ -333,6 +334,8 @@ static unsigned int serial_in(struct uart_8250_port *up, int offset)
333static void 334static void
334serial_out(struct uart_8250_port *up, int offset, int value) 335serial_out(struct uart_8250_port *up, int offset, int value)
335{ 336{
337 /* Save the offset before it's remapped */
338 int save_offset = offset;
336 offset = map_8250_out_reg(up, offset) << up->port.regshift; 339 offset = map_8250_out_reg(up, offset) << up->port.regshift;
337 340
338 switch (up->port.iotype) { 341 switch (up->port.iotype) {
@@ -359,6 +362,18 @@ serial_out(struct uart_8250_port *up, int offset, int value)
359 writeb(value, up->port.membase + offset); 362 writeb(value, up->port.membase + offset);
360 break; 363 break;
361 364
365 case UPIO_DWAPB:
366 /* Save the LCR value so it can be re-written when a
367 * Busy Detect interrupt occurs. */
368 if (save_offset == UART_LCR)
369 up->lcr = value;
370 writeb(value, up->port.membase + offset);
371 /* Read the IER to ensure any interrupt is cleared before
372 * returning from ISR. */
373 if (save_offset == UART_TX || save_offset == UART_IER)
374 value = serial_in(up, UART_IER);
375 break;
376
362 default: 377 default:
363 outb(value, up->port.iobase + offset); 378 outb(value, up->port.iobase + offset);
364 } 379 }
@@ -373,6 +388,7 @@ serial_out_sync(struct uart_8250_port *up, int offset, int value)
373#ifdef CONFIG_SERIAL_8250_AU1X00 388#ifdef CONFIG_SERIAL_8250_AU1X00
374 case UPIO_AU: 389 case UPIO_AU:
375#endif 390#endif
391 case UPIO_DWAPB:
376 serial_out(up, offset, value); 392 serial_out(up, offset, value);
377 serial_in(up, UART_LCR); /* safe, no side-effects */ 393 serial_in(up, UART_LCR); /* safe, no side-effects */
378 break; 394 break;
@@ -1389,6 +1405,19 @@ static irqreturn_t serial8250_interrupt(int irq, void *dev_id)
1389 handled = 1; 1405 handled = 1;
1390 1406
1391 end = NULL; 1407 end = NULL;
1408 } else if (up->port.iotype == UPIO_DWAPB &&
1409 (iir & UART_IIR_BUSY) == UART_IIR_BUSY) {
1410 /* The DesignWare APB UART has an Busy Detect (0x07)
1411 * interrupt meaning an LCR write attempt occured while the
1412 * UART was busy. The interrupt must be cleared by reading
1413 * the UART status register (USR) and the LCR re-written. */
1414 unsigned int status;
1415 status = *(volatile u32 *)up->port.private_data;
1416 serial_out(up, UART_LCR, up->lcr);
1417
1418 handled = 1;
1419
1420 end = NULL;
1392 } else if (end == NULL) 1421 } else if (end == NULL)
1393 end = l; 1422 end = l;
1394 1423
@@ -2090,6 +2119,7 @@ static int serial8250_request_std_resource(struct uart_8250_port *up)
2090 case UPIO_TSI: 2119 case UPIO_TSI:
2091 case UPIO_MEM32: 2120 case UPIO_MEM32:
2092 case UPIO_MEM: 2121 case UPIO_MEM:
2122 case UPIO_DWAPB:
2093 if (!up->port.mapbase) 2123 if (!up->port.mapbase)
2094 break; 2124 break;
2095 2125
@@ -2127,6 +2157,7 @@ static void serial8250_release_std_resource(struct uart_8250_port *up)
2127 case UPIO_TSI: 2157 case UPIO_TSI:
2128 case UPIO_MEM32: 2158 case UPIO_MEM32:
2129 case UPIO_MEM: 2159 case UPIO_MEM:
2160 case UPIO_DWAPB:
2130 if (!up->port.mapbase) 2161 if (!up->port.mapbase)
2131 break; 2162 break;
2132 2163