diff mbox

mmc: dw_mmc: Power on vqmmc in MMC_POWER_ON, not MMC_POWER_UP

Message ID 1421193524-19967-1-git-send-email-dianders@chromium.org (mailing list archive)
State New, archived
Headers show

Commit Message

Doug Anderson Jan. 13, 2015, 11:58 p.m. UTC
If we power up vqmmc in MMC_POWER_ON then we end up turning it on
before mmc_power_up() sets the signal voltage.  That's not so great
since we might be powering it up at the wrong voltage.

Note that this is how Yuvaraj originally coded things up in
<https://patchwork.kernel.org/patch/4401231/> but he changed it on my
suggestion.  Apparently I was wrong.

Reported-by: Alexandru M Stan <amstan@chromium.org>
Signed-off-by: Doug Anderson <dianders@chromium.org>
---
 drivers/mmc/host/dw_mmc.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

Comments

Ulf Hansson Jan. 14, 2015, 11:31 a.m. UTC | #1
On 14 January 2015 at 00:58, Doug Anderson <dianders@chromium.org> wrote:
> If we power up vqmmc in MMC_POWER_ON then we end up turning it on
> before mmc_power_up() sets the signal voltage.  That's not so great
> since we might be powering it up at the wrong voltage.
>
> Note that this is how Yuvaraj originally coded things up in
> <https://patchwork.kernel.org/patch/4401231/> but he changed it on my
> suggestion.  Apparently I was wrong.
>
> Reported-by: Alexandru M Stan <amstan@chromium.org>
> Signed-off-by: Doug Anderson <dianders@chromium.org>

Thanks! Applied for next.

Kind regards
Uffe

> ---
>  drivers/mmc/host/dw_mmc.c | 10 ++++++----
>  1 file changed, 6 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 2e8abc8..4d2e3c2 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -1119,6 +1119,12 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>                                 return;
>                         }
>                 }
> +               set_bit(DW_MMC_CARD_NEED_INIT, &slot->flags);
> +               regs = mci_readl(slot->host, PWREN);
> +               regs |= (1 << slot->id);
> +               mci_writel(slot->host, PWREN, regs);
> +               break;
> +       case MMC_POWER_ON:
>                 if (!IS_ERR(mmc->supply.vqmmc) && !slot->host->vqmmc_enabled) {
>                         ret = regulator_enable(mmc->supply.vqmmc);
>                         if (ret < 0)
> @@ -1127,10 +1133,6 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>                         else
>                                 slot->host->vqmmc_enabled = true;
>                 }
> -               set_bit(DW_MMC_CARD_NEED_INIT, &slot->flags);
> -               regs = mci_readl(slot->host, PWREN);
> -               regs |= (1 << slot->id);
> -               mci_writel(slot->host, PWREN, regs);
>                 break;
>         case MMC_POWER_OFF:
>                 if (!IS_ERR(mmc->supply.vmmc))
> --
> 2.2.0.rc0.207.ga3a616c
>
--
To unsubscribe from this list: send the line "unsubscribe linux-mmc" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 2e8abc8..4d2e3c2 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1119,6 +1119,12 @@  static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 				return;
 			}
 		}
+		set_bit(DW_MMC_CARD_NEED_INIT, &slot->flags);
+		regs = mci_readl(slot->host, PWREN);
+		regs |= (1 << slot->id);
+		mci_writel(slot->host, PWREN, regs);
+		break;
+	case MMC_POWER_ON:
 		if (!IS_ERR(mmc->supply.vqmmc) && !slot->host->vqmmc_enabled) {
 			ret = regulator_enable(mmc->supply.vqmmc);
 			if (ret < 0)
@@ -1127,10 +1133,6 @@  static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 			else
 				slot->host->vqmmc_enabled = true;
 		}
-		set_bit(DW_MMC_CARD_NEED_INIT, &slot->flags);
-		regs = mci_readl(slot->host, PWREN);
-		regs |= (1 << slot->id);
-		mci_writel(slot->host, PWREN, regs);
 		break;
 	case MMC_POWER_OFF:
 		if (!IS_ERR(mmc->supply.vmmc))