diff mbox series

[U-Boot,v3] dw_mmc: turn on the IO supply

Message ID 20190513132527.14933-1-urjaman@gmail.com
State Accepted
Commit 2b157019bb4c11303497f58b659f08f5ef9d064a
Delegated to: Kever Yang
Headers show
Series [U-Boot,v3] dw_mmc: turn on the IO supply | expand

Commit Message

Urja Rannikko May 13, 2019, 1:25 p.m. UTC
Fixes the microSD slot on the ASUS C201.

Signed-off-by: Urja Rannikko <urjaman@gmail.com>
---
v2: use #if CONFIG_IS_ENABLED(DM_REGULATOR)
v3: Move ret variable inside the if block (only used there)
---
 drivers/mmc/dw_mmc.c | 16 ++++++++++++++++
 1 file changed, 16 insertions(+)

Comments

Simon Glass May 18, 2019, 4:08 p.m. UTC | #1
On Mon, 13 May 2019 at 07:25, Urja Rannikko <urjaman@gmail.com> wrote:
>
> Fixes the microSD slot on the ASUS C201.
>
> Signed-off-by: Urja Rannikko <urjaman@gmail.com>
> ---
> v2: use #if CONFIG_IS_ENABLED(DM_REGULATOR)
> v3: Move ret variable inside the if block (only used there)
> ---
>  drivers/mmc/dw_mmc.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)

Reviewed-by: Simon Glass <sjg@chromium.org>

>
> diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
> index 1992d61182..22f6c7eefd 100644
> --- a/drivers/mmc/dw_mmc.c
> +++ b/drivers/mmc/dw_mmc.c
> @@ -13,6 +13,7 @@
>  #include <mmc.h>
>  #include <dwmmc.h>
>  #include <wait_bit.h>
> +#include <power/regulator.h>
>
>  #define PAGE_SIZE 4096
>
> @@ -493,6 +494,21 @@ static int dwmci_set_ios(struct mmc *mmc)
>         if (host->clksel)
>                 host->clksel(host);
>
> +#if CONFIG_IS_ENABLED(DM_REGULATOR)

I wonder if we could use if() here instead?


> +       if (mmc->vqmmc_supply) {
> +               int ret;
> +
> +               if (mmc->signal_voltage == MMC_SIGNAL_VOLTAGE_180)
> +                       regulator_set_value(mmc->vqmmc_supply, 1800000);
> +               else
> +                       regulator_set_value(mmc->vqmmc_supply, 3300000);
> +
> +               ret = regulator_set_enable_if_allowed(mmc->vqmmc_supply, true);
> +               if (ret)
> +                       return ret;
> +       }
> +#endif
> +
>         return 0;
>  }
>
> --
> 2.21.0
>
Peng Fan May 20, 2019, 7:03 a.m. UTC | #2
> Subject: [U-Boot] [PATCH v3] dw_mmc: turn on the IO supply
> 
> Fixes the microSD slot on the ASUS C201.
> 
> Signed-off-by: Urja Rannikko <urjaman@gmail.com>
> ---
> v2: use #if CONFIG_IS_ENABLED(DM_REGULATOR)
> v3: Move ret variable inside the if block (only used there)
> ---
>  drivers/mmc/dw_mmc.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
> 
> diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c index
> 1992d61182..22f6c7eefd 100644
> --- a/drivers/mmc/dw_mmc.c
> +++ b/drivers/mmc/dw_mmc.c
> @@ -13,6 +13,7 @@
>  #include <mmc.h>
>  #include <dwmmc.h>
>  #include <wait_bit.h>
> +#include <power/regulator.h>
> 
>  #define PAGE_SIZE 4096
> 
> @@ -493,6 +494,21 @@ static int dwmci_set_ios(struct mmc *mmc)
>  	if (host->clksel)
>  		host->clksel(host);
> 
> +#if CONFIG_IS_ENABLED(DM_REGULATOR)
> +	if (mmc->vqmmc_supply) {
> +		int ret;
> +
> +		if (mmc->signal_voltage == MMC_SIGNAL_VOLTAGE_180)
> +			regulator_set_value(mmc->vqmmc_supply, 1800000);
> +		else
> +			regulator_set_value(mmc->vqmmc_supply, 3300000);
> +
> +		ret = regulator_set_enable_if_allowed(mmc->vqmmc_supply, true);
> +		if (ret)
> +			return ret;
> +	}
> +#endif
> +

Reviewed-by: Peng Fan <peng.fan@nxp.com>

