Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

serial: max310x: turn off transmitter before activating AutoCTS or auto transmitter flow control

As documented in the data-sheet, the transmitter must be disabled before
activating AutoCTS or auto transmitter flow control. Accordingly, the
transmitter must be enabled after AutoCTS or auto transmitter flow
control gets deactivated.

Signed-off-by: Christoph Vogtländer <c.vogtlaender@sigma-surface-science.com>
Link: https://lore.kernel.org/r/20190904121746.4641-1-c.vogtlaender@sigma-surface-science.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Christoph Vogtländer and committed by
Greg Kroah-Hartman
7d4f881f 5a8c296f

+18
+18
drivers/tty/serial/max310x.c
··· 956 956 max310x_port_write(port, MAX310X_XON1_REG, termios->c_cc[VSTART]); 957 957 max310x_port_write(port, MAX310X_XOFF1_REG, termios->c_cc[VSTOP]); 958 958 959 + /* Disable transmitter before enabling AutoCTS or auto transmitter 960 + * flow control 961 + */ 962 + if (termios->c_cflag & CRTSCTS || termios->c_iflag & IXOFF) { 963 + max310x_port_update(port, MAX310X_MODE1_REG, 964 + MAX310X_MODE1_TXDIS_BIT, 965 + MAX310X_MODE1_TXDIS_BIT); 966 + } 967 + 959 968 port->status &= ~(UPSTAT_AUTOCTS | UPSTAT_AUTORTS | UPSTAT_AUTOXOFF); 960 969 961 970 if (termios->c_cflag & CRTSCTS) { ··· 982 973 MAX310X_FLOWCTRL_SWFLOWEN_BIT; 983 974 } 984 975 max310x_port_write(port, MAX310X_FLOWCTRL_REG, flow); 976 + 977 + /* Enable transmitter after disabling AutoCTS and auto transmitter 978 + * flow control 979 + */ 980 + if (!(termios->c_cflag & CRTSCTS) && !(termios->c_iflag & IXOFF)) { 981 + max310x_port_update(port, MAX310X_MODE1_REG, 982 + MAX310X_MODE1_TXDIS_BIT, 983 + 0); 984 + } 985 985 986 986 /* Get baud rate generator configuration */ 987 987 baud = uart_get_baud_rate(port, termios, old,