cr50: enable utmi wakeups

We had disabled wakeups on the AP phy when we were running on gru,
because the AP phy was not in use. We never changed that for reef, so
UTMI wakeups were disabled even when the AP USB was supposed to be
enabled. After Cr50 went to sleep any usb transactions would drop bits,
because Cr50 wouldn't notice anything was happening until it woke up on
one of the HOOK_TICK events.

This change reenables UTMI wakeups on boards with AP usb. It writes 1 to
USB_PCGCCTL_STOPCLK. This makes the controller disable the PHY clock
whenever it detects a usb suspend. When it resumes out of suspend, this
bit has no effect.

BUG=b:35774906
BRANCH=cr50
TEST=Boot up reef. Wait until cr50 goes to sleep run 'usb_updater -f'
and verify that it runs successfully. Make sure deep sleep still works

Change-Id: I54bd866111b5c9b5738575f23757e0cbe4907ec4
Signed-off-by: Mary Ruthven <mruthven@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/448988
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Reviewed-by: Vadim Bendebury <vbendeb@chromium.org>
This commit is contained in:
Mary Ruthven
2017-03-03 13:25:32 -08:00
committed by chrome-bot
parent ad089de4b0
commit f8e9a694f2
3 changed files with 5 additions and 2 deletions

View File

@@ -138,7 +138,7 @@ void rdd_detached(void)
/* Done with case-closed debug mode */
gpio_set_level(GPIO_CCD_MODE_L, 1);
enable_usb_wakeup = 0;
enable_usb_wakeup = board_has_ap_usb();
ec_uart_enabled = 0;
/* Disable CCD */

View File

@@ -94,7 +94,7 @@ static void prepare_to_sleep(void)
/* Wake on RBOX interrupts */
GREG32(RBOX, WAKEUP) = GC_RBOX_WAKEUP_ENABLE_MASK;
if (utmi_wakeup_is_enabled())
if (utmi_wakeup_is_enabled() && idle_action != IDLE_DEEP_SLEEP)
GR_PMU_EXITPD_MASK |=
GC_PMU_EXITPD_MASK_UTMI_SUSPEND_N_MASK;

View File

@@ -1261,6 +1261,9 @@ void usb_init(void)
GR_USB_DIEPMSK = 0;
GR_USB_DOEPMSK = 0;
/* Disable the PHY clock whenever usb suspend is detected */
GWRITE_FIELD(USB, PCGCCTL, STOPPCLK, 1);
/* Select the correct PHY */
usb_select_phy(which_phy);