drivers: usb_dc_stm32: enable VDDUSB if needed
This is required on boards that isolate VDDUSB from the system. Signed-off-by: Pushpal Sidhu <psidhu.devel@gmail.com>
This commit is contained in:
parent
816e3d8767
commit
e2b27d820d
2 changed files with 20 additions and 0 deletions
|
@ -55,6 +55,11 @@
|
|||
#include <stm32l4xx_ll_rng.h>
|
||||
#endif
|
||||
|
||||
#ifdef CONFIG_USB
|
||||
/* Required to remove USB transceiver supply isolation */
|
||||
#include <stm32l4xx_ll_pwr.h>
|
||||
#endif /* CONFIG_USB */
|
||||
|
||||
#endif /* !_ASMLANGUAGE */
|
||||
|
||||
#endif /* _STM32L4X_SOC_H_ */
|
||||
|
|
|
@ -330,6 +330,21 @@ int usb_dc_attach(void)
|
|||
return ret;
|
||||
}
|
||||
|
||||
/*
|
||||
* Required for at least STM32L4 devices as they electrically
|
||||
* isolate USB features from VDDUSB. It must be enabled before
|
||||
* USB can function. Refer to DM00310109, section 5.1.3.
|
||||
*/
|
||||
#ifdef PWR_CR2_PVME1
|
||||
if (LL_APB1_GRP1_IsEnabledClock(LL_APB1_GRP1_PERIPH_PWR)) {
|
||||
LL_PWR_EnableVddUSB();
|
||||
} else {
|
||||
LL_APB1_GRP1_EnableClock(LL_APB1_GRP1_PERIPH_PWR);
|
||||
LL_PWR_EnableVddUSB();
|
||||
LL_APB1_GRP1_DisableClock(LL_APB1_GRP1_PERIPH_PWR);
|
||||
}
|
||||
#endif /* PWR_CR2_PVME1 */
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue