Modify xhci_port_protocol, xhci_supported_protocol and xhci_legacy_release so that the xHCI can adapt to XiZi AIOT

This commit is contained in:
xj 2024-07-01 05:01:14 -07:00
parent 21a0f8ed30
commit e30c4e662f
1 changed files with 13 additions and 5 deletions

View File

@ -420,7 +420,8 @@ static void xhci_legacy_release ( struct xhci_host *xhci ) {
} }
/* Release ownership */ /* 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 ); 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; return 0;
/* Determine protocol version */ /* 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 ); protocol = XHCI_SUPPORTED_REVISION_VER ( revision );
/* Describe port protocol */ /* Describe port protocol */
@ -599,11 +601,14 @@ static unsigned int xhci_port_protocol ( struct xhci_host *xhci,
type = XHCI_SUPPORTED_SLOT_TYPE ( slot ); type = XHCI_SUPPORTED_SLOT_TYPE ( slot );
USB_LOG_DBG("XHCI %s-%d %sv%04x type %d \r\n", USB_LOG_DBG("XHCI %s-%d %sv%04x type %d \r\n",
xhci->name, port, name.text, protocol, type ); 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 ); psic = XHCI_SUPPORTED_PORTS_PSIC ( ports );
if ( psic ) { if ( psic ) {
USB_LOG_DBG(" speeds \r\n" ); USB_LOG_DBG(" speeds \r\n" );
for ( i = 0 ; i < psic ; i++ ) { for ( i = 0 ; i < psic ; i++ ) {
// psi = readl ( xhci->cap + supported +
// XHCI_SUPPORTED_PSI ( i ) );
psi = readl ( xhci->cap + supported + psi = readl ( xhci->cap + supported +
XHCI_SUPPORTED_PSI ( i ) ); XHCI_SUPPORTED_PSI ( i ) );
psiv = XHCI_SUPPORTED_PSI_VALUE ( psi ); psiv = XHCI_SUPPORTED_PSI_VALUE ( psi );
@ -1209,13 +1214,16 @@ static int xhci_port_speed ( struct xhci_host *xhci, unsigned int port,
return -ENOTSUP; return -ENOTSUP;
/* Get protocol speed ID count */ /* 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 ); psic = XHCI_SUPPORTED_PORTS_PSIC ( ports );
/* Use protocol speed ID table unless device is known to be faulty */ /* Use protocol speed ID table unless device is known to be faulty */
/* Iterate over PSI dwords looking for a match */ /* Iterate over PSI dwords looking for a match */
for ( i = 0 ; i < psic ; i++ ) { 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 ) ); XHCI_SUPPORTED_PSI ( i ) );
if ( psiv == XHCI_SUPPORTED_PSI_VALUE ( psi ) ) { if ( psiv == XHCI_SUPPORTED_PSI_VALUE ( psi ) ) {
mantissa = XHCI_SUPPORTED_PSI_MANTISSA ( psi ); mantissa = XHCI_SUPPORTED_PSI_MANTISSA ( psi );