Commit 2b061973 authored by Pierre Ossman's avatar Pierre Ossman

sdhci: be more cautious about block count register

The block count register shouldn't be trusted for single block transfers,
so avoid using it completely when calculating transferred bytes.
Signed-off-by: default avatarPierre Ossman <drzeus@drzeus.cx>
parent be760a9d
...@@ -477,8 +477,8 @@ static void sdhci_finish_data(struct sdhci_host *host) ...@@ -477,8 +477,8 @@ static void sdhci_finish_data(struct sdhci_host *host)
/* /*
* Controller doesn't count down when in single block mode. * Controller doesn't count down when in single block mode.
*/ */
if ((data->blocks == 1) && (data->error == MMC_ERR_NONE)) if (data->blocks == 1)
blocks = 0; blocks = (data->error == MMC_ERR_NONE) ? 0 : 1;
else else
blocks = readw(host->ioaddr + SDHCI_BLOCK_COUNT); blocks = readw(host->ioaddr + SDHCI_BLOCK_COUNT);
data->bytes_xfered = data->blksz * (data->blocks - blocks); data->bytes_xfered = data->blksz * (data->blocks - blocks);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment