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

From: Lukas Wunner
Date: Thu Nov 23 2023 - 05:38:11 EST


On Thu, Nov 23, 2023 at 11:07:16AM +0100, Rasmus Villemoes wrote:
> On 22/11/2023 15.53, Lukas Wunner wrote:
> > 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.
>
> I don't see Crescent introducing any new gpio that needs to be handled.
> In fact, I can't even see why from the perspective of the software that
> rs422 isn't just rs232; there's no transmit enable pin that needs to be
> handled. But maybe the uart driver does something different in rs422
> mode; I assume he must have some update of some driver, since otherwise
> the new rs422 bit should be rejected by the core. So I can't really see
> the whole picture of that rs422 story.

The question is, could we conceivably have the need to support
switching between the three modes RS-232, RS-485, RS-422.
If yes, then the GPIO mux interface should probably allow for that.

As a case in point, the Siemens IOT 2040 has two serial ports
which can be set to either of those three modes. The signals
are routed to the same D-sub socket, but the pins used are
different. See page 46 and 47 of this document:

https://cache.industry.siemens.com/dl/files/658/109741658/att_899623/v1/iot2000_operating_instructions_enUS_en-US.pdf

The driver for this product is 8250_exar.c. It's an Intel-based
product, so no devicetree, but it shows that such use cases exist.

Thanks,

Lukas