All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] mmc: dw_mmc: Don't send clock off command if power is off
@ 2015-03-20 18:00 ` Doug Anderson
  0 siblings, 0 replies; 11+ messages in thread
From: Doug Anderson @ 2015-03-20 18:00 UTC (permalink / raw)
  To: Jaehoon Chung, Seungwon Jeon, Ulf Hansson
  Cc: Alim Akhtar, Sonny Rao, Andrew Bresticker, Heiko Stuebner,
	Addy Ke, Alexandru Stan, javier.martinez, linux-arm-kernel,
	linux-rockchip, Doug Anderson, chris, linux-mmc, linux-kernel

We've already seen that it causes failures if we try to send the
"SDMMC_CMD_UPD_CLK" command when power is off to the system.  Here's
another case where we were doing it: we were sending an
SDMMC_CMD_UPD_CLK to set the clock to 0 when the card was already
powered off and the clock was already at 0.  Let's avoid that command
and avoid problems.

Signed-off-by: Doug Anderson <dianders@chromium.org>
---
 drivers/mmc/host/dw_mmc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 47dfd0e..aeec698 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1172,8 +1172,9 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 
 		break;
 	case MMC_POWER_OFF:
-		/* Turn clock off before power goes down */
-		dw_mci_setup_bus(slot, false);
+		/* Turn clock off before power goes down; only if powered */
+		if (slot->host->vqmmc_enabled)
+			dw_mci_setup_bus(slot, false);
 
 		if (!IS_ERR(mmc->supply.vmmc))
 			mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);
-- 
2.2.0.rc0.207.ga3a616c


^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [PATCH] mmc: dw_mmc: Don't send clock off command if power is off
@ 2015-03-20 18:00 ` Doug Anderson
  0 siblings, 0 replies; 11+ messages in thread
From: Doug Anderson @ 2015-03-20 18:00 UTC (permalink / raw)
  To: linux-arm-kernel

We've already seen that it causes failures if we try to send the
"SDMMC_CMD_UPD_CLK" command when power is off to the system.  Here's
another case where we were doing it: we were sending an
SDMMC_CMD_UPD_CLK to set the clock to 0 when the card was already
powered off and the clock was already at 0.  Let's avoid that command
and avoid problems.

Signed-off-by: Doug Anderson <dianders@chromium.org>
---
 drivers/mmc/host/dw_mmc.c | 5 +++--
 1 file changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
index 47dfd0e..aeec698 100644
--- a/drivers/mmc/host/dw_mmc.c
+++ b/drivers/mmc/host/dw_mmc.c
@@ -1172,8 +1172,9 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 
 		break;
 	case MMC_POWER_OFF:
-		/* Turn clock off before power goes down */
-		dw_mci_setup_bus(slot, false);
+		/* Turn clock off before power goes down; only if powered */
+		if (slot->host->vqmmc_enabled)
+			dw_mci_setup_bus(slot, false);
 
 		if (!IS_ERR(mmc->supply.vmmc))
 			mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);
-- 
2.2.0.rc0.207.ga3a616c

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* Re: [PATCH] mmc: dw_mmc: Don't send clock off command if power is off
  2015-03-20 18:00 ` Doug Anderson
  (?)
@ 2015-03-22 12:16   ` Alim Akhtar
  -1 siblings, 0 replies; 11+ messages in thread
From: Alim Akhtar @ 2015-03-22 12:16 UTC (permalink / raw)
  To: Doug Anderson
  Cc: Jaehoon Chung, Seungwon Jeon, Ulf Hansson, Alim Akhtar,
	Sonny Rao, Andrew Bresticker, Heiko Stuebner, Addy Ke,
	Alexandru Stan, Javier Martinez Canillas, linux-arm-kernel,
	open list:ARM/Rockchip SoC...,
	Chris Ball, linux-mmc, linux-kernel

Hi Doug,

