summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVadim Bendebury <vbendeb@chromium.org>2015-04-29 16:43:11 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-04-30 02:31:07 +0000
commitfab26ee8914ad9f111d982388aeec61c13d6b1c6 (patch)
tree29112961410d78abecc611ea778434482eedaea2
parent1ecab8b50854bec3a803bdcef2213e7d351b96fc (diff)
downloadchrome-ec-fab26ee8914ad9f111d982388aeec61c13d6b1c6.tar.gz
cr50: allow using ccprintf() early in the process
Attempts to use ccprinf() before both uart and usb consoles have been initialized cause the device lock up. Luckily both console channels are buffered (and usb console buffering is about to be greatly improved), all what needs to be done is to hold on to the attempts to start transmit interrupts until hardware has been initialized. BRANCH=none BUG=none TEST=attempts to print something on the console early in the process do not cause the device to lock up any more, and the printouts show up where expected. Change-Id: I16cd1fab79bceaf7c2334a955fdb6046d21ed550 Signed-off-by: Vadim Bendebury <vbendeb@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/268379 Reviewed-by: Bill Richardson <wfrichar@chromium.org> Reviewed-by: Sheng-liang Song <ssl@chromium.org>
-rw-r--r--chip/g/uart.c3
-rw-r--r--chip/g/usb_console.c11
2 files changed, 8 insertions, 6 deletions
diff --git a/chip/g/uart.c b/chip/g/uart.c
index 8d0e39f868..d48b6e3d9b 100644
--- a/chip/g/uart.c
+++ b/chip/g/uart.c
@@ -21,6 +21,9 @@ int uart_init_done(void)
void uart_tx_start(void)
{
+ if (!uart_init_done())
+ return;
+
/* If interrupt is already enabled, nothing to do */
if (GR_UART_ICTRL(0) & GC_UART_ICTRL_TX_MASK)
return;
diff --git a/chip/g/usb_console.c b/chip/g/usb_console.c
index 6f84001007..252a2e4a1b 100644
--- a/chip/g/usb_console.c
+++ b/chip/g/usb_console.c
@@ -250,13 +250,12 @@ int usb_vprintf(const char *format, va_list args)
int ret;
int tx_idx = 0;
- ret = usb_wait_console();
- if (ret)
- return ret;
-
ret = vfnprintf(__tx_char, &tx_idx, format, args);
-
- usb_enable_tx(tx_idx);
+ if (!ret && is_reset) {
+ ret = usb_wait_console();
+ if (!ret)
+ usb_enable_tx(tx_idx);
+ }
return ret;
}