]> www.infradead.org Git - users/jedix/linux-maple.git/commit
serial: 8250: Provide flag for IER toggling for RS485
authorJohn Ogness <john.ogness@linutronix.de>
Tue, 7 Jan 2025 21:27:00 +0000 (22:33 +0106)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 10 Jan 2025 15:08:25 +0000 (16:08 +0100)
commit910ef438e93cd2ceb70c72caea418710d648feef
treec6e1da5379b2f0f6c374888232450d3cbc1578b8
parent95a1b409ba08b602bf4464786ac74d21ae0acbf3
serial: 8250: Provide flag for IER toggling for RS485

For RS485 mode, if SER_RS485_RX_DURING_TX is not available, the
console ->write() callback needs to enable/disable Tx. It does
this by calling the ->rs485_start_tx() and ->rs485_stop_tx()
callbacks. However, some of these callbacks also disable/enable
interrupts and makes power management calls. This causes 2
problems for console writing:

1. A console write can occur in contexts that are illegal for
   pm_runtime_*(). It is not even necessary for console writing
   to use pm_runtime_*() because a console already does this in
   serial8250_console_setup() and serial8250_console_exit().

2. The console ->write() callback already handles
   disabling/enabling the interrupts by properly restoring the
   previous IER value.

Add an argument @toggle_ier to the ->rs485_start_tx() and
->rs485_stop_tx() callbacks to specify if they may disable/enable
receive interrupts while using pm_runtime_*(). Console writing
will not allow the toggling.

For all call sites other than console writing there is no
functional change.

Signed-off-by: John Ogness <john.ogness@linutronix.de>
Reviewed-by: Petr Mladek <pmladek@suse.com>
Link: https://lore.kernel.org/r/20250107212702.169493-5-john.ogness@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/8250/8250.h
drivers/tty/serial/8250/8250_bcm2835aux.c
drivers/tty/serial/8250/8250_omap.c
drivers/tty/serial/8250/8250_port.c
include/linux/serial_8250.h