From patchwork Mon Aug 29 06:31:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Janne Grunau X-Patchwork-Id: 1671314 X-Patchwork-Delegate: marek.vasut@gmail.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (P-384)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4MGLF74JJbz1yg7 for ; Mon, 29 Aug 2022 16:31:39 +1000 (AEST) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 7393D841D7; Mon, 29 Aug 2022 08:31:34 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=jannau.net Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: by phobos.denx.de (Postfix, from userid 109) id 6A4398456E; Mon, 29 Aug 2022 08:31:33 +0200 (CEST) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,SPF_HELO_NONE, SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.2 Received: from soltyk.jannau.net (soltyk.jannau.net [144.76.91.90]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 2A33C83AD1 for ; Mon, 29 Aug 2022 08:31:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=jannau.net Authentication-Results: phobos.denx.de; spf=none smtp.mailfrom=j@jannau.net Received: from coburn.home.jannau.net (p54acc2ba.dip0.t-ipconnect.de [84.172.194.186]) by soltyk.jannau.net (Postfix) with ESMTPSA id B093626EF07; Mon, 29 Aug 2022 08:31:30 +0200 (CEST) From: Janne Grunau To: u-boot@lists.denx.de Cc: Marek Vasut , Thomas Glanzmann Subject: [PATCH 1/1] usb: request only 8 bytes for USB_SPEED_FULL bMaxPacketSize0 discovery Date: Mon, 29 Aug 2022 08:31:27 +0200 Message-Id: <20220829063127.30353-1-j@jannau.net> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean 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. Signed-off-by: Janne Grunau Tested-by: Thomas Glanzmann --- 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; }