diff mbox series

usb: host: xhci: Find usb-phy by phandle if of_node not supported

Message ID 1538569991-17959-1-git-send-email-anurag.kumar.vulisha@xilinx.com (mailing list archive)
State New, archived
Headers show
Series usb: host: xhci: Find usb-phy by phandle if of_node not supported | expand

Commit Message

Anurag Kumar Vulisha Oct. 3, 2018, 12:33 p.m. UTC
There are use cases where the usb phy is created at runtime and
added into sysdev (for example phy-generic.c creates the usb phy
during probe and adds the phy to phy list using usb_add_phy_dev).
In this case, the sysdev may not have the "usb-phy" phandle added.
So, the existing devm_usb_get_phy_by_phandle() doesn't find the
"usb-phy" and returns -ENODEV. This patch modifies the code to search
for usb phy in of_node if "usb-phy" phandle is not found in sysdev.

Signed-off-by: Anurag Kumar Vulisha <anurag.kumar.vulisha@xilinx.com>
---
 drivers/usb/host/xhci-plat.c | 4 ++++
 1 file changed, 4 insertions(+)
diff mbox series

Patch

diff --git a/drivers/usb/host/xhci-plat.c b/drivers/usb/host/xhci-plat.c
index 94e9392..997836f 100644
--- a/drivers/usb/host/xhci-plat.c
+++ b/drivers/usb/host/xhci-plat.c
@@ -293,6 +293,10 @@  static int xhci_plat_probe(struct platform_device *pdev)
 	}
 
 	hcd->usb_phy = devm_usb_get_phy_by_phandle(sysdev, "usb-phy", 0);
+	if (PTR_ERR(hcd->usb_phy) == -ENODEV)
+		hcd->usb_phy =
+			devm_usb_get_phy_by_node(sysdev, sysdev->of_node, 0);
+
 	if (IS_ERR(hcd->usb_phy)) {
 		ret = PTR_ERR(hcd->usb_phy);
 		if (ret == -EPROBE_DEFER)