On Fri, Mar 20, 2015 at 11:30 PM, Doug Anderson <dianders@chromium.org> wrote:
> We've already seen that it causes failures if we try to send the
> "SDMMC_CMD_UPD_CLK" command when power is off to the system.  Here's
> another case where we were doing it: we were sending an
> SDMMC_CMD_UPD_CLK to set the clock to 0 when the card was already
> powered off and the clock was already at 0.  Let's avoid that command
> and avoid problems.
>
> Signed-off-by: Doug Anderson <dianders@chromium.org>
> ---
>  drivers/mmc/host/dw_mmc.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 47dfd0e..aeec698 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -1172,8 +1172,9 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>
>                 break;
>         case MMC_POWER_OFF:
> -               /* Turn clock off before power goes down */
> -               dw_mci_setup_bus(slot, false);
> +               /* Turn clock off before power goes down; only if powered */
> +               if (slot->host->vqmmc_enabled)
> +                       dw_mci_setup_bus(slot, false);
>
vqmmc_enabled is always _true_ when entering MMC_POWER_OFF case..right?
Is this done for extra protection? Or do you have a case where vqmmc
is OFF and driver still calls dw_mci_setup_bus from here?

>                 if (!IS_ERR(mmc->supply.vmmc))
>                         mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);
> --
> 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



-- 
Regards,
Alim

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] mmc: dw_mmc: Don't send clock off command if power is off
@ 2015-03-22 12:16   ` Alim Akhtar
  0 siblings, 0 replies; 11+ messages in thread
From: Alim Akhtar @ 2015-03-22 12:16 UTC (permalink / raw)
  To: Doug Anderson
  Cc: Jaehoon Chung, Seungwon Jeon, Ulf Hansson, Alim Akhtar,
	Sonny Rao, Andrew Bresticker, Heiko Stuebner, Addy Ke,
	Alexandru Stan, Javier Martinez Canillas, linux-arm-kernel,
	open list:ARM/Rockchip SoC...,
	Chris Ball, linux-mmc, linux-kernel

Hi Doug,

On Fri, Mar 20, 2015 at 11:30 PM, Doug Anderson <dianders@chromium.org> wrote:
> We've already seen that it causes failures if we try to send the
> "SDMMC_CMD_UPD_CLK" command when power is off to the system.  Here's
> another case where we were doing it: we were sending an
> SDMMC_CMD_UPD_CLK to set the clock to 0 when the card was already
> powered off and the clock was already at 0.  Let's avoid that command
> and avoid problems.
>
> Signed-off-by: Doug Anderson <dianders@chromium.org>
> ---
>  drivers/mmc/host/dw_mmc.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 47dfd0e..aeec698 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -1172,8 +1172,9 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>
>                 break;
>         case MMC_POWER_OFF:
> -               /* Turn clock off before power goes down */
> -               dw_mci_setup_bus(slot, false);
> +               /* Turn clock off before power goes down; only if powered */
> +               if (slot->host->vqmmc_enabled)
> +                       dw_mci_setup_bus(slot, false);
>
vqmmc_enabled is always _true_ when entering MMC_POWER_OFF case..right?
Is this done for extra protection? Or do you have a case where vqmmc
is OFF and driver still calls dw_mci_setup_bus from here?

>                 if (!IS_ERR(mmc->supply.vmmc))
>                         mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);
> --
> 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



-- 
Regards,
Alim

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] mmc: dw_mmc: Don't send clock off command if power is off
@ 2015-03-22 12:16   ` Alim Akhtar
  0 siblings, 0 replies; 11+ messages in thread
From: Alim Akhtar @ 2015-03-22 12:16 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Doug,

On Fri, Mar 20, 2015 at 11:30 PM, Doug Anderson <dianders@chromium.org> wrote:
> We've already seen that it causes failures if we try to send the
> "SDMMC_CMD_UPD_CLK" command when power is off to the system.  Here's
> another case where we were doing it: we were sending an
> SDMMC_CMD_UPD_CLK to set the clock to 0 when the card was already
> powered off and the clock was already at 0.  Let's avoid that command
> and avoid problems.
>
> Signed-off-by: Doug Anderson <dianders@chromium.org>
> ---
>  drivers/mmc/host/dw_mmc.c | 5 +++--
>  1 file changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c
> index 47dfd0e..aeec698 100644
> --- a/drivers/mmc/host/dw_mmc.c
> +++ b/drivers/mmc/host/dw_mmc.c
> @@ -1172,8 +1172,9 @@ static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
>
>                 break;
>         case MMC_POWER_OFF:
> -               /* Turn clock off before power goes down */
> -               dw_mci_setup_bus(slot, false);
> +               /* Turn clock off before power goes down; only if powered */
> +               if (slot->host->vqmmc_enabled)
> +                       dw_mci_setup_bus(slot, false);
>
vqmmc_enabled is always _true_ when entering MMC_POWER_OFF case..right?
Is this done for extra protection? Or do you have a case where vqmmc
is OFF and driver still calls dw_mci_setup_bus from here?

>                 if (!IS_ERR(mmc->supply.vmmc))
>                         mmc_regulator_set_ocr(mmc, mmc->supply.vmmc, 0);
> --
> 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 at vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html



-- 
Regards,
Alim

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] mmc: dw_mmc: Don't send clock off command if power is off
  2015-03-22 12:16   ` Alim Akhtar
  (?)
@ 2015-03-22 21:59     ` Doug Anderson
  -1 siblings, 0 replies; 11+ messages in thread
From: Doug Anderson @ 2015-03-22 21:59 UTC (permalink / raw)
  To: Alim Akhtar
  Cc: Jaehoon Chung, Seungwon Jeon, Ulf Hansson, Alim Akhtar,
	Sonny Rao, Andrew Bresticker, Heiko Stuebner, Addy Ke,
	Alexandru Stan, Javier Martinez Canillas, linux-arm-kernel,
	open list:ARM/Rockchip SoC...,
	Chris Ball, linux-mmc, linux-kernel

Alim,

On Sun, Mar 22, 2015 at 5:16 AM, Alim Akhtar <alim.akhtar@gmail.com> wrote:
>>         case MMC_POWER_OFF:
>> -               /* Turn clock off before power goes down */
>> -               dw_mci_setup_bus(slot, false);
>> +               /* Turn clock off before power goes down; only if powered */
>> +               if (slot->host->vqmmc_enabled)
>> +                       dw_mci_setup_bus(slot, false);
>>
> vqmmc_enabled is always _true_ when entering MMC_POWER_OFF case..right?
> Is this done for extra protection? Or do you have a case where vqmmc
> is OFF and driver still calls dw_mci_setup_bus from here?

Hmm.  I know I got it into the debugger in at least one reboot case
where it was failing to turn the clock off.  I thought I confirmed it
was the core trying to call MMC_POWER_OFF when the power was already
off, but now I'm less certain.  I looked back at my debug session and
I don't see where I got that evidence.  :-/  Certainly if I put a
printout here right now I can't see my code making a difference.

Unfortunately the crash was a very rare one, so I may have to go back
to the drawing board here...

-Doug

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] mmc: dw_mmc: Don't send clock off command if power is off
@ 2015-03-22 21:59     ` Doug Anderson
  0 siblings, 0 replies; 11+ messages in thread
From: Doug Anderson @ 2015-03-22 21:59 UTC (permalink / raw)
  To: Alim Akhtar
  Cc: Jaehoon Chung, Seungwon Jeon, Ulf Hansson, Alim Akhtar,
	Sonny Rao, Andrew Bresticker, Heiko Stuebner, Addy Ke,
	Alexandru Stan, Javier Martinez Canillas, linux-arm-kernel,
	open list:ARM/Rockchip SoC...,
	Chris Ball, linux-mmc, linux-kernel

Alim,

On Sun, Mar 22, 2015 at 5:16 AM, Alim Akhtar <alim.akhtar@gmail.com> wrote:
>>         case MMC_POWER_OFF:
>> -               /* Turn clock off before power goes down */
>> -               dw_mci_setup_bus(slot, false);
>> +               /* Turn clock off before power goes down; only if powered */
>> +               if (slot->host->vqmmc_enabled)
>> +                       dw_mci_setup_bus(slot, false);
>>
> vqmmc_enabled is always _true_ when entering MMC_POWER_OFF case..right?
> Is this done for extra protection? Or do you have a case where vqmmc
> is OFF and driver still calls dw_mci_setup_bus from here?

Hmm.  I know I got it into the debugger in at least one reboot case
where it was failing to turn the clock off.  I thought I confirmed it
was the core trying to call MMC_POWER_OFF when the power was already
off, but now I'm less certain.  I looked back at my debug session and
I don't see where I got that evidence.  :-/  Certainly if I put a
printout here right now I can't see my code making a difference.

Unfortunately the crash was a very rare one, so I may have to go back
to the drawing board here...

-Doug

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] mmc: dw_mmc: Don't send clock off command if power is off
@ 2015-03-22 21:59     ` Doug Anderson
  0 siblings, 0 replies; 11+ messages in thread
From: Doug Anderson @ 2015-03-22 21:59 UTC (permalink / raw)
  To: linux-arm-kernel

Alim,

On Sun, Mar 22, 2015 at 5:16 AM, Alim Akhtar <alim.akhtar@gmail.com> wrote:
>>         case MMC_POWER_OFF:
>> -               /* Turn clock off before power goes down */
>> -               dw_mci_setup_bus(slot, false);
>> +               /* Turn clock off before power goes down; only if powered */
>> +               if (slot->host->vqmmc_enabled)
>> +                       dw_mci_setup_bus(slot, false);
>>
> vqmmc_enabled is always _true_ when entering MMC_POWER_OFF case..right?
> Is this done for extra protection? Or do you have a case where vqmmc
> is OFF and driver still calls dw_mci_setup_bus from here?

Hmm.  I know I got it into the debugger in at least one reboot case
where it was failing to turn the clock off.  I thought I confirmed it
was the core trying to call MMC_POWER_OFF when the power was already
off, but now I'm less certain.  I looked back at my debug session and
I don't see where I got that evidence.  :-/  Certainly if I put a
printout here right now I can't see my code making a difference.

Unfortunately the crash was a very rare one, so I may have to go back
to the drawing board here...

-Doug

^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] mmc: dw_mmc: Don't send clock off command if power is off
  2015-03-22 21:59     ` Doug Anderson
  (?)
@ 2015-03-27  7:21       ` Jaehoon Chung
  -1 siblings, 0 replies; 11+ messages in thread
From: Jaehoon Chung @ 2015-03-27  7:21 UTC (permalink / raw)
  To: Doug Anderson, Alim Akhtar
  Cc: Seungwon Jeon, Ulf Hansson, Alim Akhtar, Sonny Rao,
	Andrew Bresticker, Heiko Stuebner, Addy Ke, Alexandru Stan,
	Javier Martinez Canillas, linux-arm-kernel,
	open list:ARM/Rockchip SoC...,
	Chris Ball, linux-mmc, linux-kernel

Hi,

On 03/23/2015 06:59 AM, Doug Anderson wrote:
> Alim,
> 
> On Sun, Mar 22, 2015 at 5:16 AM, Alim Akhtar <alim.akhtar@gmail.com> wrote:
>>>         case MMC_POWER_OFF:
>>> -               /* Turn clock off before power goes down */
>>> -               dw_mci_setup_bus(slot, false);
>>> +               /* Turn clock off before power goes down; only if powered */
>>> +               if (slot->host->vqmmc_enabled)
>>> +                       dw_mci_setup_bus(slot, false);
>>>
>> vqmmc_enabled is always _true_ when entering MMC_POWER_OFF case..right?
>> Is this done for extra protection? Or do you have a case where vqmmc
>> is OFF and driver still calls dw_mci_setup_bus from here?
> 
> Hmm.  I know I got it into the debugger in at least one reboot case
> where it was failing to turn the clock off.  I thought I confirmed it
> was the core trying to call MMC_POWER_OFF when the power was already
> off, but now I'm less certain.  I looked back at my debug session and
> I don't see where I got that evidence.  :-/  Certainly if I put a
> printout here right now I can't see my code making a difference.

I'm not sure this is really needs...and i can't find any error case..

