public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Maarten Lankhorst <m.b.lankhorst@gmail.com>
To: "Xu, Andiry" <Andiry.Xu@amd.com>
Cc: linux-usb@vger.kernel.org,
	Sarah Sharp <sarah.a.sharp@linux.intel.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] [RFC] usb: Do not attempt to reset the device while it is disabled
Date: Tue, 31 May 2011 15:47:18 +0200	[thread overview]
Message-ID: <4DE4F166.8020207@gmail.com> (raw)
In-Reply-To: <2DEEA3AB13739D45A22ADDB5086AEA0B016C1261@sshaexmb1.amd.com>

Hey Andiry,

Op 31-05-11 02:34, Xu, Andiry schreef:
>> -----Original Message-----
>> From:linux-usb-owner@vger.kernel.org  [mailto:linux-usb-
>> owner@vger.kernel.org] On Behalf Of Maarten Lankhorst
>> Sent: Monday, May 30, 2011 5:57 PM
>> To:linux-usb@vger.kernel.org
>> Cc: Sarah Sharp;linux-kernel@vger.kernel.org; Maarten Lankhorst
>> Subject: [PATCH] [RFC] usb: Broaden range of vendor codes for xhci
>>
>> My asrock P67 chipset sends code 192 on device reset. Allowing>= 192
>> to be treated as success fixes it, and allows me to use my USB3 port.
>>
> TRB completion code 192-223 is defined as Vendor defined error. Your
> host
> controller returns a error - don't know what causes the error since it's
> vendor defined.
Ahh, making it the same as COMP_EBADSLT/COMP_CTX_STATE I get this:
[72677.470421] xhci_hcd 0000:04:00.0: Can't reset device (slot ID 1) in 
enabled/disabled state

Should reset_device even be called when in that state? The comments 
above claim:
/* The Reset Device command can't fail, according to the 0.95/0.96 spec,
  * unless we tried to reset a slot ID that wasn't enabled,
  * or the device wasn't in the addressed or configured state.
  */

Ignoring the error seems to make it work fine. It seems to me that 
device reset shouldn't even be attempted since it hasn't been brought up 
yet. The reset that fails is the one that happens on the original 
hub_port_init when it calls hub_port_reset which calls 
xhci_discover_or_reset_device. The failure I'm getting seems to be a 
vendor specific variant of "you're trying to reset the device while it 
wasn't enabled".

Signed-off-by: Maarten Lankhorst<m.b.lankhorst@gmail.com>

---
index 81b976e..9a869b2 100644
--- a/drivers/usb/host/xhci.c
+++ b/drivers/usb/host/xhci.c
@@ -2307,6 +2307,10 @@ int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev)
  			return -EINVAL;
  	}

+	if (GET_SLOT_STATE(xhci_get_slot_ctx(xhci, virt_dev->out_ctx)->dev_state) == 0&&
+	    (xhci_get_ep_ctx(xhci, virt_dev->out_ctx, 0)->ep_info&  EP_STATE_MASK) == EP_STATE_DISABLED)
+		return 0;
+
  	xhci_dbg(xhci, "Resetting device with slot ID %u\n", slot_id);
  	/* Allocate the command structure that holds the struct completion.
  	 * Assume we're in process context, since the normal device reset


   


  reply	other threads:[~2011-05-31 13:47 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-05-30  9:56 [PATCH] [RFC] usb: Broaden range of vendor codes for xhci Maarten Lankhorst
2011-05-31  0:34 ` Xu, Andiry
2011-05-31 13:47   ` Maarten Lankhorst [this message]
2011-05-31 17:14     ` [PATCH] [RFC] usb: Do not attempt to reset the device while it is disabled Sarah Sharp
2011-05-31 17:41       ` Maarten Lankhorst
2011-05-31 18:18         ` Sarah Sharp
2011-05-31 19:07           ` Maarten Lankhorst
2011-05-31 22:35             ` Sarah Sharp
2011-05-31 22:55               ` Maarten Lankhorst
2011-05-31 23:57               ` Maarten Lankhorst
2011-06-01 19:39                 ` Sarah Sharp

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=4DE4F166.8020207@gmail.com \
    --to=m.b.lankhorst@gmail.com \
    --cc=Andiry.Xu@amd.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox