FAILED: patch "[PATCH] USB: xhci-plat: fix legacy PHY double init" failed to apply to 4.14-stable tree

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



The patch below does not apply to the 4.14-stable tree.
If someone wants it applied there, or to any other stable or longterm
tree, then please email the backport, including the original git commit
id to <stable@xxxxxxxxxxxxxxx>.

To reproduce the conflict and resubmit, you may use the following commands:

git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-4.14.y
git checkout FETCH_HEAD
git cherry-pick -x 16b7e0cccb243033de4406ffb4d892365041a1e7
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<stable@xxxxxxxxxxxxxxx>' --in-reply-to '2023113039-upchuck-driver-bf91@gregkh' --subject-prefix 'PATCH 4.14.y' HEAD^..

Possible dependencies:

16b7e0cccb24 ("USB: xhci-plat: fix legacy PHY double init")
424e02931e2b ("usb: xhci: plat: remove error log for failure to get usb-phy")
9134c1fd0503 ("usb: xhci: plat: Add USB 3.0 phy support")
e0fe986972f5 ("usb: host: xhci-plat: prepare operation w/o shared hcd")
0cf1ea040a7e ("usb: host: xhci-plat: create shared hcd after having added main hcd")
8e10548f7f48 ("Revert "usb: host: xhci: mvebu: make USB 3.0 PHY optional for Armada 3720"")
3241929b67d2 ("usb: host: xhci: mvebu: make USB 3.0 PHY optional for Armada 3720")
f768e718911e ("usb: host: xhci-plat: add priv quirk for skip PHY initialization")
a66d21d7dba8 ("usb: xhci: Add support for Renesas controller with memory")
ff4c65ca48f0 ("usb: hci: add hc_driver as argument for usb_hcd_pci_probe")
77d8f110acb7 ("usb: host: xhci-plat: add quirks member into struct xhci_plat_priv")
eb6c2eb6c7fb ("usb: host: xhci-plat: Prevent an abnormally restrictive PHY init skipping")
08048c04cc6f ("usb: host: xhci-plat: get optional clock by devm_clk_get_optional()")
12453a897e36 ("usb: host: xhci: mvebu: add reset on resume quirk")
a7d57abcc8a5 ("xhci: workaround CSS timeout on AMD SNPS 3.0 xHC")
11644a765952 ("xhci: Add quirk to workaround the errata seen on Cavium Thunder-X2 Soc")
2815ef7fe4d4 ("xhci-pci: allow host runtime PM as default for Intel Alpine and Titan Ridge")
c94d41e9dd1b ("usb: host: xhci-plat: add platform TPL support")
c2ef60fea2dc ("Revert "xhci: Reset Renesas uPD72020x USB controller for 32-bit DMA issue"")
12de0a35c996 ("xhci: Add quirk to zero 64bit registers on Renesas PCIe controllers")

thanks,

greg k-h

------------------ original commit in Linus's tree ------------------

>From 16b7e0cccb243033de4406ffb4d892365041a1e7 Mon Sep 17 00:00:00 2001
From: Johan Hovold <johan+linaro@xxxxxxxxxx>
Date: Fri, 3 Nov 2023 17:43:23 +0100
Subject: [PATCH] USB: xhci-plat: fix legacy PHY double init

Commits 7b8ef22ea547 ("usb: xhci: plat: Add USB phy support") and
9134c1fd0503 ("usb: xhci: plat: Add USB 3.0 phy support") added support
for looking up legacy PHYs from the sysdev devicetree node and
initialising them.

This broke drivers such as dwc3 which manages PHYs themself as the PHYs
would now be initialised twice, something which specifically can lead to
resources being left enabled during suspend (e.g. with the
usb_phy_generic PHY driver).

As the dwc3 driver uses driver-name matching for the xhci platform
device, fix this by only looking up and initialising PHYs for devices
that have been matched using OF.

Note that checking that the platform device has a devicetree node would
currently be sufficient, but that could lead to subtle breakages in case
anyone ever tries to reuse an ancestor's node.

