Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp4870412rdb; Tue, 12 Dec 2023 11:32:14 -0800 (PST) X-Google-Smtp-Source: AGHT+IFsi4ma4/olhs6bOpQuL4s4mR3cJesHqShfAOQ26AaTLwISKbIyvnMrj5neTnsUC7yR3o4c X-Received: by 2002:a17:90a:d994:b0:286:6cc1:5fd0 with SMTP id d20-20020a17090ad99400b002866cc15fd0mr3268715pjv.83.1702409534509; Tue, 12 Dec 2023 11:32:14 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702409534; cv=none; d=google.com; s=arc-20160816; b=P0IGurzyA/4JZBr7CfTEJKQsPZRqqC36827fltFC8l+pqaoVvH1lXh0h3V59F3c001 RjPZyxwUm88P2YoE7b3CzPH0dQT3o8ECGlbZgLG0t0KZN24hzTsD1qdkHT2ANLWzyADE H9B0c7vH8cZ8Ia2gs0FqHEJeGxQC4LLeF5zQkOG/ig4FoTbOqMrCQ9dDuE+UEzhROF/3 tUhk0CfwqplAU/iliF+RHxqh/S1MkxBGKmJDyLpPcSPX5rT9fch8ndKzOOM5+1wQJ6t6 v9N9YpG9POEvzO8vk4q6kHBUdGdo8Bldc9nFWeT793iPD/8YEhsPihyBzKRd8laO+Ak6 JBZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=uxuHWwvq23/rsofLGqV/BwCbxX5wvQJxpg4jLTMgYEs=; fh=DAUs0/7GsuGTl3J1yC3rv6inD4YaOJpE8jLF5sOqKl0=; b=W9eJ1EEy9vZ8TpemQljb2ROqmO2di/I1XX6R3DWSQti/FEZcQETzbHeh8FWwbNmfMk FFaaxKNjZkdDcG0wgcAqHO6gwgC1XcJesEglcH7oafH+HyBB/m/9appwl84LJLS3/oVQ 9HqasE5kpl8xpmAgN7jRv75oTOERX+I3g1HJ3j12oObyI2zT0k3uAnyt/sZqqj9+RhRq dtgpkW08V3bkEk3Q+5SKethppUA8+V00F8fmaJ8azRWL4eCp3jBCACQborubkA4KqMZ5 qWbm8OSXuGcjXi5VZK1TabWMkFUG3U2sOve9qMHoPYcp34bKXW2JrHFaODgydiEycLOU 8pSg== 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:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=sntech.de Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id q10-20020a17090a9f4a00b00286f3ca408dsi9648152pjv.132.2023.12.12.11.32.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 12 Dec 2023 11:32:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=sntech.de Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id DD7C580A64DE; Tue, 12 Dec 2023 11:32:11 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231609AbjLLTbx (ORCPT + 99 others); Tue, 12 Dec 2023 14:31:53 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233299AbjLLTbv (ORCPT ); Tue, 12 Dec 2023 14:31:51 -0500 Received: from gloria.sntech.de (gloria.sntech.de [185.11.138.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AA127106; Tue, 12 Dec 2023 11:31:52 -0800 (PST) Received: from [194.95.143.137] (helo=phil.localnet) by gloria.sntech.de with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rD8Tp-0005mP-OM; Tue, 12 Dec 2023 20:31:45 +0100 From: Heiko Stuebner To: Mathias Nyman , Thinh Nguyen , Sam Edwards Cc: Greg Kroah-Hartman , linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Sam Edwards Subject: Re: [PATCH 1/2] xhci: Introduce "disable-usb3" DT property/quirk Date: Tue, 12 Dec 2023 20:31:45 +0100 Message-ID: <4854020.GXAFRqVoOG@phil> In-Reply-To: <20231208210458.912776-2-CFSworks@gmail.com> References: <20231208210458.912776-1-CFSworks@gmail.com> <20231208210458.912776-2-CFSworks@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7Bit Content-Type: text/plain; charset="us-ascii" 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 fry.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 (fry.vger.email [0.0.0.0]); Tue, 12 Dec 2023 11:32:12 -0800 (PST) Am Freitag, 8. Dezember 2023, 22:04:57 CET schrieb Sam Edwards: > Some systems may have xHCI controllers that enumerate USB 3.0 ports, but > these ports nevertheless cannot be used. Perhaps enabling them triggers a > hardware bug, or perhaps they simply aren't connected and it would be > confusing to the user to see an unusable USB 3.0 rhub show up -- whatever > the case may be, it's reasonable to want to disable these ports. > > Add a DT property (and associated quirk) to the xHCI driver that skips > over (i.e. ignores and doesn't initialize) any USB 3.0 ports discovered > during driver initialization. > > Signed-off-by: Sam Edwards I'm very much unsure, where the line goes between hw-quirk and dt-is-not-a-configuration-space - in this specific instance. DT is meant to describe the actual hardware present and not how any operating system supports it. So having that usb3phy present in the kernel - even if only in a more limited form as you describe would be my preference. But for a short-term thing, the usb3-phy in the binding is optional, so so you could "just" deduce the no-usb3 state in your code from its absence from the dt-node? Heiko > Documentation/devicetree/bindings/usb/usb-xhci.yaml | 4 ++++ > drivers/usb/host/xhci-mem.c | 4 ++++ > drivers/usb/host/xhci-plat.c | 3 +++ > drivers/usb/host/xhci.h | 1 + > 4 files changed, 12 insertions(+) > > diff --git a/Documentation/devicetree/bindings/usb/usb-xhci.yaml b/Documentation/devicetree/bindings/usb/usb-xhci.yaml > index 180a261c3e8f..8a64e747260a 100644 > --- a/Documentation/devicetree/bindings/usb/usb-xhci.yaml > +++ b/Documentation/devicetree/bindings/usb/usb-xhci.yaml > @@ -25,6 +25,10 @@ properties: > description: Set if the controller has broken port disable mechanism > type: boolean > > + disable-usb3: > + description: Ignore (don't initialize, don't use) USB3 ports > + type: boolean > + > imod-interval-ns: > description: Interrupt moderation interval > default: 5000 > diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c > index 0a37f0d511cf..bf8fcab626e4 100644 > --- a/drivers/usb/host/xhci-mem.c > +++ b/drivers/usb/host/xhci-mem.c > @@ -1968,6 +1968,10 @@ static void xhci_add_in_port(struct xhci_hcd *xhci, unsigned int num_ports, > minor_revision = XHCI_EXT_PORT_MINOR(temp); > > if (major_revision == 0x03) { > + /* Ignore USB3 ports entirely if USB3 support is disabled. */ > + if (xhci->quirks & XHCI_DISABLE_USB3) > + return; > + > rhub = &xhci->usb3_rhub; > /* > * Some hosts incorrectly use sub-minor version for minor > diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c > index b93161374293..75285fb5bbbc 100644 > --- a/drivers/usb/host/xhci-plat.c > +++ b/drivers/usb/host/xhci-plat.c > @@ -249,6 +249,9 @@ int xhci_plat_probe(struct platform_device *pdev, struct device *sysdev, const s > if (device_property_read_bool(tmpdev, "quirk-broken-port-ped")) > xhci->quirks |= XHCI_BROKEN_PORT_PED; > > + if (device_property_read_bool(tmpdev, "disable-usb3")) > + xhci->quirks |= XHCI_DISABLE_USB3; > + > device_property_read_u32(tmpdev, "imod-interval-ns", > &xhci->imod_interval); > } > diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h > index 5df370482521..c53fbeea478f 100644 > --- a/drivers/usb/host/xhci.h > +++ b/drivers/usb/host/xhci.h > @@ -1906,6 +1906,7 @@ struct xhci_hcd { > #define XHCI_RESET_TO_DEFAULT BIT_ULL(44) > #define XHCI_ZHAOXIN_TRB_FETCH BIT_ULL(45) > #define XHCI_ZHAOXIN_HOST BIT_ULL(46) > +#define XHCI_DISABLE_USB3 BIT_ULL(47) > > unsigned int num_active_eps; > unsigned int limit_active_eps; >