Skip to content

Commit e913aad

Browse files
pawellcdnsPeter Chen
authored andcommitted
usb: cdnsp: Fixed issue with ZLP
The condition "if (need_zero_pkt && zero_len_trb)" was always false and it caused that TRB for ZLP was not prepared. Fix causes that after preparing last TRB in TD, the driver prepares additional TD with ZLP when a ZLP is required. Cc: <[email protected]> Fixes: 3d82904 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver") Signed-off-by: Pawel Laszczak <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Peter Chen <[email protected]>
1 parent aa82f94 commit e913aad

File tree

1 file changed

+8
-10
lines changed

1 file changed

+8
-10
lines changed

drivers/usb/cdns3/cdnsp-ring.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1932,15 +1932,13 @@ int cdnsp_queue_bulk_tx(struct cdnsp_device *pdev, struct cdnsp_request *preq)
19321932
}
19331933

19341934
if (enqd_len + trb_buff_len >= full_len) {
1935-
if (need_zero_pkt && zero_len_trb) {
1936-
zero_len_trb = true;
1937-
} else {
1938-
field &= ~TRB_CHAIN;
1939-
field |= TRB_IOC;
1940-
more_trbs_coming = false;
1941-
need_zero_pkt = false;
1942-
preq->td.last_trb = ring->enqueue;
1943-
}
1935+
if (need_zero_pkt)
1936+
zero_len_trb = !zero_len_trb;
1937+
1938+
field &= ~TRB_CHAIN;
1939+
field |= TRB_IOC;
1940+
more_trbs_coming = false;
1941+
preq->td.last_trb = ring->enqueue;
19441942
}
19451943

19461944
/* Only set interrupt on short packet for OUT endpoints. */
@@ -1955,7 +1953,7 @@ int cdnsp_queue_bulk_tx(struct cdnsp_device *pdev, struct cdnsp_request *preq)
19551953
length_field = TRB_LEN(trb_buff_len) | TRB_TD_SIZE(remainder) |
19561954
TRB_INTR_TARGET(0);
19571955

1958-
cdnsp_queue_trb(pdev, ring, more_trbs_coming | need_zero_pkt,
1956+
cdnsp_queue_trb(pdev, ring, more_trbs_coming | zero_len_trb,
19591957
lower_32_bits(send_addr),
19601958
upper_32_bits(send_addr),
19611959
length_field,

0 commit comments

Comments
 (0)