]> git.ipfire.org Git - people/ms/u-boot.git/blobdiff - drivers/usb/host/xhci-mvebu.c
dm: Rename dev_addr..() functions
[people/ms/u-boot.git] / drivers / usb / host / xhci-mvebu.c
index 46eb93783826be0539723aca44657f90a8e595fe..b9201a5a6a3fd0c6e8f109c85311bfda3cc1680e 100644 (file)
@@ -10,6 +10,7 @@
 #include <dm.h>
 #include <fdtdec.h>
 #include <usb.h>
+#include <power/regulator.h>
 #include <asm/gpio.h>
 
 #include "xhci.h"
@@ -44,12 +45,22 @@ 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", &regulator);
+       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();
 
@@ -63,7 +74,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;