public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
From: Mark Kettenis <mark.kettenis@xs4all.nl>
To: Janne Grunau <j@jannau.net>
Cc: u-boot@lists.denx.de, marex@denx.de, thomas@glanzmann.de
Subject: Re: [PATCH 1/1] usb: request only 8 bytes for USB_SPEED_FULL bMaxPacketSize0 discovery
Date: Mon, 29 Aug 2022 09:07:39 +0200 (CEST)	[thread overview]
Message-ID: <d3ceaccfa76970db@bloch.sibelius.xs4all.nl> (raw)
In-Reply-To: <20220829063127.30353-1-j@jannau.net> (message from Janne Grunau on Mon, 29 Aug 2022 08:31:27 +0200)

> From: Janne Grunau <j@jannau.net>
> Date: Mon, 29 Aug 2022 08:31:27 +0200
> 
> Fixes probing of various keyboards with DWC3 as integrated into Apple
> silicon SoCs. The problem appears to be requesting more data than the
> devices's bMaxPacketSize0 of 8. Older Logitech unifying receivers
> (bcdDevice 12.03 or 12.10) are for eaxample affected.

I somehow suspect this is a more general issue that doesn't really
depend on the particular USB host controller that is in use, but
rather on the particular USB device.  Would be interesting if someone
could test this on other hardware.  Probably the easiest way to fix
this is to find a keyboard that currently doesn't work with u-boot and
see whether this fixes it when used on something like a Raspberry Pi 4
(which has a PCI XHCI controller).

Don't think this should hold up this fix though.

> Signed-off-by: Janne Grunau <j@jannau.net>
> Tested-by: Thomas Glanzmann <thomas@glanzmann.de>
> ---
>  common/usb.c | 8 +++++---
>  1 file changed, 5 insertions(+), 3 deletions(-)
> 
> diff --git a/common/usb.c b/common/usb.c
> index 6fcf1e8428e9..48a310e8599d 100644
> --- a/common/usb.c
> +++ b/common/usb.c
> @@ -993,10 +993,12 @@ static int usb_setup_descriptor(struct usb_device *dev, bool do_read)
>  		 *
>  		 * At least the DWC2 controller needs to be programmed with
>  		 * the number of packets in addition to the number of bytes.
> -		 * A request for 64 bytes of data with the maxpacket guessed
> -		 * as 64 (above) yields a request for 1 packet.
> +		 * Requesting more than 8 bytes causes probing errors on the
> +		 * DWC3 controller integrated into Apple silicon SoCs with
> +		 * devices with bMaxPacketSize0 of 8. So limit the read request
> +		 * to the used size of 8 bytes.
>  		 */
> -		err = get_descriptor_len(dev, 64, 8);
> +		err = get_descriptor_len(dev, 8, 8);
>  		if (err)
>  			return err;
>  	}
> -- 
> 2.35.1
> 
> 

  reply	other threads:[~2022-08-29  7:07 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-29  6:31 [PATCH 1/1] usb: request only 8 bytes for USB_SPEED_FULL bMaxPacketSize0 discovery Janne Grunau
2022-08-29  7:07 ` Mark Kettenis [this message]
2022-09-25 23:52 ` Marek Vasut
2022-09-26  5:42   ` Janne Grunau
2022-09-26  7:34   ` Thomas Glanzmann
2022-09-30  2:54     ` Marek Vasut

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d3ceaccfa76970db@bloch.sibelius.xs4all.nl \
    --to=mark.kettenis@xs4all.nl \
    --cc=j@jannau.net \
    --cc=marex@denx.de \
    --cc=thomas@glanzmann.de \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox