Re: [PATCH 2/2] mmc: dw_mmc: Give a good reset after we give power

2015-02-25 Thread Javier Martinez Canillas
Hello Doug,

On 02/20/2015 07:57 PM, Doug Anderson wrote:
> We should give dw_mmc a good reset after we apply power.  On some
> boards vqmmc may actually be connected to the IP block in the SoC so
> it's good to reset after power comes in.
> 
> Without this we sometimes see failures enumerating cards on rk3288.
> 
> Signed-off-by: Doug Anderson 

On an Exynos5250 Snow, Exynos5420 Peach Pit and Exynos5800 Peach Pi:

Tested-by: Javier Martinez Canillas 

Best regards,
Javier

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] mmc: dw_mmc: Give a good reset after we give power

2015-02-25 Thread Jaehoon Chung
Dear, Doug.

Looks good to me. Thanks!

Acked-by: Jaehoon Chung 

Best Regards,
Jaehoon Chung

On 02/21/2015 03:57 AM, Doug Anderson wrote:
> We should give dw_mmc a good reset after we apply power.  On some
> boards vqmmc may actually be connected to the IP block in the SoC so
> it's good to reset after power comes in.
> 
> Without this we sometimes see failures enumerating cards on rk3288.
> 
> Signed-off-by: Doug Anderson 
> ---
>  drivers/mmc/host/dw_mmc.c | 27 ++-
>  1 file changed, 18 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 43fcae1..6a712ae 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -1119,13 +1119,23 @@ static void dw_mci_set_ios(struct mmc_host *mmc, 
> struct mmc_ios *ios)
>   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)
> - dev_err(slot->host->dev,
> - "failed to enable vqmmc regulator\n");
> - else
> + if (!slot->host->vqmmc_enabled) {
> + if (!IS_ERR(mmc->supply.vqmmc)) {
> + ret = regulator_enable(mmc->supply.vqmmc);
> + if (ret < 0)
> + dev_err(slot->host->dev,
> + "failed to enable vqmmc\n");
> + else
> + slot->host->vqmmc_enabled = true;
> +
> + } else {
> + /* Keep track so we don't reset again */
>   slot->host->vqmmc_enabled = true;
> + }
> +
> + /* Reset our state machine after powering on */
> + dw_mci_ctrl_reset(slot->host,
> +   SDMMC_CTRL_ALL_RESET_FLAGS);
>   }
>  
>   /* Adjust clock / bus width after power is up */
> @@ -1139,10 +1149,9 @@ static void dw_mci_set_ios(struct mmc_host *mmc, 
> struct mmc_ios *ios)
>   if (!IS_ERR(mmc->supply.vmmc))
>   mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);
>  
> - if (!IS_ERR(mmc->supply.vqmmc) && slot->host->vqmmc_enabled) {
> + if (!IS_ERR(mmc->supply.vqmmc) && slot->host->vqmmc_enabled)
>   regulator_disable(mmc->supply.vqmmc);
> - slot->host->vqmmc_enabled = false;
> - }
> + slot->host->vqmmc_enabled = false;
>  
>   regs = mci_readl(slot->host, PWREN);
>   regs &= ~(1 << slot->id);
> 

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] mmc: dw_mmc: Give a good reset after we give power

2015-02-25 Thread Javier Martinez Canillas
Hello Doug,

On 02/20/2015 07:57 PM, Doug Anderson wrote:
 We should give dw_mmc a good reset after we apply power.  On some
 boards vqmmc may actually be connected to the IP block in the SoC so
 it's good to reset after power comes in.
 
 Without this we sometimes see failures enumerating cards on rk3288.
 
 Signed-off-by: Doug Anderson diand...@chromium.org

On an Exynos5250 Snow, Exynos5420 Peach Pit and Exynos5800 Peach Pi:

Tested-by: Javier Martinez Canillas javier.marti...@collabora.co.uk

Best regards,
Javier

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


Re: [PATCH 2/2] mmc: dw_mmc: Give a good reset after we give power

2015-02-25 Thread Jaehoon Chung
Dear, Doug.

Looks good to me. Thanks!

Acked-by: Jaehoon Chung jh80.ch...@samsung.com

Best Regards,
Jaehoon Chung

On 02/21/2015 03:57 AM, Doug Anderson wrote:
 We should give dw_mmc a good reset after we apply power.  On some
 boards vqmmc may actually be connected to the IP block in the SoC so
 it's good to reset after power comes in.
 
 Without this we sometimes see failures enumerating cards on rk3288.
 
 Signed-off-by: Doug Anderson diand...@chromium.org
 ---
  drivers/mmc/host/dw_mmc.c | 27 ++-
  1 file changed, 18 insertions(+), 9 deletions(-)
 
 diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
 index 43fcae1..6a712ae 100644
 --- a/drivers/mmc/host/dw_mmc.c
 +++ b/drivers/mmc/host/dw_mmc.c
 @@ -1119,13 +1119,23 @@ static void dw_mci_set_ios(struct mmc_host *mmc, 
 struct mmc_ios *ios)
   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)
 - dev_err(slot-host-dev,
 - failed to enable vqmmc regulator\n);
 - else
 + if (!slot-host-vqmmc_enabled) {
 + if (!IS_ERR(mmc-supply.vqmmc)) {
 + ret = regulator_enable(mmc-supply.vqmmc);
 + if (ret  0)
 + dev_err(slot-host-dev,
 + failed to enable vqmmc\n);
 + else
 + slot-host-vqmmc_enabled = true;
 +
 + } else {
 + /* Keep track so we don't reset again */
   slot-host-vqmmc_enabled = true;
 + }
 +
 + /* Reset our state machine after powering on */
 + dw_mci_ctrl_reset(slot-host,
 +   SDMMC_CTRL_ALL_RESET_FLAGS);
   }
  
   /* Adjust clock / bus width after power is up */
 @@ -1139,10 +1149,9 @@ static void dw_mci_set_ios(struct mmc_host *mmc, 
 struct mmc_ios *ios)
   if (!IS_ERR(mmc-supply.vmmc))
   mmc_regulator_set_ocr(mmc, mmc-supply.vmmc, 0);
  
 - if (!IS_ERR(mmc-supply.vqmmc)  slot-host-vqmmc_enabled) {
 + if (!IS_ERR(mmc-supply.vqmmc)  slot-host-vqmmc_enabled)
   regulator_disable(mmc-supply.vqmmc);
 - slot-host-vqmmc_enabled = false;
 - }
 + slot-host-vqmmc_enabled = false;
  
   regs = mci_readl(slot-host, PWREN);
   regs = ~(1  slot-id);
 

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] mmc: dw_mmc: Give a good reset after we give power

