Kaynağa Gözat

remove duplicate h7 config

sakumisu 1 yıl önce
ebeveyn
işleme
32f96f4248
1 değiştirilmiş dosya ile 4 ekleme ve 10 silme
  1. 4 10
      port/dwc2/usb_glue_st.c

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