>  	return 0;
>  }
> 
> --
> 2.21.0
> 
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.d
> enx.de%2Flistinfo%2Fu-boot&amp;data=02%7C01%7CPeng.Fan%40nxp.com
> %7Ce49ea3fa171f4230a40308d6d7a680fc%7C686ea1d3bc2b4c6fa92cd99c5
> c301635%7C0%7C0%7C636933507511914198&amp;sdata=Hyq5z5xI5xYUPA
> tcKJU%2FmdM3PLgCdHQcIr4qkSbz4Fc%3D&amp;reserved=0
Kever Yang July 26, 2019, 7:06 a.m. UTC | #3
Hi Peng, Simon,

This patch is delegate to Philipp now, does this patch should go to
Rockchip branch first?
I can do it if yes, but double with you in case this patch should go to mmc
branch first.

Thanks,
- Kever

Peng Fan <peng.fan@nxp.com> 于2019年5月20日周一 下午3:04写道:

> > Subject: [U-Boot] [PATCH v3] dw_mmc: turn on the IO supply
> >
> > Fixes the microSD slot on the ASUS C201.
> >
> > Signed-off-by: Urja Rannikko <urjaman@gmail.com>
> > ---
> > v2: use #if CONFIG_IS_ENABLED(DM_REGULATOR)
> > v3: Move ret variable inside the if block (only used there)
> > ---
> >  drivers/mmc/dw_mmc.c | 16 ++++++++++++++++
> >  1 file changed, 16 insertions(+)
> >
> > diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c index
> > 1992d61182..22f6c7eefd 100644
> > --- a/drivers/mmc/dw_mmc.c
> > +++ b/drivers/mmc/dw_mmc.c
> > @@ -13,6 +13,7 @@
> >  #include <mmc.h>
> >  #include <dwmmc.h>
> >  #include <wait_bit.h>
> > +#include <power/regulator.h>
> >
> >  #define PAGE_SIZE 4096
> >
> > @@ -493,6 +494,21 @@ static int dwmci_set_ios(struct mmc *mmc)
> >       if (host->clksel)
> >               host->clksel(host);
> >
> > +#if CONFIG_IS_ENABLED(DM_REGULATOR)
> > +     if (mmc->vqmmc_supply) {
> > +             int ret;
> > +
> > +             if (mmc->signal_voltage == MMC_SIGNAL_VOLTAGE_180)
> > +                     regulator_set_value(mmc->vqmmc_supply, 1800000);
> > +             else
> > +                     regulator_set_value(mmc->vqmmc_supply, 3300000);
> > +
> > +             ret = regulator_set_enable_if_allowed(mmc->vqmmc_supply,
> true);
> > +             if (ret)
> > +                     return ret;
> > +     }
> > +#endif
> > +
>
> Reviewed-by: Peng Fan <peng.fan@nxp.com>
>
> >       return 0;
> >  }
> >
> > --
> > 2.21.0
> >
> > _______________________________________________
> > U-Boot mailing list
> > U-Boot@lists.denx.de
> >
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.d
> > enx.de%2Flistinfo%2Fu-boot&amp;data=02%7C01%7CPeng.Fan%40nxp.com
> > %7Ce49ea3fa171f4230a40308d6d7a680fc%7C686ea1d3bc2b4c6fa92cd99c5
> > c301635%7C0%7C0%7C636933507511914198&amp;sdata=Hyq5z5xI5xYUPA
> > tcKJU%2FmdM3PLgCdHQcIr4qkSbz4Fc%3D&amp;reserved=0
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> https://lists.denx.de/listinfo/u-boot
>
Peng Fan July 30, 2019, 12:47 a.m. UTC | #4
Hi Kever,

You could pick it up, not depends on mmc branch.

Thanks,
Peng.

From: Kever Yang [mailto:kever.yang@rock-chips.com]
Sent: 2019年7月26日 15:06
To: Peng Fan <peng.fan@nxp.com>
Cc: Urja Rannikko <urjaman@gmail.com>; u-boot@lists.denx.de
Subject: Re: [U-Boot] [PATCH v3] dw_mmc: turn on the IO supply

Hi Peng, Simon,

This patch is delegate to Philipp now, does this patch should go to Rockchip branch first?
I can do it if yes, but double with you in case this patch should go to mmc branch first.

Thanks,
- Kever

