diff mbox series

[U-Boot,v4,03/20] usb: ehci-mx6: Make regulator DM_REGULATOR dependent

Message ID 1549039198-16674-4-git-send-email-abel.vesa@nxp.com
State Accepted
Delegated to: Stefano Babic
Headers show
Series mx6sabre: Add DM and SPL FIT support | expand

Commit Message

Abel Vesa Feb. 1, 2019, 4:40 p.m. UTC
Do the regulator related work only if the build has the DM_REGULATOR.

Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
---
 drivers/usb/host/ehci-mx6.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

Comments

Fabio Estevam Feb. 2, 2019, 9:41 a.m. UTC | #1
On Fri, Feb 1, 2019 at 2:47 PM Abel Vesa <abel.vesa@nxp.com> wrote:
>
> Do the regulator related work only if the build has the DM_REGULATOR.
>
> Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
> Reviewed-by: Peng Fan <peng.fan@nxp.com>

Reviewed-by: Fabio Estevam <festevam@gmail.com>
Lukasz Majewski Feb. 2, 2019, 9:47 p.m. UTC | #2
On Fri, 1 Feb 2019 16:40:08 +0000
Abel Vesa <abel.vesa@nxp.com> wrote:

> Do the regulator related work only if the build has the DM_REGULATOR.
> 

Yes, this part was missing for IMX6Q - especially SPL can get away with
enabling SPL_DM_REGULATOR if needed.

Reviewed-by: Lukasz Majewski <lukma@denx.de>

> Signed-off-by: Abel Vesa <abel.vesa@nxp.com>
> Reviewed-by: Peng Fan <peng.fan@nxp.com>
> ---
>  drivers/usb/host/ehci-mx6.c | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
> index 1acf08d..9483947 100644
> --- a/drivers/usb/host/ehci-mx6.c
> +++ b/drivers/usb/host/ehci-mx6.c
> @@ -404,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) ? @@ -413,6 +414,7 @@ static int
> mx6_init_after_reset(struct ehci_ctrl *dev) return ret;
>  		}
>  	}
> +#endif
>  
>  	if (type == USB_INIT_DEVICE)
>  		return 0;
> @@ -514,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) ? @@ -532,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);




Best regards,

Lukasz Majewski

--

DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-59 Fax: (+49)-8142-66989-80 Email: lukma@denx.de
diff mbox series

Patch

diff --git a/drivers/usb/host/ehci-mx6.c b/drivers/usb/host/ehci-mx6.c
index 1acf08d..9483947 100644
--- a/drivers/usb/host/ehci-mx6.c
+++ b/drivers/usb/host/ehci-mx6.c
@@ -404,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) ?
@@ -413,6 +414,7 @@  static int mx6_init_after_reset(struct ehci_ctrl *dev)
 			return ret;
 		}
 	}
+#endif
 
 	if (type == USB_INIT_DEVICE)
 		return 0;
@@ -514,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) ?
@@ -532,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);