X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=drivers%2Fusb%2Fhost%2Fxhci-mvebu.c;h=b6c6aaf78ec5882c406425119907ff1d29bbebfa;hb=d01806a8fcbdaedcc67cead56ece572021d97ab7;hp=23c241a7c79e3dd5f4e58b0478a78a0a2b02c9b0;hpb=d36277ef4f5b297e5d404d1ad19123b02dc539d1;p=oweals%2Fu-boot.git diff --git a/drivers/usb/host/xhci-mvebu.c b/drivers/usb/host/xhci-mvebu.c index 23c241a7c7..b6c6aaf78e 100644 --- a/drivers/usb/host/xhci-mvebu.c +++ b/drivers/usb/host/xhci-mvebu.c @@ -1,21 +1,19 @@ +// SPDX-License-Identifier: GPL-2.0+ /* * Copyright (C) 2015 Marvell International Ltd. * * MVEBU USB HOST xHCI Controller - * - * SPDX-License-Identifier: GPL-2.0+ */ #include #include #include #include +#include #include #include "xhci.h" -DECLARE_GLOBAL_DATA_PTR; - struct mvebu_xhci_platdata { fdt_addr_t hcd_base; }; @@ -34,7 +32,7 @@ struct mvebu_xhci { * Dummy implementation that can be overwritten by a board * specific function */ -__weak int board_xhci_enable(void) +__weak int board_xhci_enable(fdt_addr_t base) { return 0; } @@ -44,23 +42,28 @@ static int xhci_usb_probe(struct udevice *dev) struct mvebu_xhci_platdata *plat = dev_get_platdata(dev); struct mvebu_xhci *ctx = dev_get_priv(dev); struct xhci_hcor *hcor; - int len; + int len, ret; + struct udevice *regulator; ctx->hcd = (struct xhci_hccr *)plat->hcd_base; len = HC_LENGTH(xhci_readl(&ctx->hcd->cr_capbase)); hcor = (struct xhci_hcor *)((uintptr_t)ctx->hcd + len); + ret = device_get_supply_regulator(dev, "vbus-supply", ®ulator); + if (!ret) { + ret = regulator_set_enable(regulator, true); + if (ret) { + printf("Failed to turn ON the VBUS regulator\n"); + return ret; + } + } + /* Enable USB xHCI (VBUS, reset etc) in board specific code */ - board_xhci_enable(); + board_xhci_enable(devfdt_get_addr_index(dev, 1)); return xhci_register(dev, ctx->hcd, hcor); } -static int xhci_usb_remove(struct udevice *dev) -{ - return xhci_deregister(dev); -} - static int xhci_usb_ofdata_to_platdata(struct udevice *dev) { struct mvebu_xhci_platdata *plat = dev_get_platdata(dev); @@ -68,7 +71,7 @@ static int xhci_usb_ofdata_to_platdata(struct udevice *dev) /* * Get the base address for XHCI controller from the device node */ - plat->hcd_base = dev_get_addr(dev); + plat->hcd_base = devfdt_get_addr(dev); if (plat->hcd_base == FDT_ADDR_T_NONE) { debug("Can't get the XHCI register base address\n"); return -ENXIO; @@ -79,6 +82,7 @@ static int xhci_usb_ofdata_to_platdata(struct udevice *dev) static const struct udevice_id xhci_usb_ids[] = { { .compatible = "marvell,armada3700-xhci" }, + { .compatible = "marvell,armada-380-xhci" }, { .compatible = "marvell,armada-8k-xhci" }, { } }; @@ -89,7 +93,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_usb_remove, + .remove = xhci_deregister, .ops = &xhci_usb_ops, .platdata_auto_alloc_size = sizeof(struct mvebu_xhci_platdata), .priv_auto_alloc_size = sizeof(struct mvebu_xhci),