u-boot/drivers/serial
Stephan Gerhold 725cf89512 serial: serial_msm: Ensure BAM/single character mode are disabled
At the moment, the U-Boot serial_msm driver does not initialize the
UART_DM_DMEN register with the required value. Usually this does not
cause any problems, because there is Qualcomm's LK bootloader running
before U-Boot which initializes the register with the correct value.

It's important that this register is initialized correctly, because
the U-Boot driver does not make use of the BAM/DMA or single character
mode functionality of the UART controller. A different bootloader
before U-Boot might initialize the register differently.

For example, on DragonBoard 410c U-Boot can also be installed to the
"aboot" partition (replacing LK entirely). In this case U-Boot is
loaded directly by SBL, which seems to use the single-character mode
for some reason. In single character mode there is always just one
char in the FIFO, instead of the 4 characters expected by
msm_serial_fetch(). It also causes issues with "earlycon" later in
the Linux kernel, which tries to output 4 chars at once,
but only the first char will be written.

This causes early UART log in Linux to be corrupted like this:

    [ 00ano:ameoi .Q1B[ 00ac _idaM00080oo'ahani-lcle._20). 15NdNii 5 SPMSJ20:U2
    [ 00rkoolmsamel
    [ 00Fw ]elamletopsioble
    [ 00ore

instead of

    [    0.000000] Booting Linux on physical CPU 0x0000000000 [0x410fd030]
    [    0.000000] Machine model: Qualcomm Technologies, Inc. APQ 8016 SBC
    [    0.000000] earlycon: msm_serial_dm0 at MMIO 0x00000000078b0000 (options '')
    [    0.000000] printk: bootconsole [msm_serial_dm0] enabled

Make sure to initialize UART_DM_DMEN correctly to fix this issue
when loading U-Boot directly after SBL (instead of through LK).

There is no functional difference when loading U-Boot through LK
since LK also initializes UART_DM_DMEN to 0x0. [1]

[1]: https://git.linaro.org/landing-teams/working/qualcomm/lk.git/tree/platform/msm_shared/uart_dm.c?h=dragonboard410c-LA.BR.1.2.7-03810-8x16.0-linaro3#n203

Cc: Ramon Fried <rfried.dev@gmail.com>
Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
Reviewed-by: Ramon Fried <rfried.dev@gmail.com>
2021-07-06 14:12:15 -04:00
..
altera_jtag_uart.c dm: Use access methods for dev/uclass private data 2021-01-05 12:24:40 -07:00
altera_uart.c dm: Use access methods for dev/uclass private data 2021-01-05 12:24:40 -07:00
arm_dcc.c serial: Remove DM_FLAG_PRE_RELOC flag in various drivers 2018-11-14 09:16:28 -08:00
atmel_usart.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
atmel_usart.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
Kconfig serial: Add additional depencies for PL010 and PL011 drivers 2021-06-28 08:55:04 +02:00
lpc32xx_hsuart.c dm: treewide: Rename ..._platdata variables to just ..._plat 2020-12-13 16:51:09 -07:00
Makefile serial: serial_octeon_bootcmd.c: Add PCI remote console support 2021-04-23 21:22:55 +02:00
ns16550.c serial: ns16550: Handle zero <clock-frequency> value 2021-03-03 19:17:25 -07:00
sandbox.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
serial-uclass.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
serial.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
serial_ar933x.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
serial_arc.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
serial_bcm283x_mu.c dm: treewide: Rename ..._platdata variables to just ..._plat 2020-12-13 16:51:09 -07:00
serial_bcm283x_pl011.c dm: treewide: Rename ..._platdata variables to just ..._plat 2020-12-13 16:51:09 -07:00
serial_bcm6345.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
serial_coreboot.c x86: Make coreboot sysinfo available to any x86 board 2021-03-27 13:59:37 +13:00
serial_cortina.c dm: treewide: Rename ofdata_to_platdata() to of_to_plat() 2020-12-13 16:51:09 -07:00
serial_efi.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
serial_intel_mid.c serial: Update NS16550_t and struct NS16550 2021-01-05 12:24:40 -07:00
serial_linflexuart.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
serial_lpuart.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
serial_mcf.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
serial_meson.c dm: Use access methods for dev/uclass private data 2021-01-05 12:24:40 -07:00
serial_mpc8xx.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
serial_msm.c serial: serial_msm: Ensure BAM/single character mode are disabled 2021-07-06 14:12:15 -04:00
serial_mt7620.c serial: add uart driver for MediaTek MT7620 SoC 2021-01-24 21:39:26 +01:00
serial_mtk.c serial: mtk: rewrite the setbrg function 2021-03-20 16:24:27 -04:00
serial_mvebu_a3700.c serial: a3720: Implement pending method for output direction 2021-01-27 13:12:51 +01:00
serial_mxc.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
serial_ns16550.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
serial_nulldev.c SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00
serial_octeon_bootcmd.c serial: serial_octeon_bootcmd.c: Add PCI remote console support 2021-04-23 21:22:55 +02:00
serial_octeon_pcie_console.c serial: serial_octeon_pcie_console.c: Add PCI remote console support 2021-04-23 21:22:55 +02:00
serial_omap.c dm: Use access methods for dev/uclass private data 2021-01-05 12:24:40 -07:00
serial_owl.c dm: treewide: Rename ofdata_to_platdata() to of_to_plat() 2020-12-13 16:51:09 -07:00
serial_pic32.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
serial_pl01x.c treewide: Convert macro and uses of __section(foo) to __section("foo") 2021-05-24 14:21:30 -04:00
serial_pl01x_internal.h dm: treewide: Rename ofdata_to_platdata() to of_to_plat() 2020-12-13 16:51:09 -07:00
serial_pxa.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
serial_rockchip.c dm: Use access methods for dev/uclass private data 2021-01-05 12:24:40 -07:00
serial_s5p.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
serial_sh.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
serial_sh.h sh: sh3: Remove CPU support 2019-05-10 22:43:18 +02:00
serial_sifive.c Merge branch '2021-02-02-drop-asm_global_data-when-unused' 2021-02-15 10:16:45 -05:00
serial_sti_asc.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
serial_stm32.c serial: stm32: define LOG_CATEGORY 2021-01-13 09:52:58 +01:00
serial_stm32.h dm: treewide: Rename ..._platdata variables to just ..._plat 2020-12-13 16:51:09 -07:00
serial_uniphier.c dm: treewide: Rename auto_alloc_size members to be shorter 2020-12-13 08:00:25 -07:00
serial_xen.c common: Drop asm/global_data.h from common header 2021-02-02 15:33:42 -05:00
serial_xuartlite.c Xilinx changes for v2021.04 2021-01-06 07:57:33 -05:00
serial_zynq.c serial: zynq: Add support for serial parameters 2021-06-28 08:56:03 +02:00
usbtty.c serial: usbtty: Send urb data in correct order 2021-03-03 04:12:45 +01:00
usbtty.h SPDX: Convert all of our single license tags to Linux Kernel style 2018-05-07 09:34:12 -04:00