mirror of
https://github.com/CTCaer/hekate.git
synced 2024-11-29 21:12:06 +00:00
bdk: usb: fix a race condition in USB2 stack
When RAM is slow (no training), it's possible to have the stack failing to negotiate configuration successfully. The race condition is caused by not flushing cache before sending a configuration packet reply. Although, cache is write-through, this needs to happen.
This commit is contained in:
parent
3fa01a1975
commit
605f270f98
1 changed files with 3 additions and 3 deletions
|
@ -785,13 +785,13 @@ static int _usbd_ep_operation(usb_ep_t endpoint, u8 *buf, u32 len, u32 sync_time
|
||||||
AHB_GIZMO(AHB_AHB_MEM_PREFETCH_CFG1) |= MEM_PREFETCH_ENABLE;
|
AHB_GIZMO(AHB_AHB_MEM_PREFETCH_CFG1) |= MEM_PREFETCH_ENABLE;
|
||||||
|
|
||||||
if (direction == USB_DIR_IN)
|
if (direction == USB_DIR_IN)
|
||||||
{
|
|
||||||
prime_bit = USB2D_ENDPT_STATUS_TX_OFFSET << actual_ep;
|
prime_bit = USB2D_ENDPT_STATUS_TX_OFFSET << actual_ep;
|
||||||
bpmp_mmu_maintenance(BPMP_MMU_MAINT_CLEAN_WAY, false);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
prime_bit = USB2D_ENDPT_STATUS_RX_OFFSET << actual_ep;
|
prime_bit = USB2D_ENDPT_STATUS_RX_OFFSET << actual_ep;
|
||||||
|
|
||||||
|
// Flush data before priming EP.
|
||||||
|
bpmp_mmu_maintenance(BPMP_MMU_MAINT_CLEAN_WAY, false);
|
||||||
|
|
||||||
// Prime endpoint.
|
// Prime endpoint.
|
||||||
usbd_otg->regs->endptprime |= prime_bit; // USB2_CONTROLLER_USB2D_ENDPTPRIME.
|
usbd_otg->regs->endptprime |= prime_bit; // USB2_CONTROLLER_USB2D_ENDPTPRIME.
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue