Skip to content

Commit

Permalink
Merge branch 'for-usb-linus' of git.kernel.org/pub/scm/linux/kernel/g…
Browse files Browse the repository at this point in the history
…it/sarah/xhci into usb-linus

* 'for-usb-linus' of ra.kernel.org:/pub/scm/linux/kernel/git/sarah/xhci:
  usb, xhci: Clear warm reset change event during init
  xhci: Set slot and ep0 flags for address command.
  usb, xhci: fix lockdep warning on endpoint timeout
  • Loading branch information
Greg Kroah-Hartman committed Nov 14, 2011
2 parents 1ea6b8f + 79c3dd8 commit 47c6a04
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 12 deletions.
6 changes: 6 additions & 0 deletions drivers/usb/core/hub.c
Original file line number Diff line number Diff line change
Expand Up @@ -813,6 +813,12 @@ static void hub_activate(struct usb_hub *hub, enum hub_activation_type type)
USB_PORT_FEAT_C_PORT_LINK_STATE);
}

if ((portchange & USB_PORT_STAT_C_BH_RESET) &&
hub_is_superspeed(hub->hdev)) {
need_debounce_delay = true;
clear_port_feature(hub->hdev, port1,
USB_PORT_FEAT_C_BH_PORT_RESET);
}
/* We can forget about a "removed" device when there's a
* physical disconnect or the connect status changes.
*/
Expand Down
5 changes: 0 additions & 5 deletions drivers/usb/host/xhci-mem.c
Original file line number Diff line number Diff line change
Expand Up @@ -982,7 +982,6 @@ int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *ud
struct xhci_virt_device *dev;
struct xhci_ep_ctx *ep0_ctx;
struct xhci_slot_ctx *slot_ctx;
struct xhci_input_control_ctx *ctrl_ctx;
u32 port_num;
struct usb_device *top_dev;

Expand All @@ -994,12 +993,8 @@ int xhci_setup_addressable_virt_dev(struct xhci_hcd *xhci, struct usb_device *ud
return -EINVAL;
}
ep0_ctx = xhci_get_ep_ctx(xhci, dev->in_ctx, 0);
ctrl_ctx = xhci_get_input_control_ctx(xhci, dev->in_ctx);
slot_ctx = xhci_get_slot_ctx(xhci, dev->in_ctx);

/* 2) New slot context and endpoint 0 context are valid*/
ctrl_ctx->add_flags = cpu_to_le32(SLOT_FLAG | EP0_FLAG);

/* 3) Only the control endpoint is valid - one endpoint context */
slot_ctx->dev_info |= cpu_to_le32(LAST_CTX(1) | udev->route);
switch (udev->speed) {
Expand Down
13 changes: 7 additions & 6 deletions drivers/usb/host/xhci-ring.c
Original file line number Diff line number Diff line change
Expand Up @@ -816,23 +816,24 @@ void xhci_stop_endpoint_command_watchdog(unsigned long arg)
struct xhci_ring *ring;
struct xhci_td *cur_td;
int ret, i, j;
unsigned long flags;

ep = (struct xhci_virt_ep *) arg;
xhci = ep->xhci;

spin_lock(&xhci->lock);
spin_lock_irqsave(&xhci->lock, flags);

ep->stop_cmds_pending--;
if (xhci->xhc_state & XHCI_STATE_DYING) {
xhci_dbg(xhci, "Stop EP timer ran, but another timer marked "
"xHCI as DYING, exiting.\n");
spin_unlock(&xhci->lock);
spin_unlock_irqrestore(&xhci->lock, flags);
return;
}
if (!(ep->stop_cmds_pending == 0 && (ep->ep_state & EP_HALT_PENDING))) {
xhci_dbg(xhci, "Stop EP timer ran, but no command pending, "
"exiting.\n");
spin_unlock(&xhci->lock);
spin_unlock_irqrestore(&xhci->lock, flags);
return;
}

Expand All @@ -844,11 +845,11 @@ void xhci_stop_endpoint_command_watchdog(unsigned long arg)
xhci->xhc_state |= XHCI_STATE_DYING;
/* Disable interrupts from the host controller and start halting it */
xhci_quiesce(xhci);
spin_unlock(&xhci->lock);
spin_unlock_irqrestore(&xhci->lock, flags);

ret = xhci_halt(xhci);

spin_lock(&xhci->lock);
spin_lock_irqsave(&xhci->lock, flags);
if (ret < 0) {
/* This is bad; the host is not responding to commands and it's
* not allowing itself to be halted. At least interrupts are
Expand Down Expand Up @@ -896,7 +897,7 @@ void xhci_stop_endpoint_command_watchdog(unsigned long arg)
}
}
}
spin_unlock(&xhci->lock);
spin_unlock_irqrestore(&xhci->lock, flags);
xhci_dbg(xhci, "Calling usb_hc_died()\n");
usb_hc_died(xhci_to_hcd(xhci)->primary_hcd);
xhci_dbg(xhci, "xHCI host controller is dead.\n");
Expand Down
5 changes: 4 additions & 1 deletion drivers/usb/host/xhci.c
Original file line number Diff line number Diff line change
Expand Up @@ -3504,6 +3504,10 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev)
/* Otherwise, update the control endpoint ring enqueue pointer. */
else
xhci_copy_ep0_dequeue_into_input_ctx(xhci, udev);
ctrl_ctx = xhci_get_input_control_ctx(xhci, virt_dev->in_ctx);
ctrl_ctx->add_flags = cpu_to_le32(SLOT_FLAG | EP0_FLAG);
ctrl_ctx->drop_flags = 0;

xhci_dbg(xhci, "Slot ID %d Input Context:\n", udev->slot_id);
xhci_dbg_ctx(xhci, virt_dev->in_ctx, 2);

Expand Down Expand Up @@ -3585,7 +3589,6 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev)
virt_dev->address = (le32_to_cpu(slot_ctx->dev_state) & DEV_ADDR_MASK)
+ 1;
/* Zero the input context control for later use */
ctrl_ctx = xhci_get_input_control_ctx(xhci, virt_dev->in_ctx);
ctrl_ctx->add_flags = 0;
ctrl_ctx->drop_flags = 0;

Expand Down

0 comments on commit 47c6a04

Please sign in to comment.