Skip to content

Commit 001fd38

Browse files
mlankhorstSarah Sharp
authored andcommitted
xhci: Do not issue device reset when device is not setup
xHCI controllers respond to a Reset Device command when the Slot is in the Enabled/Disabled state by returning an error. This is fine on other host controllers, but the Etron xHCI host controller returns a vendor-specific error code that the xHCI driver doesn't understand. The xHCI driver then gives up on device enumeration. Instead of issuing a command that will fail, just return. This fixes the issue with the xhci driver not working on ASRock P67 Pro/Extreme boards. This should be backported to stable kernels as far back as 2.6.34. Signed-off-by: Maarten Lankhorst <[email protected]> Signed-off-by: Sarah Sharp <[email protected]> Cc: [email protected]
1 parent e2b0217 commit 001fd38

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

drivers/usb/host/xhci.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2467,6 +2467,7 @@ int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev)
24672467
struct xhci_command *reset_device_cmd;
24682468
int timeleft;
24692469
int last_freed_endpoint;
2470+
struct xhci_slot_ctx *slot_ctx;
24702471

24712472
ret = xhci_check_args(hcd, udev, NULL, 0, false, __func__);
24722473
if (ret <= 0)
@@ -2499,6 +2500,12 @@ int xhci_discover_or_reset_device(struct usb_hcd *hcd, struct usb_device *udev)
24992500
return -EINVAL;
25002501
}
25012502

2503+
/* If device is not setup, there is no point in resetting it */
2504+
slot_ctx = xhci_get_slot_ctx(xhci, virt_dev->out_ctx);
2505+
if (GET_SLOT_STATE(le32_to_cpu(slot_ctx->dev_state)) ==
2506+
SLOT_STATE_DISABLED)
2507+
return 0;
2508+
25022509
xhci_dbg(xhci, "Resetting device with slot ID %u\n", slot_id);
25032510
/* Allocate the command structure that holds the struct completion.
25042511
* Assume we're in process context, since the normal device reset

0 commit comments

Comments
 (0)