diff options
author | John Ogness <john.ogness@linutronix.de> | 2025-01-07 22:33:00 +0106 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2025-01-10 16:08:25 +0100 |
commit | 910ef438e93cd2ceb70c72caea418710d648feef (patch) | |
tree | c6e1da5379b2f0f6c374888232450d3cbc1578b8 /include/linux/serial_8250.h | |
parent | 95a1b409ba08b602bf4464786ac74d21ae0acbf3 (diff) | |
download | linux-910ef438e93cd2ceb70c72caea418710d648feef.tar.gz linux-910ef438e93cd2ceb70c72caea418710d648feef.tar.bz2 linux-910ef438e93cd2ceb70c72caea418710d648feef.zip |
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>
Diffstat (limited to 'include/linux/serial_8250.h')
-rw-r--r-- | include/linux/serial_8250.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/include/linux/serial_8250.h b/include/linux/serial_8250.h index e0717c8393d7..144de7a7948d 100644 --- a/include/linux/serial_8250.h +++ b/include/linux/serial_8250.h @@ -161,8 +161,8 @@ struct uart_8250_port { void (*dl_write)(struct uart_8250_port *up, u32 value); struct uart_8250_em485 *em485; - void (*rs485_start_tx)(struct uart_8250_port *); - void (*rs485_stop_tx)(struct uart_8250_port *); + void (*rs485_start_tx)(struct uart_8250_port *up, bool toggle_ier); + void (*rs485_stop_tx)(struct uart_8250_port *up, bool toggle_ier); /* Serial port overrun backoff */ struct delayed_work overrun_backoff; |