|
@@ -197,10 +197,17 @@ static int fintek_8250_rs485_config(struct uart_port *port,
|
|
if (!pdata)
|
|
if (!pdata)
|
|
return -EINVAL;
|
|
return -EINVAL;
|
|
|
|
|
|
- if (rs485->flags & SER_RS485_ENABLED)
|
|
|
|
|
|
+ /* Hardware do not support same RTS level on send and receive */
|
|
|
|
+ if (!(rs485->flags & SER_RS485_RTS_ON_SEND) ==
|
|
|
|
+ !(rs485->flags & SER_RS485_RTS_AFTER_SEND))
|
|
|
|
+ return -EINVAL;
|
|
|
|
+
|
|
|
|
+ if (rs485->flags & SER_RS485_ENABLED) {
|
|
memset(rs485->padding, 0, sizeof(rs485->padding));
|
|
memset(rs485->padding, 0, sizeof(rs485->padding));
|
|
- else
|
|
|
|
|
|
+ config |= RS485_URA;
|
|
|
|
+ } else {
|
|
memset(rs485, 0, sizeof(*rs485));
|
|
memset(rs485, 0, sizeof(*rs485));
|
|
|
|
+ }
|
|
|
|
|
|
rs485->flags &= SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND |
|
|
rs485->flags &= SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND |
|
|
SER_RS485_RTS_AFTER_SEND;
|
|
SER_RS485_RTS_AFTER_SEND;
|
|
@@ -215,12 +222,6 @@ static int fintek_8250_rs485_config(struct uart_port *port,
|
|
config |= RXW4C_IRA;
|
|
config |= RXW4C_IRA;
|
|
}
|
|
}
|
|
|
|
|
|
- if ((!!(rs485->flags & SER_RS485_RTS_ON_SEND)) ==
|
|
|
|
- (!!(rs485->flags & SER_RS485_RTS_AFTER_SEND)))
|
|
|
|
- rs485->flags &= ~SER_RS485_ENABLED;
|
|
|
|
- else
|
|
|
|
- config |= RS485_URA;
|
|
|
|
-
|
|
|
|
if (rs485->flags & SER_RS485_RTS_ON_SEND)
|
|
if (rs485->flags & SER_RS485_RTS_ON_SEND)
|
|
config |= RTS_INVERT;
|
|
config |= RTS_INVERT;
|
|
|
|
|