Permalink
Browse files

Add sync_after_dma module parameter

  • Loading branch information...
1 parent 399a83c commit 8e39b3019b3494305d87b7489820178580369eb7 @popcornmix popcornmix committed Jul 16, 2012
Showing with 32 additions and 28 deletions.
  1. +32 −28 drivers/mmc/host/sdhci-bcm2708.c
View
60 drivers/mmc/host/sdhci-bcm2708.c
@@ -51,7 +51,6 @@
#undef CONFIG_MMC_SDHCI_BCM2708_DMA
#define CONFIG_MMC_SDHCI_BCM2708_DMA y
-#define USE_SYNC_AFTER_DMA
#ifdef CONFIG_MMC_SDHCI_BCM2708_DMA
/* #define CHECK_DMA_USE */
#endif
@@ -131,6 +130,7 @@ static inline unsigned long int since_ns(hptime_t t)
static bool allow_highspeed = 1;
static int emmc_clock_freq = BCM2708_EMMC_CLOCK_FREQ;
+static bool sync_after_dma = 1;
#if 0
static void hptime_test(void)
@@ -822,34 +822,34 @@ static void sdhci_bcm2708_dma_complete_irq(struct sdhci_host *host,
SDHCI_INT_SPACE_AVAIL);
}
} else {
-#ifdef USE_SYNC_AFTER_DMA
- /* On the Arasan controller the stop command (which will be
- scheduled after this completes) does not seem to work
- properly if we allow it to be issued when we are
- transferring data to/from the SD card.
- We get CRC and DEND errors unless we wait for
- the SD controller to finish reading/writing to the card. */
- u32 state_mask;
- int timeout=5000;
-
- DBG("PDMA over - sync card\n");
- if (data->flags & MMC_DATA_READ)
- state_mask = SDHCI_DOING_READ;
- else
- state_mask = SDHCI_DOING_WRITE;
+ if (sync_after_dma) {
+ /* On the Arasan controller the stop command (which will be
+ scheduled after this completes) does not seem to work
+ properly if we allow it to be issued when we are
+ transferring data to/from the SD card.
+ We get CRC and DEND errors unless we wait for
+ the SD controller to finish reading/writing to the card. */
+ u32 state_mask;
+ int timeout=30*5000;
+
+ DBG("PDMA over - sync card\n");
+ if (data->flags & MMC_DATA_READ)
+ state_mask = SDHCI_DOING_READ;
+ else
+ state_mask = SDHCI_DOING_WRITE;
- while (0 != (sdhci_bcm2708_raw_readl(host, SDHCI_PRESENT_STATE)
- & state_mask) && --timeout > 0)
- {
- udelay(30);
- continue;
+ while (0 != (sdhci_bcm2708_raw_readl(host, SDHCI_PRESENT_STATE)
+ & state_mask) && --timeout > 0)
+ {
+ udelay(1);
+ continue;
+ }
+ if (timeout <= 0)
+ printk(KERN_ERR"%s: final %s to SD card still "
+ "running\n",
+ mmc_hostname(host->mmc),
+ data->flags & MMC_DATA_READ? "read": "write");
}
- if (timeout <= 0)
- printk(KERN_ERR"%s: final %s to SD card still "
- "running\n",
- mmc_hostname(host->mmc),
- data->flags & MMC_DATA_READ? "read": "write");
-#endif
if (host_priv->complete) {
(*host_priv->complete)(host);
DBG("PDMA %s complete\n",
@@ -1193,7 +1193,9 @@ static int sdhci_bcm2708_probe(struct platform_device *pdev)
SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
SDHCI_QUIRK_BROKEN_TIMEOUT_VAL |
SDHCI_QUIRK_MISSING_CAPS |
- SDHCI_QUIRK_NO_HISPD_BIT;
+ SDHCI_QUIRK_NO_HISPD_BIT |
+ (sync_after_dma ? 0:SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12);
+
#ifdef CONFIG_MMC_SDHCI_BCM2708_DMA
host->flags = SDHCI_USE_PLATDMA;
@@ -1363,6 +1365,7 @@ module_exit(sdhci_drv_exit);
module_param(allow_highspeed, bool, 0444);
module_param(emmc_clock_freq, int, 0444);
+module_param(sync_after_dma, bool, 0444);
MODULE_DESCRIPTION("Secure Digital Host Controller Interface platform driver");
MODULE_AUTHOR("Broadcom <info@broadcom.com>");
@@ -1371,5 +1374,6 @@ MODULE_ALIAS("platform:"DRIVER_NAME);
MODULE_PARM_DESC(allow_highspeed, "Allow high speed transfers modes");
MODULE_PARM_DESC(emmc_clock_freq, "Specify the speed of emmc clock");
+MODULE_PARM_DESC(sync_after_dma, "Block in driver until dma complete");

0 comments on commit 8e39b30

Please sign in to comment.