]> www.infradead.org Git - users/willy/pagecache.git/commit
USB: serial: xr: add TIOCGRS485 and TIOCSRS485 ioctls
authorJarkko Sonninen <kasper@iki.fi>
Sat, 8 Jul 2023 14:56:50 +0000 (17:56 +0300)
committerJohan Hovold <johan@kernel.org>
Thu, 20 Jul 2023 13:37:03 +0000 (15:37 +0200)
commit974e2f6a0554685493cc44406bc7d8ba0a3b0e33
tree5469a08f8733bafb2127d9e94a534df1fab82922
parentfdf0eaf11452d72945af31804e2a1048ee1b574c
USB: serial: xr: add TIOCGRS485 and TIOCSRS485 ioctls

Exar devices like XR21B1411 can control an RS485 transceiver by
automatically asserting the RTS#/RS485 pin before sending data
and deasserting it when the last stop bit has been transmitted.
The polarity of the RST#/RS485 signal is configurable and the
hardware also supports half-duplex turn-around delay and
address matching mode.

Add support for enabling and disabling RS-485 mode and
configuring the RST#/RS485 signal polarity using the TIOCGRS485
and TIOCSRS485 ioctls. Support for half-duplex turn-around delay
and address matching mode are left unimplemented for now.

User enables RS-485 mode by setting SER_RS485_ENABLED flag in
struct serial_rs485 flags. User should also set either
SER_RS485_RTS_ON_SEND or SER_RS485_RTS_AFTER_SEND to select the
behaviour of the RTS#/RS485 pin. Setting SER_RS485_RTS_ON_SEND
will drive RTS#/RS485 low during transmission.

Signed-off-by: Jarkko Sonninen <kasper@iki.fi>
[ johan: let SER_RS485_RTS_ON_SEND determine SER_RS485_RTS_AFTER_SEND ]
Signed-off-by: Johan Hovold <johan@kernel.org>
drivers/usb/serial/xr_serial.c