usb: ehci-mx6: Make regulator DM_REGULATOR dependent
[pandora-u-boot.git] / drivers / usb / host / ehci-mx6.c
index 2c8fc3c..9483947 100644 (file)
@@ -1,8 +1,7 @@
+// SPDX-License-Identifier: GPL-2.0+
 /*
  * Copyright (c) 2009 Daniel Mack <daniel@caiaq.de>
  * Copyright (C) 2010 Freescale Semiconductor, Inc.
- *
- * SPDX-License-Identifier:    GPL-2.0+
  */
 
 #include <common.h>
@@ -336,7 +335,7 @@ int ehci_mx6_common_init(struct usb_ehci *ehci, int index)
        return 0;
 }
 
-#ifndef CONFIG_DM_USB
+#if !CONFIG_IS_ENABLED(DM_USB)
 int ehci_hcd_init(int index, enum usb_init_type init,
                struct ehci_hccr **hccr, struct ehci_hcor **hcor)
 {
@@ -405,6 +404,7 @@ static int mx6_init_after_reset(struct ehci_ctrl *dev)
        if (ret)
                return ret;
 
+#if CONFIG_IS_ENABLED(DM_REGULATOR)
        if (priv->vbus_supply) {
                ret = regulator_set_enable(priv->vbus_supply,
                                           (type == USB_INIT_DEVICE) ?
@@ -414,6 +414,7 @@ static int mx6_init_after_reset(struct ehci_ctrl *dev)
                        return ret;
                }
        }
+#endif
 
        if (type == USB_INIT_DEVICE)
                return 0;
@@ -515,15 +516,17 @@ static int ehci_usb_probe(struct udevice *dev)
        priv->portnr = dev->seq;
        priv->init_type = type;
 
+#if CONFIG_IS_ENABLED(DM_REGULATOR)
        ret = device_get_supply_regulator(dev, "vbus-supply",
                                          &priv->vbus_supply);
        if (ret)
                debug("%s: No vbus supply\n", dev->name);
-
+#endif
        ret = ehci_mx6_common_init(ehci, priv->portnr);
        if (ret)
                return ret;
 
+#if CONFIG_IS_ENABLED(DM_REGULATOR)
        if (priv->vbus_supply) {
                ret = regulator_set_enable(priv->vbus_supply,
                                           (type == USB_INIT_DEVICE) ?
@@ -533,6 +536,7 @@ static int ehci_usb_probe(struct udevice *dev)
                        return ret;
                }
        }
+#endif
 
        if (priv->init_type == USB_INIT_HOST) {
                setbits_le32(&ehci->usbmode, CM_HOST);