mmc: core: Attempt to flush cache before reset
PATCH 1/1 mmc: core: Attempt to flush cache before reset
CMD0 or hardware reset may invalidate the cache, so it needs to be flushed before reset.
In the case of recovery, we can't expect flushing the cache to work always, but have a go and ignore errors.
--- drivers/mmc/core/core.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/mmc/core/core.c +6 -0
@@ -2453,6 +2453,12 @@ int mmc_hw_reset(struct mmc_host *host)return -EOPNOTSUPP ; } +/* +* In the case of recovery, we can't expect flushing the cache to work +* always, but we have a go and ignore errors. +*/ +mmc_flush_cache (host->card); + ret = host->bus_ops->reset (host);mmc_bus_put (host);
Signature · 1 line
1.9.1
Quoted 5 lines · Adrian Hunter
CMD0 or hardware reset may invalidate the cache, so it needs to be flushed before reset.
In the case of recovery, we can't expect flushing the cache to work always, but have a go and ignore errors.
Makes sense!
Quoted 11 lines
Signed-off-by Adrian Hunter <[email protected]>--- drivers/mmc/core/core.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/mmc/core/core.c +0
-0
drivers/mmc/core/core.c int mmc_hw_reset(struct mmc_host *host) · line 2461
Quoted 9 lines
drivers/mmc/core/core.c +6
-0@@ -2453,6 +2453,12 @@ int mmc_hw_reset(struct mmc_host *host)return -EOPNOTSUPP ; } +/* +* In the case of recovery, we can't expect flushing the cache to work +* always, but we have a go and ignore errors. +*/ +mmc_flush_cache (host->card); +
I prefer if you move this into mmc_reset() in drivers/mmc/core/mmc.c instead, as it's an mmc specific operation.
Quoted 6 lines
drivers/mmc/core/core.c +0
-1ret = host->bus_ops->reset (host);mmc_bus_put (host); --1.9.1
Kind regards
Uffe
PATCH v2 1/1 mmc: mmc: Attempt to flush cache before reset
CMD0 or hardware reset may invalidate the cache, so it needs to be flushed before reset.
In the case of recovery, we can't expect flushing the cache to work always, but have a go and ignore errors.
---
Changes in V2:
Do flush in mmc_reset() instead of mmc_hw_reset()
drivers/mmc/core/mmc.c | 6 ++++++ 1 file changed, 6 insertions(+)
drivers/mmc/core/mmc.c +6 -0
@@ -1965,6 +1965,12 @@ static int mmc_reset(struct mmc_host *host) {struct mmc_card *card = host->card; +/* +* In the case of recovery, we can't expect flushing the cache to work +* always, but we have a go and ignore errors. +*/ +mmc_flush_cache (host->card); +if ((host->caps &MMC_CAP_HW_RESET ) && host->ops->hw_reset &&mmc_can_reset (card)) {/* If the card accept RST_n signal, send it. */
Signature · 1 line
1.9.1
Ulf Hansson
AppliedRe: [PATCH V2] mmc: mmc: Attempt to flush cache before reset
Quoted 7 lines · Adrian Hunter
CMD0 or hardware reset may invalidate the cache, so it needs to be flushed before reset.
In the case of recovery, we can't expect flushing the cache to work always, but have a go and ignore errors.
Signed-off-by Adrian Hunter <[email protected]>
Thanks, applied for next!
Kind regards
Uffe
Quoted 32 lines
---
Changes in V2:
Do flush in
mmc_reset()instead ofmmc_hw_reset()drivers/mmc/core/mmc.c | 6 ++++++ 1 file changed, 6 insertions(+)drivers/mmc/core/mmc.c +6
-1@@ -1965,6 +1965,12 @@ static int mmc_reset(struct mmc_host *host) {struct mmc_card *card = host->card; +/* +* In the case of recovery, we can't expect flushing the cache to work +* always, but we have a go and ignore errors. +*/ +mmc_flush_cache (host->card); +if ((host->caps &MMC_CAP_HW_RESET ) && host->ops->hw_reset &&mmc_can_reset (card)) {/* If the card accept RST_n signal, send it. */ --1.9.1