1 From 694247173f2e136196d7cb3a392c84cda65674d2 Mon Sep 17 00:00:00 2001
2 From: Hugo Villeneuve <hvilleneuve@dimonoff.com>
3 Date: Mon, 7 Oct 2024 12:27:15 -0400
4 Subject: [PATCH] serial: sc16is7xx: announce support for SER_RS485_RTS_ON_SEND
6 commit 068d35a7be65fa3bca4bba21c269bfe0b39158a6 upstream.
8 When specifying flag SER_RS485_RTS_ON_SEND in RS485 configuration,
9 we get the following warning after commit 4afeced55baa ("serial: core:
10 fix sanitizing check for RTS settings"):
12 invalid RTS setting, using RTS_AFTER_SEND instead
14 This results in SER_RS485_RTS_AFTER_SEND being set and the
15 driver always write to the register field SC16IS7XX_EFCR_RTS_INVERT_BIT,
16 which breaks some hardware using these chips.
18 The hardware supports both RTS_ON_SEND and RTS_AFTER_SEND modes, so fix
19 this by announcing support for RTS_ON_SEND.
21 Signed-off-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
22 Suggested-by: Konstantin Pugin <ria.freelander@gmail.com>
23 Link: https://lore.kernel.org/lkml/20240422133219.2710061-2-ria.freelander@gmail.com
24 Reviewed-by: Andy Shevchenko <andy@kernel.org>
25 Tested-by: Hugo Villeneuve <hvilleneuve@dimonoff.com>
26 Link: https://lore.kernel.org/r/20241007162716.3122912-1-hugo@hugovil.com
27 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
29 drivers/tty/serial/sc16is7xx.c | 2 +-
30 1 file changed, 1 insertion(+), 1 deletion(-)
32 --- a/drivers/tty/serial/sc16is7xx.c
33 +++ b/drivers/tty/serial/sc16is7xx.c
34 @@ -1457,7 +1457,7 @@ static int sc16is7xx_setup_mctrl_ports(s
37 static const struct serial_rs485 sc16is7xx_rs485_supported = {
38 - .flags = SER_RS485_ENABLED | SER_RS485_RTS_AFTER_SEND,
39 + .flags = SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND | SER_RS485_RTS_AFTER_SEND,
40 .delay_rts_before_send = 1,
41 .delay_rts_after_send = 1, /* Not supported but keep returning -EINVAL */