- /* Set the TRB length, TD size, and interrupter fields. */
- if (xhci->hci_version < 0x100) {
-- remainder = xhci_td_remainder(
-+ if (xhci->quirks & XHCI_MTK_HOST) {
-+ remainder = xhci_mtk_td_remainder_quirk(
-+ running_total, trb_buff_len, urb);
-+ } else {
-+ remainder = xhci_td_remainder(
- urb->transfer_buffer_length -
- running_total);
-+ }
- } else {
- remainder = xhci_v1_0_td_remainder(running_total,
- trb_buff_len, total_packet_count, urb,
-@@ -3467,8 +3478,14 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *
- field = TRB_TYPE(TRB_DATA);
+- maxp = GET_MAX_PACKET(usb_endpoint_maxp(&urb->ep->desc));
+- total_packet_count = DIV_ROUND_UP(td_total_len, maxp);
+-
+ /* One TRB with a zero-length data packet. */
+ if (num_trbs_left == 0 || (transferred == 0 && trb_buff_len == 0) ||
+ trb_buff_len == td_total_len)
+ return 0;