diff options
author | Christoph Vogtländer <c.vogtlaender@sigma-surface-science.com> | 2019-09-04 08:11:41 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-09-05 03:57:44 -0400 |
commit | 5a8c296f5362fffc9da5da10eef01cf0b9b4ac7f (patch) | |
tree | d59c077b82e21459c000566aba89be3c013d9b1d | |
parent | 8966110c56459d3d0cf3bded77a92988063b0842 (diff) |
serial: max310x: Properly set flags in AutoCTS mode
Commit 391f93f2ec9f ("serial: core: Rework hw-assisted flow control
support") has changed the way the AutoCTS mode is handled.
According to that change, serial drivers which enable H/W AutoCTS mode must
set UPSTAT_AUTORTS, UPSTAT_AUTOCTS and UPSTAT_AUTOXOFF to prevent the
serial core from inadvertently disabling RX or TX. This patch adds proper
handling of UPSTAT_AUTORTS, UPSTAT_AUTOCTS and UPSTAT_AUTOXOFF flags.
Signed-off-by: Christoph Vogtländer <c.vogtlaender@sigma-surface-science.com>
Link: https://lore.kernel.org/r/20190904121141.4570-1-c.vogtlaender@sigma-surface-science.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/tty/serial/max310x.c | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c index 0e0c2740ec7e..aed19c688beb 100644 --- a/drivers/tty/serial/max310x.c +++ b/drivers/tty/serial/max310x.c | |||
@@ -955,15 +955,23 @@ static void max310x_set_termios(struct uart_port *port, | |||
955 | /* Configure flow control */ | 955 | /* Configure flow control */ |
956 | max310x_port_write(port, MAX310X_XON1_REG, termios->c_cc[VSTART]); | 956 | max310x_port_write(port, MAX310X_XON1_REG, termios->c_cc[VSTART]); |
957 | max310x_port_write(port, MAX310X_XOFF1_REG, termios->c_cc[VSTOP]); | 957 | max310x_port_write(port, MAX310X_XOFF1_REG, termios->c_cc[VSTOP]); |
958 | if (termios->c_cflag & CRTSCTS) | 958 | |
959 | port->status &= ~(UPSTAT_AUTOCTS | UPSTAT_AUTORTS | UPSTAT_AUTOXOFF); | ||
960 | |||
961 | if (termios->c_cflag & CRTSCTS) { | ||
962 | /* Enable AUTORTS and AUTOCTS */ | ||
963 | port->status |= UPSTAT_AUTOCTS | UPSTAT_AUTORTS; | ||
959 | flow |= MAX310X_FLOWCTRL_AUTOCTS_BIT | | 964 | flow |= MAX310X_FLOWCTRL_AUTOCTS_BIT | |
960 | MAX310X_FLOWCTRL_AUTORTS_BIT; | 965 | MAX310X_FLOWCTRL_AUTORTS_BIT; |
966 | } | ||
961 | if (termios->c_iflag & IXON) | 967 | if (termios->c_iflag & IXON) |
962 | flow |= MAX310X_FLOWCTRL_SWFLOW3_BIT | | 968 | flow |= MAX310X_FLOWCTRL_SWFLOW3_BIT | |
963 | MAX310X_FLOWCTRL_SWFLOWEN_BIT; | 969 | MAX310X_FLOWCTRL_SWFLOWEN_BIT; |
964 | if (termios->c_iflag & IXOFF) | 970 | if (termios->c_iflag & IXOFF) { |
971 | port->status |= UPSTAT_AUTOXOFF; | ||
965 | flow |= MAX310X_FLOWCTRL_SWFLOW1_BIT | | 972 | flow |= MAX310X_FLOWCTRL_SWFLOW1_BIT | |
966 | MAX310X_FLOWCTRL_SWFLOWEN_BIT; | 973 | MAX310X_FLOWCTRL_SWFLOWEN_BIT; |
974 | } | ||
967 | max310x_port_write(port, MAX310X_FLOWCTRL_REG, flow); | 975 | max310x_port_write(port, MAX310X_FLOWCTRL_REG, flow); |
968 | 976 | ||
969 | /* Get baud rate generator configuration */ | 977 | /* Get baud rate generator configuration */ |