u-boot/drivers/serial
Mattijs Korpershoek afa85a2247 serial: meson: fix meson_serial_pending() tx logic
According to the dm_serial_ops documentation, pending() should:
> @return number of waiting characters, 0 for none, -ve on error

And:
> It is acceptable to return 1 if an indeterminant number
> of characters is waiting.

With the current implementation, we have:
* FIFO is full           -> pending() returns 0
* FIFO is partially used -> pending() returns 1
* FIFO is empty          -> pending() returns 1

This is not the same as what the documentation requires.

Moreover, since [1], arm reset now flushes all console devices
(including serial) before the cpu gets reset.
Because of the flawed logic:

  => reset # user calls reset
  flush() is called
  _serial_flush() is called
  ops->pending(dev, false) # never returns false
  # board hangs indefinitely without resetting.

Fix it by using AML_UART_TX_EMPTY instead of AML_UART_TX_FULL.

[1] commit c5f4cdb8eb ("console: Use flush() before panic and reset"),

Signed-off-by: Mattijs Korpershoek <mkorpershoek@baylibre.com>
Acked-by: Neil Armstrong <neil.armstrong@linaro.org>
Link: https://lore.kernel.org/r/20230606-fix-meson-serial-pending-v1-1-6a54d4a01f76@baylibre.com
Signed-off-by: Neil Armstrong <neil.armstrong@linaro.org>
2023-06-07 10:09:20 +02:00
..
altera_jtag_uart.c serial: Replace CONFIG_DEBUG_UART_BASE by CONFIG_VAL(DEBUG_UART_BASE) 2022-06-06 18:01:21 -04:00
altera_uart.c serial: Replace CONFIG_DEBUG_UART_BASE by CONFIG_VAL(DEBUG_UART_BASE) 2022-06-06 18:01:21 -04:00
arm_dcc.c serial: arm_dcc: Use CONFIG_ARM64 not CONFIG_CPU_ARMV8 2021-12-27 16:20:18 -05:00
atmel_usart.c kbuild: Remove uncmd_spl logic 2022-12-23 10:15:13 -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: mxs: Add MXS AUART driver 2023-05-21 16:54:41 +02:00
Makefile serial: mxs: Add MXS AUART driver 2023-05-21 16:54:41 +02:00
ns16550.c global: Finish CONFIG -> CFG migration 2023-01-20 12:27:24 -05:00
sandbox.c video: Rename CONFIG_DM_VIDEO to CONFIG_VIDEO 2022-10-30 20:07:17 +01:00
serial-uclass.c serial-uclass: drop redundant code in serial_check_stdout() 2023-04-06 19:10:08 -04:00
serial.c post: Move CONFIG_SYS_POST to CFG_SYS_POST 2022-12-23 13:01:13 -05:00
serial_ar933x.c serial: Replace CONFIG_DEBUG_UART_BASE by CONFIG_VAL(DEBUG_UART_BASE) 2022-06-06 18:01:21 -04:00
serial_arc.c serial: Use -EAGAIN in getc and putc 2023-01-02 16:01:40 -05:00
serial_bcm283x_mu.c Correct SPL uses of OF_BOARD 2023-02-10 07:41:41 -05:00
serial_bcm283x_pl011.c Correct SPL uses of OF_BOARD 2023-02-10 07:41:41 -05:00
serial_bcm6345.c serial: Replace CONFIG_DEBUG_UART_BASE by CONFIG_VAL(DEBUG_UART_BASE) 2022-06-06 18:01:21 -04:00
serial_coreboot.c x86: Allow locating the UART from ACPI tables 2023-05-11 10:25:29 +08: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 efi: serial: Support arrow keys 2021-12-31 06:45:01 +01:00
serial_htif.c serial: Add RISC-V HTIF console driver 2022-02-10 11:18:12 +08:00
serial_intel_mid.c serial: Update NS16550_t and struct NS16550 2021-01-05 12:24:40 -07:00
serial_linflexuart.c serial: Replace CONFIG_DEBUG_UART_BASE by CONFIG_VAL(DEBUG_UART_BASE) 2022-06-06 18:01:21 -04:00
serial_lpuart.c serial: Use -EAGAIN in getc and putc 2023-01-02 16:01:40 -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 serial: meson: fix meson_serial_pending() tx logic 2023-06-07 10:09:20 +02:00
serial_mpc8xx.c serial, mpc8xx: Take parameter RAM relocation into account 2023-05-05 07:26:53 +02:00
serial_msm.c WS cleanup: remove trailing white space 2021-09-30 08:08:56 -04:00
serial_msm_geni.c serial: msm-geni: correct oversampling value based on QUP hardware revision 2023-05-02 14:23:59 -04:00
serial_mt7620.c cyclic: Use schedule() instead of WATCHDOG_RESET() 2022-09-18 10:26:33 +02:00
serial_mtk.c kbuild: Remove uncmd_spl logic 2022-12-23 10:15:13 -05:00
serial_mvebu_a3700.c serial: Use -EAGAIN in getc and putc 2023-01-02 16:01:40 -05:00
serial_mxc.c serial: mxc: Speed-up character transmission 2023-01-30 23:23:02 +01:00
serial_mxs.c serial: mxs: Add MXS AUART driver 2023-05-21 16:54:41 +02:00
serial_npcm.c serial: npcm: Add support for Nuvoton NPCM SoCs 2022-05-05 09:28:47 -04:00
serial_ns16550.c global: Move remaining CONFIG_SYS_NS16550_* to CFG_SYS_NS16550_* 2022-12-05 16:06:07 -05:00
serial_nulldev.c serial: remove nulldev_serial_input 2022-02-09 12:30:13 -07:00
serial_octeon_bootcmd.c cyclic: Use schedule() instead of WATCHDOG_RESET() 2022-09-18 10:26:33 +02:00
serial_octeon_pcie_console.c cyclic: Use schedule() instead of WATCHDOG_RESET() 2022-09-18 10:26:33 +02:00
serial_omap.c global: Finish CONFIG -> CFG migration 2023-01-20 12:27:24 -05: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 serial: Replace CONFIG_DEBUG_UART_BASE by CONFIG_VAL(DEBUG_UART_BASE) 2022-06-06 18:01:21 -04:00
serial_pl01x.c kbuild: Remove uncmd_spl logic 2022-12-23 10:15:13 -05:00
serial_pl01x_internal.h kbuild: Remove uncmd_spl logic 2022-12-23 10:15:13 -05:00
serial_rockchip.c rockchip: serial: rename U_BOOT_DRIVER name to rockchip_uart 2022-04-18 11:25:13 +08:00
serial_s5p.c serial: s5p: Use IS_ENABLED where appropriate 2023-01-27 14:32:55 -05:00
serial_s5p4418_pl011.c arm: s5p4418: dm_serial: add driver source code 2023-01-02 16:06:08 -05:00
serial_sbi.c serial: Add a debug console using the RISC-V SBI interface 2021-10-07 16:08:23 +08:00
serial_semihosting.c serial: smh: Fake tstc 2022-06-06 18:01:21 -04:00
serial_sh.c serial: sh: Add HSCIF support for R-Car SoC 2023-04-07 17:13:28 +02:00
serial_sh.h serial: sh: Add HSCIF support for R-Car SoC 2023-04-07 17:13:28 +02:00
serial_sifive.c cyclic: Use schedule() instead of WATCHDOG_RESET() 2022-09-18 10:26:33 +02:00
serial_sti_asc.c WS cleanup: remove trailing empty lines 2021-09-30 08:08:56 -04:00
serial_stm32.c serial: Replace CONFIG_DEBUG_UART_BASE by CONFIG_VAL(DEBUG_UART_BASE) 2022-06-06 18:01:21 -04: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 WS cleanup: remove trailing empty lines 2021-09-30 08:08:56 -04:00
serial_xuartlite.c serial: Replace CONFIG_DEBUG_UART_BASE by CONFIG_VAL(DEBUG_UART_BASE) 2022-06-06 18:01:21 -04:00
serial_zynq.c drivers: use dev_read_addr_ptr when cast to pointer 2023-05-06 17:28:18 +08:00
usbtty.c global: Finish CONFIG -> CFG migration 2023-01-20 12:27:24 -05:00
usbtty.h global: Finish CONFIG -> CFG migration 2023-01-20 12:27:24 -05:00