2015-02-20 Thread Doug Anderson
We should give dw_mmc a good reset after we apply power.  On some
boards vqmmc may actually be connected to the IP block in the SoC so
it's good to reset after power comes in.

Without this we sometimes see failures enumerating cards on rk3288.

Signed-off-by: Doug Anderson 
---
 drivers/mmc/host/dw_mmc.c | 27 ++-
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 43fcae1..6a712ae 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1119,13 +1119,23 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct 
mmc_ios *ios)
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)
-   dev_err(slot->host->dev,
-   "failed to enable vqmmc regulator\n");
-   else
+   if (!slot->host->vqmmc_enabled) {
+   if (!IS_ERR(mmc->supply.vqmmc)) {
+   ret = regulator_enable(mmc->supply.vqmmc);
+   if (ret < 0)
+   dev_err(slot->host->dev,
+   "failed to enable vqmmc\n");
+   else
+   slot->host->vqmmc_enabled = true;
+
+   } else {
+   /* Keep track so we don't reset again */
slot->host->vqmmc_enabled = true;
+   }
+
+   /* Reset our state machine after powering on */
+   dw_mci_ctrl_reset(slot->host,
+ SDMMC_CTRL_ALL_RESET_FLAGS);
}
 
/* Adjust clock / bus width after power is up */
@@ -1139,10 +1149,9 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct 
mmc_ios *ios)
if (!IS_ERR(mmc->supply.vmmc))
mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);
 
-   if (!IS_ERR(mmc->supply.vqmmc) && slot->host->vqmmc_enabled) {
+   if (!IS_ERR(mmc->supply.vqmmc) && slot->host->vqmmc_enabled)
regulator_disable(mmc->supply.vqmmc);
-   slot->host->vqmmc_enabled = false;
-   }
+   slot->host->vqmmc_enabled = false;
 
regs = mci_readl(slot->host, PWREN);
regs &= ~(1 << slot->id);
-- 
2.2.0.rc0.207.ga3a616c

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/


[PATCH 2/2] mmc: dw_mmc: Give a good reset after we give power

2015-02-20 Thread Doug Anderson
We should give dw_mmc a good reset after we apply power.  On some
boards vqmmc may actually be connected to the IP block in the SoC so
it's good to reset after power comes in.

Without this we sometimes see failures enumerating cards on rk3288.

Signed-off-by: Doug Anderson diand...@chromium.org
---
 drivers/mmc/host/dw_mmc.c | 27 ++-
 1 file changed, 18 insertions(+), 9 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 43fcae1..6a712ae 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1119,13 +1119,23 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct 
mmc_ios *ios)
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)
-   dev_err(slot-host-dev,
-   failed to enable vqmmc regulator\n);
-   else
+   if (!slot-host-vqmmc_enabled) {
+   if (!IS_ERR(mmc-supply.vqmmc)) {
+   ret = regulator_enable(mmc-supply.vqmmc);
+   if (ret  0)
+   dev_err(slot-host-dev,
+   failed to enable vqmmc\n);
+   else
+   slot-host-vqmmc_enabled = true;
+
+   } else {
+   /* Keep track so we don't reset again */
slot-host-vqmmc_enabled = true;
+   }
+
+   /* Reset our state machine after powering on */
+   dw_mci_ctrl_reset(slot-host,
+ SDMMC_CTRL_ALL_RESET_FLAGS);
}
 
/* Adjust clock / bus width after power is up */
@@ -1139,10 +1149,9 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct 
mmc_ios *ios)
if (!IS_ERR(mmc-supply.vmmc))
mmc_regulator_set_ocr(mmc, mmc-supply.vmmc, 0);
 
-   if (!IS_ERR(mmc-supply.vqmmc)  slot-host-vqmmc_enabled) {
+   if (!IS_ERR(mmc-supply.vqmmc)  slot-host-vqmmc_enabled)
regulator_disable(mmc-supply.vqmmc);
-   slot-host-vqmmc_enabled = false;
-   }
+   slot-host-vqmmc_enabled = false;
 
regs = mci_readl(slot-host, PWREN);
regs = ~(1  slot-id);
-- 
2.2.0.rc0.207.ga3a616c

--
To unsubscribe from this list: send the line unsubscribe linux-kernel in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/