diff options
Diffstat (limited to 'drivers/usb/host/xhci-ring.c')
-rw-r--r-- | drivers/usb/host/xhci-ring.c | 41 |
1 files changed, 34 insertions, 7 deletions
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c index ee7bc7ecbc59..6ba841bca4a2 100644 --- a/drivers/usb/host/xhci-ring.c +++ b/drivers/usb/host/xhci-ring.c | |||
@@ -953,6 +953,17 @@ bandwidth_change: | |||
953 | case TRB_TYPE(TRB_RESET_EP): | 953 | case TRB_TYPE(TRB_RESET_EP): |
954 | handle_reset_ep_completion(xhci, event, xhci->cmd_ring->dequeue); | 954 | handle_reset_ep_completion(xhci, event, xhci->cmd_ring->dequeue); |
955 | break; | 955 | break; |
956 | case TRB_TYPE(TRB_RESET_DEV): | ||
957 | xhci_dbg(xhci, "Completed reset device command.\n"); | ||
958 | slot_id = TRB_TO_SLOT_ID( | ||
959 | xhci->cmd_ring->dequeue->generic.field[3]); | ||
960 | virt_dev = xhci->devs[slot_id]; | ||
961 | if (virt_dev) | ||
962 | handle_cmd_in_cmd_wait_list(xhci, virt_dev, event); | ||
963 | else | ||
964 | xhci_warn(xhci, "Reset device command completion " | ||
965 | "for disabled slot %u\n", slot_id); | ||
966 | break; | ||
956 | default: | 967 | default: |
957 | /* Skip over unknown commands on the event ring */ | 968 | /* Skip over unknown commands on the event ring */ |
958 | xhci->error_bitmask |= 1 << 6; | 969 | xhci->error_bitmask |= 1 << 6; |
@@ -1080,6 +1091,20 @@ static int xhci_requires_manual_halt_cleanup(struct xhci_hcd *xhci, | |||
1080 | return 0; | 1091 | return 0; |
1081 | } | 1092 | } |
1082 | 1093 | ||
1094 | int xhci_is_vendor_info_code(struct xhci_hcd *xhci, unsigned int trb_comp_code) | ||
1095 | { | ||
1096 | if (trb_comp_code >= 224 && trb_comp_code <= 255) { | ||
1097 | /* Vendor defined "informational" completion code, | ||
1098 | * treat as not-an-error. | ||
1099 | */ | ||
1100 | xhci_dbg(xhci, "Vendor defined info completion code %u\n", | ||
1101 | trb_comp_code); | ||
1102 | xhci_dbg(xhci, "Treating code as success.\n"); | ||
1103 | return 1; | ||
1104 | } | ||
1105 | return 0; | ||
1106 | } | ||
1107 | |||
1083 | /* | 1108 | /* |
1084 | * If this function returns an error condition, it means it got a Transfer | 1109 | * If this function returns an error condition, it means it got a Transfer |
1085 | * event with a corrupted Slot ID, Endpoint ID, or TRB DMA address. | 1110 | * event with a corrupted Slot ID, Endpoint ID, or TRB DMA address. |
@@ -1196,13 +1221,7 @@ static int handle_tx_event(struct xhci_hcd *xhci, | |||
1196 | status = -ENOSR; | 1221 | status = -ENOSR; |
1197 | break; | 1222 | break; |
1198 | default: | 1223 | default: |
1199 | if (trb_comp_code >= 224 && trb_comp_code <= 255) { | 1224 | if (xhci_is_vendor_info_code(xhci, trb_comp_code)) { |
1200 | /* Vendor defined "informational" completion code, | ||
1201 | * treat as not-an-error. | ||
1202 | */ | ||
1203 | xhci_dbg(xhci, "Vendor defined info completion code %u\n", | ||
1204 | trb_comp_code); | ||
1205 | xhci_dbg(xhci, "Treating code as success.\n"); | ||
1206 | status = 0; | 1225 | status = 0; |
1207 | break; | 1226 | break; |
1208 | } | 1227 | } |
@@ -2181,6 +2200,14 @@ int xhci_queue_address_device(struct xhci_hcd *xhci, dma_addr_t in_ctx_ptr, | |||
2181 | false); | 2200 | false); |
2182 | } | 2201 | } |
2183 | 2202 | ||
2203 | /* Queue a reset device command TRB */ | ||
2204 | int xhci_queue_reset_device(struct xhci_hcd *xhci, u32 slot_id) | ||
2205 | { | ||
2206 | return queue_command(xhci, 0, 0, 0, | ||
2207 | TRB_TYPE(TRB_RESET_DEV) | SLOT_ID_FOR_TRB(slot_id), | ||
2208 | false); | ||
2209 | } | ||
2210 | |||
2184 | /* Queue a configure endpoint command TRB */ | 2211 | /* Queue a configure endpoint command TRB */ |
2185 | int xhci_queue_configure_endpoint(struct xhci_hcd *xhci, dma_addr_t in_ctx_ptr, | 2212 | int xhci_queue_configure_endpoint(struct xhci_hcd *xhci, dma_addr_t in_ctx_ptr, |
2186 | u32 slot_id, bool command_must_succeed) | 2213 | u32 slot_id, bool command_must_succeed) |