[U-Boot] [RFC 3/6] usb: exynos: add init_after_reset for usb reset

Anand Moon linux.amoon at gmail.com
Mon Apr 1 11:52:29 UTC 2019


Some host controllers need addidional re-initialization
after ehci_reset() so we add .init_after_reset callback
which is requires to reinit the phy after controller reset.

Signed-off-by: Anand Moon <linux.amoon at gmail.com>
---
 drivers/usb/host/ehci-exynos.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/ehci-exynos.c b/drivers/usb/host/ehci-exynos.c
index b0f7bd4936..e6a542e092 100644
--- a/drivers/usb/host/ehci-exynos.c
+++ b/drivers/usb/host/ehci-exynos.c
@@ -143,6 +143,23 @@ static void exynos5_setup_usb_phy(struct exynos_usb_phy *usb)
 			EHCICTRL_ENAINCR16);
 }
 
+static int ehci_exynos_init_after_reset(struct ehci_ctrl *ehcntl)
+{
+	if (cpu_is_exynos4()) {
+		if (proid_is_exynos4412()) {
+			/*
+			 * "usb reset" cmd: restart re-initialize the usb driver
+			 */
+			exynos_usb_init();
+		}
+	}
+	return 0;
+}
+
+static const struct ehci_ops exynos_ehci_ops = {
+	.init_after_reset = ehci_exynos_init_after_reset,
+};
+
 static void exynos4412_setup_usb_phy(struct exynos4412_usb_phy *usb)
 {
 	writel(CLK_24MHZ, &usb->usbphyclk);
@@ -234,7 +251,8 @@ static int ehci_usb_probe(struct udevice *dev)
 	hcor = (struct ehci_hcor *)((uint32_t)ctx->hcd +
 			HC_LENGTH(ehci_readl(&ctx->hcd->cr_capbase)));
 
-	return ehci_register(dev, ctx->hcd, hcor, NULL, 0, USB_INIT_HOST);
+	return ehci_register(dev, ctx->hcd, hcor, &exynos_ehci_ops,
+			0, USB_INIT_HOST);
 }
 
 static int ehci_usb_remove(struct udevice *dev)
-- 
2.21.0



More information about the U-Boot mailing list