]> git.baikalelectronics.ru Git - kernel.git/commitdiff
serial: 8250_fintek: Fill in rs485_supported
authorIlpo Järvinen <ilpo.jarvinen@linux.intel.com>
Mon, 6 Jun 2022 10:04:05 +0000 (13:04 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Jun 2022 11:49:25 +0000 (13:49 +0200)
Add information on supported serial_rs485 features.

Differentiate based on which port is in question.

Signed-off-by: Ilpo Järvinen <ilpo.jarvinen@linux.intel.com>
Link: https://lore.kernel.org/r/20220606100433.13793-9-ilpo.jarvinen@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250_fintek.c

index dba5950b8d0e2829fcfb3e201b149dbbf9e6531d..6e98c376e082987417bff247b2bd7e4f09ab412b 100644 (file)
@@ -424,6 +424,17 @@ static int probe_setup_port(struct fintek_8250 *pdata,
        return -ENODEV;
 }
 
+/* Only the first port supports delays */
+static const struct serial_rs485 fintek_8250_rs485_supported_port0 = {
+       .flags = SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND | SER_RS485_RTS_AFTER_SEND,
+       .delay_rts_before_send = 1,
+       .delay_rts_after_send = 1,
+};
+
+static const struct serial_rs485 fintek_8250_rs485_supported = {
+       .flags = SER_RS485_ENABLED | SER_RS485_RTS_ON_SEND | SER_RS485_RTS_AFTER_SEND,
+};
+
 static void fintek_8250_set_rs485_handler(struct uart_8250_port *uart)
 {
        struct fintek_8250 *pdata = uart->port.private_data;
@@ -435,6 +446,10 @@ static void fintek_8250_set_rs485_handler(struct uart_8250_port *uart)
        case CHIP_ID_F81866:
        case CHIP_ID_F81865:
                uart->port.rs485_config = fintek_8250_rs485_config;
+               if (!pdata->index)
+                       uart->port.rs485_supported = &fintek_8250_rs485_supported_port0;
+               else
+                       uart->port.rs485_supported = &fintek_8250_rs485_supported;
                break;
 
        default: /* No RS485 Auto direction functional */