fix(port/dwc2): reset dma burst then modify, clear HCINT intstatus first
This commit is contained in:
@@ -588,6 +588,7 @@ int usb_dc_init(uint8_t busid)
|
||||
}
|
||||
|
||||
USB_OTG_DEV->DCFG &= ~USB_OTG_DCFG_DESCDMA;
|
||||
USB_OTG_GLB->GAHBCFG &= ~USB_OTG_GAHBCFG_HBSTLEN;
|
||||
USB_OTG_GLB->GAHBCFG |= (USB_OTG_GAHBCFG_DMAEN | USB_OTG_GAHBCFG_HBSTLEN_4);
|
||||
#else
|
||||
USB_OTG_GLB->GINTMSK |= USB_OTG_GINTMSK_RXFLVLM;
|
||||
|
||||
@@ -521,6 +521,7 @@ int usb_hc_init(struct usbh_bus *bus)
|
||||
ret = dwc2_flush_txfifo(bus, 0x10U);
|
||||
ret = dwc2_flush_rxfifo(bus);
|
||||
|
||||
USB_OTG_GLB->GAHBCFG &= ~USB_OTG_GAHBCFG_HBSTLEN;
|
||||
USB_OTG_GLB->GAHBCFG |= USB_OTG_GAHBCFG_HBSTLEN_4;
|
||||
USB_OTG_GLB->GAHBCFG |= USB_OTG_GAHBCFG_DMAEN;
|
||||
|
||||
@@ -895,6 +896,7 @@ static void dwc2_inchan_irq_handler(struct usbh_bus *bus, uint8_t ch_num)
|
||||
//printf("s1:%08x\r\n", chan_intstatus);
|
||||
|
||||
if (chan_intstatus & USB_OTG_HCINT_CHH) {
|
||||
USB_OTG_HC(ch_num)->HCINT = chan_intstatus;
|
||||
if (chan_intstatus & USB_OTG_HCINT_XFRC) {
|
||||
urb->errorcode = 0;
|
||||
|
||||
@@ -948,7 +950,6 @@ static void dwc2_inchan_irq_handler(struct usbh_bus *bus, uint8_t ch_num)
|
||||
urb->errorcode = -USB_ERR_IO;
|
||||
dwc2_urb_waitup(urb);
|
||||
}
|
||||
USB_OTG_HC(ch_num)->HCINT = chan_intstatus;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -965,6 +966,7 @@ static void dwc2_outchan_irq_handler(struct usbh_bus *bus, uint8_t ch_num)
|
||||
//printf("s2:%08x\r\n", chan_intstatus);
|
||||
|
||||
if (chan_intstatus & USB_OTG_HCINT_CHH) {
|
||||
USB_OTG_HC(ch_num)->HCINT = chan_intstatus;
|
||||
if (chan_intstatus & USB_OTG_HCINT_XFRC) {
|
||||
urb->errorcode = 0;
|
||||
|
||||
@@ -1029,7 +1031,6 @@ static void dwc2_outchan_irq_handler(struct usbh_bus *bus, uint8_t ch_num)
|
||||
urb->errorcode = -USB_ERR_IO;
|
||||
dwc2_urb_waitup(urb);
|
||||
}
|
||||
USB_OTG_HC(ch_num)->HCINT = chan_intstatus;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user