2
0
mirror of git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git synced 2025-09-04 20:19:47 +08:00
linux/drivers/tty/serial
Stephan Gerhold 7094832b5a serial: msm: Configure correct working mode before starting earlycon
The MSM UART DM controller supports different working modes, e.g. DMA or
the "single-character mode", where all reads/writes operate on a single
character rather than 4 chars (32-bit) at once. When using earlycon,
__msm_console_write() always writes 4 characters at a time, but we don't
know which mode the bootloader was using and we don't set the mode either.

This causes garbled output if the bootloader was using the single-character
mode, because only every 4th character appears in the serial console, e.g.

  "[ 00oni pi  000xf0[ 00i s 5rm9(l)l s 1  1 SPMTA 7:C 5[ 00A ade k d[
   00ano:ameoi .Q1B[ 00ac _idaM00080oo'"

If the bootloader was using the DMA ("DM") mode, output would likely fail
entirely. Later, when the full serial driver probes, the port is
re-initialized and output works as expected.

Fix this also for earlycon by clearing the DMEN register and
reset+re-enable the transmitter to apply the change. This ensures the
transmitter is in the expected state before writing any output.

Cc: stable <stable@kernel.org>
Fixes: 0efe729634 ("tty: serial: msm: Add earlycon support")
Signed-off-by: Stephan Gerhold <stephan.gerhold@linaro.org>
Reviewed-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20250408-msm-serial-earlycon-v1-1-429080127530@linaro.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-04-11 16:58:47 +02:00
..
8250 treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
jsm tty: serial: switch from circ_buf to kfifo 2024-04-09 15:28:03 +02:00
21285.c serial: 21285: Use port lock wrappers 2023-09-18 11:18:08 +02:00
altera_jtaguart.c serial: altera_jtaguart: Use KBUILD_MODNAME 2024-12-04 16:35:53 +01:00
altera_uart.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
amba-pl010.c serial: amba-pl010: Switch to irq_get_nr_irqs() 2024-10-16 21:56:58 +02:00
amba-pl011.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
apbuart.c serial: apbuart: fix console prompt on qemu 2024-01-04 16:21:06 +01:00
apbuart.h
ar933x_uart.c serial: Switch back to struct platform_driver::remove() 2024-10-11 08:13:28 +02:00
arc_uart.c tty: serial: switch from circ_buf to kfifo 2024-04-09 15:28:03 +02:00
atmel_serial.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
atmel_serial.h
bcm63xx_uart.c serial: Switch back to struct platform_driver::remove() 2024-10-11 08:13:28 +02:00
clps711x.c serial: Switch back to struct platform_driver::remove() 2024-10-11 08:13:28 +02:00
cpm_uart.c TTY / Serial driver updates for 6.13-rc1 2024-11-30 09:03:16 -08:00
cpm_uart.h serial: cpm_uart: Remove cpm_uart/ subdirectory 2023-08-04 15:08:30 +02:00
digicolor-usart.c serial: Switch back to struct platform_driver::remove() 2024-10-11 08:13:28 +02:00
dz.c tty: serial: switch from circ_buf to kfifo 2024-04-09 15:28:03 +02:00
dz.h
earlycon-riscv-sbi.c tty/serial: Add RISC-V SBI debug console based earlycon 2024-01-10 07:04:04 -08:00
earlycon-semihost.c
earlycon.c init: Don't proxy console= to earlycon 2024-10-01 14:11:39 +02:00
esp32_acm.c serial: Switch back to struct platform_driver::remove() 2024-10-11 08:13:28 +02:00
esp32_uart.c serial: Switch back to struct platform_driver::remove() 2024-10-11 08:13:28 +02:00
fsl_linflexuart.c serial: Switch back to struct platform_driver::remove() 2024-10-11 08:13:28 +02:00
fsl_lpuart.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
icom.c serial: icom: fix code format problems 2025-03-20 08:10:40 -07:00
imx_earlycon.c
imx.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
ip22zilog.c tty: serial: switch from circ_buf to kfifo 2024-04-09 15:28:03 +02:00
ip22zilog.h
Kconfig serial: tegra-utc: Add driver for Tegra UART Trace Controller (UTC) 2025-02-14 10:06:50 +01:00
kgdboc.c Revert "tty/serial: Add kgdb_nmi driver" 2025-02-14 10:05:43 +01:00
lantiq.c serial: Switch back to struct platform_driver::remove() 2024-10-11 08:13:28 +02:00
liteuart.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
lpc32xx_hs.c serial: Switch back to struct platform_driver::remove() 2024-10-11 08:13:28 +02:00
ma35d1_serial.c tty: serial: pl011: remove incorrect of_match_ptr annotation 2025-03-20 08:09:56 -07:00
Makefile serial: tegra-utc: Add driver for Tegra UART Trace Controller (UTC) 2025-02-14 10:06:50 +01:00
max310x.c tty: serial: max310x: convert to use maple tree register cache 2024-04-09 16:50:36 +02:00
max3100.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
mcf.c serial: Switch back to struct platform_driver::remove() 2024-10-11 08:13:28 +02:00
men_z135_uart.c module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
meson_uart.c serial: Switch back to struct platform_driver::remove() 2024-10-11 08:13:28 +02:00
milbeaut_usio.c serial: Switch back to struct platform_driver::remove() 2024-10-11 08:13:28 +02:00
mpc52xx_uart.c serial: mpc52xx_uart: Remove legacy PM hook 2025-02-04 14:38:32 +01:00
mps2-uart.c serial: mps2-uart: Use port lock wrappers 2023-09-18 11:18:12 +02:00
msm_serial.c serial: msm: Configure correct working mode before starting earlycon 2025-04-11 16:58:47 +02:00
mux.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
mvebu-uart.c tty: serial: switch from circ_buf to kfifo 2024-04-09 15:28:03 +02:00
mxs-auart.c serial: Switch back to struct platform_driver::remove() 2024-10-11 08:13:28 +02:00
omap-serial.c serial: Switch back to struct platform_driver::remove() 2024-10-11 08:13:28 +02:00
owl-uart.c serial: Switch back to struct platform_driver::remove() 2024-10-11 08:13:28 +02:00
pch_uart.c serial: pch_uart: Remove legacy PM hook 2025-02-04 14:38:36 +01:00
pic32_uart.c serial: Switch back to struct platform_driver::remove() 2024-10-11 08:13:28 +02:00
pmac_zilog.c serial: Switch back to struct platform_driver::remove() 2024-10-11 08:13:28 +02:00
pmac_zilog.h
pxa.c serial: pxa: Use uart_prepare_sysrq_char(). 2024-03-02 22:06:21 +01:00
qcom_geni_serial.c Merge 6.12-rc4 into tty-next 2024-10-21 08:51:39 +02:00
rda-uart.c serial: Switch back to struct platform_driver::remove() 2024-10-11 08:13:28 +02:00
rp2.c serial: rp2: Replace deprecated PCI functions 2024-10-30 16:07:38 -05:00
sa1100.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
samsung_tty.c tty: serial: samsung: Add Exynos8895 compatible 2024-11-04 02:02:45 +01:00
sb1250-duart.c tty: serial: switch from circ_buf to kfifo 2024-04-09 15:28:03 +02:00
sc16is7xx_i2c.c module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
sc16is7xx_spi.c module: Convert symbol namespace to string literal 2024-12-02 11:34:44 -08:00
sc16is7xx.c serial: sc16is7xx: Fix IRQ number check behavior 2025-02-04 14:42:42 +01:00
sc16is7xx.h serial: sc16is7xx: split into core and I2C/SPI parts (sc16is7xx_regcfg) 2024-04-11 14:08:08 +02:00
sccnxp.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
serial_base_bus.c Driver core changes for 6.11-rc1 2024-07-25 10:42:22 -07:00
serial_base.h serial: core: Add serial_base_match_and_update_preferred_console() 2024-07-04 15:41:44 +02:00
serial_core.c TTY/Serial driver updates for 6.15-rc1 2025-04-02 18:17:33 -07:00
serial_ctrl.c serial: core: Start managing serial controllers to enable runtime PM 2023-05-31 10:46:59 +01:00
serial_mctrl_gpio.c serial: mctrl_gpio: split disable_ms into sync and no_sync APIs 2025-02-19 15:08:36 +01:00
serial_mctrl_gpio.h serial: mctrl_gpio: split disable_ms into sync and no_sync APIs 2025-02-19 15:08:36 +01:00
serial_port.c serial: port: Make ->iotype validation global in __uart_read_properties() 2025-02-04 14:44:44 +01:00
serial_txx9.c serial: Switch back to struct platform_driver::remove() 2024-10-11 08:13:28 +02:00
serial-tegra.c serial: Switch back to struct platform_driver::remove() 2024-10-11 08:13:28 +02:00
sh-sci.c treewide: Switch/rename to timer_delete[_sync]() 2025-04-05 10:30:12 +02:00
sh-sci.h tty: serial: sh-sci: Add support for tx end interrupt handling 2023-04-20 13:47:33 +02:00
sifive.c serial: Switch back to struct platform_driver::remove() 2024-10-11 08:13:28 +02:00
sprd_serial.c serial: sprd: Add support for sc9632 2024-11-13 15:14:17 +01:00
st-asc.c serial: Switch back to struct platform_driver::remove() 2024-10-11 08:13:28 +02:00
stm32-usart.c serial: stm32: do not deassert RS485 RTS GPIO prematurely 2025-03-20 08:30:44 -07:00
stm32-usart.h serial: stm32: get FIFO size from hwcfg register 2024-01-27 19:04:11 -08:00
suncore.c
sunhv.c serial: Switch back to struct platform_driver::remove() 2024-10-11 08:13:28 +02:00
sunplus-uart.c serial: Switch back to struct platform_driver::remove() 2024-10-11 08:13:28 +02:00
sunsab.c serial: Switch back to struct platform_driver::remove() 2024-10-11 08:13:28 +02:00
sunsab.h
sunsu.c tty: sunsu: remove unused serial_icr_read() 2025-03-20 08:00:51 -07:00
sunzilog.c serial: Switch back to struct platform_driver::remove() 2024-10-11 08:13:28 +02:00
sunzilog.h
tegra-tcu.c serial: Switch back to struct platform_driver::remove() 2024-10-11 08:13:28 +02:00
tegra-utc.c serial: tegra-utc: Add driver for Tegra UART Trace Controller (UTC) 2025-02-14 10:06:50 +01:00
timbuart.c serial: Switch back to struct platform_driver::remove() 2024-10-11 08:13:28 +02:00
timbuart.h
uartlite.c serial: Switch back to struct platform_driver::remove() 2024-10-11 08:13:28 +02:00
ucc_uart.c TTY / Serial driver updates for 6.13-rc1 2024-11-30 09:03:16 -08:00
vt8500_serial.c serial: vt8500: Use port lock wrappers 2023-09-18 11:18:16 +02:00
xilinx_uartps.c serial: xilinx_uartps: Switch to use hrtimer_setup() 2025-02-20 15:38:34 +01:00
zs.c tty: serial: switch from circ_buf to kfifo 2024-04-09 15:28:03 +02:00
zs.h