summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNicolas Boichat <drinkcat@chromium.org>2018-12-12 16:53:35 +0800
committerchrome-bot <chrome-bot@chromium.org>2018-12-23 14:46:08 -0800
commit4c98d54c19702fdad5864ae6518913a21b64b192 (patch)
tree31be5fd62431ccebc1c144f4a09cc6809f48a2e2
parent9b9ca849029d804a3cc99bbe2854b22ae2cb0207 (diff)
downloadchrome-ec-4c98d54c19702fdad5864ae6518913a21b64b192.tar.gz
mt_scp/uart: Do not use usleep in tx_flush/write_char
These functions may be called in interrupt/exception context, especially when panic_printf is used. We need to busy-loop. BRANCH=none BUG=b:119929419 TEST=crash divzero works Change-Id: Ie97243afcc433226e78ea1b1225227c6ffbf2a04 Signed-off-by: Nicolas Boichat <drinkcat@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1373288 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Reviewed-by: Yilun Lin <yllin@chromium.org>
-rw-r--r--chip/mt_scp/uart.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/chip/mt_scp/uart.c b/chip/mt_scp/uart.c
index 73a284319c..94f78748dd 100644
--- a/chip/mt_scp/uart.c
+++ b/chip/mt_scp/uart.c
@@ -15,7 +15,6 @@
/* Console UART index */
#define UARTN CONFIG_UART_CONSOLE
-#define UART_WAIT_US 50
#define UART_IDLE_WAIT_US 500
static uint8_t uart_done, tx_started;
@@ -58,7 +57,7 @@ void uart_tx_stop(void)
void uart_tx_flush(void)
{
while (!(UART_LSR(UARTN) & UART_LSR_TEMT))
- usleep(UART_WAIT_US);
+ ;
}
int uart_tx_ready(void)
@@ -76,7 +75,7 @@ int uart_rx_available(void)
void uart_write_char(char c)
{
while (!uart_tx_ready())
- usleep(UART_WAIT_US);
+ ;
UART_DATA(UARTN) = c;
}