diff options
| author | sakimisu <[email protected]> | 2023-06-21 20:51:10 +0800 |
|---|---|---|
| committer | sakimisu <[email protected]> | 2023-06-21 20:51:10 +0800 |
| commit | 822cd9d679e397a7f220bd7d57ca4b52b8ccd640 (patch) | |
| tree | 58ef08194d0ab0857b4d95bda24a613f23a80d67 | |
| parent | e061b8e784f51bbb2d2f1ffe9d408c1238f73898 (diff) | |
add dwc2 param log
| -rw-r--r-- | port/dwc2/usb_dc_dwc2.c | 40 |
1 files changed, 40 insertions, 0 deletions
diff --git a/port/dwc2/usb_dc_dwc2.c b/port/dwc2/usb_dc_dwc2.c index a03b470b..39aff931 100644 --- a/port/dwc2/usb_dc_dwc2.c +++ b/port/dwc2/usb_dc_dwc2.c @@ -535,11 +535,51 @@ __WEAK void usb_dc_low_level_deinit(void) int usb_dc_init(void) { int ret; + uint8_t fsphy_type; + uint8_t hsphy_type; + uint8_t dma_support; + uint8_t endpoints; memset(&g_dwc2_udc, 0, sizeof(struct dwc2_udc)); usb_dc_low_level_init(); + /* + Full-Speed PHY Interface Type (FSPhyType) + 2'b00: Full-speed interface not supported + 2'b01: Dedicated full-speed interface + 2'b10: FS pins shared with UTMI+ pins + 2'b11: FS pins shared with ULPI pins + + High-Speed PHY Interface Type (HSPhyType) + 2'b00: High-Speed interface not supported + 2'b01: UTMI+ + 2'b10: ULPI + 2'b11: UTMI+ and ULPI + + Architecture (OtgArch) + 2'b00: Slave-Only + 2'b01: External DMA + 2'b10: Internal DMA + Others: Reserved + */ + fsphy_type = ((USB_OTG_GLB->GHWCFG2 & (0x03 << 8)) >> 8); + hsphy_type = ((USB_OTG_GLB->GHWCFG2 & (0x03 << 6)) >> 6); + dma_support = ((USB_OTG_GLB->GHWCFG2 & (0x03 << 3)) >> 3); + endpoints = ((USB_OTG_GLB->GHWCFG2 & (0x0f << 10)) >> 10) + 1; + + USB_LOG_INFO("========== dwc2 udc params ==========\r\n"); + USB_LOG_INFO("CID:%08x\r\n", USB_OTG_GLB->CID); + USB_LOG_INFO("GSNPSID:%08x\r\n", USB_OTG_GLB->GSNPSID); + USB_LOG_INFO("GHWCFG1:%08x\r\n", USB_OTG_GLB->GHWCFG1); + USB_LOG_INFO("GHWCFG2:%08x\r\n", USB_OTG_GLB->GHWCFG2); + USB_LOG_INFO("GHWCFG3:%08x\r\n", USB_OTG_GLB->GHWCFG3); + USB_LOG_INFO("GHWCFG4:%08x\r\n", USB_OTG_GLB->GHWCFG4); + + USB_LOG_INFO("dwc2 fsphy type:%d, hsphy type:%d, dma support:%d\r\n", fsphy_type, hsphy_type, dma_support); + USB_LOG_INFO("dwc2 has %d endpoints, default config: %d endpoints\r\n", endpoints, USB_NUM_BIDIR_ENDPOINTS); + USB_LOG_INFO("=================================\r\n"); + USB_OTG_DEV->DCTL |= USB_OTG_DCTL_SDIS; USB_OTG_GLB->GAHBCFG &= ~USB_OTG_GAHBCFG_GINT; |
