]> git.baikalelectronics.ru Git - kernel.git/commit
serial: mvebu-uart: fix tx lost characters at power off
authorPali Rohár <pali@kernel.org>
Wed, 23 Dec 2020 19:19:31 +0000 (20:19 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Mon, 28 Dec 2020 15:17:34 +0000 (16:17 +0100)
commit99fa4c7202fd070eb5a6e9c36b7790ef87de53f4
tree04e7308b7888995b2d5ad3b8d30de526b75d01fe
parent2af7ba1dc0ac24f9c1b6fbed627077d8df258132
serial: mvebu-uart: fix tx lost characters at power off

Commit 23806f5ed4f6 ("serial: mvebu-uart: fix tx lost characters") fixed tx
lost characters at low baud rates but started causing tx lost characters
when kernel is going to power off or reboot.

TX_EMP tells us when transmit queue is empty therefore all characters were
transmitted. TX_RDY tells us when CPU can send a new character.

Therefore we need to use different check prior transmitting new character
and different check after all characters were sent.

This patch splits polling code into two functions: wait_for_xmitr() which
waits for TX_RDY and wait_for_xmite() which waits for TX_EMP.

When rebooting A3720 platform without this patch on UART is print only:
[   42.699�

And with this patch on UART is full output:
[   39.530216] reboot: Restarting system

Fixes: 23806f5ed4f6 ("serial: mvebu-uart: fix tx lost characters")
Signed-off-by: Pali Rohár <pali@kernel.org>
Cc: stable <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/20201223191931.18343-1-pali@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/serial/mvebu-uart.c