From d7b78ecd2a34276018cbbc5cd4c2e0c52b6cf3cb Mon Sep 17 00:00:00 2001 From: songyanguang <345810377@qq.com> Date: Thu, 7 Nov 2024 10:46:01 +0800 Subject: [PATCH] Modify xhci event codes --- .../drivers/usb/components/port/xhci/xhci.c | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/port/xhci/xhci.c b/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/port/xhci/xhci.c index dc76dcd9c..f1116682c 100644 --- a/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/port/xhci/xhci.c +++ b/Ubiquitous/XiZi_AIoT/services/drivers/usb/components/port/xhci/xhci.c @@ -780,6 +780,7 @@ static int xhci_scratchpad_alloc ( struct xhci_host *xhci ) { memset(scratch->array_addr, 0, array_len); scratch->array_phy = phy_addr; + scratch->array = scratch->array_addr; /* * Allocate memory for storing all virtual address of physical pages allocated to xHCI as scratchpad buffer. @@ -928,14 +929,12 @@ static int xhci_command_alloc ( struct xhci_host *xhci ) { goto err_writeq; #endif - for(i = 0; i < XHCI_RING_ITEMS; i++){ - trb_link = (struct xhci_trb_link *)&xhci->cmds->ring[i]; - trb_link->reserved_c |= XHCI_TRB_C; - - } trb_link = (struct xhci_trb_link *)&xhci->cmds->ring[XHCI_RING_ITEMS - 1]; - trb_link->reserved_c |= XHCI_TRB_TC; + trb_link->type = XHCI_TRB_LINK; + trb_link->flags = XHCI_TRB_TC; + trb_link->reserved_c |= XHCI_TRB_TC; + trb_link->next = CPU_TO_LE64 ( ( (uintptr_t)xhci->cmds_phy ) ); if ( ( rc = xhci_writeq ( xhci, ( cmds_phy | XHCI_CRCR_RCS ), xhci->op_addr + XHCI_OP_CRCR ) ) != 0 ) @@ -1019,7 +1018,7 @@ static int xhci_event_alloc ( struct xhci_host *xhci ) { xhci->eseg = (struct xhci_er_seg *)xhci->eseg_addr; memset(xhci->eseg, 0U, sizeof(*xhci->eseg)); - xhci->eseg->base = CPU_TO_LE64 ( ( (uintptr_t)xhci->evts ) ); + xhci->eseg->base = CPU_TO_LE64 ( xhci->evts_phy ); xhci->eseg->count = XHCI_RING_ITEMS; /* items of event ring TRB */ /* Program event ring registers */ @@ -2955,10 +2954,10 @@ void xhci_event_process(struct xhci_host *xhci) { /* check and ack event */ for (;;) { /* Stop if we reach an empty TRB */ -// DSB(); + DSB(); // __asm__ __volatile__("dsb sy": : : "memory"); // __asm__ volatile("dmb ish\n\t"); - BARRIER(); +// BARRIER(); nidx = evts->nidx; /* index of dequeue trb */ cs = evts->cs; /* cycle state toggle by xHc */