[PATCH V2 16/17] usb: gadget: fastboot: use correct max packet size

Maxime Ripard maxime at cerno.tech
Wed Jun 23 12:15:50 CEST 2021


Hi,

Adding Andre, Lukasz and Marek in Cc

On Mon, Jan 25, 2021 at 09:43:59PM +0800, peng.fan at nxp.com wrote:
> From: Li Jun <jun.li at nxp.com>
> 
> Change to use wMaxPacketSize of current speed EP desc for request
> length wrap up.
> 
> Reviewed-by: Peter Chen <peter.chen at nxp.com>
> Signed-off-by: Li Jun <jun.li at nxp.com>
> Signed-off-by: Peng Fan <peng.fan at nxp.com>
> ---
>  drivers/usb/gadget/f_fastboot.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/gadget/f_fastboot.c b/drivers/usb/gadget/f_fastboot.c
> index c2abdd66a8..2ef75a1388 100644
> --- a/drivers/usb/gadget/f_fastboot.c
> +++ b/drivers/usb/gadget/f_fastboot.c
> @@ -427,7 +427,7 @@ static unsigned int rx_bytes_expected(struct usb_ep *ep)
>  {
>  	int rx_remain = fastboot_data_remaining();
>  	unsigned int rem;
> -	unsigned int maxpacket = ep->maxpacket;
> +	unsigned int maxpacket = usb_endpoint_maxp(ep->desc);

Unfortunately this introduces a regression on sunxi, where a fastboot
flash command will stall on the download part forever.

Interestingly, this occurs on the last packet of the download and only
if the packet size is a power of two, and over 512.

This can be easily tested using

dd if=/dev/random of=test-custom.bin bs=1 count=512
fastboot flash uboot test-custom.bin

However, 511, 513 (or any other size, really) will work just fine.

Maxime
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 228 bytes
Desc: not available
URL: <https://lists.denx.de/pipermail/u-boot/attachments/20210623/a61cf868/attachment.sig>


More information about the U-Boot mailing list