summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorLukas Wunner <lukas@wunner.de>2020-02-28 14:31:02 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-03-07 09:52:01 +0100
commitfe7f0fa43cef191a6d17bedf90bacce806c58eba (patch)
tree2be63355f6c96c566f7031080c76c419c741df05 /drivers
parentf45709df7731ad36306a28a3e1af7309d55c35f5 (diff)
serial: 8250: Support rs485 devicetree properties
Retrieve rs485 devicetree properties on registration of 8250 ports in case they are attached to an rs485 transceiver. If the property "linux,rs485-enabled-at-boot-time" is present, invoke the ->rs485_config() callback to immediately deassert RTS, thereby ceasing control of the bus. Signed-off-by: Lukas Wunner <lukas@wunner.de> Cc: Giulio Benetti <giulio.benetti@micronovasrl.com> Cc: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Link: https://lore.kernel.org/r/5908ea89b7f9da54872d6634b606d83db032297a.1582895077.git.lukas@wunner.de Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/tty/serial/8250/8250_core.c4
-rw-r--r--drivers/tty/serial/8250/8250_port.c3
2 files changed, 6 insertions, 1 deletions
diff --git a/drivers/tty/serial/8250/8250_core.c b/drivers/tty/serial/8250/8250_core.c
index f2a33c9082a6..9a1d09fbb836 100644
--- a/drivers/tty/serial/8250/8250_core.c
+++ b/drivers/tty/serial/8250/8250_core.c
@@ -1013,8 +1013,10 @@ int serial8250_register_8250_port(struct uart_8250_port *up)
if (uart->port.fifosize && !uart->tx_loadsz)
uart->tx_loadsz = uart->port.fifosize;
- if (up->port.dev)
+ if (up->port.dev) {
uart->port.dev = up->port.dev;
+ uart_get_rs485_mode(uart->port.dev, &uart->port.rs485);
+ }
if (up->port.flags & UPF_FIXED_TYPE)
uart->port.type = up->port.type;
diff --git a/drivers/tty/serial/8250/8250_port.c b/drivers/tty/serial/8250/8250_port.c
index a8f4cedde4dc..40efcea8c6e7 100644
--- a/drivers/tty/serial/8250/8250_port.c
+++ b/drivers/tty/serial/8250/8250_port.c
@@ -2989,6 +2989,9 @@ static void serial8250_config_port(struct uart_port *port, int flags)
if (flags & UART_CONFIG_TYPE)
autoconfig(up);
+ if (port->rs485.flags & SER_RS485_ENABLED)
+ port->rs485_config(port, &port->rs485);
+
/* if access method is AU, it is a 16550 with a quirk */
if (port->type == PORT_16550A && port->iotype == UPIO_AU)
up->bugs |= UART_BUG_NOMSR;