All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: host: xhci: Find usb-phy by phandle if of_node not supported
@ 2018-10-03 12:33 ` Anurag Kumar Vulisha
  0 siblings, 0 replies; 2+ messages in thread
From: Anurag Kumar Vulisha @ 2018-10-03 12:33 UTC (permalink / raw)
  To: mathias.nyman, gregkh
  Cc: linux-usb, linux-kernel, v.anuragkumar, apandey, Anurag Kumar Vulisha

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 --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)
-- 
2.1.1


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

* usb: host: xhci: Find usb-phy by phandle if of_node not supported
@ 2018-10-03 12:33 ` Anurag Kumar Vulisha
  0 siblings, 0 replies; 2+ messages in thread
From: Anurag Kumar Vulisha @ 2018-10-03 12:33 UTC (permalink / raw)
  To: mathias.nyman, gregkh
  Cc: linux-usb, linux-kernel, v.anuragkumar, apandey, Anurag Kumar Vulisha

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 --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)

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

end of thread, other threads:[~2018-10-03 12:33 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-10-03 12:33 [PATCH] usb: host: xhci: Find usb-phy by phandle if of_node not supported Anurag Kumar Vulisha
2018-10-03 12:33 ` Anurag Kumar Vulisha

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.