U-Boot Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb: dwc3: Add support for usb3-phy PHY configuration
@ 2022-02-23 14:56 Michal Simek
  2022-02-23 17:31 ` Marek Vasut
  2022-03-03  8:40 ` Bin Meng
  0 siblings, 2 replies; 11+ messages in thread
From: Michal Simek @ 2022-02-23 14:56 UTC (permalink / raw)
  To: u-boot, git; +Cc: Angus Ainslie, Kunihiko Hayashi, Marek Vasut, Simon Glass

When usb3-phy label is found, PHY driver is called and serdes line is
initialized. This is preparation for serdes/psgtr driver to configure GT
lines based on description in DT.

Signed-off-by: Michal Simek <michal.simek@xilinx.com>
---

 drivers/usb/dwc3/dwc3-generic.c | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/drivers/usb/dwc3/dwc3-generic.c b/drivers/usb/dwc3/dwc3-generic.c
index 01bd0ca190e3..b1e019b5b91a 100644
--- a/drivers/usb/dwc3/dwc3-generic.c
+++ b/drivers/usb/dwc3/dwc3-generic.c
@@ -409,6 +409,17 @@ static int dwc3_glue_probe(struct udevice *dev)
 	struct udevice *child = NULL;
 	int index = 0;
 	int ret;
+	struct phy phy;
+
+	ret = generic_phy_get_by_name(dev, "usb3-phy", &phy);
+	if (!ret) {
+		ret = generic_phy_init(&phy);
+		if (ret)
+			return ret;
+	} else if (ret != -ENOENT) {
+		debug("could not get phy (err %d)\n", ret);
+		return ret;
+	}
 
 	glue->regs = dev_read_addr(dev);
 
@@ -420,6 +431,12 @@ static int dwc3_glue_probe(struct udevice *dev)
 	if (ret)
 		return ret;
 
+	if (phy.dev) {
+		ret = generic_phy_power_on(&phy);
+		if (ret)
+			return ret;
+	}
+
 	ret = device_find_first_child(dev, &child);
 	if (ret)
 		return ret;
-- 
2.35.1


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

end of thread, other threads:[~2022-03-08 21:58 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-23 14:56 [PATCH] usb: dwc3: Add support for usb3-phy PHY configuration Michal Simek
2022-02-23 17:31 ` Marek Vasut
2022-03-03  8:40 ` Bin Meng
2022-03-04  4:42   ` Marek Vasut
2022-03-04 17:33     ` Marek Vasut
2022-03-08 13:21       ` Michal Simek
2022-03-08 13:39         ` Marek Vasut
2022-03-08 13:46           ` Michal Simek
2022-03-08 15:32             ` Marek Vasut
2022-03-08 15:34               ` Michal Simek
2022-03-08 21:58                 ` Marek Vasut

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox