summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsakumisu <[email protected]>2024-04-16 21:51:20 +0800
committersakumisu <[email protected]>2024-04-16 21:52:52 +0800
commit32f96f4248fd15ceae25108b730e1290b64d6b02 (patch)
treeffcc20dfc593715edcc549ff64df0e51fcde95a6
parente3886fe99d298adebc3d5b5f5f8d9c7d2e94e233 (diff)
remove duplicate h7 config
-rw-r--r--port/dwc2/usb_glue_st.c14
1 files changed, 4 insertions, 10 deletions
diff --git a/port/dwc2/usb_glue_st.c b/port/dwc2/usb_glue_st.c
index f51a7786..034bbedc 100644
--- a/port/dwc2/usb_glue_st.c
+++ b/port/dwc2/usb_glue_st.c
@@ -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));