mmc: dw_mmc: Don't send clock off command if power is off
PATCH 1/1 mmc: dw_mmc: Don't send clock off command if power is off
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.
--- drivers/mmc/host/dw_mmc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)
drivers/mmc/host/dw_mmc.c +3 -2
@@ -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 );
Signature · 1 line
2.2.0.rc0.207.ga3a616c
Hi Doug,
Quoted 17 lines · Doug Anderson
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 anSDMMC_CMD_UPD_CLKto 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 <[email protected]>--- drivers/mmc/host/dw_mmc.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-)drivers/mmc/host/dw_mmc.c +0
-0
drivers/mmc/host/dw_mmc.c static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) · line 1178
Quoted 9 lines
drivers/mmc/host/dw_mmc.c +3
-2@@ -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?
Quoted 9 lines
drivers/mmc/host/dw_mmc.c +0
-1if (!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
Signature · 2 lines
Regards, Alim
Alim,
Quoted 10 lines · Alim Akhtar
drivers/mmc/host/dw_mmc.c static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) · line 1177
Quoted 7 lines
case
MMC_POWER_OFF:drivers/mmc/host/dw_mmc.c +3
-2-/* 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_enabledis always _true_ when enteringMMC_POWER_OFFcase..right? Is this done for extra protection? Or do you have a case where vqmmc is OFF and driver still callsdw_mci_setup_busfrom 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
Jaehoon Chung
maintainerHi,
Quoted 14 lines · Doug Anderson
Alim,
Quoted 10 lines · Alim Akhtar
drivers/mmc/host/dw_mmc.c static void dw_mci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios) · line 1177
Quoted 7 lines
case
MMC_POWER_OFF:drivers/mmc/host/dw_mmc.c +3
-2-/* 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_enabledis always _true_ when enteringMMC_POWER_OFFcase..right? Is this done for extra protection? Or do you have a case where vqmmc is OFF and driver still callsdw_mci_setup_busfrom here?
Quoted 6 lines
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_OFFwhen 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
Quoted 6 lines
Unfortunately the crash was a very rare one, so I may have to go back to the drawing board here...
-Doug