Fixes: 7b8ef22ea547 ("usb: xhci: plat: Add USB phy support")
Fixes: 9134c1fd0503 ("usb: xhci: plat: Add USB 3.0 phy support")
Cc: stable@xxxxxxxxxxxxxxx      # 4.1
Cc: Maxime Ripard <mripard@xxxxxxxxxx>
Cc: Stanley Chang <stanley_chang@xxxxxxxxxxx>
Signed-off-by: Johan Hovold <johan+linaro@xxxxxxxxxx>
Tested-by: Stefan Eichenberger <stefan.eichenberger@xxxxxxxxxxx>
Tested-by: Stanley Chang <stanley_chang@xxxxxxxxxxx>
Link: https://lore.kernel.org/r/20231103164323.14294-1-johan+linaro@xxxxxxxxxx
Signed-off-by: Greg Kroah-Hartman <gregkh@xxxxxxxxxxxxxxxxxxx>

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index b93161374293..732cdeb73920 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -13,6 +13,7 @@
 #include <linux/module.h>
 #include <linux/pci.h>
 #include <linux/of.h>
+#include <linux/of_device.h>
 #include <linux/platform_device.h>
 #include <linux/usb/phy.h>
 #include <linux/slab.h>
@@ -148,7 +149,7 @@ int xhci_plat_probe(struct platform_device *pdev, struct device *sysdev, const s
 	int			ret;
 	int			irq;
 	struct xhci_plat_priv	*priv = NULL;
-
+	bool			of_match;
 
 	if (usb_disabled())
 		return -ENODEV;
@@ -253,16 +254,23 @@ int xhci_plat_probe(struct platform_device *pdev, struct device *sysdev, const s
 					 &xhci->imod_interval);
 	}
 
-	hcd->usb_phy = devm_usb_get_phy_by_phandle(sysdev, "usb-phy", 0);
-	if (IS_ERR(hcd->usb_phy)) {
-		ret = PTR_ERR(hcd->usb_phy);
-		if (ret == -EPROBE_DEFER)
-			goto disable_clk;
-		hcd->usb_phy = NULL;
-	} else {
-		ret = usb_phy_init(hcd->usb_phy);
-		if (ret)
-			goto disable_clk;
+	/*
+	 * Drivers such as dwc3 manages PHYs themself (and rely on driver name
+	 * matching for the xhci platform device).
+	 */
+	of_match = of_match_device(pdev->dev.driver->of_match_table, &pdev->dev);
+	if (of_match) {
+		hcd->usb_phy = devm_usb_get_phy_by_phandle(sysdev, "usb-phy", 0);
+		if (IS_ERR(hcd->usb_phy)) {
+			ret = PTR_ERR(hcd->usb_phy);
+			if (ret == -EPROBE_DEFER)
+				goto disable_clk;
+			hcd->usb_phy = NULL;
+		} else {
+			ret = usb_phy_init(hcd->usb_phy);
+			if (ret)
+				goto disable_clk;
+		}
 	}
 
 	hcd->tpl_support = of_usb_host_tpl_support(sysdev->of_node);
@@ -285,15 +293,17 @@ int xhci_plat_probe(struct platform_device *pdev, struct device *sysdev, const s
 			goto dealloc_usb2_hcd;
 		}
 
-		xhci->shared_hcd->usb_phy = devm_usb_get_phy_by_phandle(sysdev,
-			    "usb-phy", 1);
-		if (IS_ERR(xhci->shared_hcd->usb_phy)) {
-			xhci->shared_hcd->usb_phy = NULL;
-		} else {
-			ret = usb_phy_init(xhci->shared_hcd->usb_phy);
-			if (ret)
-				dev_err(sysdev, "%s init usb3phy fail (ret=%d)\n",
-					    __func__, ret);
+		if (of_match) {
+			xhci->shared_hcd->usb_phy = devm_usb_get_phy_by_phandle(sysdev,
+										"usb-phy", 1);
+			if (IS_ERR(xhci->shared_hcd->usb_phy)) {
+				xhci->shared_hcd->usb_phy = NULL;
+			} else {
+				ret = usb_phy_init(xhci->shared_hcd->usb_phy);
+				if (ret)
+					dev_err(sysdev, "%s init usb3phy fail (ret=%d)\n",
+						__func__, ret);
+			}
 		}
 
 		xhci->shared_hcd->tpl_support = hcd->tpl_support;





[Index of Archives]     [Linux Kernel]     [Kernel Development Newbies]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite Hiking]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux