diff options
| author | Jan Čermák <sairon@sairon.cz> | 2026-10-01 11:04:32 +0200 |
|---|---|---|
| committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2026-10-13 15:17:02 +0200 |
| commit | ca576923c39863ac528427b563ea2f6631703d22 (patch) | |
| tree | d542b5bb19c05952c4bc6a87d950bf9cc94fe2e7 /tools/lib/python | |
| parent | e95442c31ae65b57ddffdfa609531c549055f308 (diff) | |
serial: 8250_bcm2835aux: Add support for RTS/CTS auto flow control
The bcm2835aux mini UART can automatically de-assert RTS based on the RX
FIFO fill level and gate the transmitter on CTS, but the driver never
made use of it. Wire it up:
- Enable AUTORTS/AUTOCTS (with the RTS4 threshold and inverted, i.e.
conventional active-low, polarity) whenever CRTSCTS is set on ports
declaring the "uart-has-rtscts" property, advertised via
UPF_HARD_FLOW.
- Gate the AUTORTS function on TIOCM_RTS in set_mctrl() so that clearing
RTS (port close, TIOCMBIC, B0) actually de-asserts the pin while auto
flow control is active.
- Implement throttle()/unthrottle() by disabling the RX interrupts and
letting the FIFO fill up, making the hardware de-assert RTS - the same
approach as in 8250_omap. Re-sync this state on termios and rs485
changes, as those paths may re-enable the RX interrupts (or leave them
disabled) behind the throttle's back.
- Never enable auto flow control together with rs485, which uses RTS as
the transceiver direction control. As the software CTS fallback of the
serial core cannot work without a modem status interrupt, strip
CRTSCTS whenever it cannot be handled in hardware. Keep it when a CTS
GPIO is present, as the serial core's mctrl_gpio handling then
delivers the interrupt and the software fallback keeps working.
- Restore RXEN when rs485 is disabled, as the emulation may be torn down
without the rs485_stop_tx() callback ever being called, which would
leave the receiver disabled.
Assisted-by: Claude:claude-fable-5
Signed-off-by: Jan Čermák <sairon@sairon.cz>
Link: https://patch.msgid.link/20261001090432.1045270-1-sairon@sairon.cz
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'tools/lib/python')
0 files changed, 0 insertions, 0 deletions
