Skip to content

Commit 547d57b

Browse files
committed
sdhci-bcm2708: replace busy-waiting DMA sync by Auto-CMD12
Busy-waiting for the end of a DMA request is very bad, especially because many SD cards are very slow. It's a much better idea to delegate this waiting to the SDHCI controller, which can do this easily with the Auto-CMD12 feature. This seems to be available and work just fine on the Arasan controller, so enable it, and scrap the sync-after-DMA code.
1 parent 1ed1c55 commit 547d57b

File tree

1 file changed

+2
-30
lines changed

1 file changed

+2
-30
lines changed

drivers/mmc/host/sdhci-bcm2708.c

Lines changed: 2 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
#undef CONFIG_MMC_SDHCI_BCM2708_DMA
5353
#define CONFIG_MMC_SDHCI_BCM2708_DMA y
5454

55-
#define USE_SYNC_AFTER_DMA
5655
#ifdef CONFIG_MMC_SDHCI_BCM2708_DMA
5756
/* #define CHECK_DMA_USE */
5857
#endif
@@ -832,34 +831,6 @@ static void sdhci_bcm2708_dma_complete_irq(struct sdhci_host *host,
832831
SDHCI_INT_SPACE_AVAIL);
833832
}
834833
} else {
835-
#ifdef USE_SYNC_AFTER_DMA
836-
/* On the Arasan controller the stop command (which will be
837-
scheduled after this completes) does not seem to work
838-
properly if we allow it to be issued when we are
839-
transferring data to/from the SD card.
840-
We get CRC and DEND errors unless we wait for
841-
the SD controller to finish reading/writing to the card. */
842-
u32 state_mask;
843-
int timeout=5000;
844-
845-
DBG("PDMA over - sync card\n");
846-
if (data->flags & MMC_DATA_READ)
847-
state_mask = SDHCI_DOING_READ;
848-
else
849-
state_mask = SDHCI_DOING_WRITE;
850-
851-
while (0 != (sdhci_bcm2708_raw_readl(host, SDHCI_PRESENT_STATE)
852-
& state_mask) && --timeout > 0)
853-
{
854-
udelay(30);
855-
continue;
856-
}
857-
if (timeout <= 0)
858-
printk(KERN_ERR"%s: final %s to SD card still "
859-
"running\n",
860-
mmc_hostname(host->mmc),
861-
data->flags & MMC_DATA_READ? "read": "write");
862-
#endif
863834
if (host_priv->complete) {
864835
(*host_priv->complete)(host);
865836
DBG("PDMA %s complete\n",
@@ -1315,7 +1286,8 @@ static int __devinit sdhci_bcm2708_probe(struct platform_device *pdev)
13151286
SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
13161287
SDHCI_QUIRK_BROKEN_TIMEOUT_VAL |
13171288
SDHCI_QUIRK_MISSING_CAPS |
1318-
SDHCI_QUIRK_NO_HISPD_BIT;
1289+
SDHCI_QUIRK_NO_HISPD_BIT |
1290+
SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12;
13191291

13201292
#ifdef CONFIG_MMC_SDHCI_BCM2708_DMA
13211293
host->flags = SDHCI_USE_PLATDMA;

0 commit comments

Comments
 (0)