From patchwork Sun Apr 19 15:48:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: =?utf-8?q?Marek_Beh=C3=BAn?= X-Patchwork-Id: 238025 List-Id: U-Boot discussion From: marek.behun at nic.cz (=?UTF-8?q?Marek=20Beh=C3=BAn?=) Date: Sun, 19 Apr 2020 17:48:45 +0200 Subject: [PATCH u-boot-marvell 06/11] usb: xhci-mvebu: call generic-phy initialization In-Reply-To: <20200419154850.25868-1-marek.behun@nic.cz> References: <20200419154850.25868-1-marek.behun@nic.cz> Message-ID: <20200419154850.25868-7-marek.behun@nic.cz> 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 --- 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 +#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", ®ulator); 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),