Commit e8759ad17d41 ("serial: uapi: Add support for bus termination"), allowed user space to change rs485 bus termination through a flag in struct serial_rs485. But so far only a single driver, 8250_exar.c, supports the flag: It hardcodes a GPIO specific to Siemens IOT2040 products. Provide for a more generic solution: Define a device tree binding for an rs485 bus termination GPIO (patch [3/4]), amend the serial core to retrieve the GPIO from the device tree and amend the default ->rs485_config() callback for 8250 drivers to change the GPIO on request from user space (patch [4/4]). Retrieving the GPIO from the device tree may fail, so allow uart_get_rs485_mode() to return an errno and change all callers to check for failure (patch [2/4]). Testing has exposed a bug in the 8250 core if retrieval of the GPIO initially fails with -EPROBE_DEFER and is later retried. That bug is fixed by patch [1/4]. Lukas Wunner (4): serial: 8250: Avoid error message on reprobe serial: Allow uart_get_rs485_mode() to return errno dt-bindings: serial: Add binding for rs485 bus termination GPIO serial: 8250: Support rs485 bus termination GPIO .../devicetree/bindings/serial/rs485.yaml | 4 +++ drivers/tty/serial/8250/8250_core.c | 16 +++++++--- drivers/tty/serial/8250/8250_port.c | 4 +++ drivers/tty/serial/ar933x_uart.c | 6 ++-- drivers/tty/serial/atmel_serial.c | 6 ++-- drivers/tty/serial/fsl_lpuart.c | 5 +++- drivers/tty/serial/imx.c | 6 +++- drivers/tty/serial/omap-serial.c | 4 ++- drivers/tty/serial/serial_core.c | 30 ++++++++++++++++++- drivers/tty/serial/stm32-usart.c | 8 ++--- include/linux/serial_core.h | 4 ++- 11 files changed, 76 insertions(+), 17 deletions(-) -- 2.26.2