From: Heiner Kallweit <hkallweit1@gmail.com>
To: Mathias Nyman <mathias.nyman@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Linux USB Mailing List <linux-usb@vger.kernel.org>,
"open list:ARM/Amlogic Meson..."
<linux-amlogic@lists.infradead.org>,
Alan Stern <stern@rowland.harvard.edu>,
Jack Pham <quic_jackp@quicinc.com>,
Tung Nguyen <tunguyen@apm.com>
Subject: [PATCH 1/5] usb: host: xhci-plat: create shared hcd after having added main hcd
Date: Fri, 4 Mar 2022 19:34:23 +0100 [thread overview]
Message-ID: <ffee4668-f087-66b9-a52f-d2dddf617a77@gmail.com> (raw)
In-Reply-To: <18a93669-7f7a-dad8-38f4-44819fc3b64a@gmail.com>
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 <hkallweit1@gmail.com>
---
drivers/usb/host/xhci-plat.c | 28 +++++++++++++++-------------
1 file changed, 15 insertions(+), 13 deletions(-)
diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 8094da348..484c7fe3e 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -294,12 +294,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;
@@ -324,16 +318,15 @@ 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) {
ret = xhci_priv_plat_setup(hcd);
@@ -351,12 +344,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);
@@ -370,15 +372,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);
--
2.35.1
_______________________________________________
linux-amlogic mailing list
linux-amlogic@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-amlogic
next prev parent reply other threads:[~2022-03-04 18:37 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-04 18:32 [PATCH 0/5] usb: host: xhci-plat: omit shared hcd if either of the root hubs has no ports Heiner Kallweit
2022-03-04 18:34 ` Heiner Kallweit [this message]
2022-03-04 18:35 ` [PATCH 2/5] xhci: factor out parts of xhci_gen_setup() Heiner Kallweit
2022-03-04 18:35 ` [PATCH 3/5] xhci: prepare for operation w/o shared hcd Heiner Kallweit
2022-03-04 18:36 ` [PATCH 4/5] usb: host: xhci-plat: prepare " Heiner Kallweit
2022-03-04 18:37 ` [PATCH 5/5] xhci: support omitting shared hcd if either of the root hubs has no ports Heiner Kallweit
2022-03-08 14:55 ` Mathias Nyman
2022-03-10 21:10 ` Heiner Kallweit
2022-03-08 14:31 ` [PATCH 0/5] usb: host: xhci-plat: omit " Mathias Nyman
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ffee4668-f087-66b9-a52f-d2dddf617a77@gmail.com \
--to=hkallweit1@gmail.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-amlogic@lists.infradead.org \
--cc=linux-usb@vger.kernel.org \
--cc=mathias.nyman@intel.com \
--cc=quic_jackp@quicinc.com \
--cc=stern@rowland.harvard.edu \
--cc=tunguyen@apm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®