From 71133a0d80dcb6f15e3bd57dd0c4e29d978b1e66 Mon Sep 17 00:00:00 2001 From: Bill Richardson Date: Fri, 6 Nov 2015 10:15:06 -0800 Subject: [PATCH] Cr50: Fix uart_tx_flush() to really flush We were just checking to see if the UART TX unit was idle. We also need to be sure there aren't any bytes in the TX FIFO that haven't been clocked out yet. BUG=none BRANCH=none TEST=make buildall, manual Before, "crash watchdog" would truncate the trace dump as it rebooted. Now it doesn't. Change-Id: Icff828445801ce61a0a8f296b3d3e9fb300b7efc Signed-off-by: Bill Richardson Reviewed-on: https://chromium-review.googlesource.com/311299 Reviewed-by: Vadim Bendebury --- chip/g/uart.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/chip/g/uart.c b/chip/g/uart.c index 665d893e11..f7219d5d4c 100644 --- a/chip/g/uart.c +++ b/chip/g/uart.c @@ -57,8 +57,9 @@ void uart_tx_stop(void) int uart_tx_in_progress(void) { - /* Transmit is in progress if the TX idle bit is not set */ - return !(GR_UART_STATE(0) & GC_UART_STATE_TXIDLE_MASK); + /* Transmit is in progress unless the TX FIFO is empty and idle. */ + return !(GR_UART_STATE(0) & (GC_UART_STATE_TXIDLE_MASK | + GC_UART_STATE_TXEMPTY_MASK)); } void uart_tx_flush(void)