mbox series

[0/4] tty: serial: Add ability to control rs485 RX_DURING_TX via a GPIO

Message ID 20221026165049.9541-1-cniedermaier@dh-electronics.com (mailing list archive)
Headers show
Series tty: serial: Add ability to control rs485 RX_DURING_TX via a GPIO | expand

Message

Christoph Niedermaier Oct. 26, 2022, 4:50 p.m. UTC
This patch series add the ability to control the RS485 feature RX_DURING_TX via
a GPIO. Currently it is handled by the low level serial driver and it depends
on the ability of the serial hardware. In case of that RX_DURING_TX is disabled
the serial hardware must be capable to turn off the receiver during sending.
The idea is to have an electrical circuit that connects/disconnects the Rx by
using the RX_DURING_TX GPIO. On one hand by using this GPIO the use of RS485
RX_DURING_TX becomes independent of the capability of the serial hardware, and
on the other hand possible software-caused switch-off and switch-on times of the
receiver in case of RX_DURING_TX is disabled (default state) can also be avoided.

The core patch adds a generic GPIO variable for the use of this RS485 feature
controlled by a GPIO. The GPIO is defined by the devicetree property
"rs485-rx-during-tx-gpios".

The low-level implementation is done for the STM32 and the i.MX serial driver.
Other platforms are not covered in this series, but can easily be added.

I tested it with a DHCOM i.MX6DL and DHCOM STM32MP1 on a PicoITX board.

In this series the devicetree bindings description is also included.


Christoph Niedermaier (4):
  dt_bindings: rs485: Add binding for GPIO that controls Rx enable
    during Tx
  serial: core: Add option to control rs485 RX_DURING_TX by a GPIO
  serial: imx: Add support for rs485 RX_DURING_TX GPIO
  serial: stm32: Add support for rs485 RX_DURING_TX GPIO

 Documentation/devicetree/bindings/serial/rs485.yaml |  4 ++++
 drivers/tty/serial/imx.c                            | 13 +++++++++++--
 drivers/tty/serial/serial_core.c                    | 12 ++++++++++++
 drivers/tty/serial/stm32-usart.c                    |  9 ++++++++-
 include/linux/serial_core.h                         |  1 +
 5 files changed, 36 insertions(+), 3 deletions(-)