mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sriram Dash <sriram.dash@nxp.com>
To: <linux-kernel@vger.kernel.org>, <linux-usb@vger.kernel.org>
Cc: <mathias.nyman@intel.com>, <gregkh@linuxfoundation.org>,
	<suresh.gupta@nxp.com>, <felipe.balbi@linux.intel.com>,
	<stern@rowland.harvard.edu>, Sriram Dash <sriram.dash@nxp.com>,
	Rajat Srivastava <rajat.srivastava@nxp.com>,
	Rajesh Bhagat <rajesh.bhagat@nxp.com>
Subject: [PATCH v2] usb: xhci: Don't drive port 2.0 reset while resuming
Date: Tue, 25 Oct 2016 16:15:41 +0530	[thread overview]
Message-ID: <1477392341-5942-1-git-send-email-sriram.dash@nxp.com> (raw)

For the USB3.0 controller, USB 2.0 reset not driven while
port is in Resume state. So, do not program the USB 2.0 reset
(PORTSC[PR]=1) while in Resume state.

Signed-off-by: Rajat Srivastava <rajat.srivastava@nxp.com>
Signed-off-by: Sriram Dash <sriram.dash@nxp.com>
Signed-off-by: Rajesh Bhagat <rajesh.bhagat@nxp.com>
---
Changes in v2:
  - Remove the quirk and make it generic to xhci.
  - Edit the title and comment


 drivers/usb/host/xhci-hub.c | 17 ++++++++++++++++-
 1 file changed, 16 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c
index 730b9fd..a27dbb4 100644
--- a/drivers/usb/host/xhci-hub.c
+++ b/drivers/usb/host/xhci-hub.c
@@ -878,7 +878,7 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
 	struct xhci_hcd	*xhci = hcd_to_xhci(hcd);
 	int max_ports;
 	unsigned long flags;
-	u32 temp, status;
+	u32 temp, status, tmp_status = 0;
 	int retval = 0;
 	__le32 __iomem **port_array;
 	int slot_id;
@@ -1098,6 +1098,21 @@ int xhci_hub_control(struct usb_hcd *hcd, u16 typeReq, u16 wValue,
 			spin_lock_irqsave(&xhci->lock, flags);
 			break;
 		case USB_PORT_FEAT_RESET:
+			/*
+			 * Do not drive a reset signal when the port
+			 * is resuming
+			 */
+			tmp_status = readl(port_array[wIndex]);
+			spin_unlock_irqrestore(&xhci->lock, flags);
+			if (!DEV_SUPERSPEED(tmp_status)	&&
+			    (tmp_status & PORT_PLS_MASK) == XDEV_RESUME) {
+				xhci_err(xhci, "skip port reset\n");
+				spin_lock_irqsave(&xhci->lock, flags);
+				retval = -EPERM;
+				break;
+			}
+			spin_lock_irqsave(&xhci->lock, flags);
+
 			temp = (temp | PORT_RESET);
 			writel(temp, port_array[wIndex]);
 
-- 
2.1.0

             reply	other threads:[~2016-10-25 11:01 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-10-25 10:45 Sriram Dash [this message]
2016-10-25 12:58 ` Mathias Nyman
2016-10-26 12:34   ` Sriram Dash
2016-10-26 14:39     ` Alan Stern

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=1477392341-5942-1-git-send-email-sriram.dash@nxp.com \
    --to=sriram.dash@nxp.com \
    --cc=felipe.balbi@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mathias.nyman@intel.com \
    --cc=rajat.srivastava@nxp.com \
    --cc=rajesh.bhagat@nxp.com \
    --cc=stern@rowland.harvard.edu \
    --cc=suresh.gupta@nxp.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®