]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
serial: 8250_exar: Set missing rs485_supported flag
authorLino Sanfilippo <l.sanfilippo@kunbus.com>
Wed, 3 Jan 2024 06:18:18 +0000 (07:18 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 23 Feb 2024 07:55:12 +0000 (08:55 +0100)
[ Upstream commit 0c2a5f471ce58bca8f8ab5fcb911aff91eaaa5eb ]

The UART supports an auto-RTS mode in which the RTS pin is automatically
activated during transmission. So mark this mode as being supported even
if RTS is not controlled by the driver but the UART.

Also the serial core expects now at least one of both modes rts-on-send or
rts-after-send to be supported. This is since during sanitization
unsupported flags are deleted from a RS485 configuration set by userspace.
However if the configuration ends up with both flags unset, the core prints
a warning since it considers such a configuration invalid (see
uart_sanitize_serial_rs485()).

Cc: <stable@vger.kernel.org>
Reviewed-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Signed-off-by: Lino Sanfilippo <l.sanfilippo@kunbus.com>
Link: https://lore.kernel.org/r/20240103061818.564-8-l.sanfilippo@kunbus.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/tty/serial/8250/8250_exar.c

index 24878d5a6a0500f8afbb557147abc2e7a5130c8b..ada9666f598895a9c361923a19c32c80c58227c9 100644 (file)
@@ -443,7 +443,7 @@ static int generic_rs485_config(struct uart_port *port,
 }
 
 static const struct serial_rs485 generic_rs485_supported = {
-       .flags = SER_RS485_ENABLED,
+       .flags = SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND,
 };
 
 static const struct exar8250_platform exar8250_default_platform = {
@@ -487,7 +487,8 @@ static int iot2040_rs485_config(struct uart_port *port,
 }
 
 static const struct serial_rs485 iot2040_rs485_supported = {
-       .flags = SER_RS485_ENABLED | SER_RS485_RX_DURING_TX | SER_RS485_TERMINATE_BUS,
+       .flags = SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND |
+                SER_RS485_RX_DURING_TX | SER_RS485_TERMINATE_BUS,
 };
 
 static const struct property_entry iot2040_gpio_properties[] = {