From patchwork Thu Nov 23 08:19:48 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hardik Gajjar X-Patchwork-Id: 168770 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:ce62:0:b0:403:3b70:6f57 with SMTP id o2csp294084vqx; Thu, 23 Nov 2023 00:20:19 -0800 (PST) X-Google-Smtp-Source: AGHT+IGx0MiLAw1yZXqFa53u+21ip/Wm7Byi/f+qWDMpApz/PjBjEIpHrWcmJyYPTniF8s3Y+hGG X-Received: by 2002:a17:903:5c3:b0:1cc:3daa:d368 with SMTP id kf3-20020a17090305c300b001cc3daad368mr4623631plb.65.1700727619118; Thu, 23 Nov 2023 00:20:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700727619; cv=none; d=google.com; s=arc-20160816; b=H9tgXcA9dDlceiMJArIPstlSUMs2wZfWKWSuARPtDQBhRSmCiqWXoEh0bCBHs9i0fw Y8nkGnylsvU3MifGBqZiZg63lG3Bs4wvIhdlCdYcpg2/VOSvlSeT3qdy0DhbdzMN4UpL mpSJllnG7i/dVw2W2PF9haugoST3pC9M4d22pvEDlaugaxd8WCO1/HA1+J3r9uwmAKGb Itek3zOtXsjo9kMzMTIL4uUhKd02L0AjzcLFwf3kATF1eIayj69QNpqKXpTtf2DDAv1N qm1+gMdI0taJQlSmZB2shjO+8lJnb2MjR7foBDTNIaAuA9tV5FEzYee0aiu5MaYwPmJE HCPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:cc:to:from; bh=NNs2c+pQnsvPKKNE0cnT5snresYI79Is7l3Ae+1EWoM=; fh=gVLocDNh14sTr3dSorIVVq7Kj16eZOTyPyqWfwQH0Ss=; b=H3UPLIeefJ59ZVyaK6E/TVkNX8r80s9AUAOTiR19OLQ25RTHCGYZC/hULJcuBzAdgh u7rEQPTJq736uzASgkLbLGqF3bRsLf7gMGzXNpGx7ky1Md3Mh9s2c7tGRciF2Amc8Qwz jik/RepujALBHIfo+VPI+fXFd5vLbLlwZaKWb5+DdfjSYiQP2mYTB2veSKq0ruIP4WJd lN7+pRJUqPAiDODR4OeFPfQ5IW9wWVkJAHV6WFiCS3xJX4m3vT24BtVC/IN1DMlkNi5d 8YVvMttn69H92m990/MrMQWhfv7p2XrLAstUCC+RgYHnbZQ/zexakmZgN6Xiy+yBZjRU 2dww== 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:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id k3-20020a170902694300b001c9cc3a07c3si661520plt.280.2023.11.23.00.20.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 23 Nov 2023 00:20:19 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 74F738076D33; Thu, 23 Nov 2023 00:20:13 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232012AbjKWIUE (ORCPT + 99 others); Thu, 23 Nov 2023 03:20:04 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42136 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229543AbjKWIUB (ORCPT ); Thu, 23 Nov 2023 03:20:01 -0500 Received: from hi1smtp01.de.adit-jv.com (smtp1.de.adit-jv.com [93.241.18.167]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 81DC9B9; Thu, 23 Nov 2023 00:20:07 -0800 (PST) Received: from hi2exch02.adit-jv.com (hi2exch02.adit-jv.com [10.72.92.28]) by hi1smtp01.de.adit-jv.com (Postfix) with ESMTP id 825C2520165; Thu, 23 Nov 2023 09:20:05 +0100 (CET) Received: from vmlxhi-118.adit-jv.com (10.72.93.77) by hi2exch02.adit-jv.com (10.72.92.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.1.2507.34; Thu, 23 Nov 2023 09:20:05 +0100 From: Hardik Gajjar To: , , CC: , , , , , , , , Subject: [PATCH] usb: hubs: Decrease IN-endpoint poll interval for Microchip USB491x hub Date: Thu, 23 Nov 2023 09:19:48 +0100 Message-ID: <20231123081948.58776-1-hgajjar@de.adit-jv.com> X-Mailer: git-send-email 2.17.1 MIME-Version: 1.0 X-Originating-IP: [10.72.93.77] X-ClientProxiedBy: hi2exch02.adit-jv.com (10.72.92.28) To hi2exch02.adit-jv.com (10.72.92.28) 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 pete.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 (pete.vger.email [0.0.0.0]); Thu, 23 Nov 2023 00:20:13 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1783342164339737815 X-GMAIL-MSGID: 1783342164339737815 There is a potential delay in announcing downstream USB bus activity to Linux USB drivers due to the default interrupt endpoint having a poll interval of 256ms. Microchip has recommended ignoring the device descriptor and reducing that value to 32ms, as it was too late to modify it in silicon. This patch aims to speed up the USB enumeration process, facilitating the successful completion of Apple CarPlay certifications and enhancing user experience when utilizing USB devices through the Microchip Multihost Hub. A new quirk, USB_QUIRK_REDUCE_FRAME_INTR_BINTERVAL, accelerates the notification process by changing the Endpoint interrupt poll interval from 256ms to 32ms. Signed-off-by: Hardik Gajjar --- Documentation/admin-guide/kernel-parameters.txt | 4 ++++ drivers/usb/core/config.c | 8 ++++++++ drivers/usb/core/quirks.c | 11 +++++++++++ include/linux/usb/quirks.h | 5 +++++ 4 files changed, 28 insertions(+) diff --git a/Documentation/admin-guide/kernel-parameters.txt b/Documentation/admin-guide/kernel-parameters.txt index 65731b060e3f..6b0a66f0e6bf 100644 --- a/Documentation/admin-guide/kernel-parameters.txt +++ b/Documentation/admin-guide/kernel-parameters.txt @@ -6908,6 +6908,10 @@ pause after every control message); o = USB_QUIRK_HUB_SLOW_RESET (Hub needs extra delay after resetting its port); + p = USB_QUIRK_REDUCE_FRAME_INTR_BINTERVAL (Set + bInterval to a Maximum of 9 to Reduce + default Poll Rate from 256 ms to + 32 ms); Example: quirks=0781:5580:bk,0a5c:5834:gij usbhid.mousepoll= diff --git a/drivers/usb/core/config.c b/drivers/usb/core/config.c index b19e38d5fd10..4edbb5922872 100644 --- a/drivers/usb/core/config.c +++ b/drivers/usb/core/config.c @@ -355,6 +355,14 @@ static int usb_parse_endpoint(struct device *ddev, int cfgno, n = clamp(fls(d->bInterval), i, j); i = j = n; } + + /* + * This quirk limits bInterval to 9 (32 ms). + */ + if (udev->quirks & USB_QUIRK_REDUCE_FRAME_INTR_BINTERVAL) { + n = clamp(fls(d->bInterval), i, min(j, 9)); + i = j = n; + } break; default: /* USB_SPEED_FULL or _LOW */ /* diff --git a/drivers/usb/core/quirks.c b/drivers/usb/core/quirks.c index 15e9bd180a1d..243ae5981cc8 100644 --- a/drivers/usb/core/quirks.c +++ b/drivers/usb/core/quirks.c @@ -138,6 +138,9 @@ static int quirks_param_set(const char *value, const struct kernel_param *kp) case 'o': flags |= USB_QUIRK_HUB_SLOW_RESET; break; + case 'p': + flags |= USB_QUIRK_REDUCE_FRAME_INTR_BINTERVAL; + break; /* Ignore unrecognized flag characters */ } } @@ -211,6 +214,14 @@ static const struct usb_device_id usb_quirk_list[] = { /* USB3503 */ { USB_DEVICE(0x0424, 0x3503), .driver_info = USB_QUIRK_RESET_RESUME }, + /* USB491x hubs need 32ms instead of 256ms bInterval */ + { USB_DEVICE(0x0424, 0x4913), .driver_info = + USB_QUIRK_REDUCE_FRAME_INTR_BINTERVAL}, + { USB_DEVICE(0x0424, 0x4914), .driver_info = + USB_QUIRK_REDUCE_FRAME_INTR_BINTERVAL}, + { USB_DEVICE(0x0424, 0x4915), .driver_info = + USB_QUIRK_REDUCE_FRAME_INTR_BINTERVAL}, + /* Microsoft Wireless Laser Mouse 6000 Receiver */ { USB_DEVICE(0x045e, 0x00e1), .driver_info = USB_QUIRK_RESET_RESUME }, diff --git a/include/linux/usb/quirks.h b/include/linux/usb/quirks.h index eeb7c2157c72..8fbcca4432bf 100644 --- a/include/linux/usb/quirks.h +++ b/include/linux/usb/quirks.h @@ -72,4 +72,9 @@ /* device has endpoints that should be ignored */ #define USB_QUIRK_ENDPOINT_IGNORE BIT(15) +/* + * Limits the bInterval value to 9 instead of default value 16 + */ +#define USB_QUIRK_REDUCE_FRAME_INTR_BINTERVAL BIT(16) + #endif /* __LINUX_USB_QUIRKS_H */