usb: dwc_otg_310: pcd: fix out short packet handle

If there is more data in the request than we could fit into
a single hardware request, then check both of the following
conditions:

- ep->dwc_ep.xfer_len < ep->dwc_ep.total_len;
- deptsiz.b.xfersize == 0;

If ep->dwc_ep.xfer_len < ep->dwc_ep.total_len and deptsiz.b.xfersize
isn't zero, it means that we have received a short packet from
host, then we shouldn't setup transfer for next portion of
data.

This patch can fix the following issue:
Use MTP to transfer more than 4GB single file from PC to RK3368
tablet base on the follow conditions:

- Increase the default Tx/Rx buf size to 64K or more in f_mtp.c
- Set the core_params->max_transfer_size to 65535;

Without this patch, it will fail to transfer the file at the end
because the f_mtp driver is waiting for a short packet to signal
EOF for file sizes > 4 gig, but the dwc2 driver doesn't handle
the short packet.

Change-Id: I172d48d727da4b75153705ce6b60728203dd35ca
Signed-off-by: William Wu <william.wu@rock-chips.com>
This commit is contained in:
William Wu
2018-01-25 10:54:39 +08:00
committed by Tao Huang
parent b988a8dabd
commit c94093c84f

View File

@@ -2404,7 +2404,8 @@ static void complete_ep(dwc_otg_pcd_ep_t *ep)
/* Check if the whole transfer was completed,
* if no, setup transfer for next portion of data
*/
if (ep->dwc_ep.xfer_len < ep->dwc_ep.total_len) {
if (ep->dwc_ep.xfer_len < ep->dwc_ep.total_len &&
deptsiz.b.xfersize == 0) {
dwc_otg_ep_start_transfer(core_if,
&ep->dwc_ep);
} else if (ep->dwc_ep.sent_zlp) {