|
|
@@ -147,13 +147,14 @@ static int usb_hsphy_init(uint32_t hse_value)
|
|
|
|
|
|
uint32_t usbd_get_dwc2_gccfg_conf(uint32_t reg_base)
|
|
|
{
|
|
|
-#ifdef CONFIG_USB_HS
|
|
|
#if __has_include("stm32h7xx.h") || __has_include("stm32f7xx.h") || __has_include("stm32l4xx.h")
|
|
|
#define USB_OTG_GLB ((USB_OTG_GlobalTypeDef *)(reg_base))
|
|
|
/* B-peripheral session valid override enable */
|
|
|
USB_OTG_GLB->GOTGCTL |= USB_OTG_GOTGCTL_BVALOEN;
|
|
|
USB_OTG_GLB->GOTGCTL |= USB_OTG_GOTGCTL_BVALOVAL;
|
|
|
#endif
|
|
|
+
|
|
|
+#ifdef CONFIG_USB_HS
|
|
|
#if defined(STM32F722xx) || defined(STM32F723xx) || defined(STM32F730xx) || defined(STM32F732xx) || defined(STM32F733xx)
|
|
|
USB_OTG_GLB->GCCFG = (1 << 23);
|
|
|
usb_hsphy_init(25000000U);
|
|
|
@@ -163,10 +164,6 @@ uint32_t usbd_get_dwc2_gccfg_conf(uint32_t reg_base)
|
|
|
#endif
|
|
|
#else
|
|
|
#if __has_include("stm32h7xx.h") || __has_include("stm32f7xx.h") || __has_include("stm32l4xx.h")
|
|
|
-#define USB_OTG_GLB ((USB_OTG_GlobalTypeDef *)(reg_base))
|
|
|
- /* B-peripheral session valid override enable */
|
|
|
- USB_OTG_GLB->GOTGCTL |= USB_OTG_GOTGCTL_BVALOEN;
|
|
|
- USB_OTG_GLB->GOTGCTL |= USB_OTG_GOTGCTL_BVALOVAL;
|
|
|
return (1 << 16);
|
|
|
#else
|
|
|
return ((1 << 16) | (1 << 21));
|
|
|
@@ -176,13 +173,14 @@ uint32_t usbd_get_dwc2_gccfg_conf(uint32_t reg_base)
|
|
|
|
|
|
uint32_t usbh_get_dwc2_gccfg_conf(uint32_t reg_base)
|
|
|
{
|
|
|
-#ifdef CONFIG_USB_HS
|
|
|
#if __has_include("stm32h7xx.h") || __has_include("stm32f7xx.h") || __has_include("stm32l4xx.h")
|
|
|
#define USB_OTG_GLB ((USB_OTG_GlobalTypeDef *)(reg_base))
|
|
|
/* B-peripheral session valid override enable */
|
|
|
USB_OTG_GLB->GOTGCTL &= ~USB_OTG_GOTGCTL_BVALOEN;
|
|
|
USB_OTG_GLB->GOTGCTL &= ~USB_OTG_GOTGCTL_BVALOVAL;
|
|
|
#endif
|
|
|
+
|
|
|
+#ifdef CONFIG_USB_HS
|
|
|
#if defined(STM32F722xx) || defined(STM32F723xx) || defined(STM32F730xx) || defined(STM32F732xx) || defined(STM32F733xx)
|
|
|
USB_OTG_GLB->GCCFG = (1 << 23);
|
|
|
usb_hsphy_init(25000000U);
|
|
|
@@ -192,10 +190,6 @@ uint32_t usbh_get_dwc2_gccfg_conf(uint32_t reg_base)
|
|
|
#endif
|
|
|
#else
|
|
|
#if __has_include("stm32h7xx.h") || __has_include("stm32f7xx.h") || __has_include("stm32l4xx.h")
|
|
|
-#define USB_OTG_GLB ((USB_OTG_GlobalTypeDef *)(reg_base))
|
|
|
- /* B-peripheral session valid override enable */
|
|
|
- USB_OTG_GLB->GOTGCTL &= ~USB_OTG_GOTGCTL_BVALOEN;
|
|
|
- USB_OTG_GLB->GOTGCTL &= ~USB_OTG_GOTGCTL_BVALOVAL;
|
|
|
return (1 << 16);
|
|
|
#else
|
|
|
return ((1 << 16) | (1 << 21));
|