From 0f1342f36b1ceb885d6ffeaca1e3ae24b5ec6bc4 Mon Sep 17 00:00:00 2001 From: David Sidrane Date: Fri, 21 Jan 2022 15:53:52 -0800 Subject: [PATCH] stm32:Add OTG ID GPIO disable --- arch/arm/src/stm32/Kconfig | 13 +++++++++++++ arch/arm/src/stm32/stm32_otgfsdev.c | 6 +++++- 2 files changed, 18 insertions(+), 1 deletion(-) 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. */