summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsakumisu <[email protected]>2023-11-27 20:30:12 +0800
committersakumisu <[email protected]>2023-11-27 20:30:15 +0800
commitc90f273e245140859113ad7ee07a07090546136b (patch)
treee864c3e3738d2f65f4da20f023cec6c9dd1fbe95
parentb14976dd5624a3697d69024d1230199d3a91dbb4 (diff)
port and add comment for gccfg with gd/at/st
-rw-r--r--port/dwc2/README.md2
-rw-r--r--port/dwc2/usb_glue_at.c30
-rw-r--r--port/dwc2/usb_glue_gd.c27
-rw-r--r--port/dwc2/usb_glue_st.c9
4 files changed, 66 insertions, 2 deletions
diff --git a/port/dwc2/README.md b/port/dwc2/README.md
index 2ef2d7ad..b4f59d57 100644
--- a/port/dwc2/README.md
+++ b/port/dwc2/README.md
@@ -14,7 +14,7 @@
## AT32
-- AT32F415xx
+- AT32F402xx、AT32F405xx、AT32F415xx、AT32F423xx、AT32F425xx、AT32F435xx、AT32F437xx
## GD32
diff --git a/port/dwc2/usb_glue_at.c b/port/dwc2/usb_glue_at.c
new file mode 100644
index 00000000..8febfcce
--- /dev/null
+++ b/port/dwc2/usb_glue_at.c
@@ -0,0 +1,30 @@
+#include "usb_config.h"
+#include "stdint.h"
+#include "usb_dwc2_reg.h"
+
+/* you can find this config in function: usb_global_init, file:at32fxxx_usb.c, for example:
+ *
+ * usbx->gccfg_bit.pwrdown = TRUE;
+ * usbx->gccfg_bit.avalidsesen = TRUE;
+ * usbx->gccfg_bit.bvalidsesen = TRUE;
+ *
+*/
+
+uint32_t usbd_get_dwc2_gccfg_conf(void)
+{
+#ifdef CONFIG_USB_HS
+ return (1 << 16);
+#else
+ // return ((1 << 16) | (1 << 18) | (1 << 19));
+ return (1 << 16);
+#endif
+}
+
+uint32_t usbh_get_dwc2_gccfg_conf(void)
+{
+#ifdef CONFIG_USB_DWC2_ULPI_PHY
+ return (1 << 16);
+#else
+ return (1 << 16);
+#endif
+} \ No newline at end of file
diff --git a/port/dwc2/usb_glue_gd.c b/port/dwc2/usb_glue_gd.c
new file mode 100644
index 00000000..4123ce5d
--- /dev/null
+++ b/port/dwc2/usb_glue_gd.c
@@ -0,0 +1,27 @@
+#include "usb_config.h"
+#include "stdint.h"
+#include "usb_dwc2_reg.h"
+
+/* you can find this config in function:usb_core_init, file:drv_usb_core.c, for example:
+ *
+ * usb_regs->gr->GCCFG |= GCCFG_PWRON | GCCFG_VBUSACEN | GCCFG_VBUSBCEN;
+ *
+*/
+
+uint32_t usbd_get_dwc2_gccfg_conf(void)
+{
+#ifdef CONFIG_USB_HS
+ return 0;
+#else
+ return ((1 << 16) | (1 << 18) | (1 << 19));
+#endif
+}
+
+uint32_t usbh_get_dwc2_gccfg_conf(void)
+{
+#ifdef CONFIG_USB_DWC2_ULPI_PHY
+ return 0;
+#else
+ return ((1 << 16) | (1 << 18) | (1 << 19));
+#endif
+} \ No newline at end of file
diff --git a/port/dwc2/usb_glue_st.c b/port/dwc2/usb_glue_st.c
index 3b60a40f..cac4f447 100644
--- a/port/dwc2/usb_glue_st.c
+++ b/port/dwc2/usb_glue_st.c
@@ -2,7 +2,14 @@
#include "stdint.h"
#include "usb_dwc2_reg.h"
-/* st different chips maybe have a little difference in this register, you should check this */
+/* you can find this config in function: USB_DevInit, file:stm32xxx_ll_usb.c, for example:
+ *
+ * USBx->GCCFG |= USB_OTG_GCCFG_PWRDWN;
+ * USBx->GCCFG |= USB_OTG_GCCFG_NOVBUSSENS;
+ * USBx->GCCFG &= ~USB_OTG_GCCFG_VBUSBSEN;
+ * USBx->GCCFG &= ~USB_OTG_GCCFG_VBUSASEN;
+ *
+*/
uint32_t usbd_get_dwc2_gccfg_conf(void)
{