Peng Fan <peng.fan@nxp.com<mailto:peng.fan@nxp.com>> 于2019年5月20日周一 下午3:04写道:
> Subject: [U-Boot] [PATCH v3] dw_mmc: turn on the IO supply
>
> Fixes the microSD slot on the ASUS C201.
>
> Signed-off-by: Urja Rannikko <urjaman@gmail.com<mailto:urjaman@gmail.com>>
> ---
> v2: use #if CONFIG_IS_ENABLED(DM_REGULATOR)
> v3: Move ret variable inside the if block (only used there)
> ---
>  drivers/mmc/dw_mmc.c | 16 ++++++++++++++++
>  1 file changed, 16 insertions(+)
>
> diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c index
> 1992d61182..22f6c7eefd 100644
> --- a/drivers/mmc/dw_mmc.c
> +++ b/drivers/mmc/dw_mmc.c
> @@ -13,6 +13,7 @@
>  #include <mmc.h>
>  #include <dwmmc.h>
>  #include <wait_bit.h>
> +#include <power/regulator.h>
>
>  #define PAGE_SIZE 4096
>
> @@ -493,6 +494,21 @@ static int dwmci_set_ios(struct mmc *mmc)
>       if (host->clksel)
>               host->clksel(host);
>
> +#if CONFIG_IS_ENABLED(DM_REGULATOR)
> +     if (mmc->vqmmc_supply) {
> +             int ret;
> +
> +             if (mmc->signal_voltage == MMC_SIGNAL_VOLTAGE_180)
> +                     regulator_set_value(mmc->vqmmc_supply, 1800000);
> +             else
> +                     regulator_set_value(mmc->vqmmc_supply, 3300000);
> +
> +             ret = regulator_set_enable_if_allowed(mmc->vqmmc_supply, true);
> +             if (ret)
> +                     return ret;
> +     }
> +#endif
> +

Reviewed-by: Peng Fan <peng.fan@nxp.com<mailto:peng.fan@nxp.com>>

>       return 0;
>  }
>
> --
> 2.21.0
>
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de<mailto:U-Boot@lists.denx.de>
> https://eur01.safelinks.protection.outlook.com/?url=https%3A%2F%2Flists.d<https://lists.d>
> enx.de<https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2Fenx.de&data=02%7C01%7Cpeng.fan%40nxp.com%7C11ccf6dc22aa4b87faa308d71197bfa7%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636997215762062849&sdata=ZRlAdJM9%2BafKEW2CIgJ9AKbFsgYpZ2q61m%2Fxh5ktdkU%3D&reserved=0>%2Flistinfo%2Fu-boot&amp;data=02%7C01%7CPeng.Fan%40nxp.com<https://eur01.safelinks.protection.outlook.com/?url=http%3A%2F%2F40nxp.com&data=02%7C01%7Cpeng.fan%40nxp.com%7C11ccf6dc22aa4b87faa308d71197bfa7%7C686ea1d3bc2b4c6fa92cd99c5c301635%7C0%7C0%7C636997215762062849&sdata=km5AEShdXwRM2MtHYLm2662Sz9Z1b2C7RiZgMeygUsc%3D&reserved=0>
> %7Ce49ea3fa171f4230a40308d6d7a680fc%7C686ea1d3bc2b4c6fa92cd99c5
> c301635%7C0%7C0%7C636933507511914198&amp;sdata=Hyq5z5xI5xYUPA
> tcKJU%2FmdM3PLgCdHQcIr4qkSbz4Fc%3D&amp;reserved=0
diff mbox series

Patch

diff --git a/drivers/mmc/dw_mmc.c b/drivers/mmc/dw_mmc.c
index 1992d61182..22f6c7eefd 100644
--- a/drivers/mmc/dw_mmc.c
+++ b/drivers/mmc/dw_mmc.c
@@ -13,6 +13,7 @@ 
 #include <mmc.h>
 #include <dwmmc.h>
 #include <wait_bit.h>
+#include <power/regulator.h>
 
 #define PAGE_SIZE 4096
 
@@ -493,6 +494,21 @@  static int dwmci_set_ios(struct mmc *mmc)
 	if (host->clksel)
 		host->clksel(host);
 
+#if CONFIG_IS_ENABLED(DM_REGULATOR)
+	if (mmc->vqmmc_supply) {
+		int ret;
+
+		if (mmc->signal_voltage == MMC_SIGNAL_VOLTAGE_180)
+			regulator_set_value(mmc->vqmmc_supply, 1800000);
+		else
+			regulator_set_value(mmc->vqmmc_supply, 3300000);
+
+		ret = regulator_set_enable_if_allowed(mmc->vqmmc_supply, true);
+		if (ret)
+			return ret;
+	}
+#endif
+
 	return 0;
 }