dt-bindings: serial: rs485: add rs485-mux-gpios binding
Quoted 63 lines · Christoph Niedermaier
From: Lino Sanfilippo [mailto:[email protected]]
Sent: Saturday, December 23, 2023 2:41 PMQuoted 53 lines · Christoph Niedermaier
Quoted 28 lines
From: Lukas Wunner [mailto:[email protected]]
Sent: Thursday, December 21, 2023 4:53 PMQuoted 18 lines · Christoph Niedermaier
Quoted 8 lines
I will summarize the current situation from my point of view, maybe it helps:
RS-232:
- Full Duplex Point-to-Point connection
- No transceiver control with RTS
- No termination
- No extra struct in useQuoted 8 lines
RS-422:
- Full Duplex Point-to-Point connection
- No transceiver control with RTS needed
- Termination possible
- Extra structserial_rs485needed if termination is used
=> RS-422 can be used in RS-232 operation, but if a termination should be
switchable the RS485 flag has to be enabled. But then also transceiver control will be enabled. Not a very satisfying situation.Quoted 7 lines
Well why don't we just allow enabling or disabling RS-485 termination independently from the
SER_RS485_ENABLEDbit in structserial_rs485?Just let the user issue a TIOCSRS485 ioctl to toggle termination even if in RS-232 mode and use that mode for RS-422.
Looks like the simplest solution to me.
Quoted 8 lines
Sounds not bad. The termination should only depend on whether the GPIO is given or not.
Irrespective of this, I think the Linos idea of an RS-422 mode is not bad. This allows you to take care of special features that were previously overlooked. For example, hardware flow control can be switched off so that this does not cause any problems.
Also note, that RS232 and RS422 may NOT always be the same from driver perspective. Take a look at
8250_excar.cfor example. That driver has to configure the hardware accordingly when switching from RS232 to RS422 (seeiot2040_rs485_config()).While a
SER_RS485_MODE_RS422flag set by userspace could work to switch to RS422, I still think that the cleanest solution would be another ioctl TIOCSRS422 with a parameter likestruct serial_rs422 { __u32 flags; #define SER_RS422_ENABLED (1 << 0) #define SER_RS422_TERMINATE_BUS (1 << 1) __u32 padding[7] };Quoted 4 lines
The
SER_RS485_MODE_RS422flag could still be used internally as a hint to the driver. That solution would also be expandable if needed. I planned to send a patch that implements this
as a RFC to the mailing list (maybe in the next few days).Having your own ioctl is a nice distinction, but when I think about it for a moment, questions come to mind:
Quoted 8 lines
From userspace perspective then there are two termination flags
SER_RS485_TERMINATE_BUSandSER_RS422_TERMINATE_BUS? How will they interact internally?What about the devicetree property?
Will there be rs422-term-gpios as well?Could the user enable RS422 and RS485 at the same time?
Exactly, if you are going for this, just make a new entry into union, and use flags for that. So, you probably will have the same IOCTL, but which will serve RS422/RS385 purposes excluding odds of the use of the pieces.
Signature · 2 lines
With Best Regards, Andy Shevchenko