Modify xhci_stop so that the xHCI can adapt to XiZi AIOT

This commit is contained in:
xj 2024-07-01 03:02:01 -07:00
parent e34d688cc3
commit 3efb2335c5
1 changed files with 17 additions and 6 deletions

View File

@ -358,18 +358,26 @@ static void xhci_legacy_claim ( struct xhci_host *xhci ) {
return; return;
/* Claim ownership */ /* Claim ownership */
// writeb ( XHCI_USBLEGSUP_OS_OWNED,
// xhci->cap + xhci->legacy + XHCI_USBLEGSUP_OS );
writeb ( XHCI_USBLEGSUP_OS_OWNED, writeb ( XHCI_USBLEGSUP_OS_OWNED,
xhci->cap + xhci->legacy + XHCI_USBLEGSUP_OS ); xhci->cap_addr + xhci->legacy + XHCI_USBLEGSUP_OS );
/* Wait for BIOS to release ownership */ /* Wait for BIOS to release ownership */
for ( i = 0 ; i < XHCI_USBLEGSUP_MAX_WAIT_MS ; i++ ) { for ( i = 0 ; i < XHCI_USBLEGSUP_MAX_WAIT_MS ; i++ ) {
/* Check if BIOS has released ownership */ /* Check if BIOS has released ownership */
bios = readb ( xhci->cap + xhci->legacy + XHCI_USBLEGSUP_BIOS ); // bios = readb ( xhci->cap + xhci->legacy + XHCI_USBLEGSUP_BIOS );
bios = readb ( xhci->cap_addr + xhci->legacy + XHCI_USBLEGSUP_BIOS );
if ( ! ( bios & XHCI_USBLEGSUP_BIOS_OWNED ) ) { if ( ! ( bios & XHCI_USBLEGSUP_BIOS_OWNED ) ) {
USB_LOG_DBG("XHCI %s claimed ownership from BIOS\n", USB_LOG_DBG("XHCI %s claimed ownership from BIOS\n",
xhci->name ); xhci->name );
ctlsts = readl ( xhci->cap + xhci->legacy + // ctlsts = readl ( xhci->cap + xhci->legacy +
// XHCI_USBLEGSUP_CTLSTS );
ctlsts = readl ( xhci->cap_addr + xhci->legacy +
XHCI_USBLEGSUP_CTLSTS ); XHCI_USBLEGSUP_CTLSTS );
if ( ctlsts ) { if ( ctlsts ) {
USB_LOG_DBG("XHCI %s warning: BIOS retained " USB_LOG_DBG("XHCI %s warning: BIOS retained "
@ -428,15 +436,18 @@ static int xhci_stop ( struct xhci_host *xhci ) {
unsigned int i; unsigned int i;
/* Clear run/stop bit */ /* Clear run/stop bit */
usbcmd = readl ( xhci->op + XHCI_OP_USBCMD ); // usbcmd = readl ( xhci->op + XHCI_OP_USBCMD );
usbcmd = readl ( xhci->op_addr + XHCI_OP_USBCMD );
usbcmd &= ~XHCI_USBCMD_RUN; usbcmd &= ~XHCI_USBCMD_RUN;
writel ( usbcmd, xhci->op + XHCI_OP_USBCMD ); // writel ( usbcmd, xhci->op + XHCI_OP_USBCMD );
writel ( usbcmd, xhci->op_addr + XHCI_OP_USBCMD );
/* Wait for device to stop */ /* Wait for device to stop */
for ( i = 0 ; i < XHCI_STOP_MAX_WAIT_MS ; i++ ) { for ( i = 0 ; i < XHCI_STOP_MAX_WAIT_MS ; i++ ) {
/* Check if device is stopped */ /* Check if device is stopped */
usbsts = readl ( xhci->op + XHCI_OP_USBSTS ); // usbsts = readl ( xhci->op + XHCI_OP_USBSTS );
usbsts = readl ( xhci->op_addr + XHCI_OP_USBSTS );
if ( usbsts & XHCI_USBSTS_HCH ) if ( usbsts & XHCI_USBSTS_HCH )
return 0; return 0;