From patchwork Wed Mar 16 22:09:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 12783222 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99CF6C4167D for ; Wed, 16 Mar 2022 22:12:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349502AbiCPWN7 (ORCPT ); Wed, 16 Mar 2022 18:13:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40120 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232977AbiCPWN4 (ORCPT ); Wed, 16 Mar 2022 18:13:56 -0400 Received: from mail-ej1-x62c.google.com (mail-ej1-x62c.google.com [IPv6:2a00:1450:4864:20::62c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A4D02BC for ; Wed, 16 Mar 2022 15:12:34 -0700 (PDT) Received: by mail-ej1-x62c.google.com with SMTP id d10so7002676eje.10 for ; Wed, 16 Mar 2022 15:12:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language :from:to:cc:references:in-reply-to:content-transfer-encoding; bh=T/NbAW0FgkZ+mseMDdzfNr0GMsaf8rvz3pB0rcu1QCg=; b=MM/8jrGmaZqZ8aSxIxRrCINlreNlOSRbT5mEjqFf+Vzysyq11zJdVSV8IigRf8kJdu Ys0G/SC/E/Ku0IlNHcN+fKt5JLHw4iqBA/2B67lCmWsqhoohEFyPqcnr92gYAeJRV2Nk JwH+c5gy3NLmqYRc+qP5xwU3KY7mrLchUNVWU7LQSwfTzS45V5wnocWy7VSC469gJTRY KuTtjDvoMJ994APRetfW3nABJg2h0LYKG/Ff5OkmwJKJ/nNs+7NiNz6uRaKk5DXS1ehE OThY2nK14ni/1EV0sHuBTJqf1izAm5Pp6btgVqxf7YHKP6tqxSkxQl8ECMtZZzy2WE1R 6CsA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:from:to:cc:references:in-reply-to :content-transfer-encoding; bh=T/NbAW0FgkZ+mseMDdzfNr0GMsaf8rvz3pB0rcu1QCg=; b=a/Q83d8VyBmc69yTm762LdEoQEsmqsPJNEFcXygQRVIYral6DMUL5o9MgGny8XKK85 xxMsOzJ6sHFisrVIl9mbvzLBhulzEfyjAzz7uyDf//hIzdy64nnbFeGUQ6+jpoH5lz4/ xpjhsPfB6x9CYPmk8H7cLpaxclb5+5W0j8OSymrufszLVzddCU/n1c2P60cf8QXOOGN4 +OKllIZicZRud0tI/yKRe3gvwZxdkdE5aKjgXzk96BX+202UDomhX7IyZn0+ogsPRgQU 2y2RWkFPdWme5pE+uDQXk0Kqmq4VOP8doPaA94k18+l8YOdT4kiImmGvg/NRZPSKgVRh UTZg== X-Gm-Message-State: AOAM5322IScHeVeKyYcrRm2YQJetHsB6U0mGQvYiKWHKY0feMfvGnPhT siqYfENVHnvM6VCvHx5C8QA= X-Google-Smtp-Source: ABdhPJyH00337y47wFV4QGO4Oi/9sJsI+ybUJ25Gkv1b9PTirMhZEbmomJspbCXZ0F7+Z2riekyr2w== X-Received: by 2002:a17:907:c10:b0:6db:63b1:cd17 with SMTP id ga16-20020a1709070c1000b006db63b1cd17mr1759734ejc.730.1647468752831; Wed, 16 Mar 2022 15:12:32 -0700 (PDT) Received: from ?IPV6:2a01:c23:b866:cc00:e490:2de6:a89f:9b66? (dynamic-2a01-0c23-b866-cc00-e490-2de6-a89f-9b66.c23.pool.telefonica.de. [2a01:c23:b866:cc00:e490:2de6:a89f:9b66]) by smtp.googlemail.com with ESMTPSA id cr19-20020a170906d55300b006df6b316e29sm1433924ejc.208.2022.03.16.15.12.31 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Mar 2022 15:12:32 -0700 (PDT) Message-ID: <06f0dba6-4820-7a88-41e6-be1f42725754@gmail.com> Date: Wed, 16 Mar 2022 23:09:08 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: [PATCH v2 1/5] xhci: factor out parts of xhci_gen_setup() Content-Language: en-US From: Heiner Kallweit To: Mathias Nyman , Greg Kroah-Hartman Cc: Linux USB Mailing List , "open list:ARM/Amlogic Meson..." , Alan Stern , Jack Pham , Tung Nguyen References: <0684616b-5cc0-e9f6-7015-ce709c6d4386@gmail.com> In-Reply-To: <0684616b-5cc0-e9f6-7015-ce709c6d4386@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Factoring out parts of xhci_gen_setup() has two motivations: - When adding functionaliy to omit shared hcd if not needed in a subsequent patch, we'll have to call xhci_hcd_init_usb3_data() from two places. - It reduces size of xhci_gen_setup() and makes it better readable. Signed-off-by: Heiner Kallweit --- drivers/usb/host/xhci.c | 104 +++++++++++++++++++++------------------- 1 file changed, 54 insertions(+), 50 deletions(-) diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 642610c78..4949de71a 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -5196,6 +5196,57 @@ static int xhci_get_frame(struct usb_hcd *hcd) return readl(&xhci->run_regs->microframe_index) >> 3; } +static void xhci_hcd_init_usb2_data(struct xhci_hcd *xhci, struct usb_hcd *hcd) +{ + xhci->usb2_rhub.hcd = hcd; + hcd->speed = HCD_USB2; + hcd->self.root_hub->speed = USB_SPEED_HIGH; + /* + * USB 2.0 roothub under xHCI has an integrated TT, + * (rate matching hub) as opposed to having an OHCI/UHCI + * companion controller. + */ + hcd->has_tt = 1; +} + +static void xhci_hcd_init_usb3_data(struct xhci_hcd *xhci, struct usb_hcd *hcd) +{ + unsigned int minor_rev; + + /* + * Early xHCI 1.1 spec did not mention USB 3.1 capable hosts + * should return 0x31 for sbrn, or that the minor revision + * is a two digit BCD containig minor and sub-minor numbers. + * This was later clarified in xHCI 1.2. + * + * Some USB 3.1 capable hosts therefore have sbrn 0x30, and + * minor revision set to 0x1 instead of 0x10. + */ + if (xhci->usb3_rhub.min_rev == 0x1) + minor_rev = 1; + else + minor_rev = xhci->usb3_rhub.min_rev / 0x10; + + switch (minor_rev) { + case 2: + hcd->speed = HCD_USB32; + hcd->self.root_hub->speed = USB_SPEED_SUPER_PLUS; + hcd->self.root_hub->rx_lanes = 2; + hcd->self.root_hub->tx_lanes = 2; + hcd->self.root_hub->ssp_rate = USB_SSP_GEN_2x2; + break; + case 1: + hcd->speed = HCD_USB31; + hcd->self.root_hub->speed = USB_SPEED_SUPER_PLUS; + hcd->self.root_hub->ssp_rate = USB_SSP_GEN_2x1; + break; + } + xhci_info(xhci, "Host supports USB 3.%x %sSuperSpeed\n", + minor_rev, minor_rev ? "Enhanced " : ""); + + xhci->usb3_rhub.hcd = hcd; +} + int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) { struct xhci_hcd *xhci; @@ -5204,7 +5255,6 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) * quirks */ struct device *dev = hcd->self.sysdev; - unsigned int minor_rev; int retval; /* Accept arbitrarily long scatter-gather lists */ @@ -5219,60 +5269,14 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) xhci = hcd_to_xhci(hcd); if (usb_hcd_is_primary_hcd(hcd)) { - xhci->main_hcd = hcd; - xhci->usb2_rhub.hcd = hcd; - /* Mark the first roothub as being USB 2.0. - * The xHCI driver will register the USB 3.0 roothub. - */ - hcd->speed = HCD_USB2; - hcd->self.root_hub->speed = USB_SPEED_HIGH; - /* - * USB 2.0 roothub under xHCI has an integrated TT, - * (rate matching hub) as opposed to having an OHCI/UHCI - * companion controller. - */ - hcd->has_tt = 1; + xhci_hcd_init_usb2_data(xhci, hcd); } else { - /* - * Early xHCI 1.1 spec did not mention USB 3.1 capable hosts - * should return 0x31 for sbrn, or that the minor revision - * is a two digit BCD containig minor and sub-minor numbers. - * This was later clarified in xHCI 1.2. - * - * Some USB 3.1 capable hosts therefore have sbrn 0x30, and - * minor revision set to 0x1 instead of 0x10. - */ - if (xhci->usb3_rhub.min_rev == 0x1) - minor_rev = 1; - else - minor_rev = xhci->usb3_rhub.min_rev / 0x10; - - switch (minor_rev) { - case 2: - hcd->speed = HCD_USB32; - hcd->self.root_hub->speed = USB_SPEED_SUPER_PLUS; - hcd->self.root_hub->rx_lanes = 2; - hcd->self.root_hub->tx_lanes = 2; - hcd->self.root_hub->ssp_rate = USB_SSP_GEN_2x2; - break; - case 1: - hcd->speed = HCD_USB31; - hcd->self.root_hub->speed = USB_SPEED_SUPER_PLUS; - hcd->self.root_hub->ssp_rate = USB_SSP_GEN_2x1; - break; - } - xhci_info(xhci, "Host supports USB 3.%x %sSuperSpeed\n", - minor_rev, - minor_rev ? "Enhanced " : ""); - - xhci->usb3_rhub.hcd = hcd; - /* xHCI private pointer was set in xhci_pci_probe for the second - * registered roothub. - */ + xhci_hcd_init_usb3_data(xhci, hcd); return 0; } mutex_init(&xhci->mutex); + xhci->main_hcd = hcd; xhci->cap_regs = hcd->regs; xhci->op_regs = hcd->regs + HC_LENGTH(readl(&xhci->cap_regs->hc_capbase)); From patchwork Wed Mar 16 22:09:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 12783223 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 5C751C4167B for ; Wed, 16 Mar 2022 22:12:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S245064AbiCPWN5 (ORCPT ); Wed, 16 Mar 2022 18:13:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40148 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236816AbiCPWN4 (ORCPT ); Wed, 16 Mar 2022 18:13:56 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91A1F5F6D for ; Wed, 16 Mar 2022 15:12:35 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id d10so7002767eje.10 for ; Wed, 16 Mar 2022 15:12:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language :from:to:cc:references:in-reply-to:content-transfer-encoding; bh=rYxiRi2cwAm8x1qVoSOdXncq7rt0hYO3tNXv8eXq2lo=; b=WsIrUCIHM65GmF758hc5I7cGBYFjYEYGttzpnYJmOw1xjA1wFnBfzz5z/ejG1RU+mI JchCP0BRqrXgYrKNX+AFJv6CvE5e4rA7WWddrFA6rAMMkKS+SOMxxecGfoktBlNN/v0L 1r6Ch/DgXd5/iiDILxRzKomdGAKrJCwbpcsUaFkDAyG1J6X4/R7PHtgs+Uf/alAZ3jff ty9sG869TvWHz3mKDg7buMApISE3OM6EB79u8ouLxyWFPcOqruK1ETRToITBAhvYYk8v qBQyR15GFuXFErVozwRWVPEYZ824p+ui7Y0hMHxIHYhT7GP1h82Ws4M0lefPMgKrOq+r ylgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:from:to:cc:references:in-reply-to :content-transfer-encoding; bh=rYxiRi2cwAm8x1qVoSOdXncq7rt0hYO3tNXv8eXq2lo=; b=EODaq/e6Mgh4JbL3dhheysDBdTZjXQmW0HM1iJkJ8fOeVj0ymUQ/iOV+37g7PlPqrA w7v5k5ncbQnKADzlzszVAgrHMIj5hphEoSyO433Fzlh67o2juAmBDo6m2VTrJ/f2YCfM Zxbymqwut8HtBr76W7H34mi7IGtc4q4K5ajueWDxoMNlpAq2l7gdF9I5ZUk/dy58TCp5 D3Je+ffdqIVtgwWQnL73vG7TTS4bjiAAbYE82bgF8YRinVeyeNh2rrqY5Jnp91cd9ZIi 181DepvHz0Jm7HG4P5GujHroHfQQ+gbIG9WRNGauOcpIsKkBnWyj8q8aIGF8JIxXWNMQ qWEQ== X-Gm-Message-State: AOAM533ykg5x/MjSgSFUsew1A6dukOZMPYkEePXfrvAyHsh+g0KuWHqs HLAtd62p/V4fCEwRiWJ1O3I= X-Google-Smtp-Source: ABdhPJz6ukN4d/e7cGS7csBQD/GCcB8MilSDHEZpCs+vf4R3YqZOsWSAXu64B27x3VCxF0RvM6Xhkg== X-Received: by 2002:a17:906:a0ce:b0:6d1:cb30:3b3b with SMTP id bh14-20020a170906a0ce00b006d1cb303b3bmr1753819ejb.582.1647468754135; Wed, 16 Mar 2022 15:12:34 -0700 (PDT) Received: from ?IPV6:2a01:c23:b866:cc00:e490:2de6:a89f:9b66? (dynamic-2a01-0c23-b866-cc00-e490-2de6-a89f-9b66.c23.pool.telefonica.de. [2a01:c23:b866:cc00:e490:2de6:a89f:9b66]) by smtp.googlemail.com with ESMTPSA id z9-20020a05640235c900b00416c894bd41sm1680654edc.16.2022.03.16.15.12.33 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Mar 2022 15:12:33 -0700 (PDT) Message-ID: <2fad4158-e974-459c-3b75-52773420e138@gmail.com> Date: Wed, 16 Mar 2022 23:09:49 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: [PATCH v2 2/5] xhci: prepare for operation w/o shared hcd Content-Language: en-US From: Heiner Kallweit To: Mathias Nyman , Greg Kroah-Hartman Cc: Linux USB Mailing List , "open list:ARM/Amlogic Meson..." , Alan Stern , Jack Pham , Tung Nguyen References: <0684616b-5cc0-e9f6-7015-ce709c6d4386@gmail.com> In-Reply-To: <0684616b-5cc0-e9f6-7015-ce709c6d4386@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org This patch prepares xhci for the following scenario: - If either of the root hubs has no ports, then omit shared hcd - Main hcd can be USB3 if there are no USB2 ports Signed-off-by: Heiner Kallweit --- drivers/usb/host/xhci-hub.c | 3 ++- drivers/usb/host/xhci-mem.c | 11 ++++---- drivers/usb/host/xhci.c | 53 ++++++++++++++++++++++++------------- drivers/usb/host/xhci.h | 26 ++++++++++++++++++ 4 files changed, 68 insertions(+), 25 deletions(-) diff --git a/drivers/usb/host/xhci-hub.c b/drivers/usb/host/xhci-hub.c index 1e7dc130c..9e835fdfe 100644 --- a/drivers/usb/host/xhci-hub.c +++ b/drivers/usb/host/xhci-hub.c @@ -707,6 +707,7 @@ static int xhci_enter_test_mode(struct xhci_hcd *xhci, u16 test_mode, u16 wIndex, unsigned long *flags) __must_hold(&xhci->lock) { + struct usb_hcd *usb3_hcd = xhci_get_usb3_hcd(xhci); int i, retval; /* Disable all Device Slots */ @@ -727,7 +728,7 @@ static int xhci_enter_test_mode(struct xhci_hcd *xhci, xhci_dbg(xhci, "Disable all port (PP = 0)\n"); /* Power off USB3 ports*/ for (i = 0; i < xhci->usb3_rhub.num_ports; i++) - xhci_set_port_power(xhci, xhci->shared_hcd, i, false, flags); + xhci_set_port_power(xhci, usb3_hcd, i, false, flags); /* Power off USB2 ports*/ for (i = 0; i < xhci->usb2_rhub.num_ports; i++) xhci_set_port_power(xhci, xhci->main_hcd, i, false, flags); diff --git a/drivers/usb/host/xhci-mem.c b/drivers/usb/host/xhci-mem.c index bbb27ee2c..50bf64dcb 100644 --- a/drivers/usb/host/xhci-mem.c +++ b/drivers/usb/host/xhci-mem.c @@ -1072,7 +1072,7 @@ static u32 xhci_find_real_port_number(struct xhci_hcd *xhci, struct usb_hcd *hcd; if (udev->speed >= USB_SPEED_SUPER) - hcd = xhci->shared_hcd; + hcd = xhci_get_usb3_hcd(xhci); else hcd = xhci->main_hcd; @@ -2362,10 +2362,11 @@ static int xhci_setup_port_arrays(struct xhci_hcd *xhci, gfp_t flags) xhci->usb2_rhub.num_ports = USB_MAXCHILDREN; } - /* - * Note we could have all USB 3.0 ports, or all USB 2.0 ports. - * Not sure how the USB core will handle a hub with no ports... - */ + if (!xhci->usb2_rhub.num_ports) + xhci_info(xhci, "USB2 root hub has no ports\n"); + + if (!xhci->usb3_rhub.num_ports) + xhci_info(xhci, "USB3 root hub has no ports\n"); xhci_create_rhub_port_array(xhci, &xhci->usb2_rhub, flags); xhci_create_rhub_port_array(xhci, &xhci->usb3_rhub, flags); diff --git a/drivers/usb/host/xhci.c b/drivers/usb/host/xhci.c index 4949de71a..5d1576a7b 100644 --- a/drivers/usb/host/xhci.c +++ b/drivers/usb/host/xhci.c @@ -486,6 +486,10 @@ static void compliance_mode_recovery(struct timer_list *t) xhci = from_timer(xhci, t, comp_mode_recovery_timer); rhub = &xhci->usb3_rhub; + hcd = rhub->hcd; + + if (!hcd) + return; for (i = 0; i < rhub->num_ports; i++) { temp = readl(rhub->ports[i]->addr); @@ -499,7 +503,6 @@ static void compliance_mode_recovery(struct timer_list *t) i + 1); xhci_dbg_trace(xhci, trace_xhci_dbg_quirks, "Attempting compliance mode recovery"); - hcd = xhci->shared_hcd; if (hcd->state == HC_STATE_SUSPENDED) usb_hcd_resume_root_hub(hcd); @@ -612,14 +615,11 @@ static int xhci_run_finished(struct xhci_hcd *xhci) xhci_halt(xhci); return -ENODEV; } - xhci->shared_hcd->state = HC_STATE_RUNNING; xhci->cmd_ring_state = CMD_RING_STATE_RUNNING; if (xhci->quirks & XHCI_NEC_HOST) xhci_ring_cmd_db(xhci); - xhci_dbg_trace(xhci, trace_xhci_dbg_init, - "Finished xhci_run for USB3 roothub"); return 0; } @@ -694,12 +694,15 @@ int xhci_run(struct usb_hcd *hcd) xhci_free_command(xhci, command); } xhci_dbg_trace(xhci, trace_xhci_dbg_init, - "Finished xhci_run for USB2 roothub"); + "Finished %s for main hcd", __func__); xhci_create_dbc_dev(xhci); xhci_debugfs_init(xhci); + if (xhci_has_one_roothub(xhci)) + return xhci_run_finished(xhci); + return 0; } EXPORT_SYMBOL_GPL(xhci_run); @@ -981,7 +984,7 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup) return 0; if (hcd->state != HC_STATE_SUSPENDED || - xhci->shared_hcd->state != HC_STATE_SUSPENDED) + (xhci->shared_hcd && xhci->shared_hcd->state != HC_STATE_SUSPENDED)) return -EINVAL; /* Clear root port wake on bits if wakeup not allowed. */ @@ -998,15 +1001,18 @@ int xhci_suspend(struct xhci_hcd *xhci, bool do_wakeup) __func__, hcd->self.busnum); clear_bit(HCD_FLAG_POLL_RH, &hcd->flags); del_timer_sync(&hcd->rh_timer); - clear_bit(HCD_FLAG_POLL_RH, &xhci->shared_hcd->flags); - del_timer_sync(&xhci->shared_hcd->rh_timer); + if (xhci->shared_hcd) { + clear_bit(HCD_FLAG_POLL_RH, &xhci->shared_hcd->flags); + del_timer_sync(&xhci->shared_hcd->rh_timer); + } if (xhci->quirks & XHCI_SUSPEND_DELAY) usleep_range(1000, 1500); spin_lock_irq(&xhci->lock); clear_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); - clear_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags); + if (xhci->shared_hcd) + clear_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags); /* step 1: stop endpoint */ /* skipped assuming that port suspend has done */ @@ -1106,7 +1112,8 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) msleep(100); set_bit(HCD_FLAG_HW_ACCESSIBLE, &hcd->flags); - set_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags); + if (xhci->shared_hcd) + set_bit(HCD_FLAG_HW_ACCESSIBLE, &xhci->shared_hcd->flags); spin_lock_irq(&xhci->lock); @@ -1166,7 +1173,8 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) /* Let the USB core know _both_ roothubs lost power. */ usb_root_hub_lost_power(xhci->main_hcd->self.root_hub); - usb_root_hub_lost_power(xhci->shared_hcd->self.root_hub); + if (xhci->shared_hcd) + usb_root_hub_lost_power(xhci->shared_hcd->self.root_hub); xhci_dbg(xhci, "Stop HCD\n"); xhci_halt(xhci); @@ -1206,12 +1214,13 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) xhci_dbg(xhci, "Start the primary HCD\n"); retval = xhci_run(hcd->primary_hcd); - if (!retval) { + if (!retval && secondary_hcd) { xhci_dbg(xhci, "Start the secondary HCD\n"); retval = xhci_run(secondary_hcd); } hcd->state = HC_STATE_SUSPENDED; - xhci->shared_hcd->state = HC_STATE_SUSPENDED; + if (xhci->shared_hcd) + xhci->shared_hcd->state = HC_STATE_SUSPENDED; goto done; } @@ -1249,7 +1258,8 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) } if (pending_portevent) { - usb_hcd_resume_root_hub(xhci->shared_hcd); + if (xhci->shared_hcd) + usb_hcd_resume_root_hub(xhci->shared_hcd); usb_hcd_resume_root_hub(hcd); } } @@ -1268,8 +1278,10 @@ int xhci_resume(struct xhci_hcd *xhci, bool hibernated) /* Re-enable port polling. */ xhci_dbg(xhci, "%s: starting usb%d port polling.\n", __func__, hcd->self.busnum); - set_bit(HCD_FLAG_POLL_RH, &xhci->shared_hcd->flags); - usb_hcd_poll_rh_status(xhci->shared_hcd); + if (xhci->shared_hcd) { + set_bit(HCD_FLAG_POLL_RH, &xhci->shared_hcd->flags); + usb_hcd_poll_rh_status(xhci->shared_hcd); + } set_bit(HCD_FLAG_POLL_RH, &hcd->flags); usb_hcd_poll_rh_status(hcd); @@ -5268,9 +5280,7 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) xhci = hcd_to_xhci(hcd); - if (usb_hcd_is_primary_hcd(hcd)) { - xhci_hcd_init_usb2_data(xhci, hcd); - } else { + if (!usb_hcd_is_primary_hcd(hcd)) { xhci_hcd_init_usb3_data(xhci, hcd); return 0; } @@ -5351,6 +5361,11 @@ int xhci_gen_setup(struct usb_hcd *hcd, xhci_get_quirks_t get_quirks) return retval; xhci_dbg(xhci, "Called HCD init\n"); + if (xhci_hcd_is_usb3(hcd)) + xhci_hcd_init_usb3_data(xhci, hcd); + else + xhci_hcd_init_usb2_data(xhci, hcd); + xhci_info(xhci, "hcc params 0x%08x hci version 0x%x quirks 0x%016llx\n", xhci->hcc_params, xhci->hci_version, xhci->quirks); diff --git a/drivers/usb/host/xhci.h b/drivers/usb/host/xhci.h index 473a33ce2..c792a3148 100644 --- a/drivers/usb/host/xhci.h +++ b/drivers/usb/host/xhci.h @@ -1911,6 +1911,8 @@ struct xhci_hcd { unsigned hw_lpm_support:1; /* Broken Suspend flag for SNPS Suspend resume issue */ unsigned broken_suspend:1; + /* Indicates that omitting hcd is supported if root hub has no ports */ + unsigned allow_single_roothub:1; /* cached usb2 extened protocol capabilites */ u32 *ext_caps; unsigned int num_ext_caps; @@ -1966,6 +1968,30 @@ static inline struct usb_hcd *xhci_to_hcd(struct xhci_hcd *xhci) return xhci->main_hcd; } +static inline struct usb_hcd *xhci_get_usb3_hcd(struct xhci_hcd *xhci) +{ + if (xhci->shared_hcd) + return xhci->shared_hcd; + + if (!xhci->usb2_rhub.num_ports) + return xhci->main_hcd; + + return NULL; +} + +static inline bool xhci_hcd_is_usb3(struct usb_hcd *hcd) +{ + struct xhci_hcd *xhci = hcd_to_xhci(hcd); + + return hcd == xhci_get_usb3_hcd(xhci); +} + +static inline bool xhci_has_one_roothub(struct xhci_hcd *xhci) +{ + return xhci->allow_single_roothub && + (!xhci->usb2_rhub.num_ports || !xhci->usb3_rhub.num_ports); +} + #define xhci_dbg(xhci, fmt, args...) \ dev_dbg(xhci_to_hcd(xhci)->self.controller , fmt , ## args) #define xhci_err(xhci, fmt, args...) \ From patchwork Wed Mar 16 22:10:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 12783225 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79CE6C433FE for ; Wed, 16 Mar 2022 22:12:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350815AbiCPWN7 (ORCPT ); Wed, 16 Mar 2022 18:13:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40154 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239288AbiCPWN4 (ORCPT ); Wed, 16 Mar 2022 18:13:56 -0400 Received: from mail-ej1-x62a.google.com (mail-ej1-x62a.google.com [IPv6:2a00:1450:4864:20::62a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 239006334 for ; Wed, 16 Mar 2022 15:12:37 -0700 (PDT) Received: by mail-ej1-x62a.google.com with SMTP id r13so7054505ejd.5 for ; Wed, 16 Mar 2022 15:12:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language :from:to:cc:references:in-reply-to:content-transfer-encoding; bh=d84l6wYcxRO0cEaO9IcZrp8h8jURQZcOK4qYQT4QMuA=; b=o7eEzQ+ASLlkjYaFVSPfsXli4290UKATThIPg/XT58iIlalM/ED/pWH2FP3/21sxDC 0sKZtVS7ZqBIzNz2BY0YsCyP/M5L9S0/gEAR286IuOlWX7GA3X2f3rCvXEG9pMXaLza7 VbCQPCsI4Cc2vHlkpwIjpRAgyy7i8V3ECLClT1bGmxAmgVbku1uhxZy/9AxnpvcHoqxc 87mt/iaus9NyY3g+DW63xRR9oSRv9QiYYxk3y/2Mzoy903Djep8++gp6URP1JeP8VXHn RryY1TWIsjF9qbHjn7yjimFDaHShQOSSF6nWqMVnHgh0GHiZKzpD7VNkDpt0Lv7OL/Wx UqGQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:from:to:cc:references:in-reply-to :content-transfer-encoding; bh=d84l6wYcxRO0cEaO9IcZrp8h8jURQZcOK4qYQT4QMuA=; b=trISXNIsCtjdYM42w8FQ2N4SGNOy4SV3y5VxFfyQqUxWO8VjjNW1v+61iAxZuQrn3Q j3VSs8Qb2zfA0nKPvZCIfdpx2y4OW5lx6L4MEp8C/KjQ915T6cDnLUtGmclS5slcLAbW N8uRy/qg/tAgM7D/BPKIB7YhpXJDyfcBBy/wG5SPb8vsIXyjf6/UTwcmwTpXO6wu69S3 44P7D6X+bbOqYeXxqBCc/Axlz73CsNzvaJYOwcfiDOfLM9yALz5HLVYi5NflLpLfX3bp +GDvmQOq4TDChrSHqdLIWpLmUCRvuNMZPZVQrBQMObtGon6vtxSeosrGme3kAR6Ift2N itLA== X-Gm-Message-State: AOAM530+0xyYzY66a331erVivehytzS2dSXPBp+xqUZWpeeT4ma8/UYT h1gCeKVMz3SMCNiJMfKfCTI= X-Google-Smtp-Source: ABdhPJzy3/y1+m2wuz92O7wzDv8zztpXffG3dqpbRODppWqqPJBVfnzd79rWEYVEEKorP5Tz9n85vQ== X-Received: by 2002:a17:907:6091:b0:6db:ef36:f0ff with SMTP id ht17-20020a170907609100b006dbef36f0ffmr1737966ejc.505.1647468755639; Wed, 16 Mar 2022 15:12:35 -0700 (PDT) Received: from ?IPV6:2a01:c23:b866:cc00:e490:2de6:a89f:9b66? (dynamic-2a01-0c23-b866-cc00-e490-2de6-a89f-9b66.c23.pool.telefonica.de. [2a01:c23:b866:cc00:e490:2de6:a89f:9b66]) by smtp.googlemail.com with ESMTPSA id si13-20020a170906cecd00b006cded0c5ee2sm1478461ejb.61.2022.03.16.15.12.34 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Mar 2022 15:12:35 -0700 (PDT) Message-ID: <5a364ad0-fb48-5a6b-c04f-479afbdca532@gmail.com> Date: Wed, 16 Mar 2022 23:10:41 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: [PATCH v2 3/5] usb: host: xhci-plat: create shared hcd after having added main hcd Content-Language: en-US From: Heiner Kallweit To: Mathias Nyman , Greg Kroah-Hartman Cc: Linux USB Mailing List , "open list:ARM/Amlogic Meson..." , Alan Stern , Jack Pham , Tung Nguyen References: <0684616b-5cc0-e9f6-7015-ce709c6d4386@gmail.com> In-Reply-To: <0684616b-5cc0-e9f6-7015-ce709c6d4386@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org This patch is in preparation of an extension where in case of a root hub with no ports no shared hcd will be created. Whether one of the root hubs has no ports we figure our in usb_add_hcd() for the primary hcd. Therefore create the shared hcd only after this call. Signed-off-by: Heiner Kallweit --- drivers/usb/host/xhci-plat.c | 29 ++++++++++++++++------------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 649ffd861..5d752b384 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -283,12 +283,6 @@ static int xhci_plat_probe(struct platform_device *pdev) device_set_wakeup_capable(&pdev->dev, true); xhci->main_hcd = hcd; - xhci->shared_hcd = __usb_create_hcd(driver, sysdev, &pdev->dev, - dev_name(&pdev->dev), hcd); - if (!xhci->shared_hcd) { - ret = -ENOMEM; - goto disable_clk; - } /* imod_interval is the interrupt moderation value in nanoseconds. */ xhci->imod_interval = 40000; @@ -313,16 +307,16 @@ static int xhci_plat_probe(struct platform_device *pdev) if (IS_ERR(hcd->usb_phy)) { ret = PTR_ERR(hcd->usb_phy); if (ret == -EPROBE_DEFER) - goto put_usb3_hcd; + goto disable_clk; hcd->usb_phy = NULL; } else { ret = usb_phy_init(hcd->usb_phy); if (ret) - goto put_usb3_hcd; + goto disable_clk; } hcd->tpl_support = of_usb_host_tpl_support(sysdev->of_node); - xhci->shared_hcd->tpl_support = hcd->tpl_support; + if (priv && (priv->quirks & XHCI_SKIP_PHY_INIT)) hcd->skip_phy_initialization = 1; @@ -333,12 +327,21 @@ static int xhci_plat_probe(struct platform_device *pdev) if (ret) goto disable_usb_phy; + xhci->shared_hcd = __usb_create_hcd(driver, sysdev, &pdev->dev, + dev_name(&pdev->dev), hcd); + if (!xhci->shared_hcd) { + ret = -ENOMEM; + goto dealloc_usb2_hcd; + } + + xhci->shared_hcd->tpl_support = hcd->tpl_support; + if (HCC_MAX_PSA(xhci->hcc_params) >= 4) xhci->shared_hcd->can_do_streams = 1; ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED); if (ret) - goto dealloc_usb2_hcd; + goto put_usb3_hcd; device_enable_async_suspend(&pdev->dev); pm_runtime_put_noidle(&pdev->dev); @@ -352,15 +355,15 @@ static int xhci_plat_probe(struct platform_device *pdev) return 0; +put_usb3_hcd: + usb_put_hcd(xhci->shared_hcd); + dealloc_usb2_hcd: usb_remove_hcd(hcd); disable_usb_phy: usb_phy_shutdown(hcd->usb_phy); -put_usb3_hcd: - usb_put_hcd(xhci->shared_hcd); - disable_clk: clk_disable_unprepare(xhci->clk); From patchwork Wed Mar 16 22:11:33 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 12783221 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8BEB2C43217 for ; Wed, 16 Mar 2022 22:12:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232357AbiCPWN5 (ORCPT ); Wed, 16 Mar 2022 18:13:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40152 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234500AbiCPWN4 (ORCPT ); Wed, 16 Mar 2022 18:13:56 -0400 Received: from mail-ed1-x52e.google.com (mail-ed1-x52e.google.com [IPv6:2a00:1450:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5AF6B63A7 for ; Wed, 16 Mar 2022 15:12:38 -0700 (PDT) Received: by mail-ed1-x52e.google.com with SMTP id z92so3463822ede.13 for ; Wed, 16 Mar 2022 15:12:38 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language :from:to:cc:references:in-reply-to:content-transfer-encoding; bh=Mbk9eDgtV28j0TWUuMi3KlCoJjoq5ox4im4qxu+j5Ck=; b=SmhRYRQhoXZPq4H8FSWuHTlBLFyJmoQ8H9PxDXvVqGz+Myc/4Kx9o0TKTuo1gXBIgl 8lazzj1K2J7wvX/iEG3pOjANpIdSfgP5YCKS8nnCETMFlTFdpl0yF1M/64fl4tc+QR/R xszvesuLHTL1GJ7qJJZ0e2QV+W+C+Aseaza7EGvktqdlVs/nR0R7rQ0YwfL1HHIHElSf 8OjHRgzHqND5IbDVDoT7YtTFW5FYTNy+P+/pomkyAPQbRegIVij728nORfjyVUooUZQY kSCry2bhKdTt+bkMl1liOGajsKjWctE0+Fyr4Y6RfABK01fcxqYnduOBON3/2DHl6Swt CocA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:from:to:cc:references:in-reply-to :content-transfer-encoding; bh=Mbk9eDgtV28j0TWUuMi3KlCoJjoq5ox4im4qxu+j5Ck=; b=k9cNFq6wPfCsVaO31Y98WpQxyXysauZSgECDUY28jMePAUwetotSoTePSz/rDC1ZFp tt4ZkL4JYEEUgiSjTVEUJRyadpjbhbjNucnwvApBCpCHohrde0GuBpWK+9qiJKVKJmoo 9qzX42txQxeyOQ8GwDDKEeERtrMzP4ng3obc9KDJqH8ywN/hYR7qE1BDqffapTCpmew3 nwAbEcJSD4C4a0YMI/gyzXLI7NZLLtGwMR8sv3Cfqm39/1lCk6FZY3u9Jf72d672sU5G wo07R5Hp5CgpfgRAsyrHj7PsHxqZe2ad/F7cNJeD7ig/Uqi4JEVJXS2L+r1M8cRZTOzs UK4g== X-Gm-Message-State: AOAM530CuoH74H66n2u3n4w2Zh2iMJ4mM78ET3lx1N+mf01e0jiTy1oW Xs+VGFWFX2v203zdrZC/Q4g= X-Google-Smtp-Source: ABdhPJyOYTPz8Lm6U+5GQXq3v/ePt7jRdvqzUwNvaWYE2Emf9uwGbx2vo9KvFKvzAOWYR5pDdSLSwA== X-Received: by 2002:a05:6402:50cf:b0:418:ee57:ed9 with SMTP id h15-20020a05640250cf00b00418ee570ed9mr1494329edb.37.1647468756890; Wed, 16 Mar 2022 15:12:36 -0700 (PDT) Received: from ?IPV6:2a01:c23:b866:cc00:e490:2de6:a89f:9b66? (dynamic-2a01-0c23-b866-cc00-e490-2de6-a89f-9b66.c23.pool.telefonica.de. [2a01:c23:b866:cc00:e490:2de6:a89f:9b66]) by smtp.googlemail.com with ESMTPSA id ec21-20020a170906b6d500b006d170a3444csm1424902ejb.164.2022.03.16.15.12.36 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Mar 2022 15:12:36 -0700 (PDT) Message-ID: <506113fe-5bd9-bdd0-7858-2b702ca32d53@gmail.com> Date: Wed, 16 Mar 2022 23:11:33 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: [PATCH v2 4/5] usb: host: xhci-plat: prepare operation w/o shared hcd Content-Language: en-US From: Heiner Kallweit To: Mathias Nyman , Greg Kroah-Hartman Cc: Linux USB Mailing List , "open list:ARM/Amlogic Meson..." , Alan Stern , Jack Pham , Tung Nguyen References: <0684616b-5cc0-e9f6-7015-ce709c6d4386@gmail.com> In-Reply-To: <0684616b-5cc0-e9f6-7015-ce709c6d4386@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org This patch prepares xhci-plat for the following scenario - If either of the root hubs has no ports, then omit shared hcd - Main hcd can be USB3 if there are no USB2 ports Signed-off-by: Heiner Kallweit --- drivers/usb/host/xhci-plat.c | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index 5d752b384..c512ec214 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -180,7 +180,7 @@ static int xhci_plat_probe(struct platform_device *pdev) struct device *sysdev, *tmpdev; struct xhci_hcd *xhci; struct resource *res; - struct usb_hcd *hcd; + struct usb_hcd *hcd, *usb3_hcd; int ret; int irq; struct xhci_plat_priv *priv = NULL; @@ -327,21 +327,26 @@ static int xhci_plat_probe(struct platform_device *pdev) if (ret) goto disable_usb_phy; - xhci->shared_hcd = __usb_create_hcd(driver, sysdev, &pdev->dev, - dev_name(&pdev->dev), hcd); - if (!xhci->shared_hcd) { - ret = -ENOMEM; - goto dealloc_usb2_hcd; - } + if (!xhci_has_one_roothub(xhci)) { + xhci->shared_hcd = __usb_create_hcd(driver, sysdev, &pdev->dev, + dev_name(&pdev->dev), hcd); + if (!xhci->shared_hcd) { + ret = -ENOMEM; + goto dealloc_usb2_hcd; + } - xhci->shared_hcd->tpl_support = hcd->tpl_support; + xhci->shared_hcd->tpl_support = hcd->tpl_support; + } - if (HCC_MAX_PSA(xhci->hcc_params) >= 4) - xhci->shared_hcd->can_do_streams = 1; + usb3_hcd = xhci_get_usb3_hcd(xhci); + if (usb3_hcd && HCC_MAX_PSA(xhci->hcc_params) >= 4) + usb3_hcd->can_do_streams = 1; - ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED); - if (ret) - goto put_usb3_hcd; + if (xhci->shared_hcd) { + ret = usb_add_hcd(xhci->shared_hcd, irq, IRQF_SHARED); + if (ret) + goto put_usb3_hcd; + } device_enable_async_suspend(&pdev->dev); pm_runtime_put_noidle(&pdev->dev); From patchwork Wed Mar 16 22:12:19 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heiner Kallweit X-Patchwork-Id: 12783224 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C468FC433F5 for ; Wed, 16 Mar 2022 22:12:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239288AbiCPWN7 (ORCPT ); Wed, 16 Mar 2022 18:13:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239294AbiCPWN4 (ORCPT ); Wed, 16 Mar 2022 18:13:56 -0400 Received: from mail-ej1-x636.google.com (mail-ej1-x636.google.com [IPv6:2a00:1450:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB47B63AE for ; Wed, 16 Mar 2022 15:12:39 -0700 (PDT) Received: by mail-ej1-x636.google.com with SMTP id qx21so6985870ejb.13 for ; Wed, 16 Mar 2022 15:12:39 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language :from:to:cc:references:in-reply-to:content-transfer-encoding; bh=t5YisPtzsM0C7fd6A1oY9SJVrPbbN9Fr5lieyUuqkfc=; b=fmwiNl0r6a9JRcS3K6o1ySAskAiVMhvrq5sSCwGp48vGBkIgjJD6xTFBQYnvXpXA2m 1/xpsLio6KIPNZCdMBc5KwTo6RsiXcsr5HzJe4ENqMzvxhz9EDbQ/hU2ZJFAen97UZ2e FWt3ez8jRkkikqWznF+OSUKDyM4D7bplgNxJoFmde1pCmwNie37Y8YPoelj6GcKaLC0s plswckazIaqMYeUuVu1Q7phBIrMTB/apcw8VCCIdCKiAZu+DogUoTgPSB83DvnI7m38K jic7aTyWzC4uNDQ9HSXMYw8maMB+FjngeebxVqUYRQV+1fzqe72kUYxPOUbzJBadx9FI JnLg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:from:to:cc:references:in-reply-to :content-transfer-encoding; bh=t5YisPtzsM0C7fd6A1oY9SJVrPbbN9Fr5lieyUuqkfc=; b=C/lq5BkQ3n4Zl0I0FtD0IhzI868kc+psZcVAQAnivuK531lw4tJELh611ldJCwbKBQ z+s6RwlWBTn1BNieZ5iTe5p4A8ibsjezWmEBEFu+jY3ejIOWKrnoVzEUHblmPQa7BfEj IG1SFG8YAIOXEUtJNo9T5yqPogIm06FsNcGXlC3Hs2qSvEZVc/Sa2948pBYSiMvS+cSB BxYJxNcpcjBWafjEys67kYRyb+6OG+GwGhpwau8RbGEEcaeME3HZRmJWKnqbC6YLAwKH kLQUaWAKX06VjG0W6ub3kvs9CAgHDikl8kKlrQ3LRWx6+7MMTrjxsQYWQ7sgi7h0fZbW C24A== X-Gm-Message-State: AOAM530xzwyaFTM455TWLYgjTNGt4yXJU/pq989RSjLpM+9CDKUjAOQt cw2VTKXTyAvZ5xFURNoHlmQ= X-Google-Smtp-Source: ABdhPJxrjkgQZHXfQI57DVw/cpw3kGWhJM8+A2NW/BrvO9HS075CCoUCmKco4qeyPPLf3EiNGtJfFQ== X-Received: by 2002:a17:906:c053:b0:6b5:fde8:af2 with SMTP id bm19-20020a170906c05300b006b5fde80af2mr1739626ejb.642.1647468758296; Wed, 16 Mar 2022 15:12:38 -0700 (PDT) Received: from ?IPV6:2a01:c23:b866:cc00:e490:2de6:a89f:9b66? (dynamic-2a01-0c23-b866-cc00-e490-2de6-a89f-9b66.c23.pool.telefonica.de. [2a01:c23:b866:cc00:e490:2de6:a89f:9b66]) by smtp.googlemail.com with ESMTPSA id v5-20020a50c405000000b004161123bf7asm1609613edf.67.2022.03.16.15.12.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Mar 2022 15:12:37 -0700 (PDT) Message-ID: <4667c495-56d0-c53d-2c2d-3280e8a6ae13@gmail.com> Date: Wed, 16 Mar 2022 23:12:19 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: [PATCH v2 5/5] usb: host: xhci-plat: omit shared hcd if either root hub has no ports Content-Language: en-US From: Heiner Kallweit To: Mathias Nyman , Greg Kroah-Hartman Cc: Linux USB Mailing List , "open list:ARM/Amlogic Meson..." , Alan Stern , Jack Pham , Tung Nguyen References: <0684616b-5cc0-e9f6-7015-ce709c6d4386@gmail.com> In-Reply-To: <0684616b-5cc0-e9f6-7015-ce709c6d4386@gmail.com> Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Activate the just added extension for xhci-plat and omit the shared hcd if either of the root hubs has no ports. Signed-off-by: Heiner Kallweit --- drivers/usb/host/xhci-plat.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c index c512ec214..044855818 100644 --- a/drivers/usb/host/xhci-plat.c +++ b/drivers/usb/host/xhci-plat.c @@ -245,6 +245,8 @@ static int xhci_plat_probe(struct platform_device *pdev) xhci = hcd_to_xhci(hcd); + xhci->allow_single_roothub = 1; + /* * Not all platforms have clks so it is not an error if the * clock do not exist.