Best Regards,
Jaehoon Chung
> 
> Unfortunately the crash was a very rare one, so I may have to go back
> to the drawing board here...
> 
> -Doug
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* Re: [PATCH] mmc: dw_mmc: Don't send clock off command if power is off
@ 2015-03-27  7:21       ` Jaehoon Chung
  0 siblings, 0 replies; 11+ messages in thread
From: Jaehoon Chung @ 2015-03-27  7:21 UTC (permalink / raw)
  To: Doug Anderson, Alim Akhtar
  Cc: Seungwon Jeon, Ulf Hansson, Alim Akhtar, Sonny Rao,
	Andrew Bresticker, Heiko Stuebner, Addy Ke, Alexandru Stan,
	Javier Martinez Canillas, linux-arm-kernel,
	open list:ARM/Rockchip SoC...,
	Chris Ball, linux-mmc, linux-kernel

Hi,

On 03/23/2015 06:59 AM, Doug Anderson wrote:
> Alim,
> 
> On Sun, Mar 22, 2015 at 5:16 AM, Alim Akhtar <alim.akhtar@gmail.com> wrote:
>>>         case MMC_POWER_OFF:
>>> -               /* Turn clock off before power goes down */
>>> -               dw_mci_setup_bus(slot, false);
>>> +               /* Turn clock off before power goes down; only if powered */
>>> +               if (slot->host->vqmmc_enabled)
>>> +                       dw_mci_setup_bus(slot, false);
>>>
>> vqmmc_enabled is always _true_ when entering MMC_POWER_OFF case..right?
>> Is this done for extra protection? Or do you have a case where vqmmc
>> is OFF and driver still calls dw_mci_setup_bus from here?
> 
> Hmm.  I know I got it into the debugger in at least one reboot case
> where it was failing to turn the clock off.  I thought I confirmed it
> was the core trying to call MMC_POWER_OFF when the power was already
> off, but now I'm less certain.  I looked back at my debug session and
> I don't see where I got that evidence.  :-/  Certainly if I put a
> printout here right now I can't see my code making a difference.

I'm not sure this is really needs...and i can't find any error case..

Best Regards,
Jaehoon Chung
> 
> Unfortunately the crash was a very rare one, so I may have to go back
> to the drawing board here...
> 
> -Doug
> 


^ permalink raw reply	[flat|nested] 11+ messages in thread

* [PATCH] mmc: dw_mmc: Don't send clock off command if power is off
@ 2015-03-27  7:21       ` Jaehoon Chung
  0 siblings, 0 replies; 11+ messages in thread
From: Jaehoon Chung @ 2015-03-27  7:21 UTC (permalink / raw)
  To: linux-arm-kernel

Hi,

On 03/23/2015 06:59 AM, Doug Anderson wrote:
> Alim,
> 
> On Sun, Mar 22, 2015 at 5:16 AM, Alim Akhtar <alim.akhtar@gmail.com> wrote:
>>>         case MMC_POWER_OFF:
>>> -               /* Turn clock off before power goes down */
>>> -               dw_mci_setup_bus(slot, false);
>>> +               /* Turn clock off before power goes down; only if powered */
>>> +               if (slot->host->vqmmc_enabled)
>>> +                       dw_mci_setup_bus(slot, false);
>>>
>> vqmmc_enabled is always _true_ when entering MMC_POWER_OFF case..right?
>> Is this done for extra protection? Or do you have a case where vqmmc
>> is OFF and driver still calls dw_mci_setup_bus from here?
> 
> Hmm.  I know I got it into the debugger in at least one reboot case
> where it was failing to turn the clock off.  I thought I confirmed it
> was the core trying to call MMC_POWER_OFF when the power was already
> off, but now I'm less certain.  I looked back at my debug session and
> I don't see where I got that evidence.  :-/  Certainly if I put a
> printout here right now I can't see my code making a difference.

I'm not sure this is really needs...and i can't find any error case..

Best Regards,
Jaehoon Chung
> 
> Unfortunately the crash was a very rare one, so I may have to go back
> to the drawing board here...
> 
> -Doug
> 

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-03-27  7:21 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-20 18:00 [PATCH] mmc: dw_mmc: Don't send clock off command if power is off Doug Anderson
2015-03-20 18:00 ` Doug Anderson
2015-03-22 12:16 ` Alim Akhtar
2015-03-22 12:16   ` Alim Akhtar
2015-03-22 12:16   ` Alim Akhtar
2015-03-22 21:59   ` Doug Anderson
2015-03-22 21:59     ` Doug Anderson
2015-03-22 21:59     ` Doug Anderson
2015-03-27  7:21     ` Jaehoon Chung
2015-03-27  7:21       ` Jaehoon Chung
2015-03-27  7:21       ` Jaehoon Chung

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.