All of lore.kernel.org
 help / color / mirror / Atom feed
From: Greg KH <gregkh@linuxfoundation.org>
To: "Alexis R. Cortes" <alexis.cortes@ti.com>
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
Date: Tue, 31 Jul 2012 16:18:14 -0700	[thread overview]
Message-ID: <20120731231814.GC1558@kroah.com> (raw)
In-Reply-To: <501860C6.3070309@ti.com>

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 <alexis.cortes@ti.com>
> ---
>  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

  reply	other threads:[~2012-07-31 23:18 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-07-31 22:48 [PATCH] usb: host: xhci: Fix Compliance Mode on SN65LVPE502CP Hardware Alexis R. Cortes
2012-07-31 23:18 ` Greg KH [this message]
  -- strict thread matches above, loose matches on Subject: below --
2012-08-01 22:36 Alexis R. Cortes
2012-08-01 23:23 ` Peter Stuge
2012-08-01 23:51 ` Sarah Sharp
2012-08-01 19:04 Alexis R. Cortes
2012-08-01 20:01 ` Peter Stuge
2012-08-01 21:18   ` Sarah Sharp
     [not found]     ` <007b01cd702f$1b5e4870$521ad950$@cortes@ti.com>
2012-08-01 23:32       ` Sarah Sharp
2012-07-31 21:19 Alexis Cortes
2012-07-31 21:38 ` Greg KH
     [not found]   ` <50186206.0730b60a.069d.6df1SMTPIN_ADDED@mx.google.com>
2012-07-31 23:16     ` 'Greg KH'

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20120731231814.GC1558@kroah.com \
    --to=gregkh@linuxfoundation.org \
    --cc=alexis.cortes@ti.com \
    --cc=brian.quach@ti.com \
    --cc=jorge.llamas@ti.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=sarah.a.sharp@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.