From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756104Ab2GaXSV (ORCPT ); Tue, 31 Jul 2012 19:18:21 -0400 Received: from mail-ob0-f174.google.com ([209.85.214.174]:34585 "EHLO mail-ob0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752815Ab2GaXSU (ORCPT ); Tue, 31 Jul 2012 19:18:20 -0400 Date: Tue, 31 Jul 2012 16:18:14 -0700 From: Greg KH To: "Alexis R. Cortes" Cc: sarah.a.sharp@linux.intel.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, brian.quach@ti.com, jorge.llamas@ti.com Subject: Re: [PATCH] usb: host: xhci: Fix Compliance Mode on SN65LVPE502CP Hardware Message-ID: <20120731231814.GC1558@kroah.com> References: <501860C6.3070309@ti.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <501860C6.3070309@ti.com> User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jul 31, 2012 at 05:48:38PM -0500, Alexis R. Cortes wrote: > 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, > and if that happens on the first insertion, the host controller > port will enter in Compliance Mode as per xHCI Spec. 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. > > Signed-off-by: Alexis R. Cortes > --- > drivers/usb/host/xhci-hub.c | 27 ++++++++++++++ > drivers/usb/host/xhci.c | 81 +++++++++++++++++++++++++++++++++++++++++++ > drivers/usb/host/xhci.h | 6 +++ > 3 files changed, 114 insertions(+), 0 deletions(-) > > diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c > index 7b01094..4ea498d 100644 > --- a/drivers/usb/host/xhci-hub.c > +++ b/drivers/usb/host/xhci-hub.c > @@ -493,7 +493,19 @@ static void xhci_hub_report_link_state(u32 *status, u32 status_reg) > * when this bit is set. > */ > pls |= USB_PORT_STAT_CONNECTION; > + } else { > + /* > + * If CAS bit isn't set but the Port is already at > + * Compliance Mode, fake a connection so the USB core > + * notices the Compliance state and resets the port. > + * This resolves an issue generated by the SN65LVPE502CP > + * in which sometimes the port enters compliance mode > + * caused by a delay on the host-device negotiation. > + */ > + if (pls == USB_SS_PORT_LS_COMP_MOD) > + pls |= USB_PORT_STAT_CONNECTION; > } > + > /* update status field */ > *status |= pls; > } > @@ -645,6 +657,21 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue, > /* Update Port Link State for super speed ports*/ > if (hcd->speed == HCD_USB3) { > xhci_hub_report_link_state(&status, temp); > + /* > + * Verify if all USB3 Ports Have entered U0. Delete compliance > + * mode timer if so. > + */ > + if (xhci->quirks & XHCI_COMP_MODE_QUIRK) { > + if (xhci->port_status_u0 != ((1 << xhci->num_usb3_ports)-1)) { > + if ((temp & PORT_PLS_MASK) == XDEV_U0) > + xhci->port_status_u0 |= 1 << wIndex; > + } else { > + /* Deleting Compliance Mode Recovery Timer */ > + if (del_timer_sync(&xhci->comp_mode_recovery_timer)) > + xhci_dbg(xhci, "Compliance Mode Recovery Timer Deleted. " > + "All USB3 ports have entered U0 at least once.\n"); You need to disable the quirk flag here now, right? Otherwise can't the timer be deleted twice if the module is unloaded after this happens? thanks, greg k-h