From 86d7ea33af1d6565afb169aefafff6cd08e30fe6 Mon Sep 17 00:00:00 2001 From: Randall Spangler Date: Tue, 15 Aug 2017 17:45:38 -0700 Subject: [PATCH] cr50: Remove BOARD_AP_USB property We previously disabled the USB PHY to the AP. But the BOARD_AP_USB property lingered on. Remove the property. Also clean up the idle task deciding when to do utmi wakes. With the AP USB connection disabled, that's only necessary when the debug cable is attached, so we can check that explicitly. BUG=none BRANCH=cr50 TEST=make buildall; boot CR50_DEV=1 image Change-Id: If81a7bcfe845d9d70dcc7e16239244a4f5f2427b Signed-off-by: Randall Spangler Reviewed-on: https://chromium-review.googlesource.com/616301 Reviewed-by: Vadim Bendebury Reviewed-by: Mary Ruthven --- board/cr50/board.c | 12 +++--------- board/cr50/board.h | 1 - board/cr50/rdd.c | 11 ----------- board/cr50/scratch_reg1.h | 5 ++--- chip/g/idle.c | 12 +++++++++--- chip/g/rdd.h | 6 ------ 6 files changed, 14 insertions(+), 33 deletions(-) diff --git a/board/cr50/board.c b/board/cr50/board.c index 44e263d784..a5cea8af99 100644 --- a/board/cr50/board.c +++ b/board/cr50/board.c @@ -115,11 +115,6 @@ void ec_tx_cr50_rx(enum gpio_signal signal) hook_call_deferred(&ec_uart_deferred__data, 0); } -int board_has_ap_usb(void) -{ - return !!(board_properties & BOARD_USB_AP); -} - int board_use_plt_rst(void) { return !!(board_properties & BOARD_USE_PLT_RESET); @@ -204,18 +199,17 @@ const struct strap_desc strap_regs[] = { "a12"}, }; -#define BOARD_PROPERTIES_DEFAULT (BOARD_SLAVE_CONFIG_I2C | BOARD_USE_PLT_RESET \ - | BOARD_USB_AP) +#define BOARD_PROPERTIES_DEFAULT (BOARD_SLAVE_CONFIG_I2C | BOARD_USE_PLT_RESET) static struct board_cfg board_cfg_table[] = { /* SPI Variants: DIOA12 = 1M PD, DIOA6 = 1M PD */ /* Kevin/Gru: DI0A9 = 5k PD, DIOA1 = 1M PU */ { 0x02, BOARD_SLAVE_CONFIG_SPI | BOARD_NEEDS_SYS_RST_PULL_UP }, /* Poppy: DI0A9 = 1M PU, DIOA1 = 1M PU */ - { 0x0A, BOARD_SLAVE_CONFIG_SPI | BOARD_USB_AP | BOARD_USE_PLT_RESET }, + { 0x0A, BOARD_SLAVE_CONFIG_SPI | BOARD_USE_PLT_RESET }, /* I2C Variants: DIOA9 = 1M PD, DIOA1 = 1M PD */ /* Reef/Eve: DIOA12 = 5k PD, DIOA6 = 1M PU */ - { 0x20, BOARD_SLAVE_CONFIG_I2C | BOARD_USB_AP | BOARD_USE_PLT_RESET }, + { 0x20, BOARD_SLAVE_CONFIG_I2C | BOARD_USE_PLT_RESET }, /* Rowan: DIOA12 = 5k PD, DIOA6 = 5k PU */ { 0x30, BOARD_SLAVE_CONFIG_I2C }, }; diff --git a/board/cr50/board.h b/board/cr50/board.h index f62a8fa692..db47101953 100644 --- a/board/cr50/board.h +++ b/board/cr50/board.h @@ -203,7 +203,6 @@ void assert_ec_rst(void); void deassert_ec_rst(void); int is_ec_rst_asserted(void); -int board_has_ap_usb(void); int board_use_plt_rst(void); int board_rst_pullup_needed(void); int board_tpm_uses_i2c(void); diff --git a/board/cr50/rdd.c b/board/cr50/rdd.c index 38af5d3999..75c8a202ce 100644 --- a/board/cr50/rdd.c +++ b/board/cr50/rdd.c @@ -20,7 +20,6 @@ #define CPRINTS(format, args...) cprints(CC_USB, format, ## args) static int keep_ccd_enabled; -static int enable_usb_wakeup; struct uart_config { const char *name; @@ -38,12 +37,6 @@ int rdd_is_connected(void) return ccd_get_mode() == CCD_MODE_ENABLED; } -int is_utmi_wakeup_allowed(void) -{ - return enable_usb_wakeup; -} - - /* If the UART TX is connected the pinmux select will have a non-zero value */ int uart_tx_is_connected(int uart) { @@ -114,8 +107,6 @@ static void configure_ccd(int enable) /* Enable CCD */ ccd_set_mode(CCD_MODE_ENABLED); - enable_usb_wakeup = 1; - /* Attempt to connect UART TX */ uartn_tx_connect(UART_AP); uartn_tx_connect(UART_EC); @@ -127,8 +118,6 @@ static void configure_ccd(int enable) uartn_tx_disconnect(UART_EC); uartn_tx_disconnect(UART_AP); - enable_usb_wakeup = board_has_ap_usb(); - /* Disable CCD */ ccd_set_mode(CCD_MODE_DISABLED); diff --git a/board/cr50/scratch_reg1.h b/board/cr50/scratch_reg1.h index 23b03db546..86dc8d7e4b 100644 --- a/board/cr50/scratch_reg1.h +++ b/board/cr50/scratch_reg1.h @@ -13,8 +13,7 @@ */ #define BOARD_SLAVE_CONFIG_SPI (1 << 0) /* TPM uses SPI interface */ #define BOARD_SLAVE_CONFIG_I2C (1 << 1) /* TPM uses I2C interface */ -#define BOARD_USB_AP (1 << 2) /* One of the USB PHYs is */ - /* connected to the AP */ + /* * The gaps are left to enusre backwards compatibility with the earliest cr50 * code releases. It will be possible to safely reuse these gaps if and when the @@ -51,6 +50,6 @@ * updated if additional strap related properties are added. */ #define BOARD_ALL_PROPERTIES (BOARD_SLAVE_CONFIG_SPI | BOARD_SLAVE_CONFIG_I2C \ - | BOARD_USB_AP | BOARD_NEEDS_SYS_RST_PULL_UP | BOARD_USE_PLT_RESET) + | BOARD_NEEDS_SYS_RST_PULL_UP | BOARD_USE_PLT_RESET) #endif /* ! __EC_BOARD_CR50_SCRATCH_REG1_H */ diff --git a/chip/g/idle.c b/chip/g/idle.c index ebdb747278..ea994e8dec 100644 --- a/chip/g/idle.c +++ b/chip/g/idle.c @@ -71,9 +71,15 @@ DECLARE_SAFE_CONSOLE_COMMAND(idle, command_idle, static int utmi_wakeup_is_enabled(void) { #ifdef CONFIG_RDD - return is_utmi_wakeup_allowed(); -#endif + /* + * USB is only used for CCD, so only enable UTMI wakeups when RDD + * detects that a debug accessory is attached. + */ + return rdd_is_connected(); +#else + /* USB is used for the host interface, so always enable UTMI wakeups */ return 1; +#endif } static void prepare_to_sleep(void) @@ -226,7 +232,7 @@ void __idle(void) while (1) { - /* Anyone still busy? */ + /* Anyone still busy? (this checks sleep_mask) */ sleep_ok = DEEP_SLEEP_ALLOWED; /* Wait a bit, just in case */ diff --git a/chip/g/rdd.h b/chip/g/rdd.h index 1f19ee9b3e..7fd5549ec5 100644 --- a/chip/g/rdd.h +++ b/chip/g/rdd.h @@ -12,10 +12,4 @@ 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 */