kernel_samsung_a53x/drivers/tty
Tony Lindgren fb4bde4362 serial: 8250: omap: Fix imprecise external abort for omap_8250_pm()
[ Upstream commit 398cecc24846e867b9f90a0bd22730e3df6b05be ]

We must idle the uart only after serial8250_unregister_port(). Otherwise
unbinding the uart via sysfs while doing cat on the port produces an
imprecise external abort:

mem_serial_in from omap_8250_pm+0x44/0xf4
omap_8250_pm from uart_hangup+0xe0/0x194
uart_hangup from __tty_hangup.part.0+0x37c/0x3a8
__tty_hangup.part.0 from uart_remove_one_port+0x9c/0x22c
uart_remove_one_port from serial8250_unregister_port+0x60/0xe8
serial8250_unregister_port from omap8250_remove+0x6c/0xd0
omap8250_remove from platform_remove+0x28/0x54

Turns out the driver needs to have runtime PM functional before the
driver probe calls serial8250_register_8250_port(). And it needs
runtime PM after driver remove calls serial8250_unregister_port().

On probe, we need to read registers before registering the port in
omap_serial_fill_features_erratas(). We do that with custom uart_read()
already.

On remove, after serial8250_unregister_port(), we need to write to the
uart registers to idle the device. Let's add a custom uart_write() for
that.

Currently the uart register access depends on port->membase to be
initialized, which won't work after serial8250_unregister_port().
Let's use priv->membase instead, and use it for runtime PM related
functions to remove the dependency to port->membase for early and
late register access.

Note that during use, we need to check for a valid port in the runtime PM
related functions. This is needed for the optional wakeup configuration.
We now need to set the drvdata a bit earlier so it's available for the
runtime PM functions.

With the port checks in runtime PM functions, the old checks for priv in
omap8250_runtime_suspend() and omap8250_runtime_resume() functions are no
longer needed and are removed.

Signed-off-by: Tony Lindgren <tony@atomide.com>
Link: https://lore.kernel.org/r/20230508082014.23083-3-tony@atomide.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Stable-dep-of: 560706eff7c8 ("serial: 8250_omap: Fix errors with no_console_suspend")
Signed-off-by: Sasha Levin <sashal@kernel.org>
2024-11-08 11:26:14 +01:00
..
hvc Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ipwireless Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
serdev Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
serial serial: 8250: omap: Fix imprecise external abort for omap_8250_pm() 2024-11-08 11:26:14 +01:00
vt Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
amiserial.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
cyclades.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ehv_bytechan.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
goldfish.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
isicom.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Kconfig Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
Makefile Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mips_ejtag_fdc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
moxa.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
moxa.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mxser.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
mxser.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
n_gsm.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
n_hdlc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
n_null.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
n_r3964.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
n_tracerouter.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
n_tracesink.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
n_tracesink.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
n_tty.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
nozomi.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
pty.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rocket.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rocket.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
rocket_int.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
synclink.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
synclink_gt.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
synclinkmp.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
sysrq.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tty.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tty_audit.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tty_baudrate.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tty_buffer.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tty_io.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tty_ioctl.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tty_jobctrl.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tty_ldisc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tty_ldsem.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tty_mutex.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
tty_port.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
ttynull.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
vcc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00