diff options
author | Sergey Organov <sorganov@gmail.com> | 2019-06-26 10:11:30 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-07-03 13:35:42 -0400 |
commit | 011bd05d1f5d99eeb91e8a6f81f00654a2b8d3d1 (patch) | |
tree | f2f2d61df67c75d4cf46e1c0308b77265c284a39 | |
parent | ddf89e7503deb931403add648b67545ec196c3fe (diff) |
serial: imx: set_termios(): preserve RTS state
imx_set_termios() cleared RTS on every call, now fixed.
Reviewed-by: Sascha Hauer <s.hauer@pengutronix.de>
Tested-by: Sascha Hauer <s.hauer@pengutronix.de>
Signed-off-by: Sergey Organov <sorganov@gmail.com>
Link: https://lore.kernel.org/r/1561558293-7683-5-git-send-email-sorganov@gmail.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/tty/serial/imx.c | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/drivers/tty/serial/imx.c b/drivers/tty/serial/imx.c index 1cb891b4eaa0..57d6e6ba556e 100644 --- a/drivers/tty/serial/imx.c +++ b/drivers/tty/serial/imx.c | |||
@@ -1562,7 +1562,14 @@ imx_uart_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1562 | 1562 | ||
1563 | spin_lock_irqsave(&sport->port.lock, flags); | 1563 | spin_lock_irqsave(&sport->port.lock, flags); |
1564 | 1564 | ||
1565 | ucr2 = UCR2_SRST | UCR2_IRTS; | 1565 | /* |
1566 | * Read current UCR2 and save it for future use, then clear all the bits | ||
1567 | * except those we will or may need to preserve. | ||
1568 | */ | ||
1569 | old_ucr2 = imx_uart_readl(sport, UCR2); | ||
1570 | ucr2 = old_ucr2 & (UCR2_TXEN | UCR2_RXEN | UCR2_ATEN | UCR2_CTS); | ||
1571 | |||
1572 | ucr2 |= UCR2_SRST | UCR2_IRTS; | ||
1566 | if ((termios->c_cflag & CSIZE) == CS8) | 1573 | if ((termios->c_cflag & CSIZE) == CS8) |
1567 | ucr2 |= UCR2_WS; | 1574 | ucr2 |= UCR2_WS; |
1568 | 1575 | ||
@@ -1631,7 +1638,6 @@ imx_uart_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1631 | imx_uart_writel(sport, | 1638 | imx_uart_writel(sport, |
1632 | old_ucr1 & ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN), | 1639 | old_ucr1 & ~(UCR1_TXMPTYEN | UCR1_RRDYEN | UCR1_RTSDEN), |
1633 | UCR1); | 1640 | UCR1); |
1634 | old_ucr2 = imx_uart_readl(sport, UCR2); | ||
1635 | imx_uart_writel(sport, old_ucr2 & ~UCR2_ATEN, UCR2); | 1641 | imx_uart_writel(sport, old_ucr2 & ~UCR2_ATEN, UCR2); |
1636 | 1642 | ||
1637 | while (!(imx_uart_readl(sport, USR2) & USR2_TXDC)) | 1643 | while (!(imx_uart_readl(sport, USR2) & USR2_TXDC)) |
@@ -1639,7 +1645,6 @@ imx_uart_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1639 | 1645 | ||
1640 | /* then, disable everything */ | 1646 | /* then, disable everything */ |
1641 | imx_uart_writel(sport, old_ucr2 & ~(UCR2_TXEN | UCR2_RXEN | UCR2_ATEN), UCR2); | 1647 | imx_uart_writel(sport, old_ucr2 & ~(UCR2_TXEN | UCR2_RXEN | UCR2_ATEN), UCR2); |
1642 | old_ucr2 &= (UCR2_TXEN | UCR2_RXEN | UCR2_ATEN); | ||
1643 | 1648 | ||
1644 | /* custom-baudrate handling */ | 1649 | /* custom-baudrate handling */ |
1645 | div = sport->port.uartclk / (baud * 16); | 1650 | div = sport->port.uartclk / (baud * 16); |
@@ -1677,8 +1682,7 @@ imx_uart_set_termios(struct uart_port *port, struct ktermios *termios, | |||
1677 | 1682 | ||
1678 | imx_uart_writel(sport, old_ucr1, UCR1); | 1683 | imx_uart_writel(sport, old_ucr1, UCR1); |
1679 | 1684 | ||
1680 | /* set the parity, stop bits and data size */ | 1685 | imx_uart_writel(sport, ucr2, UCR2); |
1681 | imx_uart_writel(sport, ucr2 | old_ucr2, UCR2); | ||
1682 | 1686 | ||
1683 | if (UART_ENABLE_MS(&sport->port, termios->c_cflag)) | 1687 | if (UART_ENABLE_MS(&sport->port, termios->c_cflag)) |
1684 | imx_uart_enable_ms(&sport->port); | 1688 | imx_uart_enable_ms(&sport->port); |