diff options
author | Serge Semin <fancer.lancer@gmail.com> | 2019-05-14 06:14:14 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-05-21 06:15:53 -0400 |
commit | 2b9e6f0a400b6be1a408cd63ed09cfeb8f5dd627 (patch) | |
tree | c607b11b8447c31af6bd3c1d58736fde897f4866 | |
parent | 68f22c0c99d9c3534b88d1cd1215753a7a3655aa (diff) |
tty: max310x: Optionally enable rs485 on startup
UART port might be pre-configured with rs485 enabled flag at the
time of the port starting up process. In this case we need to
have the hardware rs485-related registers initialized in accordance
with the rs485 flags and settings provided by the configs descriptor.
Signed-off-by: Serge Semin <fancer.lancer@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/tty/serial/max310x.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/tty/serial/max310x.c b/drivers/tty/serial/max310x.c index 2255300404bd..36943f6c198c 100644 --- a/drivers/tty/serial/max310x.c +++ b/drivers/tty/serial/max310x.c | |||
@@ -1030,6 +1030,22 @@ static int max310x_startup(struct uart_port *port) | |||
1030 | max310x_port_update(port, MAX310X_MODE2_REG, | 1030 | max310x_port_update(port, MAX310X_MODE2_REG, |
1031 | MAX310X_MODE2_FIFORST_BIT, 0); | 1031 | MAX310X_MODE2_FIFORST_BIT, 0); |
1032 | 1032 | ||
1033 | /* Configure mode1/mode2 to have rs485/rs232 enabled at startup */ | ||
1034 | val = (clamp(port->rs485.delay_rts_before_send, 0U, 15U) << 4) | | ||
1035 | clamp(port->rs485.delay_rts_after_send, 0U, 15U); | ||
1036 | max310x_port_write(port, MAX310X_HDPIXDELAY_REG, val); | ||
1037 | |||
1038 | if (port->rs485.flags & SER_RS485_ENABLED) { | ||
1039 | max310x_port_update(port, MAX310X_MODE1_REG, | ||
1040 | MAX310X_MODE1_TRNSCVCTRL_BIT, | ||
1041 | MAX310X_MODE1_TRNSCVCTRL_BIT); | ||
1042 | |||
1043 | if (!(port->rs485.flags & SER_RS485_RX_DURING_TX)) | ||
1044 | max310x_port_update(port, MAX310X_MODE2_REG, | ||
1045 | MAX310X_MODE2_ECHOSUPR_BIT, | ||
1046 | MAX310X_MODE2_ECHOSUPR_BIT); | ||
1047 | } | ||
1048 | |||
1033 | /* Configure flow control levels */ | 1049 | /* Configure flow control levels */ |
1034 | /* Flow control halt level 96, resume level 48 */ | 1050 | /* Flow control halt level 96, resume level 48 */ |
1035 | max310x_port_write(port, MAX310X_FLOWLVL_REG, | 1051 | max310x_port_write(port, MAX310X_FLOWLVL_REG, |