summaryrefslogtreecommitdiff
path: root/common/main.c
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2017-07-07 10:44:34 +0200
committerchrome-bot <chrome-bot@chromium.org>2017-08-02 17:26:42 -0700
commite156e014dda43438761985cf67ca95ec48cb3208 (patch)
tree29ea27317133b319731c3cf4507d38833f0c13cc /common/main.c
parentec99f3913791bfe1935735ddcda18bd29ffcfd18 (diff)
downloadchrome-ec-e156e014dda43438761985cf67ca95ec48cb3208.tar.gz
g: slightly optimize boot on USB resume
Save a small amount of time when the USB resume is making the chip boot from deep-sleep by removing the verbose serial traces in main and increasing the usb initialization priority. This brings us from borderline timings wrt the USB specification to a reasonable margin. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=none BUG=b:38160821 TEST=run on hotelgolf, go to deep-sleep on USB-suspend. On USB resume, measure the time from CPU boot to the end of usb_init using the CPU cycle count. We are shaving 1.3ms. Change-Id: Ia5bf69c0ca26748dec59a87f3908a5fe68296b36 Reviewed-on: https://chromium-review.googlesource.com/563206 Commit-Ready: Marius Schilder <mschilder@chromium.org> Tested-by: Marius Schilder <mschilder@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Marius Schilder <mschilder@chromium.org> Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
Diffstat (limited to 'common/main.c')
-rw-r--r--common/main.c22
1 files changed, 13 insertions, 9 deletions
diff --git a/common/main.c b/common/main.c
index a05f5808b0..d1ea65d0d1 100644
--- a/common/main.c
+++ b/common/main.c
@@ -121,16 +121,20 @@ test_mockable __keep int main(void)
/* Initialize UART. Console output functions may now be used. */
uart_init();
- if (system_jumped_to_this_image()) {
- CPRINTS("UART initialized after sysjump");
- } else {
- CPUTS("\n\n--- UART initialized after reboot ---\n");
- CPUTS("[Reset cause: ");
- system_print_reset_flags();
- CPUTS("]\n");
+ /* be less verbose if we boot for USB resume to meet spec timings */
+ if (!(system_get_reset_flags() & RESET_FLAG_USB_RESUME)) {
+ if (system_jumped_to_this_image()) {
+ CPRINTS("UART initialized after sysjump");
+ } else {
+ CPUTS("\n\n--- UART initialized after reboot ---\n");
+ CPUTS("[Reset cause: ");
+ system_print_reset_flags();
+ CPUTS("]\n");
+ }
+ CPRINTF("[Image: %s, %s]\n",
+ system_get_image_copy_string(),
+ system_get_build_info());
}
- CPRINTF("[Image: %s, %s]\n",
- system_get_image_copy_string(), system_get_build_info());
#ifdef CONFIG_BRINGUP
ccprintf("\n\nWARNING: BRINGUP BUILD\n\n\n");