[PATCH u-boot-marvell 06/11] usb: xhci-mvebu: call generic-phy initialization

Marek Behún marek.behun at nic.cz
Sun Apr 19 17:48:45 CEST 2020


Use the new usb_phys_setup and usb_phys_shutdown to initialize
potential generic-phys in the xhci-mvebu driver.

Signed-off-by: Marek Behún <marek.behun at nic.cz>
---
 drivers/usb/host/xhci-mvebu.c | 19 ++++++++++++++++++-
 1 file changed, 18 insertions(+), 1 deletion(-)

diff --git a/drivers/usb/host/xhci-mvebu.c b/drivers/usb/host/xhci-mvebu.c
index 2b871046ae..2939e658ef 100644
--- a/drivers/usb/host/xhci-mvebu.c
+++ b/drivers/usb/host/xhci-mvebu.c
@@ -14,6 +14,8 @@
 
 #include <usb/xhci.h>
 
+#include "phy.h"
+
 struct mvebu_xhci_platdata {
 	fdt_addr_t hcd_base;
 };
@@ -49,6 +51,10 @@ static int xhci_usb_probe(struct udevice *dev)
 	len = HC_LENGTH(xhci_readl(&ctx->hcd->cr_capbase));
 	hcor = (struct xhci_hcor *)((uintptr_t)ctx->hcd + len);
 
+	ret = usb_phys_setup(dev);
+	if (ret)
+		return ret;
+
 	ret = device_get_supply_regulator(dev, "vbus-supply", &regulator);
 	if (!ret) {
 		ret = regulator_set_enable(regulator, true);
@@ -64,6 +70,17 @@ static int xhci_usb_probe(struct udevice *dev)
 	return xhci_register(dev, ctx->hcd, hcor);
 }
 
+static int xhci_usb_remove(struct udevice *dev)
+{
+	int ret;
+
+	ret = xhci_deregister(dev);
+	if (ret)
+		return ret;
+
+	return usb_phys_shutdown(dev);
+}
+
 static int xhci_usb_ofdata_to_platdata(struct udevice *dev)
 {
 	struct mvebu_xhci_platdata *plat = dev_get_platdata(dev);
@@ -93,7 +110,7 @@ U_BOOT_DRIVER(usb_xhci) = {
 	.of_match = xhci_usb_ids,
 	.ofdata_to_platdata = xhci_usb_ofdata_to_platdata,
 	.probe = xhci_usb_probe,
-	.remove = xhci_deregister,
+	.remove = xhci_usb_remove,
 	.ops	= &xhci_usb_ops,
 	.platdata_auto_alloc_size = sizeof(struct mvebu_xhci_platdata),
 	.priv_auto_alloc_size = sizeof(struct mvebu_xhci),
-- 
2.24.1



More information about the U-Boot mailing list