linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] usb: host: xhci-plat: fix support for XHCI_SKIP_PHY_INIT quirk
@ 2020-12-21 15:09 Pali Rohár
  2020-12-22  2:14 ` Peter Chen
  2020-12-23 16:18 ` [PATCH v2] " Pali Rohár
  0 siblings, 2 replies; 15+ messages in thread
From: Pali Rohár @ 2020-12-21 15:09 UTC (permalink / raw)
  To: Mathias Nyman, Greg Kroah-Hartman, Peter Chen
  Cc: Jun Li, linux-usb, linux-kernel

Currently init_quirk callbacks for xhci platform drivers are called
xhci_plat_setup() function which is called after chip reset completes.
It happens in the middle of the usb_add_hcd() function.

But XHCI_SKIP_PHY_INIT quirk is checked in the xhci_plat_probe() function
prior calling usb_add_hcd() function. Therefore this XHCI_SKIP_PHY_INIT
currently does nothing as prior xhci_plat_setup() it is not set.

Quirk XHCI_SKIP_PHY_INIT is only setting hcd->skip_phy_initialization value
which really needs to be set prior calling usb_add_hcd() as this function
at its beginning skips PHY init if this member is set.

This patch fixes implementation of the XHCI_SKIP_PHY_INIT quirk by calling
init_quirk callbacks (via xhci_priv_init_quirk()) prior checking if
XHCI_SKIP_PHY_INIT is set.

Fixes: f768e718911e0 ("usb: host: xhci-plat: add priv quirk for skip PHY initialization")
Signed-off-by: Pali Rohár <pali@kernel.org>
---
 drivers/usb/host/xhci-plat.c | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 4d34f6005381..58704c5b002b 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -89,13 +89,6 @@ static void xhci_plat_quirks(struct device *dev, struct xhci_hcd *xhci)
 /* called during probe() after chip reset completes */
 static int xhci_plat_setup(struct usb_hcd *hcd)
 {
-	int ret;
-
-
-	ret = xhci_priv_init_quirk(hcd);
-	if (ret)
-		return ret;
-
 	return xhci_gen_setup(hcd, xhci_plat_quirks);
 }
 
@@ -330,6 +323,13 @@ static int xhci_plat_probe(struct platform_device *pdev)
 
 	hcd->tpl_support = of_usb_host_tpl_support(sysdev->of_node);
 	xhci->shared_hcd->tpl_support = hcd->tpl_support;
+
+	if (priv) {
+		ret = xhci_priv_init_quirk(hcd);
+		if (ret)
+			goto disable_usb_phy;
+	}
+
 	if (priv && (priv->quirks & XHCI_SKIP_PHY_INIT))
 		hcd->skip_phy_initialization = 1;
 
-- 
2.20.1


^ permalink raw reply related	[flat|nested] 15+ messages in thread

end of thread, other threads:[~2021-02-02  1:18 UTC | newest]

Thread overview: 15+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-21 15:09 [PATCH] usb: host: xhci-plat: fix support for XHCI_SKIP_PHY_INIT quirk Pali Rohár
2020-12-22  2:14 ` Peter Chen
2020-12-22  9:23   ` Pali Rohár
2020-12-22 13:30     ` Pali Rohár
2020-12-23  1:02       ` Peter Chen
2020-12-23  1:04         ` Pali Rohár
2020-12-23 16:18 ` [PATCH v2] " Pali Rohár
2020-12-24  5:59   ` Peter Chen
2021-01-13 23:20     ` Pali Rohár
2021-01-15 13:32       ` Mathias Nyman
2021-01-25 14:20         ` Pali Rohár
2021-01-26  4:27           ` Yoshihiro Shimoda
2021-01-26  9:06             ` Pali Rohár
2021-02-01 15:11               ` Pali Rohár
2021-02-02  1:17                 ` Yoshihiro Shimoda

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).