aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mmc/host/sdhci.c
diff options
context:
space:
mode:
authorPierre Ossman <drzeus@drzeus.cx>2008-04-18 14:41:49 -0400
committerPierre Ossman <drzeus@drzeus.cx>2008-07-15 08:14:39 -0400
commitc9b74c5b8fb807187f6b1db09012828fcd2d7e73 (patch)
treea481a8560c1035e7185566784efff4578055c789 /drivers/mmc/host/sdhci.c
parent50515af207d410c9f228380e529c56f43c3de0bd (diff)
sdhci: don't check block count for progress
The specification is insufficiently strict when it comes to how the hardware should update the block count register, making it useless for checking transfer progress. Signed-off-by: Pierre Ossman <drzeus@drzeus.cx>
Diffstat (limited to 'drivers/mmc/host/sdhci.c')
-rw-r--r--drivers/mmc/host/sdhci.c23
1 files changed, 9 insertions, 14 deletions
diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
index b413aa6c246b..9b06c6042d97 100644
--- a/drivers/mmc/host/sdhci.c
+++ b/drivers/mmc/host/sdhci.c
@@ -567,7 +567,6 @@ static void sdhci_set_transfer_mode(struct sdhci_host *host,
567static void sdhci_finish_data(struct sdhci_host *host) 567static void sdhci_finish_data(struct sdhci_host *host)
568{ 568{
569 struct mmc_data *data; 569 struct mmc_data *data;
570 u16 blocks;
571 570
572 BUG_ON(!host->data); 571 BUG_ON(!host->data);
573 572
@@ -580,20 +579,16 @@ static void sdhci_finish_data(struct sdhci_host *host)
580 } 579 }
581 580
582 /* 581 /*
583 * Controller doesn't count down when in single block mode. 582 * The specification states that the block count register must
583 * be updated, but it does not specify at what point in the
584 * data flow. That makes the register entirely useless to read
585 * back so we have to assume that nothing made it to the card
586 * in the event of an error.
584 */ 587 */
585 if (data->blocks == 1) 588 if (data->error)
586 blocks = (data->error == 0) ? 0 : 1; 589 data->bytes_xfered = 0;
587 else 590 else
588 blocks = readw(host->ioaddr + SDHCI_BLOCK_COUNT); 591 data->bytes_xfered = data->blksz * data->blocks;
589 data->bytes_xfered = data->blksz * (data->blocks - blocks);
590
591 if (!data->error && blocks) {
592 printk(KERN_ERR "%s: Controller signalled completion even "
593 "though there were blocks left.\n",
594 mmc_hostname(host->mmc));
595 data->error = -EIO;
596 }
597 592
598 if (data->stop) { 593 if (data->stop) {
599 /* 594 /*
@@ -1466,7 +1461,7 @@ static int __devinit sdhci_probe_slot(struct pci_dev *pdev, int slot)
1466 mmc->ops = &sdhci_ops; 1461 mmc->ops = &sdhci_ops;
1467 mmc->f_min = host->max_clk / 256; 1462 mmc->f_min = host->max_clk / 256;
1468 mmc->f_max = host->max_clk; 1463 mmc->f_max = host->max_clk;
1469 mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_MULTIWRITE | MMC_CAP_SDIO_IRQ; 1464 mmc->caps = MMC_CAP_4_BIT_DATA | MMC_CAP_SDIO_IRQ;
1470 1465
1471 if (caps & SDHCI_CAN_DO_HISPD) 1466 if (caps & SDHCI_CAN_DO_HISPD)
1472 mmc->caps |= MMC_CAP_SD_HIGHSPEED; 1467 mmc->caps |= MMC_CAP_SD_HIGHSPEED;