diff --git a/drivers/usb/dwc3/core.c b/drivers/usb/dwc3/core.c index 85cc96ac87b..87b9c87edf6 100644 --- a/drivers/usb/dwc3/core.c +++ b/drivers/usb/dwc3/core.c @@ -122,6 +122,8 @@ static struct dwc3_event_buffer *dwc3_alloc_one_event_buffer(struct dwc3 *dwc, if (!evt->buf) return ERR_PTR(-ENOMEM); + dwc3_flush_cache((uintptr_t)evt->buf, evt->length); + return evt; } diff --git a/drivers/usb/dwc3/gadget.c b/drivers/usb/dwc3/gadget.c index 8c53cc0b8ae..e065c5aeb38 100644 --- a/drivers/usb/dwc3/gadget.c +++ b/drivers/usb/dwc3/gadget.c @@ -2668,11 +2668,12 @@ void dwc3_gadget_uboot_handle_interrupt(struct dwc3 *dwc) int i; struct dwc3_event_buffer *evt; + dwc3_thread_interrupt(0, dwc); + + /* Clean + Invalidate the buffers after touching them */ for (i = 0; i < dwc->num_event_buffers; i++) { evt = dwc->ev_buffs[i]; dwc3_flush_cache((uintptr_t)evt->buf, evt->length); } - - dwc3_thread_interrupt(0, dwc); } }