diff options
Diffstat (limited to 'drivers/tty/serial/sh-sci.c')
| -rw-r--r-- | drivers/tty/serial/sh-sci.c | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/drivers/tty/serial/sh-sci.c b/drivers/tty/serial/sh-sci.c index 7d8103cd3e2e..1a3fc7a2e4db 100644 --- a/drivers/tty/serial/sh-sci.c +++ b/drivers/tty/serial/sh-sci.c | |||
| @@ -421,9 +421,9 @@ static void sci_port_enable(struct sci_port *sci_port) | |||
| 421 | 421 | ||
| 422 | pm_runtime_get_sync(sci_port->port.dev); | 422 | pm_runtime_get_sync(sci_port->port.dev); |
| 423 | 423 | ||
| 424 | clk_enable(sci_port->iclk); | 424 | clk_prepare_enable(sci_port->iclk); |
| 425 | sci_port->port.uartclk = clk_get_rate(sci_port->iclk); | 425 | sci_port->port.uartclk = clk_get_rate(sci_port->iclk); |
| 426 | clk_enable(sci_port->fclk); | 426 | clk_prepare_enable(sci_port->fclk); |
| 427 | } | 427 | } |
| 428 | 428 | ||
| 429 | static void sci_port_disable(struct sci_port *sci_port) | 429 | static void sci_port_disable(struct sci_port *sci_port) |
| @@ -431,8 +431,16 @@ static void sci_port_disable(struct sci_port *sci_port) | |||
| 431 | if (!sci_port->port.dev) | 431 | if (!sci_port->port.dev) |
| 432 | return; | 432 | return; |
| 433 | 433 | ||
| 434 | clk_disable(sci_port->fclk); | 434 | /* Cancel the break timer to ensure that the timer handler will not try |
| 435 | clk_disable(sci_port->iclk); | 435 | * to access the hardware with clocks and power disabled. Reset the |
| 436 | * break flag to make the break debouncing state machine ready for the | ||
| 437 | * next break. | ||
| 438 | */ | ||
| 439 | del_timer_sync(&sci_port->break_timer); | ||
| 440 | sci_port->break_flag = 0; | ||
| 441 | |||
| 442 | clk_disable_unprepare(sci_port->fclk); | ||
| 443 | clk_disable_unprepare(sci_port->iclk); | ||
| 436 | 444 | ||
| 437 | pm_runtime_put_sync(sci_port->port.dev); | 445 | pm_runtime_put_sync(sci_port->port.dev); |
| 438 | } | 446 | } |
| @@ -557,7 +565,7 @@ static inline int sci_rxd_in(struct uart_port *port) | |||
| 557 | return 1; | 565 | return 1; |
| 558 | 566 | ||
| 559 | /* Cast for ARM damage */ | 567 | /* Cast for ARM damage */ |
| 560 | return !!__raw_readb((void __iomem *)s->cfg->port_reg); | 568 | return !!__raw_readb((void __iomem *)(uintptr_t)s->cfg->port_reg); |
| 561 | } | 569 | } |
| 562 | 570 | ||
| 563 | /* ********************************************************************** * | 571 | /* ********************************************************************** * |
| @@ -733,8 +741,6 @@ static void sci_break_timer(unsigned long data) | |||
| 733 | { | 741 | { |
| 734 | struct sci_port *port = (struct sci_port *)data; | 742 | struct sci_port *port = (struct sci_port *)data; |
| 735 | 743 | ||
| 736 | sci_port_enable(port); | ||
| 737 | |||
| 738 | if (sci_rxd_in(&port->port) == 0) { | 744 | if (sci_rxd_in(&port->port) == 0) { |
| 739 | port->break_flag = 1; | 745 | port->break_flag = 1; |
| 740 | sci_schedule_break_timer(port); | 746 | sci_schedule_break_timer(port); |
| @@ -744,8 +750,6 @@ static void sci_break_timer(unsigned long data) | |||
| 744 | sci_schedule_break_timer(port); | 750 | sci_schedule_break_timer(port); |
| 745 | } else | 751 | } else |
| 746 | port->break_flag = 0; | 752 | port->break_flag = 0; |
| 747 | |||
| 748 | sci_port_disable(port); | ||
| 749 | } | 753 | } |
| 750 | 754 | ||
| 751 | static int sci_handle_errors(struct uart_port *port) | 755 | static int sci_handle_errors(struct uart_port *port) |
| @@ -1309,7 +1313,7 @@ static int sci_dma_rx_push(struct sci_port *s, size_t count) | |||
| 1309 | } | 1313 | } |
| 1310 | 1314 | ||
| 1311 | if (room < count) | 1315 | if (room < count) |
| 1312 | dev_warn(port->dev, "Rx overrun: dropping %u bytes\n", | 1316 | dev_warn(port->dev, "Rx overrun: dropping %zu bytes\n", |
| 1313 | count - room); | 1317 | count - room); |
| 1314 | if (!room) | 1318 | if (!room) |
| 1315 | return room; | 1319 | return room; |
| @@ -1442,7 +1446,7 @@ static void work_fn_rx(struct work_struct *work) | |||
| 1442 | int count; | 1446 | int count; |
| 1443 | 1447 | ||
| 1444 | chan->device->device_control(chan, DMA_TERMINATE_ALL, 0); | 1448 | chan->device->device_control(chan, DMA_TERMINATE_ALL, 0); |
| 1445 | dev_dbg(port->dev, "Read %u bytes with cookie %d\n", | 1449 | dev_dbg(port->dev, "Read %zu bytes with cookie %d\n", |
| 1446 | sh_desc->partial, sh_desc->cookie); | 1450 | sh_desc->partial, sh_desc->cookie); |
| 1447 | 1451 | ||
| 1448 | spin_lock_irqsave(&port->lock, flags); | 1452 | spin_lock_irqsave(&port->lock, flags); |
| @@ -1691,16 +1695,17 @@ static void sci_request_dma(struct uart_port *port) | |||
| 1691 | s->chan_tx = chan; | 1695 | s->chan_tx = chan; |
| 1692 | sg_init_table(&s->sg_tx, 1); | 1696 | sg_init_table(&s->sg_tx, 1); |
| 1693 | /* UART circular tx buffer is an aligned page. */ | 1697 | /* UART circular tx buffer is an aligned page. */ |
| 1694 | BUG_ON((int)port->state->xmit.buf & ~PAGE_MASK); | 1698 | BUG_ON((uintptr_t)port->state->xmit.buf & ~PAGE_MASK); |
| 1695 | sg_set_page(&s->sg_tx, virt_to_page(port->state->xmit.buf), | 1699 | sg_set_page(&s->sg_tx, virt_to_page(port->state->xmit.buf), |
| 1696 | UART_XMIT_SIZE, (int)port->state->xmit.buf & ~PAGE_MASK); | 1700 | UART_XMIT_SIZE, |
| 1701 | (uintptr_t)port->state->xmit.buf & ~PAGE_MASK); | ||
| 1697 | nent = dma_map_sg(port->dev, &s->sg_tx, 1, DMA_TO_DEVICE); | 1702 | nent = dma_map_sg(port->dev, &s->sg_tx, 1, DMA_TO_DEVICE); |
| 1698 | if (!nent) | 1703 | if (!nent) |
| 1699 | sci_tx_dma_release(s, false); | 1704 | sci_tx_dma_release(s, false); |
| 1700 | else | 1705 | else |
| 1701 | dev_dbg(port->dev, "%s: mapped %d@%p to %x\n", __func__, | 1706 | dev_dbg(port->dev, "%s: mapped %d@%p to %pad\n", __func__, |
| 1702 | sg_dma_len(&s->sg_tx), | 1707 | sg_dma_len(&s->sg_tx), port->state->xmit.buf, |
| 1703 | port->state->xmit.buf, sg_dma_address(&s->sg_tx)); | 1708 | &sg_dma_address(&s->sg_tx)); |
| 1704 | 1709 | ||
| 1705 | s->sg_len_tx = nent; | 1710 | s->sg_len_tx = nent; |
| 1706 | 1711 | ||
| @@ -1740,7 +1745,7 @@ static void sci_request_dma(struct uart_port *port) | |||
| 1740 | 1745 | ||
| 1741 | sg_init_table(sg, 1); | 1746 | sg_init_table(sg, 1); |
| 1742 | sg_set_page(sg, virt_to_page(buf[i]), s->buf_len_rx, | 1747 | sg_set_page(sg, virt_to_page(buf[i]), s->buf_len_rx, |
| 1743 | (int)buf[i] & ~PAGE_MASK); | 1748 | (uintptr_t)buf[i] & ~PAGE_MASK); |
| 1744 | sg_dma_address(sg) = dma[i]; | 1749 | sg_dma_address(sg) = dma[i]; |
| 1745 | } | 1750 | } |
| 1746 | 1751 | ||
