diff --git a/arch/arm/src/stm32/Kconfig b/arch/arm/src/stm32/Kconfig index 77a3efed1a..6ba361fdb1 100644 --- a/arch/arm/src/stm32/Kconfig +++ b/arch/arm/src/stm32/Kconfig @@ -10828,6 +10828,19 @@ endmenu comment "USB Device Configuration" +menu "OTG Configuration" + depends on STM32_OTGFS + +config OTG_ID_GPIO_DISABLE + bool "Disable the use of GPIO_OTG_ID pin." + default n + ---help--- + Disables/Enables the use of GPIO_OTG_ID pin. This allows non OTG use + cases to reuse this GPIO pin and ensure it is not set incorrectlty + during OS boot. + +endmenu + config STM32_USB_ITRMP bool "Re-map USB interrupt" default n if !STM32_CAN1 diff --git a/arch/arm/src/stm32/stm32_otgfsdev.c b/arch/arm/src/stm32/stm32_otgfsdev.c index 31e3a95e32..64fecdcf3d 100644 --- a/arch/arm/src/stm32/stm32_otgfsdev.c +++ b/arch/arm/src/stm32/stm32_otgfsdev.c @@ -5623,7 +5623,11 @@ void arm_usbinitialize(void) stm32_configgpio(GPIO_OTGFS_DM); stm32_configgpio(GPIO_OTGFS_DP); - stm32_configgpio(GPIO_OTGFS_ID); /* Only needed for OTG */ + + /* Only needed for OTG */ +#ifndef CONFIG_OTG_ID_GPIO_DISABLE + stm32_configgpio(GPIO_OTGFS_ID); +#endif /* SOF output pin configuration is configurable. */