Pali Rohár ee3a62cb26 serial: mvebu-uart: fix tx lost characters at power off
commit 54ca955b5a4024e2ce0f206b03adb7109bc4da26 upstream.

Commit c685af1108d7 ("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: c685af1108d7 ("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>
2021-01-27 11:55:16 +01:00
..
2020-10-28 13:39:14 +01:00
2020-08-31 07:19:25 +02:00
2020-01-29 10:13:27 -08:00
2020-08-18 13:51:18 +02:00
2020-07-20 09:39:11 +02:00
2020-05-15 12:22:19 +02:00
2020-10-05 13:32:30 +02:00
2020-08-18 13:51:18 +02:00
2020-01-29 10:13:27 -08:00
2020-09-27 14:17:43 +02:00
2019-12-18 15:04:57 +01:00
2020-04-16 16:13:34 +02:00
2021-01-27 11:54:59 +01:00
2020-01-29 10:13:27 -08:00