diff options
Diffstat (limited to 'drivers/usb/host/xhci.c')
-rw-r--r-- | drivers/usb/host/xhci.c | 39 |
1 files changed, 22 insertions, 17 deletions
diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 1ff95a0df57..a1afb7c39f7 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c | |||
@@ -711,7 +711,10 @@ static void xhci_clear_command_ring(struct xhci_hcd *xhci) | |||
711 | ring = xhci->cmd_ring; | 711 | ring = xhci->cmd_ring; |
712 | seg = ring->deq_seg; | 712 | seg = ring->deq_seg; |
713 | do { | 713 | do { |
714 | memset(seg->trbs, 0, SEGMENT_SIZE); | 714 | memset(seg->trbs, 0, |
715 | sizeof(union xhci_trb) * (TRBS_PER_SEGMENT - 1)); | ||
716 | seg->trbs[TRBS_PER_SEGMENT - 1].link.control &= | ||
717 | cpu_to_le32(~TRB_CYCLE); | ||
715 | seg = seg->next; | 718 | seg = seg->next; |
716 | } while (seg != ring->deq_seg); | 719 | } while (seg != ring->deq_seg); |
717 | 720 | ||
@@ -799,7 +802,7 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
799 | u32 command, temp = 0; | 802 | u32 command, temp = 0; |
800 | struct usb_hcd *hcd = xhci_to_hcd(xhci); | 803 | struct usb_hcd *hcd = xhci_to_hcd(xhci); |
801 | struct usb_hcd *secondary_hcd; | 804 | struct usb_hcd *secondary_hcd; |
802 | int retval; | 805 | int retval = 0; |
803 | 806 | ||
804 | /* Wait a bit if either of the roothubs need to settle from the | 807 | /* Wait a bit if either of the roothubs need to settle from the |
805 | * transition into bus suspend. | 808 | * transition into bus suspend. |
@@ -809,6 +812,9 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
809 | xhci->bus_state[1].next_statechange)) | 812 | xhci->bus_state[1].next_statechange)) |
810 | msleep(100); | 813 | msleep(100); |
811 | 814 | ||
815 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
816 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags); | ||
817 | |||
812 | spin_lock_irq(&xhci->lock); | 818 | spin_lock_irq(&xhci->lock); |
813 | if (xhci->quirks & XHCI_RESET_ON_RESUME) | 819 | if (xhci->quirks & XHCI_RESET_ON_RESUME) |
814 | hibernated = true; | 820 | hibernated = true; |
@@ -878,20 +884,13 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) | |||
878 | return retval; | 884 | return retval; |
879 | xhci_dbg(xhci, "Start the primary HCD\n"); | 885 | xhci_dbg(xhci, "Start the primary HCD\n"); |
880 | retval = xhci_run(hcd->primary_hcd); | 886 | retval = xhci_run(hcd->primary_hcd); |
881 | if (retval) | ||
882 | goto failed_restart; | ||
883 | |||
884 | xhci_dbg(xhci, "Start the secondary HCD\n"); | ||
885 | retval = xhci_run(secondary_hcd); | ||
886 | if (!retval) { | 887 | if (!retval) { |
887 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | 888 | xhci_dbg(xhci, "Start the secondary HCD\n"); |
888 | set_bit(HCD_FLAG_HW_ACCESSIBLE, | 889 | retval = xhci_run(secondary_hcd); |
889 | &xhci->shared_hcd->flags); | ||
890 | } | 890 | } |
891 | failed_restart: | ||
892 | hcd->state = HC_STATE_SUSPENDED; | 891 | hcd->state = HC_STATE_SUSPENDED; |
893 | xhci->shared_hcd->state = HC_STATE_SUSPENDED; | 892 | xhci->shared_hcd->state = HC_STATE_SUSPENDED; |
894 | return retval; | 893 | goto done; |
895 | } | 894 | } |
896 | 895 | ||
897 | /* step 4: set Run/Stop bit */ | 896 | /* step 4: set Run/Stop bit */ |
@@ -910,11 +909,14 @@ failed_restart: | |||
910 | * Running endpoints by ringing their doorbells | 909 | * Running endpoints by ringing their doorbells |
911 | */ | 910 | */ |
912 | 911 | ||
913 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); | ||
914 | set_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags); | ||
915 | |||
916 | spin_unlock_irq(&xhci->lock); | 912 | spin_unlock_irq(&xhci->lock); |
917 | return 0; | 913 | |
914 | done: | ||
915 | if (retval == 0) { | ||
916 | usb_hcd_resume_root_hub(hcd); | ||
917 | usb_hcd_resume_root_hub(xhci->shared_hcd); | ||
918 | } | ||
919 | return retval; | ||
918 | } | 920 | } |
919 | #endif /* CONFIG_PM */ | 921 | #endif /* CONFIG_PM */ |
920 | 922 | ||
@@ -3504,6 +3506,10 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev) | |||
3504 | /* Otherwise, update the control endpoint ring enqueue pointer. */ | 3506 | /* Otherwise, update the control endpoint ring enqueue pointer. */ |
3505 | else | 3507 | else |
3506 | xhci_copy_ep0_dequeue_into_input_ctx(xhci, udev); | 3508 | xhci_copy_ep0_dequeue_into_input_ctx(xhci, udev); |
3509 | ctrl_ctx = xhci_get_input_control_ctx(xhci, virt_dev->in_ctx); | ||
3510 | ctrl_ctx->add_flags = cpu_to_le32(SLOT_FLAG | EP0_FLAG); | ||
3511 | ctrl_ctx->drop_flags = 0; | ||
3512 | |||
3507 | xhci_dbg(xhci, "Slot ID %d Input Context:\n", udev->slot_id); | 3513 | xhci_dbg(xhci, "Slot ID %d Input Context:\n", udev->slot_id); |
3508 | xhci_dbg_ctx(xhci, virt_dev->in_ctx, 2); | 3514 | xhci_dbg_ctx(xhci, virt_dev->in_ctx, 2); |
3509 | 3515 | ||
@@ -3585,7 +3591,6 @@ int xhci_address_device(struct usb_hcd *hcd, struct usb_device *udev) | |||
3585 | virt_dev->address = (le32_to_cpu(slot_ctx->dev_state) & DEV_ADDR_MASK) | 3591 | virt_dev->address = (le32_to_cpu(slot_ctx->dev_state) & DEV_ADDR_MASK) |
3586 | + 1; | 3592 | + 1; |
3587 | /* Zero the input context control for later use */ | 3593 | /* Zero the input context control for later use */ |
3588 | ctrl_ctx = xhci_get_input_control_ctx(xhci, virt_dev->in_ctx); | ||
3589 | ctrl_ctx->add_flags = 0; | 3594 | ctrl_ctx->add_flags = 0; |
3590 | ctrl_ctx->drop_flags = 0; | 3595 | ctrl_ctx->drop_flags = 0; |
3591 | 3596 | ||