mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-27 18:25:05 +00:00
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>
This commit is contained in:
@@ -14,7 +14,7 @@
|
||||
|
||||
#define CPRINTS(format, args...) cprints(CC_USB, format, ## args)
|
||||
|
||||
static int uart_enabled;
|
||||
static int uart_enabled, enable_usb_wakeup;
|
||||
|
||||
struct uart_config {
|
||||
const char *name;
|
||||
@@ -32,6 +32,12 @@ static int ccd_is_enabled(void)
|
||||
return !gpio_get_level(GPIO_CCD_MODE_L);
|
||||
}
|
||||
|
||||
int is_utmi_wakeup_allowed(void)
|
||||
{
|
||||
return enable_usb_wakeup;
|
||||
}
|
||||
|
||||
|
||||
/* If the UART TX is enabled the pinmux select will have a non-zero value */
|
||||
int uartn_enabled(int uart)
|
||||
{
|
||||
@@ -89,6 +95,8 @@ void rdd_attached(void)
|
||||
/* Enable CCD */
|
||||
ccd_set_mode(CCD_MODE_ENABLED);
|
||||
|
||||
enable_usb_wakeup = 1;
|
||||
|
||||
/* Enable device state monitoring */
|
||||
device_detect_state_enable(1);
|
||||
}
|
||||
@@ -109,6 +117,8 @@ void rdd_detached(void)
|
||||
/* Done with case-closed debug mode */
|
||||
gpio_set_level(GPIO_CCD_MODE_L, 1);
|
||||
|
||||
enable_usb_wakeup = 0;
|
||||
|
||||
/* Disable CCD */
|
||||
ccd_set_mode(CCD_MODE_DISABLED);
|
||||
}
|
||||
|
||||
@@ -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 |
|
||||
|
||||
@@ -11,4 +11,11 @@ void rdd_detached(void);
|
||||
|
||||
/* Attach to debug cable */
|
||||
void rdd_attached(void);
|
||||
|
||||
/*
|
||||
* USB is only used for CCD, so only enable UTMI wakeups when RDD detects that
|
||||
* a debug accessory is attached and disable it as a wakeup source when the
|
||||
* cable is detached.
|
||||
*/
|
||||
int is_utmi_wakeup_allowed(void);
|
||||
#endif /* __CROS_RDD_H */
|
||||
|
||||
Reference in New Issue
Block a user