usb: gadget: fastboot: fix downloading files of wMaxPacketSize bytes
File transfers with sizes of exact multiples of wMaxPacketSize up to
EP_BUFFER_SIZE do not work. For a typical scenario that would be files
of 512, 1024 ... 3584 bytes.

This happens because we unconditionally put EP_BUFFER_SIZE into the
initial request length. For non wMaxPacketSize aligned lengths this
works well because the transfer is completed with a short packet.
For wMaxPacketSize aligned lengths there is no short packet though,
so the transfer never completes. Instead we have to put the file
size into the initial request length.

Some controllers like the DWC3 do not work when the request length is
not aligned to wMaxPacketSize, so we align up to wMaxPacketSize like
done in U-Boot.

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Reported-by: Gavin Schenk <g.schenk@eckelmann.de>
Tested-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
1 parent d5d470b commit 0d9869010cbd727aa0ab48fbad0259b6590094b4
@Sascha Hauer Sascha Hauer authored on 1 Oct 2018
Showing 1 changed file
View
drivers/usb/gadget/f_fastboot.c