diff options
Diffstat (limited to 'drivers/serial')
-rw-r--r-- | drivers/serial/atmel_serial.c | 17 | ||||
-rw-r--r-- | drivers/serial/sh-sci.c | 22 | ||||
-rw-r--r-- | drivers/serial/sh-sci.h | 16 |
3 files changed, 34 insertions, 21 deletions
diff --git a/drivers/serial/atmel_serial.c b/drivers/serial/atmel_serial.c index 61fb8b6d19af..d5efd6c77904 100644 --- a/drivers/serial/atmel_serial.c +++ b/drivers/serial/atmel_serial.c | |||
@@ -1258,6 +1258,8 @@ static void __devinit atmel_init_port(struct atmel_uart_port *atmel_port, | |||
1258 | atmel_port->clk = clk_get(&pdev->dev, "usart"); | 1258 | atmel_port->clk = clk_get(&pdev->dev, "usart"); |
1259 | clk_enable(atmel_port->clk); | 1259 | clk_enable(atmel_port->clk); |
1260 | port->uartclk = clk_get_rate(atmel_port->clk); | 1260 | port->uartclk = clk_get_rate(atmel_port->clk); |
1261 | clk_disable(atmel_port->clk); | ||
1262 | /* only enable clock when USART is in use */ | ||
1261 | } | 1263 | } |
1262 | 1264 | ||
1263 | atmel_port->use_dma_rx = data->use_dma_rx; | 1265 | atmel_port->use_dma_rx = data->use_dma_rx; |
@@ -1379,6 +1381,8 @@ static int __init atmel_console_setup(struct console *co, char *options) | |||
1379 | return -ENODEV; | 1381 | return -ENODEV; |
1380 | } | 1382 | } |
1381 | 1383 | ||
1384 | clk_enable(atmel_ports[co->index].clk); | ||
1385 | |||
1382 | UART_PUT_IDR(port, -1); | 1386 | UART_PUT_IDR(port, -1); |
1383 | UART_PUT_CR(port, ATMEL_US_RSTSTA | ATMEL_US_RSTRX); | 1387 | UART_PUT_CR(port, ATMEL_US_RSTSTA | ATMEL_US_RSTRX); |
1384 | UART_PUT_CR(port, ATMEL_US_TXEN | ATMEL_US_RXEN); | 1388 | UART_PUT_CR(port, ATMEL_US_TXEN | ATMEL_US_RXEN); |
@@ -1403,7 +1407,7 @@ static struct console atmel_console = { | |||
1403 | .data = &atmel_uart, | 1407 | .data = &atmel_uart, |
1404 | }; | 1408 | }; |
1405 | 1409 | ||
1406 | #define ATMEL_CONSOLE_DEVICE &atmel_console | 1410 | #define ATMEL_CONSOLE_DEVICE (&atmel_console) |
1407 | 1411 | ||
1408 | /* | 1412 | /* |
1409 | * Early console initialization (before VM subsystem initialized). | 1413 | * Early console initialization (before VM subsystem initialized). |
@@ -1534,6 +1538,15 @@ static int __devinit atmel_serial_probe(struct platform_device *pdev) | |||
1534 | if (ret) | 1538 | if (ret) |
1535 | goto err_add_port; | 1539 | goto err_add_port; |
1536 | 1540 | ||
1541 | if (atmel_is_console_port(&port->uart) | ||
1542 | && ATMEL_CONSOLE_DEVICE->flags & CON_ENABLED) { | ||
1543 | /* | ||
1544 | * The serial core enabled the clock for us, so undo | ||
1545 | * the clk_enable() in atmel_console_setup() | ||
1546 | */ | ||
1547 | clk_disable(port->clk); | ||
1548 | } | ||
1549 | |||
1537 | device_init_wakeup(&pdev->dev, 1); | 1550 | device_init_wakeup(&pdev->dev, 1); |
1538 | platform_set_drvdata(pdev, port); | 1551 | platform_set_drvdata(pdev, port); |
1539 | 1552 | ||
@@ -1544,7 +1557,6 @@ err_add_port: | |||
1544 | port->rx_ring.buf = NULL; | 1557 | port->rx_ring.buf = NULL; |
1545 | err_alloc_ring: | 1558 | err_alloc_ring: |
1546 | if (!atmel_is_console_port(&port->uart)) { | 1559 | if (!atmel_is_console_port(&port->uart)) { |
1547 | clk_disable(port->clk); | ||
1548 | clk_put(port->clk); | 1560 | clk_put(port->clk); |
1549 | port->clk = NULL; | 1561 | port->clk = NULL; |
1550 | } | 1562 | } |
@@ -1568,7 +1580,6 @@ static int __devexit atmel_serial_remove(struct platform_device *pdev) | |||
1568 | 1580 | ||
1569 | /* "port" is allocated statically, so we shouldn't free it */ | 1581 | /* "port" is allocated statically, so we shouldn't free it */ |
1570 | 1582 | ||
1571 | clk_disable(atmel_port->clk); | ||
1572 | clk_put(atmel_port->clk); | 1583 | clk_put(atmel_port->clk); |
1573 | 1584 | ||
1574 | return ret; | 1585 | return ret; |
diff --git a/drivers/serial/sh-sci.c b/drivers/serial/sh-sci.c index 5c0f32c7fbf6..165fc010978c 100644 --- a/drivers/serial/sh-sci.c +++ b/drivers/serial/sh-sci.c | |||
@@ -144,9 +144,9 @@ static void put_char(struct uart_port *port, char c) | |||
144 | status = sci_in(port, SCxSR); | 144 | status = sci_in(port, SCxSR); |
145 | } while (!(status & SCxSR_TDxE(port))); | 145 | } while (!(status & SCxSR_TDxE(port))); |
146 | 146 | ||
147 | sci_out(port, SCxTDR, c); | ||
148 | sci_in(port, SCxSR); /* Dummy read */ | 147 | sci_in(port, SCxSR); /* Dummy read */ |
149 | sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port)); | 148 | sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port)); |
149 | sci_out(port, SCxTDR, c); | ||
150 | 150 | ||
151 | spin_unlock_irqrestore(&port->lock, flags); | 151 | spin_unlock_irqrestore(&port->lock, flags); |
152 | } | 152 | } |
@@ -478,10 +478,10 @@ static void sci_transmit_chars(struct uart_port *port) | |||
478 | return; | 478 | return; |
479 | } | 479 | } |
480 | 480 | ||
481 | if (port->type == PORT_SCIF) | 481 | if (port->type == PORT_SCI) |
482 | count = scif_txroom(port); | ||
483 | else | ||
484 | count = sci_txroom(port); | 482 | count = sci_txroom(port); |
483 | else | ||
484 | count = scif_txroom(port); | ||
485 | 485 | ||
486 | do { | 486 | do { |
487 | unsigned char c; | 487 | unsigned char c; |
@@ -510,7 +510,7 @@ static void sci_transmit_chars(struct uart_port *port) | |||
510 | } else { | 510 | } else { |
511 | ctrl = sci_in(port, SCSCR); | 511 | ctrl = sci_in(port, SCSCR); |
512 | 512 | ||
513 | if (port->type == PORT_SCIF) { | 513 | if (port->type != PORT_SCI) { |
514 | sci_in(port, SCxSR); /* Dummy read */ | 514 | sci_in(port, SCxSR); /* Dummy read */ |
515 | sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port)); | 515 | sci_out(port, SCxSR, SCxSR_TDxE_CLEAR(port)); |
516 | } | 516 | } |
@@ -536,10 +536,10 @@ static inline void sci_receive_chars(struct uart_port *port) | |||
536 | return; | 536 | return; |
537 | 537 | ||
538 | while (1) { | 538 | while (1) { |
539 | if (port->type == PORT_SCIF) | 539 | if (port->type == PORT_SCI) |
540 | count = scif_rxroom(port); | ||
541 | else | ||
542 | count = sci_rxroom(port); | 540 | count = sci_rxroom(port); |
541 | else | ||
542 | count = scif_rxroom(port); | ||
543 | 543 | ||
544 | /* Don't copy more bytes than there is room for in the buffer */ | 544 | /* Don't copy more bytes than there is room for in the buffer */ |
545 | count = tty_buffer_request_room(tty, count); | 545 | count = tty_buffer_request_room(tty, count); |
@@ -714,7 +714,7 @@ static inline int sci_handle_breaks(struct uart_port *port) | |||
714 | 714 | ||
715 | #if defined(SCIF_ORER) | 715 | #if defined(SCIF_ORER) |
716 | /* XXX: Handle SCIF overrun error */ | 716 | /* XXX: Handle SCIF overrun error */ |
717 | if (port->type == PORT_SCIF && (sci_in(port, SCLSR) & SCIF_ORER) != 0) { | 717 | if (port->type != PORT_SCI && (sci_in(port, SCLSR) & SCIF_ORER) != 0) { |
718 | sci_out(port, SCLSR, 0); | 718 | sci_out(port, SCLSR, 0); |
719 | if (tty_insert_flip_char(tty, 0, TTY_OVERRUN)) { | 719 | if (tty_insert_flip_char(tty, 0, TTY_OVERRUN)) { |
720 | copied++; | 720 | copied++; |
@@ -1042,7 +1042,7 @@ static void sci_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1042 | 1042 | ||
1043 | sci_out(port, SCSCR, 0x00); /* TE=0, RE=0, CKE1=0 */ | 1043 | sci_out(port, SCSCR, 0x00); /* TE=0, RE=0, CKE1=0 */ |
1044 | 1044 | ||
1045 | if (port->type == PORT_SCIF) | 1045 | if (port->type != PORT_SCI) |
1046 | sci_out(port, SCFCR, SCFCR_RFRST | SCFCR_TFRST); | 1046 | sci_out(port, SCFCR, SCFCR_RFRST | SCFCR_TFRST); |
1047 | 1047 | ||
1048 | smr_val = sci_in(port, SCSMR) & 3; | 1048 | smr_val = sci_in(port, SCSMR) & 3; |
@@ -1085,6 +1085,7 @@ static const char *sci_type(struct uart_port *port) | |||
1085 | case PORT_SCI: return "sci"; | 1085 | case PORT_SCI: return "sci"; |
1086 | case PORT_SCIF: return "scif"; | 1086 | case PORT_SCIF: return "scif"; |
1087 | case PORT_IRDA: return "irda"; | 1087 | case PORT_IRDA: return "irda"; |
1088 | case PORT_SCIFA: return "scifa"; | ||
1088 | } | 1089 | } |
1089 | 1090 | ||
1090 | return NULL; | 1091 | return NULL; |
@@ -1112,6 +1113,7 @@ static void sci_config_port(struct uart_port *port, int flags) | |||
1112 | s->init_pins = sci_init_pins_sci; | 1113 | s->init_pins = sci_init_pins_sci; |
1113 | break; | 1114 | break; |
1114 | case PORT_SCIF: | 1115 | case PORT_SCIF: |
1116 | case PORT_SCIFA: | ||
1115 | s->init_pins = sci_init_pins_scif; | 1117 | s->init_pins = sci_init_pins_scif; |
1116 | break; | 1118 | break; |
1117 | case PORT_IRDA: | 1119 | case PORT_IRDA: |
diff --git a/drivers/serial/sh-sci.h b/drivers/serial/sh-sci.h index 6163a45f968f..9f33b064172e 100644 --- a/drivers/serial/sh-sci.h +++ b/drivers/serial/sh-sci.h | |||
@@ -289,18 +289,18 @@ | |||
289 | #define CPU_SCIx_FNS(name, sci_offset, sci_size, scif_offset, scif_size)\ | 289 | #define CPU_SCIx_FNS(name, sci_offset, sci_size, scif_offset, scif_size)\ |
290 | static inline unsigned int sci_##name##_in(struct uart_port *port) \ | 290 | static inline unsigned int sci_##name##_in(struct uart_port *port) \ |
291 | { \ | 291 | { \ |
292 | if (port->type == PORT_SCI) { \ | 292 | if (port->type == PORT_SCIF) { \ |
293 | SCI_IN(sci_size, sci_offset) \ | 293 | SCI_IN(scif_size, scif_offset) \ |
294 | } else { \ | 294 | } else { /* PORT_SCI or PORT_SCIFA */ \ |
295 | SCI_IN(scif_size, scif_offset); \ | 295 | SCI_IN(sci_size, sci_offset); \ |
296 | } \ | 296 | } \ |
297 | } \ | 297 | } \ |
298 | static inline void sci_##name##_out(struct uart_port *port, unsigned int value) \ | 298 | static inline void sci_##name##_out(struct uart_port *port, unsigned int value) \ |
299 | { \ | 299 | { \ |
300 | if (port->type == PORT_SCI) { \ | 300 | if (port->type == PORT_SCIF) { \ |
301 | SCI_OUT(sci_size, sci_offset, value) \ | 301 | SCI_OUT(scif_size, scif_offset, value) \ |
302 | } else { \ | 302 | } else { /* PORT_SCI or PORT_SCIFA */ \ |
303 | SCI_OUT(scif_size, scif_offset, value); \ | 303 | SCI_OUT(sci_size, sci_offset, value); \ |
304 | } \ | 304 | } \ |
305 | } | 305 | } |
306 | 306 | ||