diff options
Diffstat (limited to 'drivers/tty/serial/fsl_lpuart.c')
-rw-r--r-- | drivers/tty/serial/fsl_lpuart.c | 35 |
1 files changed, 17 insertions, 18 deletions
diff --git a/drivers/tty/serial/fsl_lpuart.c b/drivers/tty/serial/fsl_lpuart.c index a1c6519837a4..f02934ffb329 100644 --- a/drivers/tty/serial/fsl_lpuart.c +++ b/drivers/tty/serial/fsl_lpuart.c | |||
@@ -1407,6 +1407,18 @@ lpuart_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1407 | /* ask the core to calculate the divisor */ | 1407 | /* ask the core to calculate the divisor */ |
1408 | baud = uart_get_baud_rate(port, termios, old, 50, port->uartclk / 16); | 1408 | baud = uart_get_baud_rate(port, termios, old, 50, port->uartclk / 16); |
1409 | 1409 | ||
1410 | /* | ||
1411 | * Need to update the Ring buffer length according to the selected | ||
1412 | * baud rate and restart Rx DMA path. | ||
1413 | * | ||
1414 | * Since timer function acqures sport->port.lock, need to stop before | ||
1415 | * acquring same lock because otherwise del_timer_sync() can deadlock. | ||
1416 | */ | ||
1417 | if (old && sport->lpuart_dma_rx_use) { | ||
1418 | del_timer_sync(&sport->lpuart_timer); | ||
1419 | lpuart_dma_rx_free(&sport->port); | ||
1420 | } | ||
1421 | |||
1410 | spin_lock_irqsave(&sport->port.lock, flags); | 1422 | spin_lock_irqsave(&sport->port.lock, flags); |
1411 | 1423 | ||
1412 | sport->port.read_status_mask = 0; | 1424 | sport->port.read_status_mask = 0; |
@@ -1456,22 +1468,11 @@ lpuart_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1456 | /* restore control register */ | 1468 | /* restore control register */ |
1457 | writeb(old_cr2, sport->port.membase + UARTCR2); | 1469 | writeb(old_cr2, sport->port.membase + UARTCR2); |
1458 | 1470 | ||
1459 | /* | 1471 | if (old && sport->lpuart_dma_rx_use) { |
1460 | * If new baud rate is set, we will also need to update the Ring buffer | 1472 | if (!lpuart_start_rx_dma(sport)) |
1461 | * length according to the selected baud rate and restart Rx DMA path. | ||
1462 | */ | ||
1463 | if (old) { | ||
1464 | if (sport->lpuart_dma_rx_use) { | ||
1465 | del_timer_sync(&sport->lpuart_timer); | ||
1466 | lpuart_dma_rx_free(&sport->port); | ||
1467 | } | ||
1468 | |||
1469 | if (sport->dma_rx_chan && !lpuart_start_rx_dma(sport)) { | ||
1470 | sport->lpuart_dma_rx_use = true; | ||
1471 | rx_dma_timer_init(sport); | 1473 | rx_dma_timer_init(sport); |
1472 | } else { | 1474 | else |
1473 | sport->lpuart_dma_rx_use = false; | 1475 | sport->lpuart_dma_rx_use = false; |
1474 | } | ||
1475 | } | 1476 | } |
1476 | 1477 | ||
1477 | spin_unlock_irqrestore(&sport->port.lock, flags); | 1478 | spin_unlock_irqrestore(&sport->port.lock, flags); |
@@ -2131,12 +2132,10 @@ static int lpuart_resume(struct device *dev) | |||
2131 | 2132 | ||
2132 | if (sport->lpuart_dma_rx_use) { | 2133 | if (sport->lpuart_dma_rx_use) { |
2133 | if (sport->port.irq_wake) { | 2134 | if (sport->port.irq_wake) { |
2134 | if (!lpuart_start_rx_dma(sport)) { | 2135 | if (!lpuart_start_rx_dma(sport)) |
2135 | sport->lpuart_dma_rx_use = true; | ||
2136 | rx_dma_timer_init(sport); | 2136 | rx_dma_timer_init(sport); |
2137 | } else { | 2137 | else |
2138 | sport->lpuart_dma_rx_use = false; | 2138 | sport->lpuart_dma_rx_use = false; |
2139 | } | ||
2140 | } | 2139 | } |
2141 | } | 2140 | } |
2142 | 2141 | ||