aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/host/xhci-ring.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/usb/host/xhci-ring.c')
-rw-r--r--drivers/usb/host/xhci-ring.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/drivers/usb/host/xhci-ring.c b/drivers/usb/host/xhci-ring.c
index 02d81985c454..d5b952997423 100644
--- a/drivers/usb/host/xhci-ring.c
+++ b/drivers/usb/host/xhci-ring.c
@@ -1285,6 +1285,7 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
1285 /* Queue the first TRB, even if it's zero-length */ 1285 /* Queue the first TRB, even if it's zero-length */
1286 do { 1286 do {
1287 u32 field = 0; 1287 u32 field = 0;
1288 u32 length_field = 0;
1288 1289
1289 /* Don't change the cycle bit of the first TRB until later */ 1290 /* Don't change the cycle bit of the first TRB until later */
1290 if (first_trb) 1291 if (first_trb)
@@ -1314,10 +1315,13 @@ static int queue_bulk_sg_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
1314 (unsigned int) (addr + TRB_MAX_BUFF_SIZE) & ~(TRB_MAX_BUFF_SIZE - 1), 1315 (unsigned int) (addr + TRB_MAX_BUFF_SIZE) & ~(TRB_MAX_BUFF_SIZE - 1),
1315 (unsigned int) addr + trb_buff_len); 1316 (unsigned int) addr + trb_buff_len);
1316 } 1317 }
1318 length_field = TRB_LEN(trb_buff_len) |
1319 TD_REMAINDER(urb->transfer_buffer_length - running_total) |
1320 TRB_INTR_TARGET(0);
1317 queue_trb(xhci, ep_ring, false, 1321 queue_trb(xhci, ep_ring, false,
1318 (u32) addr, 1322 (u32) addr,
1319 (u32) ((u64) addr >> 32), 1323 (u32) ((u64) addr >> 32),
1320 TRB_LEN(trb_buff_len) | TRB_INTR_TARGET(0), 1324 length_field,
1321 /* We always want to know if the TRB was short, 1325 /* We always want to know if the TRB was short,
1322 * or we won't get an event when it completes. 1326 * or we won't get an event when it completes.
1323 * (Unless we use event data TRBs, which are a 1327 * (Unless we use event data TRBs, which are a
@@ -1365,7 +1369,7 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
1365 struct xhci_generic_trb *start_trb; 1369 struct xhci_generic_trb *start_trb;
1366 bool first_trb; 1370 bool first_trb;
1367 int start_cycle; 1371 int start_cycle;
1368 u32 field; 1372 u32 field, length_field;
1369 1373
1370 int running_total, trb_buff_len, ret; 1374 int running_total, trb_buff_len, ret;
1371 u64 addr; 1375 u64 addr;
@@ -1443,10 +1447,13 @@ int xhci_queue_bulk_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
1443 td->last_trb = ep_ring->enqueue; 1447 td->last_trb = ep_ring->enqueue;
1444 field |= TRB_IOC; 1448 field |= TRB_IOC;
1445 } 1449 }
1450 length_field = TRB_LEN(trb_buff_len) |
1451 TD_REMAINDER(urb->transfer_buffer_length - running_total) |
1452 TRB_INTR_TARGET(0);
1446 queue_trb(xhci, ep_ring, false, 1453 queue_trb(xhci, ep_ring, false,
1447 (u32) addr, 1454 (u32) addr,
1448 (u32) ((u64) addr >> 32), 1455 (u32) ((u64) addr >> 32),
1449 TRB_LEN(trb_buff_len) | TRB_INTR_TARGET(0), 1456 length_field,
1450 /* We always want to know if the TRB was short, 1457 /* We always want to know if the TRB was short,
1451 * or we won't get an event when it completes. 1458 * or we won't get an event when it completes.
1452 * (Unless we use event data TRBs, which are a 1459 * (Unless we use event data TRBs, which are a
@@ -1478,7 +1485,7 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
1478 struct usb_ctrlrequest *setup; 1485 struct usb_ctrlrequest *setup;
1479 struct xhci_generic_trb *start_trb; 1486 struct xhci_generic_trb *start_trb;
1480 int start_cycle; 1487 int start_cycle;
1481 u32 field; 1488 u32 field, length_field;
1482 struct xhci_td *td; 1489 struct xhci_td *td;
1483 1490
1484 ep_ring = xhci->devs[slot_id]->ep_rings[ep_index]; 1491 ep_ring = xhci->devs[slot_id]->ep_rings[ep_index];
@@ -1528,13 +1535,16 @@ int xhci_queue_ctrl_tx(struct xhci_hcd *xhci, gfp_t mem_flags,
1528 1535
1529 /* If there's data, queue data TRBs */ 1536 /* If there's data, queue data TRBs */
1530 field = 0; 1537 field = 0;
1538 length_field = TRB_LEN(urb->transfer_buffer_length) |
1539 TD_REMAINDER(urb->transfer_buffer_length) |
1540 TRB_INTR_TARGET(0);
1531 if (urb->transfer_buffer_length > 0) { 1541 if (urb->transfer_buffer_length > 0) {
1532 if (setup->bRequestType & USB_DIR_IN) 1542 if (setup->bRequestType & USB_DIR_IN)
1533 field |= TRB_DIR_IN; 1543 field |= TRB_DIR_IN;
1534 queue_trb(xhci, ep_ring, false, 1544 queue_trb(xhci, ep_ring, false,
1535 lower_32_bits(urb->transfer_dma), 1545 lower_32_bits(urb->transfer_dma),
1536 upper_32_bits(urb->transfer_dma), 1546 upper_32_bits(urb->transfer_dma),
1537 TRB_LEN(urb->transfer_buffer_length) | TRB_INTR_TARGET(0), 1547 length_field,
1538 /* Event on short tx */ 1548 /* Event on short tx */
1539 field | TRB_ISP | TRB_TYPE(TRB_DATA) | ep_ring->cycle_state); 1549 field | TRB_ISP | TRB_TYPE(TRB_DATA) | ep_ring->cycle_state);
1540 } 1550 }