diff --git a/linux-5.10/rk3568_patch/kernel.patch b/linux-5.10/rk3568_patch/kernel.patch index f9e165016e9f1c205cc6e6a7adcef30b1a741727..8c127131545d39fc76df46edeb9a32fb5dca8a72 100644 --- a/linux-5.10/rk3568_patch/kernel.patch +++ b/linux-5.10/rk3568_patch/kernel.patch @@ -1593027,7 +1593027,7 @@ index 4512c4223..a937bc6db } static void xhci_kill_ring_urbs(struct xhci_hcd *xhci, struct xhci_ring *ring) -@@ -1228,10 +1312,10 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, int slot_id, +@@ -1231,10 +1315,10 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, int slot_id, unsigned int ep_index; unsigned int stream_id; struct xhci_ring *ep_ring; @@ -1593039,7 +1593039,7 @@ index 4512c4223..a937bc6db ep_index = TRB_TO_EP_INDEX(le32_to_cpu(trb->generic.field[3])); stream_id = TRB_TO_STREAM_ID(le32_to_cpu(trb->generic.field[2])); -@@ -1239,8 +1323,7 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, int slot_id, +@@ -1242,8 +1326,7 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, int slot_id, if (!ep) return; @@ -1593049,7 +1593049,7 @@ index 4512c4223..a937bc6db if (!ep_ring) { xhci_warn(xhci, "WARN Set TR deq ptr command for freed stream ID %u\n", stream_id); -@@ -1248,8 +1331,8 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, int slot_id, +@@ -1251,8 +1334,8 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, int slot_id, goto cleanup; } @@ -1593060,7 +1593060,7 @@ index 4512c4223..a937bc6db trace_xhci_handle_cmd_set_deq(slot_ctx); trace_xhci_handle_cmd_set_deq_ep(ep_ctx); -@@ -1302,7 +1385,7 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, int slot_id, +@@ -1305,7 +1388,7 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, int slot_id, /* Update the ring's dequeue segment and dequeue pointer * to reflect the new position. */ @@ -1593069,7 +1593069,7 @@ index 4512c4223..a937bc6db ep_ring, ep_index); } else { xhci_warn(xhci, "Mismatch between completed Set TR Deq Ptr command & xHCI internal state.\n"); -@@ -1310,7 +1393,24 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, int slot_id, +@@ -1313,7 +1396,24 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, int slot_id, ep->queued_deq_seg, ep->queued_deq_ptr); } } @@ -1593095,7 +1593095,7 @@ index 4512c4223..a937bc6db cleanup: ep->ep_state &= ~SET_DEQ_PENDING; ep->queued_deq_seg = NULL; -@@ -1322,7 +1422,6 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, int slot_id, +@@ -1325,7 +1425,6 @@ static void xhci_handle_cmd_set_deq(struct xhci_hcd *xhci, int slot_id, static void xhci_handle_cmd_reset_ep(struct xhci_hcd *xhci, int slot_id, union xhci_trb *trb, u32 cmd_comp_code) { @@ -1593103,7 +1593103,7 @@ index 4512c4223..a937bc6db struct xhci_virt_ep *ep; struct xhci_ep_ctx *ep_ctx; unsigned int ep_index; -@@ -1332,8 +1431,7 @@ static void xhci_handle_cmd_reset_ep(struct xhci_hcd *xhci, int slot_id, +@@ -1335,8 +1434,7 @@ static void xhci_handle_cmd_reset_ep(struct xhci_hcd *xhci, int slot_id, if (!ep) return; @@ -1593113,7 +1593113,7 @@ index 4512c4223..a937bc6db trace_xhci_handle_cmd_reset_ep(ep_ctx); /* This command will only fail if the endpoint wasn't halted, -@@ -1342,27 +1440,15 @@ static void xhci_handle_cmd_reset_ep(struct xhci_hcd *xhci, int slot_id, +@@ -1345,27 +1443,15 @@ static void xhci_handle_cmd_reset_ep(struct xhci_hcd *xhci, int slot_id, xhci_dbg_trace(xhci, trace_xhci_dbg_reset_ep, "Ignoring reset ep completion code of %u", cmd_comp_code); @@ -1593148,7 +1593148,7 @@ index 4512c4223..a937bc6db /* if this was a soft reset, then restart */ if ((le32_to_cpu(trb->generic.field[3])) & TRB_TSP) -@@ -1396,7 +1482,7 @@ static void xhci_handle_cmd_disable_slot(struct xhci_hcd *xhci, int slot_id) +@@ -1399,7 +1485,7 @@ static void xhci_handle_cmd_disable_slot(struct xhci_hcd *xhci, int slot_id) } static void xhci_handle_cmd_config_ep(struct xhci_hcd *xhci, int slot_id, @@ -1593157,7 +1593157,7 @@ index 4512c4223..a937bc6db { struct xhci_virt_device *virt_dev; struct xhci_input_control_ctx *ctrl_ctx; -@@ -1414,6 +1500,8 @@ static void xhci_handle_cmd_config_ep(struct xhci_hcd *xhci, int slot_id, +@@ -1417,6 +1503,8 @@ static void xhci_handle_cmd_config_ep(struct xhci_hcd *xhci, int slot_id, * is not waiting on the configure endpoint command. */ virt_dev = xhci->devs[slot_id]; @@ -1593166,7 +1593166,7 @@ index 4512c4223..a937bc6db ctrl_ctx = xhci_get_input_control_ctx(virt_dev->in_ctx); if (!ctrl_ctx) { xhci_warn(xhci, "Could not get input context, bad type.\n"); -@@ -1458,24 +1546,27 @@ static void xhci_handle_cmd_addr_dev(struct xhci_hcd *xhci, int slot_id) +@@ -1461,24 +1549,27 @@ static void xhci_handle_cmd_addr_dev(struct xhci_hcd *xhci, int slot_id) struct xhci_slot_ctx *slot_ctx; vdev = xhci->devs[slot_id]; @@ -1593199,7 +1593199,7 @@ index 4512c4223..a937bc6db } static void xhci_handle_cmd_nec_get_fw(struct xhci_hcd *xhci, -@@ -1568,7 +1659,7 @@ void xhci_handle_command_timeout(struct work_struct *work) +@@ -1571,7 +1662,7 @@ void xhci_handle_command_timeout(struct work_struct *work) static void handle_cmd_completion(struct xhci_hcd *xhci, struct xhci_event_cmd *event) { @@ -1593208,7 +1593208,7 @@ index 4512c4223..a937bc6db u64 cmd_dma; dma_addr_t cmd_dequeue_dma; u32 cmd_comp_code; -@@ -1576,6 +1667,11 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, +@@ -1579,6 +1670,11 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, struct xhci_command *cmd; u32 cmd_type; @@ -1593220,7 +1593220,7 @@ index 4512c4223..a937bc6db cmd_dma = le64_to_cpu(event->cmd_trb); cmd_trb = xhci->cmd_ring->dequeue; -@@ -1636,8 +1732,7 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, +@@ -1639,8 +1735,7 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, break; case TRB_CONFIG_EP: if (!cmd->completion) @@ -1593230,7 +1593230,7 @@ index 4512c4223..a937bc6db break; case TRB_EVAL_CONTEXT: break; -@@ -1648,7 +1743,8 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, +@@ -1651,7 +1746,8 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, WARN_ON(slot_id != TRB_TO_SLOT_ID( le32_to_cpu(cmd_trb->generic.field[3]))); if (!cmd->completion) @@ -1593240,7 +1593240,7 @@ index 4512c4223..a937bc6db break; case TRB_SET_DEQ: WARN_ON(slot_id != TRB_TO_SLOT_ID( -@@ -1671,7 +1767,7 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, +@@ -1674,7 +1770,7 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, */ slot_id = TRB_TO_SLOT_ID( le32_to_cpu(cmd_trb->generic.field[3])); @@ -1593249,7 +1593249,7 @@ index 4512c4223..a937bc6db break; case TRB_NEC_GET_FW: xhci_handle_cmd_nec_get_fw(xhci, event); -@@ -1698,11 +1794,8 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, +@@ -1701,11 +1797,8 @@ static void handle_cmd_completion(struct xhci_hcd *xhci, } static void handle_vendor_event(struct xhci_hcd *xhci, @@ -1593262,23 +1593262,9 @@ index 4512c4223..a937bc6db xhci_dbg(xhci, "Vendor specific event TRB type = %u\n", trb_type); if (trb_type == TRB_NEC_CMD_COMP && (xhci->quirks & XHCI_NEC_HOST)) handle_cmd_completion(xhci, &event->event_cmd); -@@ -2059,29 +2152,60 @@ int xhci_is_vendor_info_code(struct xhci_hcd *xhci, unsigned int trb_comp_code) - return 0; - } +@@ -2070,18 +2163,53 @@ static int finish_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, --static int finish_td(struct xhci_hcd *xhci, struct xhci_td *td, -- struct xhci_transfer_event *event, struct xhci_virt_ep *ep) -+static int finish_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, -+ struct xhci_ring *ep_ring, struct xhci_td *td, -+ u32 trb_comp_code) - { - struct xhci_ep_ctx *ep_ctx; -- struct xhci_ring *ep_ring; -- u32 trb_comp_code; - -- ep_ring = xhci_dma_to_transfer_ring(ep, le64_to_cpu(event->buffer)); ep_ctx = xhci_get_ep_ctx(xhci, ep->vdev->out_ctx, ep->ep_index); -- trb_comp_code = GET_COMP_CODE(le32_to_cpu(event->transfer_len)); - if (trb_comp_code == COMP_STOPPED_LENGTH_INVALID || - trb_comp_code == COMP_STOPPED || @@ -1593295,7 +1593281,7 @@ index 4512c4223..a937bc6db * the ring dequeue pointer or take this TD off any lists yet. */ return 0; -- } + } - if (trb_comp_code == COMP_STALL_ERROR || - xhci_requires_manual_halt_cleanup(xhci, ep_ctx, - trb_comp_code)) { @@ -1593338,7 +1593324,7 @@ index 4512c4223..a937bc6db /* * xhci internal endpoint state will go to a "halt" state for * any stall, including default control pipe protocol stall. -@@ -2092,18 +2216,23 @@ static int finish_td(struct xhci_hcd *xhci, struct xhci_td *td, +@@ -2092,19 +2220,23 @@ static int finish_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, * stall later. Hub TT buffer should only be cleared for FS/LS * devices behind HS hubs for functional stalls. */ @@ -1593350,8 +1593336,9 @@ index 4512c4223..a937bc6db - EP_HARD_RESET); - } else { - /* Update ring dequeue pointer */ -- while (ep_ring->dequeue != td->last_trb) -- inc_deq(xhci, ep_ring); +- ep_ring->dequeue = td->last_trb; +- ep_ring->deq_seg = td->last_trb_seg; +- ep_ring->num_trbs_free += td->num_trbs - 1; - inc_deq(xhci, ep_ring); + EP_HARD_RESET); + @@ -1593369,95 +1593356,7 @@ index 4512c4223..a937bc6db return xhci_td_cleanup(xhci, td, ep_ring, td->status); } -@@ -2125,9 +2254,9 @@ static int sum_trb_lengths(struct xhci_hcd *xhci, struct xhci_ring *ring, - /* - * Process control tds, update urb status and actual_length. - */ --static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td, -- union xhci_trb *ep_trb, struct xhci_transfer_event *event, -- struct xhci_virt_ep *ep) -+static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, -+ struct xhci_ring *ep_ring, struct xhci_td *td, -+ union xhci_trb *ep_trb, struct xhci_transfer_event *event) - { - struct xhci_ep_ctx *ep_ctx; - u32 trb_comp_code; -@@ -2215,18 +2344,19 @@ static int process_ctrl_td(struct xhci_hcd *xhci, struct xhci_td *td, - td->urb->actual_length = requested; - - finish_td: -- return finish_td(xhci, td, event, ep); -+ return finish_td(xhci, ep, ep_ring, td, trb_comp_code); - } - - /* - * Process isochronous tds, update urb packet status and actual_length. - */ --static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td, -- union xhci_trb *ep_trb, struct xhci_transfer_event *event, -- struct xhci_virt_ep *ep) -+static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, -+ struct xhci_ring *ep_ring, struct xhci_td *td, -+ union xhci_trb *ep_trb, struct xhci_transfer_event *event) - { - struct urb_priv *urb_priv; - int idx; -+ - struct usb_iso_packet_descriptor *frame; - u32 trb_comp_code; - bool sum_trbs_for_length = false; -@@ -2300,7 +2430,7 @@ static int process_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td, - - td->urb->actual_length += frame->actual_length; - -- return finish_td(xhci, td, event, ep); -+ return finish_td(xhci, ep, ep_ring, td, trb_comp_code); - } - - static int skip_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td, -@@ -2321,8 +2451,9 @@ static int skip_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td, - frame->actual_length = 0; - - /* Update ring dequeue pointer */ -- while (ep->ring->dequeue != td->last_trb) -- inc_deq(xhci, ep->ring); -+ ep->ring->dequeue = td->last_trb; -+ ep->ring->deq_seg = td->last_trb_seg; -+ ep->ring->num_trbs_free += td->num_trbs - 1; - inc_deq(xhci, ep->ring); - - return xhci_td_cleanup(xhci, td, ep->ring, status); -@@ -2331,17 +2462,15 @@ static int skip_isoc_td(struct xhci_hcd *xhci, struct xhci_td *td, - /* - * Process bulk and interrupt tds, update urb status and actual_length. - */ --static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td, -- union xhci_trb *ep_trb, struct xhci_transfer_event *event, -- struct xhci_virt_ep *ep) -+static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, -+ struct xhci_ring *ep_ring, struct xhci_td *td, -+ union xhci_trb *ep_trb, struct xhci_transfer_event *event) - { - struct xhci_slot_ctx *slot_ctx; -- struct xhci_ring *ep_ring; - u32 trb_comp_code; - u32 remaining, requested, ep_trb_len; - - slot_ctx = xhci_get_slot_ctx(xhci, ep->vdev->out_ctx); -- ep_ring = xhci_dma_to_transfer_ring(ep, le64_to_cpu(event->buffer)); - trb_comp_code = GET_COMP_CODE(le32_to_cpu(event->transfer_len)); - remaining = EVENT_TRB_LEN(le32_to_cpu(event->transfer_len)); - ep_trb_len = TRB_LEN(le32_to_cpu(ep_trb->generic.field[2])); -@@ -2401,7 +2530,7 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td, - remaining); - td->urb->actual_length = 0; - } -- return finish_td(xhci, td, event, ep); -+ return finish_td(xhci, ep, ep_ring, td, trb_comp_code); - } - - /* -@@ -2412,7 +2541,6 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_td *td, +@@ -2432,7 +2564,6 @@ static int process_bulk_intr_td(struct xhci_hcd *xhci, struct xhci_virt_ep *ep, static int handle_tx_event(struct xhci_hcd *xhci, struct xhci_transfer_event *event) { @@ -1593465,7 +1593364,7 @@ index 4512c4223..a937bc6db struct xhci_virt_ep *ep; struct xhci_ring *ep_ring; unsigned int slot_id; -@@ -2439,9 +2567,8 @@ static int handle_tx_event(struct xhci_hcd *xhci, +@@ -2459,9 +2590,8 @@ static int handle_tx_event(struct xhci_hcd *xhci, goto err_out; } @@ -1593476,7 +1593375,7 @@ index 4512c4223..a937bc6db if (GET_EP_CTX_STATE(ep_ctx) == EP_STATE_DISABLED) { xhci_err(xhci, -@@ -2519,7 +2646,6 @@ static int handle_tx_event(struct xhci_hcd *xhci, +@@ -2539,7 +2669,6 @@ static int handle_tx_event(struct xhci_hcd *xhci, case COMP_STALL_ERROR: xhci_dbg(xhci, "Stalled endpoint for slot %u ep %u\n", slot_id, ep_index); @@ -1593484,22 +1593383,7 @@ index 4512c4223..a937bc6db status = -EPIPE; break; case COMP_SPLIT_TRANSACTION_ERROR: -@@ -2752,11 +2878,11 @@ static int handle_tx_event(struct xhci_hcd *xhci, - - /* update the urb's actual_length and give back to the core */ - if (usb_endpoint_xfer_control(&td->urb->ep->desc)) -- process_ctrl_td(xhci, td, ep_trb, event, ep); -+ process_ctrl_td(xhci, ep, ep_ring, td, ep_trb, event); - else if (usb_endpoint_xfer_isoc(&td->urb->ep->desc)) -- process_isoc_td(xhci, td, ep_trb, event, ep); -+ process_isoc_td(xhci, ep, ep_ring, td, ep_trb, event); - else -- process_bulk_intr_td(xhci, td, ep_trb, event, ep); -+ process_bulk_intr_td(xhci, ep, ep_ring, td, ep_trb, event); - cleanup: - handling_skipped_tds = ep->skip && - trb_comp_code != COMP_MISSED_SERVICE_ERROR && -@@ -2797,10 +2923,11 @@ static int handle_tx_event(struct xhci_hcd *xhci, +@@ -2848,10 +2977,11 @@ static int handle_tx_event(struct xhci_hcd *xhci, * Returns >0 for "possibly more events to process" (caller should call again), * otherwise 0 if done. In future, <0 returns should indicate error code. */ @@ -1593512,7 +1593396,7 @@ index 4512c4223..a937bc6db int ret; /* Event ring hasn't been allocated yet. */ -@@ -2822,31 +2949,30 @@ static int xhci_handle_event(struct xhci_hcd *xhci) +@@ -2873,31 +3003,30 @@ static int xhci_handle_event(struct xhci_hcd *xhci) * speculative reads of the event's flags/data below. */ rmb(); @@ -1593554,7 +1593438,7 @@ index 4512c4223..a937bc6db } /* Any of the above functions may drop and re-acquire the lock, so check * to make sure a watchdog timer didn't mark the host as non-responsive. -@@ -2866,13 +2992,14 @@ static int xhci_handle_event(struct xhci_hcd *xhci) +@@ -2917,13 +3046,14 @@ static int xhci_handle_event(struct xhci_hcd *xhci) */ return 1; } @@ -1593570,7 +1593454,7 @@ index 4512c4223..a937bc6db union xhci_trb *event_ring_deq) { u64 temp_64; -@@ -2902,6 +3029,16 @@ static void xhci_update_erst_dequeue(struct xhci_hcd *xhci, +@@ -2953,6 +3083,16 @@ static void xhci_update_erst_dequeue(struct xhci_hcd *xhci, temp_64 |= ERST_EHB; xhci_write_64(xhci, temp_64, &xhci->ir_set->erst_dequeue); } @@ -1593587,7 +1593471,7 @@ index 4512c4223..a937bc6db /* * xHCI spec says we can get an interrupt, and if the HC has an error condition, -@@ -2937,6 +3074,10 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd) +@@ -2988,6 +3128,10 @@ irqreturn_t xhci_irq(struct usb_hcd *hcd) goto out; } @@ -1593598,7 +1593482,7 @@ index 4512c4223..a937bc6db /* * Clear the op reg interrupt status first, * so we can receive interrupts from other MSI-X interrupters. -@@ -3029,6 +3170,7 @@ static int prepare_ring(struct xhci_hcd *xhci, struct xhci_ring *ep_ring, +@@ -3080,6 +3224,7 @@ static int prepare_ring(struct xhci_hcd *xhci, struct xhci_ring *ep_ring, u32 ep_state, unsigned int num_trbs, gfp_t mem_flags) { unsigned int num_trbs_needed; @@ -1593606,7 +1593490,7 @@ index 4512c4223..a937bc6db /* Make sure the endpoint has been added to xHC schedule */ switch (ep_state) { -@@ -3099,7 +3241,19 @@ static int prepare_ring(struct xhci_hcd *xhci, struct xhci_ring *ep_ring, +@@ -3150,7 +3295,19 @@ static int prepare_ring(struct xhci_hcd *xhci, struct xhci_ring *ep_ring, ep_ring->enq_seg = ep_ring->enq_seg->next; ep_ring->enqueue = ep_ring->enq_seg->trbs; @@ -1593626,7 +1593510,7 @@ index 4512c4223..a937bc6db return 0; } -@@ -3118,7 +3272,8 @@ static int prepare_transfer(struct xhci_hcd *xhci, +@@ -3169,7 +3326,8 @@ static int prepare_transfer(struct xhci_hcd *xhci, struct xhci_ring *ep_ring; struct xhci_ep_ctx *ep_ctx = xhci_get_ep_ctx(xhci, xdev->out_ctx, ep_index); @@ -1593636,68 +1593520,15 @@ index 4512c4223..a937bc6db if (!ep_ring) { xhci_dbg(xhci, "Can't prepare ring for bad stream ID %u\n", stream_id); -@@ -3487,7 +3642,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, - field |= TRB_IOC; - more_trbs_coming = false; - td->last_trb = ring->enqueue; -- -+ td->last_trb_seg = ring->enq_seg; - if (xhci_urb_suitable_for_idt(urb)) { - memcpy(&send_addr, urb->transfer_buffer, - trb_buff_len); -@@ -3513,7 +3668,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, - upper_32_bits(send_addr), - length_field, - field); -- -+ td->num_trbs++; - addr += trb_buff_len; - sent_len = trb_buff_len; - -@@ -3537,8 +3692,10 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, - ep_index, urb->stream_id, - 1, urb, 1, mem_flags); - urb_priv->td[1].last_trb = ring->enqueue; -+ urb_priv->td[1].last_trb_seg = ring->enq_seg; - field = TRB_TYPE(TRB_NORMAL) | ring->cycle_state | TRB_IOC; - queue_trb(xhci, ring, 0, 0, 0, TRB_INTR_TARGET(0), field); -+ urb_priv->td[1].num_trbs++; - } +@@ -3488,6 +3646,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags, + need_zero_pkt = true; - check_trb_math(urb, enqd_len); -@@ -3589,6 +3746,7 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, - - urb_priv = urb->hcpriv; td = &urb_priv->td[0]; + td->num_trbs = num_trbs; /* * Don't give the first TRB to the hardware (by toggling the cycle bit) -@@ -3661,6 +3819,7 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags, - - /* Save the DMA address of the last TRB in the TD */ - td->last_trb = ep_ring->enqueue; -+ td->last_trb_seg = ep_ring->enq_seg; - - /* Queue status TRB - see Table 7 and sections 4.11.2.2 and 6.4.1.2.3 */ - /* If the device sent data, the status stage is an OUT transfer */ -@@ -3905,6 +4064,7 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, - goto cleanup; - } - td = &urb_priv->td[i]; -+ td->num_trbs = trbs_per_td; - - /* use SIA as default, if frame id is used overwrite it */ - sia_frame_id = TRB_SIA; -@@ -3948,6 +4108,7 @@ static int xhci_queue_isoc_tx(struct xhci_hcd *xhci, gfp_t mem_flags, - } else { - more_trbs_coming = false; - td->last_trb = ep_ring->enqueue; -+ td->last_trb_seg = ep_ring->enq_seg; - field |= TRB_IOC; - if (trb_block_event_intr(xhci, num_tds, i)) - field |= TRB_BEI; -@@ -4230,71 +4391,7 @@ int xhci_queue_stop_endpoint(struct xhci_hcd *xhci, struct xhci_command *cmd, +@@ -4286,71 +4445,7 @@ int xhci_queue_stop_endpoint(struct xhci_hcd *xhci, struct xhci_command *cmd, return queue_command(xhci, cmd, 0, 0, 0, trb_slot_id | trb_ep_index | type | trb_suspend, false); } @@ -1594226,7 +1594057,7 @@ index 45584a278..b30e76ca0 /* Nec vendor-specific command completion event. */ #define TRB_NEC_CMD_COMP 48 /* Get NEC firmware revision. */ -@@ -1542,17 +1542,27 @@ struct xhci_segment { +@@ -1542,10 +1542,18 @@ struct xhci_segment { unsigned int bounce_len; }; @@ -1594245,16 +1594076,7 @@ index 45584a278..b30e76ca0 struct urb *urb; struct xhci_segment *start_seg; union xhci_trb *first_trb; - union xhci_trb *last_trb; -+ struct xhci_segment *last_trb_seg; - struct xhci_segment *bounce_seg; - /* actual_length of the URB has already been set */ - bool urb_length_set; -+ unsigned int num_trbs; - }; - - /* xHCI command default timeout value */ -@@ -1564,13 +1574,6 @@ struct xhci_cd { +@@ -1567,13 +1575,6 @@ struct xhci_cd { union xhci_trb *cmd_trb; }; @@ -1594268,7 +1594090,7 @@ index 45584a278..b30e76ca0 enum xhci_ring_type { TYPE_CTRL = 0, TYPE_ISOC, -@@ -1923,6 +1926,7 @@ struct xhci_hcd { +@@ -1926,6 +1927,7 @@ struct xhci_hcd { struct list_head regset_list; void *dbc; @@ -1594276,7 +1594098,7 @@ index 45584a278..b30e76ca0 /* platform-specific data -- must come last */ unsigned long priv[] __aligned(sizeof(s64)); }; -@@ -1932,8 +1936,15 @@ struct xhci_driver_overrides { +@@ -1935,8 +1937,15 @@ struct xhci_driver_overrides { size_t extra_priv_size; int (*reset)(struct usb_hcd *hcd); int (*start)(struct usb_hcd *hcd); @@ -1594292,7 +1594114,7 @@ index 45584a278..b30e76ca0 int (*update_hub_device)(struct usb_hcd *hcd, struct usb_device *hdev, struct usb_tt *tt, gfp_t mem_flags); }; -@@ -2062,10 +2073,6 @@ void xhci_free_device_endpoint_resources(struct xhci_hcd *xhci, +@@ -2065,10 +2074,6 @@ void xhci_free_device_endpoint_resources(struct xhci_hcd *xhci, struct xhci_ring *xhci_dma_to_transfer_ring( struct xhci_virt_ep *ep, u64 address); @@ -1594303,7 +1594125,7 @@ index 45584a278..b30e76ca0 struct xhci_command *xhci_alloc_command(struct xhci_hcd *xhci, bool allocate_completion, gfp_t mem_flags); struct xhci_command *xhci_alloc_command_with_ctx(struct xhci_hcd *xhci, -@@ -2090,8 +2097,13 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks); +@@ -2093,8 +2098,13 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks); void xhci_shutdown(struct usb_hcd *hcd); void xhci_init_driver(struct hc_driver *drv, const struct xhci_driver_overrides *over); @@ -1594317,7 +1594139,7 @@ index 45584a278..b30e76ca0 int xhci_update_hub_device(struct usb_hcd *hcd, struct usb_device *hdev, struct usb_tt *tt, gfp_t mem_flags); int xhci_disable_slot(struct xhci_hcd *xhci, u32 slot_id); -@@ -2141,13 +2153,6 @@ int xhci_queue_reset_ep(struct xhci_hcd *xhci, struct xhci_command *cmd, +@@ -2144,13 +2154,6 @@ int xhci_queue_reset_ep(struct xhci_hcd *xhci, struct xhci_command *cmd, enum xhci_ep_reset_type reset_type); int xhci_queue_reset_device(struct xhci_hcd *xhci, struct xhci_command *cmd, u32 slot_id); @@ -1594331,7 +1594153,7 @@ index 45584a278..b30e76ca0 void xhci_cleanup_stalled_ring(struct xhci_hcd *xhci, unsigned int slot_id, unsigned int ep_index, unsigned int stream_id, struct xhci_td *td); -@@ -2208,6 +2213,53 @@ static inline struct xhci_ring *xhci_urb_to_transfer_ring(struct xhci_hcd *xhci, +@@ -2211,6 +2214,53 @@ static inline struct xhci_ring *xhci_urb_to_transfer_ring(struct xhci_hcd *xhci, urb->stream_id); }