kernel_samsung_a53x/drivers/tty/serial/8250
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
..
8250.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_accent.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_acorn.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_aspeed_vuart.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_bcm2835aux.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_boca.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_core.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_dma.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_dw.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_dwlib.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_dwlib.h Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_early.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_em.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_exar.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_exar_st16c554.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_fintek.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_fourport.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_fsl.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_gsc.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_hp300.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_hub6.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_ingenic.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_ioc3.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_lpc18xx.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_lpss.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_men_mcb.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_mid.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_mtk.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_of.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_omap.c serial: 8250: omap: Fix imprecise external abort for omap_8250_pm() 2024-11-08 11:26:14 +01:00
8250_pci.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_pnp.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_port.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_pxa.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_tegra.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00
8250_uniphier.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
serial_cs.c Import A536BXXU9EXDC 2024-06-15 16:02:09 -03:00