diff options
author | Mattijs Korpershoek <mkorpershoek@baylibre.com> | 2023-06-06 18:07:48 +0200 |
---|---|---|
committer | Neil Armstrong <neil.armstrong@linaro.org> | 2023-06-07 10:09:20 +0200 |
commit | afa85a2247297d660a63295bfbdd6e24e8e56902 (patch) | |
tree | 6aed0e68852c6effb842841d90d68754ac08cf99 /arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c | |
parent | fadf83c86d7252df2b50ba526ffeea95658cb5b5 (diff) |
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 c5f4cdb8eb60 ("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>
Diffstat (limited to 'arch/arm/mach-stm32mp/cmd_stm32prog/stm32prog_usb.c')
0 files changed, 0 insertions, 0 deletions