From e30c4e662fbd0d9bbc339c198237c2219e63ab8c Mon Sep 17 00:00:00 2001 From: xj Date: Mon, 1 Jul 2024 05:01:14 -0700 Subject: [PATCH] Modify xhci_port_protocol, xhci_supported_protocol and xhci_legacy_release so that the xHCI can adapt to XiZi AIOT --- .../drivers/usb/components/port/xhci/xhci.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 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 c87ec3293..292af3f2c 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 @@ -420,7 +420,8 @@ static void xhci_legacy_release ( struct xhci_host *xhci ) { } /* Release ownership */ - writeb ( 0, xhci->cap + xhci->legacy + XHCI_USBLEGSUP_OS ); +// writeb ( 0, xhci->cap + xhci->legacy + XHCI_USBLEGSUP_OS ); + writeb ( 0, xhci->cap_addr + xhci->legacy + XHCI_USBLEGSUP_OS ); USB_LOG_DBG("XHCI %s released ownership to BIOS\n", xhci->name ); } @@ -586,7 +587,8 @@ static unsigned int xhci_port_protocol ( struct xhci_host *xhci, return 0; /* Determine protocol version */ - revision = readl ( xhci->cap + supported + XHCI_SUPPORTED_REVISION ); +// revision = readl ( xhci->cap + supported + XHCI_SUPPORTED_REVISION ); + revision = readl ( xhci->cap_addr + supported + XHCI_SUPPORTED_REVISION ); protocol = XHCI_SUPPORTED_REVISION_VER ( revision ); /* Describe port protocol */ @@ -599,11 +601,14 @@ static unsigned int xhci_port_protocol ( struct xhci_host *xhci, type = XHCI_SUPPORTED_SLOT_TYPE ( slot ); USB_LOG_DBG("XHCI %s-%d %sv%04x type %d \r\n", xhci->name, port, name.text, protocol, type ); - ports = readl ( xhci->cap + supported + XHCI_SUPPORTED_PORTS ); +// ports = readl ( xhci->cap + supported + XHCI_SUPPORTED_PORTS ); + ports = readl ( xhci->cap_addr + supported + XHCI_SUPPORTED_PORTS ); psic = XHCI_SUPPORTED_PORTS_PSIC ( ports ); if ( psic ) { USB_LOG_DBG(" speeds \r\n" ); for ( i = 0 ; i < psic ; i++ ) { +// psi = readl ( xhci->cap + supported + +// XHCI_SUPPORTED_PSI ( i ) ); psi = readl ( xhci->cap + supported + XHCI_SUPPORTED_PSI ( i ) ); psiv = XHCI_SUPPORTED_PSI_VALUE ( psi ); @@ -1209,13 +1214,16 @@ static int xhci_port_speed ( struct xhci_host *xhci, unsigned int port, return -ENOTSUP; /* Get protocol speed ID count */ - ports = readl ( xhci->cap + supported + XHCI_SUPPORTED_PORTS ); +// ports = readl ( xhci->cap + supported + XHCI_SUPPORTED_PORTS ); + ports = readl ( xhci->cap_addr + supported + XHCI_SUPPORTED_PORTS ); psic = XHCI_SUPPORTED_PORTS_PSIC ( ports ); /* Use protocol speed ID table unless device is known to be faulty */ /* Iterate over PSI dwords looking for a match */ for ( i = 0 ; i < psic ; i++ ) { - psi = readl ( xhci->cap + supported + +// psi = readl ( xhci->cap + supported + +// XHCI_SUPPORTED_PSI ( i ) ); + psi = readl ( xhci->cap_addr + supported + XHCI_SUPPORTED_PSI ( i ) ); if ( psiv == XHCI_SUPPORTED_PSI_VALUE ( psi ) ) { mantissa = XHCI_SUPPORTED_PSI_MANTISSA ( psi );