Received: by 2002:a05:7412:b10a:b0:f3:1519:9f41 with SMTP id az10csp443273rdb; Thu, 30 Nov 2023 08:40:51 -0800 (PST) X-Google-Smtp-Source: AGHT+IEyLalufCjQO/22ySTXD1KPAw6m9tA1Gom61HL+uE6K0PTFbuGvQJXiD6rR7gMWhFn5ALLL X-Received: by 2002:a17:90b:38d2:b0:285:b77d:619a with SMTP id nn18-20020a17090b38d200b00285b77d619amr16272201pjb.33.1701362451443; Thu, 30 Nov 2023 08:40:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701362451; cv=none; d=google.com; s=arc-20160816; b=G4MFM7ZqEqHxH9jLx444Z45nUod8VIk8Bw9eESME+nRG0WCuprJZfCvUmU+iNa/u94 LXAWY/9uSxbf0iqUOZk8WPLLsLuzRQQfgHINdLPWCzssdXBPmOAABZb48kDwsV7XCT9v UHZE5nM74pGf7WEaxwFqbna/H2fh7bKEPrYW6Y8yyDIjml3GVc+L9vdhkW0yIfxg+s6T dzYn8ygPnf3Q2fkG3THYhxUux2SK5kuG/rXhmkfGrOJvTIHRRpJxDskIMfCHte+pRunl vIM8uVBsTjXmBayByYHlbUVkqFMy/eni+xL1LZtptHTKWoAFxvyn5wBvU2UxdmPDcxnz SezQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=Hkv/CR0yMe8snNrnIpWLStOgeDOugpn88S116sh6t5E=; fh=PRNp//tzEkV2SHUN491UjbD63h48NsGOvebFpKwiYDc=; b=BXRteq8UxJ/JHDqRUJLpUz41ZnOzrgHZEVBRXPZkf3pKs5rHpVsM/LLM+m5I234kuq bH4rFDk4055bYjSZnqCQM+aP6wrka6XQEjGwZtKh1g2X/4BDNNeeTJKGU6erzxuc4aXj 8LvGB9vx2gxIIoSfDid9sl2wai3AbJNzN4LXb1JRNp5Kg2b6XxNlRhhNt4sj/6ML43vQ yrP1lguZJi7F3mPz2d0WcqMjbJ9HNVjq12xcQBw6uOE+9JkyJJM5AdcUmIaUy0xAOqo7 IuZtmUMA3WPrllYHwOQv7WOOnwwfd775TtU/rHhalivCmThxwjSyC01vdsbgXlytuJyp r3Bw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Return-Path: Received: from howler.vger.email (howler.vger.email. [2620:137:e000::3:4]) by mx.google.com with ESMTPS id o7-20020a17090a4b4700b0028651d04183si181348pjl.144.2023.11.30.08.40.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 30 Nov 2023 08:40:51 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) client-ip=2620:137:e000::3:4; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:4 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=harvard.edu Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id AB8A6809B9D4; Thu, 30 Nov 2023 08:40:36 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231919AbjK3QkQ (ORCPT + 99 others); Thu, 30 Nov 2023 11:40:16 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40700 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229483AbjK3QkO (ORCPT ); Thu, 30 Nov 2023 11:40:14 -0500 Received: from netrider.rowland.org (netrider.rowland.org [192.131.102.5]) by lindbergh.monkeyblade.net (Postfix) with SMTP id 529F710DB for ; Thu, 30 Nov 2023 08:40:20 -0800 (PST) Received: (qmail 252396 invoked by uid 1000); 30 Nov 2023 11:40:19 -0500 Date: Thu, 30 Nov 2023 11:40:19 -0500 From: Alan Stern To: Hardik Gajjar Cc: gregkh@linuxfoundation.org, corbet@lwn.net, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, erosca@de.adit-jv.com, tj@kernel.org, paulmck@kernel.org, Martin.Mueller5@de.bosch.com Subject: Re: [PATCH v2] usb: hub: Add quirk to decrease IN-ep poll interval for Microchip USB491x hub Message-ID: <48f43dd1-15f3-4eda-b823-2bd8ffd27b6b@rowland.harvard.edu> References: <20231130084855.119937-1-hgajjar@de.adit-jv.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231130084855.119937-1-hgajjar@de.adit-jv.com> X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Thu, 30 Nov 2023 08:40:37 -0800 (PST) On Thu, Nov 30, 2023 at 09:48:55AM +0100, Hardik Gajjar wrote: > There is a potential delay in notifying Linux USB drivers of downstream > USB bus activity when connecting a high-speed or superSpeed device via the > Microchip USB491x hub. This delay is due to the fixed bInterval value of > 12 in the silicon of the Microchip USB491x hub. > > Microchip requested to ignore the device descriptor and decrease that > value to 9 as it was too late to modify that in silicon. > > This patch speeds up the USB enummeration process that helps to pass > Apple Carplay certifications and improve the User experience when utilizing > the USB device via Microchip Multihost USB491x Hub. > > A new hub quirk HUB_QUIRK_REDUCE_FRAME_INTR_BINTERVAL speeds up > the notification process for Microchip USB491x hub by limiting > the maximum bInterval value to 9. > > Signed-off-by: Hardik Gajjar > --- > changes since version 1: > - Move implementation from config.c and quirk.c to hub.c as this is hub > specific changes. > - Improve commit message. > - Link to v1 - https://lore.kernel.org/all/20231123081948.58776-1-hgajjar@de.adit-jv.com/ > --- > drivers/usb/core/hub.c | 27 +++++++++++++++++++++++++++ > 1 file changed, 27 insertions(+) > > diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c > index b4584a0cd484..3d26d942fcae 100644 > --- a/drivers/usb/core/hub.c > +++ b/drivers/usb/core/hub.c > @@ -47,12 +47,18 @@ > #define USB_VENDOR_TEXAS_INSTRUMENTS 0x0451 > #define USB_PRODUCT_TUSB8041_USB3 0x8140 > #define USB_PRODUCT_TUSB8041_USB2 0x8142 > +#define USB_VENDOR_MICROCHIP 0x0424 > +#define USB_PRODUCT_USB4913 0x4913 > +#define USB_PRODUCT_USB4914 0x4914 > +#define USB_PRODUCT_USB4915 0x4915 > #define HUB_QUIRK_CHECK_PORT_AUTOSUSPEND 0x01 > #define HUB_QUIRK_DISABLE_AUTOSUSPEND 0x02 > +#define HUB_QUIRK_REDUCE_FRAME_INTR_BINTERVAL 0x08 Why not use 0x04, the next available bit? > > #define USB_TP_TRANSMISSION_DELAY 40 /* ns */ > #define USB_TP_TRANSMISSION_DELAY_MAX 65535 /* ns */ > #define USB_PING_RESPONSE_TIME 400 /* ns */ > +#define USB_REDUCE_FRAME_INTR_BINTERVAL 9 > > /* Protect struct usb_device->state and ->children members > * Note: Both are also protected by ->dev.sem, except that ->state can > @@ -1927,6 +1933,12 @@ static int hub_probe(struct usb_interface *intf, const struct usb_device_id *id) > usb_autopm_get_interface_no_resume(intf); > } > > + if ((id->driver_info & HUB_QUIRK_REDUCE_FRAME_INTR_BINTERVAL) && > + desc->endpoint[0].desc.bInterval > USB_REDUCE_FRAME_INTR_BINTERVAL) { > + desc->endpoint[0].desc.bInterval = > + USB_REDUCE_FRAME_INTR_BINTERVAL; As I mentioned in an earlier email, you need to do: /* Tell the HCD about the interrupt ep's new bInterval */ usb_set_interface(hdev, 0, 0); here. Everything else looks okay (and much better than before). Alan Stern > + } > + > if (hub_configure(hub, &desc->endpoint[0].desc) >= 0) { > onboard_hub_create_pdevs(hdev, &hub->onboard_hub_devs); > > @@ -5918,6 +5930,21 @@ static const struct usb_device_id hub_id_table[] = { > .idVendor = USB_VENDOR_TEXAS_INSTRUMENTS, > .idProduct = USB_PRODUCT_TUSB8041_USB3, > .driver_info = HUB_QUIRK_DISABLE_AUTOSUSPEND}, > + { .match_flags = USB_DEVICE_ID_MATCH_VENDOR > + | USB_DEVICE_ID_MATCH_PRODUCT, > + .idVendor = USB_VENDOR_MICROCHIP, > + .idProduct = USB_PRODUCT_USB4913, > + .driver_info = HUB_QUIRK_REDUCE_FRAME_INTR_BINTERVAL}, > + { .match_flags = USB_DEVICE_ID_MATCH_VENDOR > + | USB_DEVICE_ID_MATCH_PRODUCT, > + .idVendor = USB_VENDOR_MICROCHIP, > + .idProduct = USB_PRODUCT_USB4914, > + .driver_info = HUB_QUIRK_REDUCE_FRAME_INTR_BINTERVAL}, > + { .match_flags = USB_DEVICE_ID_MATCH_VENDOR > + | USB_DEVICE_ID_MATCH_PRODUCT, > + .idVendor = USB_VENDOR_MICROCHIP, > + .idProduct = USB_PRODUCT_USB4915, > + .driver_info = HUB_QUIRK_REDUCE_FRAME_INTR_BINTERVAL}, > { .match_flags = USB_DEVICE_ID_MATCH_DEV_CLASS, > .bDeviceClass = USB_CLASS_HUB}, > { .match_flags = USB_DEVICE_ID_MATCH_INT_CLASS, > -- > 2.17.1 >