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: <stable@vger.kernel.org>
Fixes: 3d82904559 ("usb: cdnsp: cdns3 Add main part of Cadence USBSSP DRD Driver")
Signed-off-by: Pawel Laszczak <pawell@cadence.com>
Link: https://lore.kernel.org/r/20210623072728.41275-1-pawell@gli-login.cadence.com
Signed-off-by: Peter Chen <peter.chen@kernel.org>
This commit is contained in:
Pawel Laszczak 2021-06-23 09:27:28 +02:00 коммит произвёл Peter Chen
Родитель aa82f94e86
Коммит e913aada06
1 изменённых файлов: 8 добавлений и 10 удалений

Просмотреть файл

@ -1932,16 +1932,14 @@ int cdnsp_queue_bulk_tx(struct cdnsp_device *pdev, struct cdnsp_request *preq)
}
if (enqd_len + trb_buff_len >= full_len) {
if (need_zero_pkt && zero_len_trb) {
zero_len_trb = true;
} else {
if (need_zero_pkt)
zero_len_trb = !zero_len_trb;
field &= ~TRB_CHAIN;
field |= TRB_IOC;
more_trbs_coming = false;
need_zero_pkt = false;
preq->td.last_trb = ring->enqueue;
}
}
/* Only set interrupt on short packet for OUT endpoints. */
if (!preq->direction)
@ -1955,7 +1953,7 @@ int cdnsp_queue_bulk_tx(struct cdnsp_device *pdev, struct cdnsp_request *preq)
length_field = TRB_LEN(trb_buff_len) | TRB_TD_SIZE(remainder) |
TRB_INTR_TARGET(0);
cdnsp_queue_trb(pdev, ring, more_trbs_coming | need_zero_pkt,
cdnsp_queue_trb(pdev, ring, more_trbs_coming | zero_len_trb,
lower_32_bits(send_addr),
upper_32_bits(send_addr),
length_field,