diff options
author | Mary Ruthven <mruthven@chromium.org> | 2016-07-14 18:43:12 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-07-19 16:32:10 -0700 |
commit | c0f6ac5e02cdb7a25f593af6dce7b0eea71d996d (patch) | |
tree | 9c6b8025c62cbaeb81f1da9168b159611340c40a /chip/g/idle.c | |
parent | 4cedfaab42ff020616a0445a96d13295f798d6ad (diff) | |
download | chrome-ec-c0f6ac5e02cdb7a25f593af6dce7b0eea71d996d.tar.gz |
g: disable usb wakeup when debug accessory is disconnected
USB is only used for CCD. USB should not be enabled as a wakeup source
unless a debug accessory is detected, because that is the only USB
traffic we care about. The rest may be from other sources like the HID
interface or something else using those signals. This change disables
the utmi wake source when the debug accessory is attached and enables it
when it is connected.
BUG=chrome-os-partner:54796
BRANCH=none
TEST=manual
The SPI_CS_L pin still gets triggered and will wake up cr50
before usb so disable wake up pins as a wakeup source.
Verify Cr50 goes to sleep and plugging in a SuzyQ will wake it
up and after removing it Cr50 will go back to sleep.
Change-Id: Ib97244016b0af244c340259915def9f4d8f97569
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/360693
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Diffstat (limited to 'chip/g/idle.c')
-rw-r--r-- | chip/g/idle.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/chip/g/idle.c b/chip/g/idle.c index dc003d3eef..68e2e16678 100644 --- a/chip/g/idle.c +++ b/chip/g/idle.c @@ -5,6 +5,7 @@ #include "common.h" #include "console.h" +#include "rdd.h" #include "registers.h" #include "system.h" #include "task.h" @@ -47,6 +48,14 @@ DECLARE_CONSOLE_COMMAND(idle, command_idle, "Set or show the idle action: wfi, sleep, deep sleep", NULL); +static int utmi_wakeup_is_enabled(void) +{ +#ifdef CONFIG_RDD + return is_utmi_wakeup_allowed(); +#endif + return 1; +} + static void prepare_to_sleep(void) { /* No task switching! */ @@ -55,11 +64,14 @@ static void prepare_to_sleep(void) /* Enable all possible internal wake sources */ GR_PMU_EXITPD_MASK = GC_PMU_EXITPD_MASK_PIN_PD_EXIT_MASK | - GC_PMU_EXITPD_MASK_UTMI_SUSPEND_N_MASK | GC_PMU_EXITPD_MASK_RDD0_PD_EXIT_TIMER_MASK | GC_PMU_EXITPD_MASK_TIMELS0_PD_EXIT_TIMER0_MASK | GC_PMU_EXITPD_MASK_TIMELS0_PD_EXIT_TIMER1_MASK; + if (utmi_wakeup_is_enabled()) + GR_PMU_EXITPD_MASK |= + GC_PMU_EXITPD_MASK_UTMI_SUSPEND_N_MASK; + /* Which rails should we turn off? */ GR_PMU_LOW_POWER_DIS = GC_PMU_LOW_POWER_DIS_VDDIOF_MASK | |