[U-Boot] [PATCH v3 7/7] usb: host: ohci-generic: add generic PHY support

patrice.chotard at st.com patrice.chotard at st.com
Wed May 17 13:34:08 UTC 2017


From: Patrice Chotard <patrice.chotard at st.com>

Extend ohci-generic driver with generic PHY framework

Signed-off-by: Patrice Chotard <patrice.chotard at st.com>
---

v3:	_ extract in this patch the PHY support add-on from previous patch 5


 drivers/usb/host/ohci-generic.c | 25 ++++++++++++++++++++++++-
 1 file changed, 24 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/ohci-generic.c b/drivers/usb/host/ohci-generic.c
index bf14ab7..47e522c 100644
--- a/drivers/usb/host/ohci-generic.c
+++ b/drivers/usb/host/ohci-generic.c
@@ -7,6 +7,7 @@
 #include <common.h>
 #include <clk.h>
 #include <dm.h>
+#include <generic-phy.h>
 #include <reset.h>
 #include "ohci.h"
 
@@ -28,6 +29,7 @@ struct generic_ohci {
 	ohci_t ohci;
 	struct list_head clks;
 	struct list_head resets;
+	struct phy phy;
 };
 
 static int ohci_release_resets(struct generic_ohci *priv)
@@ -158,8 +160,25 @@ static int ohci_usb_probe(struct udevice *dev)
 		list_add(&ohci_reset->list, &priv->resets);
 	}
 
+	ret = generic_phy_get_by_index(dev, 0, &priv->phy);
+	if (ret) {
+		error("failed to get usb phy\n");
+		goto reset_err;
+	}
+
+	ret = generic_phy_init(&priv->phy);
+	if (ret) {
+		error("failed to init usb phy\n");
+		goto reset_err;
+	}
+
+	ret = ohci_register(dev, regs);
+	if (!ret)
+		return ret;
 
-	return ohci_register(dev, regs);
+	ret = generic_phy_exit(&priv->phy);
+	if (ret)
+		return ret;
 
 reset_err:
 	ret = ohci_release_resets(priv);
@@ -178,6 +197,10 @@ static int ohci_usb_remove(struct udevice *dev)
 	if (ret)
 		return ret;
 
+	ret = generic_phy_exit(&priv->phy);
+	if (ret)
+		return ret;
+
 	ret = ohci_release_resets(priv);
 	if (ret)
 		return ret;
-- 
1.9.1



More information about the U-Boot mailing list