Re: [PATCH 1/2] dt-bindings: serial: rs485: add rs485-mux-gpios binding

From: Lukas Wunner
Date: Wed Nov 22 2023 - 09:53:52 EST


On Mon, Nov 20, 2023 at 04:10:54PM +0100, Rasmus Villemoes wrote:
> Some boards are capable of both rs232 and rs485, and control which
> external terminals are active via a gpio-controlled mux. Allow
> describing that gpio in DT so that the kernel can transparently handle
> the proper setting when the uart is switched between rs232 and rs485
> modes.

Crescent CY Hsieh (+cc) is in parallel trying to add an RS-422 mode bit
to struct serial_rs485:

https://lore.kernel.org/all/20231121095122.15948-1-crescentcy.hsieh@xxxxxxxx/

I don't know whether that makes sense at all (I had thought RS-422 is
the same as RS-485 with full-duplex, i.e. SER_RS485_ENABLED plus
SER_RS485_RX_DURING_TX).

But if that patch gets accepted, we'd have *three* different modes:
RS-232, RS-485, RS-422. A single GPIO seems insufficient to handle that.
You'd need at least two GPIOs.


> --- a/Documentation/devicetree/bindings/serial/rs485.yaml
> +++ b/Documentation/devicetree/bindings/serial/rs485.yaml
> @@ -61,6 +61,11 @@ properties:
> the active state enables RX during TX.
> maxItems: 1
>
> + rs485-mux-gpios:
> + description: GPIO pin to control muxing of the SOC signals to the RS485
> + transceiver.
> + maxItems: 1

The description doesn't really add much to the name "rs485-mux-gpios".

Suggestion:

description: selects whether the UART is connect to an RS-232 driver (low)
or an RS-485 transceiver (high)

Thanks,

Lukas