summaryrefslogtreecommitdiffstats
path: root/drivers/tty/serial
diff options
context:
space:
mode:
authorChristoph Niedermaier <cniedermaier@dh-electronics.com>2022-12-02 11:41:27 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-01-19 16:01:35 +0100
commitc54d48543689f821f6a5ade7e7fa828ada6a1195 (patch)
treed671164398593837808e884a84fec669eceb12cd /drivers/tty/serial
parentca530cfa968c6fa197ee7df877a277954b87bad5 (diff)
downloadlinux-stable-c54d48543689f821f6a5ade7e7fa828ada6a1195.tar.gz
linux-stable-c54d48543689f821f6a5ade7e7fa828ada6a1195.tar.bz2
linux-stable-c54d48543689f821f6a5ade7e7fa828ada6a1195.zip
serial: stm32: Add support for rs485 RX_DURING_TX output GPIO
If a RX_DURING_TX GPIO is defined by the DT property "rs485-rx-during-tx-gpios" this patch switches this GPIO accordingly to the RS485 flag RX_DURING_TX in user space. Controlled by this GPIO, now the hardware is responsible for connecting or disconnecting RX during TX. Signed-off-by: Christoph Niedermaier <cniedermaier@dh-electronics.com> Link: https://lore.kernel.org/r/20221202104127.122761-4-cniedermaier@dh-electronics.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/tty/serial')
-rw-r--r--drivers/tty/serial/stm32-usart.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/drivers/tty/serial/stm32-usart.c b/drivers/tty/serial/stm32-usart.c
index a1490033aa16..f1b1df78118f 100644
--- a/drivers/tty/serial/stm32-usart.c
+++ b/drivers/tty/serial/stm32-usart.c
@@ -226,7 +226,11 @@ static int stm32_usart_config_rs485(struct uart_port *port, struct ktermios *ter
stm32_usart_clr_bits(port, ofs->cr1, BIT(cfg->uart_enable_bit));
- rs485conf->flags |= SER_RS485_RX_DURING_TX;
+ if (port->rs485_rx_during_tx_gpio)
+ gpiod_set_value_cansleep(port->rs485_rx_during_tx_gpio,
+ !!(rs485conf->flags & SER_RS485_RX_DURING_TX));
+ else
+ rs485conf->flags |= SER_RS485_RX_DURING_TX;
if (rs485conf->flags & SER_RS485_ENABLED) {
cr1 = readl_relaxed(port->membase + ofs->cr1);