uart: provide polling mode of operation

Early hardware bringup often is complicated by exceptions happening in
the code all over the place. Using interrupt based console output to
trace startup progress is inefficient - a lot of text gets buffered
and never shows up on the console.

The new config option enables the mode where the console output is
supposed to be happening in polling mode, the character transmit
function not exiting until the entire character is transmitted.

BRANCH=none
BUG=chrome-os-partner:43791
TEST=with the new config enabled (and the appropriate changes to
     chip/g/uart.c) was able to debug bringup on the new version.

Change-Id: I85fd2f3990ac1d31097d58bd6a7fa658b2b5146e
Signed-off-by: Vadim Bendebury <vbendeb@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/291852
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
This commit is contained in:
Vadim Bendebury
2015-08-07 13:24:30 -07:00
committed by ChromeOS Commit Bot
parent c124e8cbc7
commit 6cb2008348
2 changed files with 17 additions and 0 deletions

View File

@@ -68,6 +68,12 @@ static int __tx_char(void *context, int c)
if (c == '\n' && __tx_char(NULL, '\r'))
return 1;
#if defined CONFIG_POLLING_UART
(void) tx_buf_next;
(void) tx_buf_new_tail;
uart_write_char(c);
#else
tx_buf_next = TX_BUF_NEXT(tx_buf_head);
if (tx_buf_next == tx_buf_tail)
return 1;
@@ -89,6 +95,7 @@ static int __tx_char(void *context, int c)
tx_buf[tx_buf_head] = c;
tx_buf_head = tx_buf_next;
#endif
return 0;
}

View File

@@ -1220,6 +1220,16 @@
*/
#undef CONFIG_PMU_POWERINFO
/*
* Enable this config to make console UART self sufficient (no other
* initialization required before uart_init(), no interrupts, uart_tx_char()
* does not exit until character finished transmitting).
*
* This is useful during early hardware bringup, each platform needs to
* implement its own code to support this.
*/
#undef CONFIG_POLLING_UART
/*****************************************************************************/
/*