summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/cr50/board.h1
-rw-r--r--board/cr50/rdd.c55
-rw-r--r--chip/g/usb.c16
3 files changed, 11 insertions, 61 deletions
diff --git a/board/cr50/board.h b/board/cr50/board.h
index 5b1b541653..665361b125 100644
--- a/board/cr50/board.h
+++ b/board/cr50/board.h
@@ -90,7 +90,6 @@
#define CONFIG_USB_CONSOLE
#define CONFIG_USB_I2C
#define CONFIG_USB_INHIBIT_INIT
-#define CONFIG_USB_SELECT_PHY
#define CONFIG_USB_SPI
#define CONFIG_USB_SERIALNO
#define DEFAULT_SERIALNO "0"
diff --git a/board/cr50/rdd.c b/board/cr50/rdd.c
index 52082d56f4..74ea87eff0 100644
--- a/board/cr50/rdd.c
+++ b/board/cr50/rdd.c
@@ -21,7 +21,6 @@
static int keep_ccd_enabled;
static int enable_usb_wakeup;
-static int usb_is_initialized;
struct uart_config {
const char *name;
@@ -178,58 +177,6 @@ void ccd_mode_pin_changed(int pin_level)
configure_ccd(enable);
}
-void ccd_phy_init(int enable_ccd)
-{
- /*
- * For boards that have one phy connected to the AP and one to the
- * external port PHY0 is for the AP and PHY1 is for CCD.
- */
- uint32_t which_phy = enable_ccd ? USB_SEL_PHY1 : USB_SEL_PHY0;
-
- /*
- * TODO: if both PHYs are connected to the external port select the
- * PHY based on the detected polarity
- */
- usb_select_phy(which_phy);
-
- /*
- * If the usb is going to be initialized on the AP PHY, but the AP is
- * off, wait until HOOK_CHIPSET_RESUME to initialize usb.
- */
- if (!enable_ccd && device_get_state(DEVICE_AP) != DEVICE_STATE_ON) {
- usb_is_initialized = 0;
- return;
- }
-
- /*
- * If the board has the non-ccd phy connected to the AP initialize the
- * phy no matter what. Otherwise only initialize the phy if ccd is
- * enabled.
- */
- if (board_has_ap_usb() || enable_ccd) {
- usb_init();
- usb_is_initialized = 1;
- }
-}
-
-void disable_ap_usb(void)
-{
- if (board_has_ap_usb() && !ccd_is_enabled() && usb_is_initialized) {
- usb_release();
- usb_is_initialized = 0;
- }
-}
-DECLARE_HOOK(HOOK_CHIPSET_SHUTDOWN, disable_ap_usb, HOOK_PRIO_DEFAULT);
-
-void enable_ap_usb(void)
-{
- if (board_has_ap_usb() && !ccd_is_enabled() && !usb_is_initialized) {
- usb_is_initialized = 1;
- usb_init();
- }
-}
-DECLARE_HOOK(HOOK_CHIPSET_RESUME, enable_ap_usb, HOOK_PRIO_DEFAULT);
-
static void rdd_ccd_change_hook(void)
{
if (uart_tx_is_connected(UART_AP) &&
@@ -251,8 +198,6 @@ static void rdd_ccd_change_hook(void)
/* Not transmitting to EC, but allowed now */
uartn_tx_connect(UART_EC);
}
-
-
}
DECLARE_HOOK(HOOK_CCD_CHANGE, rdd_ccd_change_hook, HOOK_PRIO_DEFAULT);
diff --git a/chip/g/usb.c b/chip/g/usb.c
index 3672e03ea4..ea048ba43a 100644
--- a/chip/g/usb.c
+++ b/chip/g/usb.c
@@ -1397,15 +1397,17 @@ static int command_usb(int argc, char **argv)
int val;
if (argc > 1) {
- if (!strcasecmp("a", argv[1]))
- usb_select_phy(USB_SEL_PHY0);
- else if (!strcasecmp("b", argv[1]))
- usb_select_phy(USB_SEL_PHY1);
- else if (parse_bool(argv[1], &val)) {
+ if (parse_bool(argv[1], &val)) {
if (val)
usb_init();
else
usb_release();
+#ifdef CONFIG_USB_SELECT_PHY
+ } else if (!strcasecmp("a", argv[1])) {
+ usb_select_phy(USB_SEL_PHY0);
+ } else if (!strcasecmp("b", argv[1])) {
+ usb_select_phy(USB_SEL_PHY1);
+#endif
} else
return EC_ERROR_PARAM1;
}
@@ -1416,7 +1418,11 @@ static int command_usb(int argc, char **argv)
return EC_SUCCESS;
}
DECLARE_CONSOLE_COMMAND(usb, command_usb,
+#ifdef CONFIG_USB_SELECT_PHY
"[<BOOLEAN> | a | b]",
+#else
+ "<BOOLEAN>",
+#endif
"Get/set the USB connection state and PHY selection");
#if USE_SERIAL_NUMBER