summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--board/dingdong/board.h2
-rw-r--r--board/hoho/board.h2
-rw-r--r--chip/stm32/usb.c5
-rw-r--r--include/config.h5
-rw-r--r--include/usb_api.h7
5 files changed, 14 insertions, 7 deletions
diff --git a/board/dingdong/board.h b/board/dingdong/board.h
index de68de93e8..3007f8b67f 100644
--- a/board/dingdong/board.h
+++ b/board/dingdong/board.h
@@ -21,7 +21,7 @@
#define CONFIG_HW_CRC
#define CONFIG_USB
#define CONFIG_USB_BOS
-#define CONFIG_USB_INHIBIT
+#define CONFIG_USB_INHIBIT_CONNECT
#define CONFIG_USB_POWER_DELIVERY
#define CONFIG_USB_PD_ALT_MODE
#define CONFIG_USB_PD_DUAL_ROLE
diff --git a/board/hoho/board.h b/board/hoho/board.h
index 41c7dc40a7..0ed93413e5 100644
--- a/board/hoho/board.h
+++ b/board/hoho/board.h
@@ -29,7 +29,7 @@
#define CONFIG_SPI_CS_GPIO GPIO_PD_MCDP_SPI_CS_L
#define CONFIG_USB
#define CONFIG_USB_BOS
-#define CONFIG_USB_INHIBIT
+#define CONFIG_USB_INHIBIT_CONNECT
#define CONFIG_USB_POWER_DELIVERY
#define CONFIG_USB_PD_ALT_MODE
#define CONFIG_USB_PD_DUAL_ROLE
diff --git a/chip/stm32/usb.c b/chip/stm32/usb.c
index 425b768632..a0a37524be 100644
--- a/chip/stm32/usb.c
+++ b/chip/stm32/usb.c
@@ -295,13 +295,16 @@ void usb_init(void)
/* set interrupts mask : reset/correct tranfer/errors */
STM32_USB_CNTR = 0xe400;
-#ifndef CONFIG_USB_INHIBIT
+#ifndef CONFIG_USB_INHIBIT_CONNECT
usb_connect();
#endif
CPRINTF("USB init done\n");
}
+
+#ifndef CONFIG_USB_INHIBIT_INIT
DECLARE_HOOK(HOOK_INIT, usb_init, HOOK_PRIO_DEFAULT);
+#endif
void usb_release(void)
{
diff --git a/include/config.h b/include/config.h
index 92cd267121..324646f7e0 100644
--- a/include/config.h
+++ b/include/config.h
@@ -1129,8 +1129,11 @@
/* Compile chip support for the USB device controller */
#undef CONFIG_USB
+/* Disable automatic connection of USB peripheral */
+#undef CONFIG_USB_INHIBIT_CONNECT
+
/* Disable automatic initialization of USB peripheral */
-#undef CONFIG_USB_INHIBIT
+#undef CONFIG_USB_INHIBIT_INIT
/* Support simple control of power to the device's USB ports */
#undef CONFIG_USB_PORT_POWER_DUMB
diff --git a/include/usb_api.h b/include/usb_api.h
index feeb6abb27..dc0a0fd654 100644
--- a/include/usb_api.h
+++ b/include/usb_api.h
@@ -14,9 +14,10 @@
/*
* Initialize the USB peripheral, enabling its clock and configuring the DP/DN
- * GPIOs correctly. This function is called via an init hook, but may need to
- * be called again if usb_release is called. This function will call
- * usb_connect by default unless CONFIG_USB_INHIBIT is defined.
+ * GPIOs correctly. This function is called via an init hook (unless the board
+ * defined CONFIG_USB_INHIBIT_INIT), but may need to be called again if
+ * usb_release is called. This function will call usb_connect by default
+ * unless CONFIG_USB_INHIBIT_CONNECT is defined.
*/
void usb_init(void);