]> git.baikalelectronics.ru Git - uboot.git/commit
serial: mxc: Wait for TX completion before reset
authorLoic Poulain <loic.poulain@linaro.org>
Thu, 12 Jan 2023 17:19:50 +0000 (18:19 +0100)
committerStefano Babic <sbabic@denx.de>
Mon, 30 Jan 2023 22:23:02 +0000 (23:23 +0100)
commitac01204d940022ba6dc978e7e1fa832d1615a225
treee666ee09acee284d07d40b434cba5c90e6ac03de
parent2043290be01196082b617356effa741ec7c22d63
serial: mxc: Wait for TX completion before reset

The u-boot console may show some corrupted characters when
printing in board_init() due to reset or baudrate change
of the UART (probe) before the TX FIFO has been completely
drained.

To fix this issue, and in case UART is still running, we now
try to flush the FIFO before proceeding to UART reinitialization.
For this we're waiting for Transmitter Complete bit, indicating
that the FIFO and the shift register are empty.

flushing has a 4ms timeout guard, which is normally more than
enough to consume the FIFO @ low baudrate (9600bps).

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>
Tested-by: Lothar Waßmann <LW@KARO-electronics.de>
Acked-by: Pali Rohár <pali@kernel.org>
Reviewed-by: Fabio Estevam <festevam@denx.de>
drivers/serial/serial_mxc.c