diff options
author | Julius Werner <jwerner@chromium.org> | 2015-08-17 18:47:18 -0700 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2015-08-28 06:46:19 +0000 |
commit | e8a8a00342b8791b3c29827b33139aa5722b3f61 (patch) | |
tree | 0ac65893db60c808b59aa4b30da7014a4df7b4ad /payloads | |
parent | 4bfa29e94788df12c5845adeb8d5fb915db89541 (diff) | |
download | coreboot-e8a8a00342b8791b3c29827b33139aa5722b3f61.tar.xz |
libpayload: usb: dwc2: Always return 'size' transferred bytes for OUT
Seems like our transferred bytes calculation for OUT transfers that span
more than one packet had been wrong, and we just got lucky that we never
noticed it before. The HCTSIZ.xfersize register field we're reading only
counts bytes transferred by the last packet we sent.
OUT endpoints cannot have short transfers -- every transfer should
either finish all bytes we wanted to send or end in a proper error
condition. Therefore, in the absence of an error we can just conclude
that all input bytes have been transferred.
BRANCH=veyron
BUG=chrome-os-partner:35525
TEST=SMSC95xx netboot on Jerry now works.
Change-Id: I57349e697c428df6b56e2f6f62e87652ef1e7a94
Signed-off-by: Patrick Georgi <patrick@georgi-clan.de>
Original-Commit-Id: 0abee13b6d89dec12c6fff581ece1836393c7703
Original-Change-Id: Id0a127e6919f5786ba05218277705dda1067b8c3
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/293956
Original-Reviewed-by: yunzhi li <lyz@rock-chips.com>
Original-Reviewed-by: David Hendricks <dhendrix@chromium.org>
Reviewed-on: http://review.coreboot.org/11404
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'payloads')
-rw-r--r-- | payloads/libpayload/drivers/usb/dwc2.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/payloads/libpayload/drivers/usb/dwc2.c b/payloads/libpayload/drivers/usb/dwc2.c index 9d19bc6666..30e00fba64 100644 --- a/payloads/libpayload/drivers/usb/dwc2.c +++ b/payloads/libpayload/drivers/usb/dwc2.c @@ -283,7 +283,7 @@ dwc2_do_xfer(endpoint_t *ep, int size, int pid, ep_dir_t dir, if (ret >= 0) { /* Calculate actual transferred length */ - transferred = (dir == EPDIR_IN) ? inpkt_length - ret : ret; + transferred = (dir == EPDIR_IN) ? inpkt_length - ret : size; if (do_copy && (dir == EPDIR_IN)) memcpy(data_buf, aligned_buf, transferred); |