[U-Boot] [PATCH 1/2] usb: extend generic EHCI driver with PHY

patrice.chotard at st.com patrice.chotard at st.com
Fri May 12 13:13:57 UTC 2017


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

Add support of generic PHY framework
Replace printf() by error()

Signed-off-by: Patrice Chotard <patrice.chotard at st.com>
---
 drivers/usb/host/ehci-generic.c | 11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/drivers/usb/host/ehci-generic.c b/drivers/usb/host/ehci-generic.c
index 2190adb..d744a57 100644
--- a/drivers/usb/host/ehci-generic.c
+++ b/drivers/usb/host/ehci-generic.c
@@ -6,6 +6,8 @@
 
 #include <common.h>
 #include <clk.h>
+#include <fdtdec.h>
+#include <generic-phy.h>
 #include <reset.h>
 #include <asm/io.h>
 #include <dm.h>
@@ -24,6 +26,7 @@ static int ehci_usb_probe(struct udevice *dev)
 {
 	struct ehci_hccr *hccr;
 	struct ehci_hcor *hcor;
+	struct phy usb_phy;
 	int i;
 
 	for (i = 0; ; i++) {
@@ -34,7 +37,7 @@ static int ehci_usb_probe(struct udevice *dev)
 		if (ret < 0)
 			break;
 		if (clk_enable(&clk))
-			printf("failed to enable clock %d\n", i);
+			error("failed to enable clock %d\n", i);
 		clk_free(&clk);
 	}
 
@@ -46,10 +49,14 @@ static int ehci_usb_probe(struct udevice *dev)
 		if (ret < 0)
 			break;
 		if (reset_deassert(&reset))
-			printf("failed to deassert reset %d\n", i);
+			error("failed to deassert reset %d\n", i);
 		reset_free(&reset);
 	}
 
+	if (!generic_phy_get_by_index(dev, 0, &usb_phy))
+		if (generic_phy_init(&usb_phy))
+			error("failed to init usb phy %d\n", i);
+
 	hccr = map_physmem(dev_get_addr(dev), 0x100, MAP_NOCACHE);
 	hcor = (struct ehci_hcor *)((uintptr_t)hccr +
 				    HC_LENGTH(ehci_readl(&hccr->cr_capbase)));
-- 
1.9.1



More information about the U-Boot mailing list