Skip to content
  • Alexis R. Cortes's avatar
    usb: host: xhci: Fix Compliance Mode on SN65LVPE502CP Hardware · 71c731a2
    Alexis R. Cortes authored
    This patch is intended to work around a known issue on the
    SN65LVPE502CP USB3.0 re-driver that can delay the negotiation
    between a device and the host past the usual handshake timeout.
    
    If that happens on the first insertion, the host controller
    port will enter in Compliance Mode and NO port status event will
    be generated (as per xHCI Spec) making impossible to detect this
    event by software. The port will remain in compliance mode until
    a warm reset is applied to it.
    
    As a result of this, the port will seem "dead" to the user and no
    device connections or disconnections will be detected.
    
    For solving this, the patch creates a timer which polls every 2
    seconds the link state of each host controller's port (this
    by reading the PORTSC register) and recovers the port by issuing a
    Warm reset every time Compliance mode is detected.
    
    If a xHC USB3.0 port has previously entered to U0, the compliance
    mode issue will NOT occur only until system resumes from
    sleep/hibernate, therefore, the compliance mode timer is stopped
    when all xHC USB 3.0 ports have entered U0. The timer is initialized
    again after each system resume.
    
    Since the issue is being caused by a piece of hardware, the timer
    will be enabled ONLY on those systems that have the SN65LVPE502CP
    installed (this patch uses DMI strings for detecting those systems)
    therefore making this patch to act as a quirk (XHCI_COMP_MODE_QUIRK
    has been added to the xhci stack).
    
    This patch applies for these systems:
    Vendor: Hewlett-Packard. System Models: Z420, Z620 and Z820.
    
    This patch should be backported to kernels as old as 3.2, as that was
    the first kernel to support warm reset.  The kernels will need to
    contain both commit 10d674a8 "USB: When
    hot reset for USB3 fails, try warm reset" and commit
    8bea2bd3
    
     "usb: Add support for root hub
    port status CAS".  The first patch add warm reset support, and the
    second patch modifies the USB core to issue a warm reset when the port
    is in compliance mode.
    
    Signed-off-by: default avatarAlexis R. Cortes <alexis.cortes@ti.com>
    Signed-off-by: default avatarSarah Sharp <sarah.a.sharp@linux.intel.com>
    Cc: stable@vger.kernel.org
    71c731a2