brcm2708: update against latest rpi-3.10.y branch
[openwrt/svn-archive/archive.git] / target / linux / brcm2708 / patches-3.10 / 0020-Add-sync_after_dma-module-parameter.patch
1 From 9e42f33f4f80999a2c65a50b2a7ac6562ca194f5 Mon Sep 17 00:00:00 2001
2 From: popcornmix <popcornmix@gmail.com>
3 Date: Tue, 17 Jul 2012 00:48:27 +0100
4 Subject: [PATCH 020/174] Add sync_after_dma module parameter
5
6 ---
7 drivers/mmc/host/sdhci-bcm2708.c | 60 +++++++++++++++++++++-------------------
8 1 file changed, 32 insertions(+), 28 deletions(-)
9
10 --- a/drivers/mmc/host/sdhci-bcm2708.c
11 +++ b/drivers/mmc/host/sdhci-bcm2708.c
12 @@ -51,7 +51,6 @@
13 #undef CONFIG_MMC_SDHCI_BCM2708_DMA
14 #define CONFIG_MMC_SDHCI_BCM2708_DMA y
15
16 -#define USE_SYNC_AFTER_DMA
17 #ifdef CONFIG_MMC_SDHCI_BCM2708_DMA
18 /* #define CHECK_DMA_USE */
19 #endif
20 @@ -131,6 +130,7 @@ static inline unsigned long int since_ns
21
22 static bool allow_highspeed = 1;
23 static int emmc_clock_freq = BCM2708_EMMC_CLOCK_FREQ;
24 +static bool sync_after_dma = 1;
25
26 #if 0
27 static void hptime_test(void)
28 @@ -822,34 +822,34 @@ static void sdhci_bcm2708_dma_complete_i
29 SDHCI_INT_SPACE_AVAIL);
30 }
31 } else {
32 -#ifdef USE_SYNC_AFTER_DMA
33 - /* On the Arasan controller the stop command (which will be
34 - scheduled after this completes) does not seem to work
35 - properly if we allow it to be issued when we are
36 - transferring data to/from the SD card.
37 - We get CRC and DEND errors unless we wait for
38 - the SD controller to finish reading/writing to the card. */
39 - u32 state_mask;
40 - int timeout=5000;
41 + if (sync_after_dma) {
42 + /* On the Arasan controller the stop command (which will be
43 + scheduled after this completes) does not seem to work
44 + properly if we allow it to be issued when we are
45 + transferring data to/from the SD card.
46 + We get CRC and DEND errors unless we wait for
47 + the SD controller to finish reading/writing to the card. */
48 + u32 state_mask;
49 + int timeout=30*5000;
50
51 - DBG("PDMA over - sync card\n");
52 - if (data->flags & MMC_DATA_READ)
53 - state_mask = SDHCI_DOING_READ;
54 - else
55 - state_mask = SDHCI_DOING_WRITE;
56 + DBG("PDMA over - sync card\n");
57 + if (data->flags & MMC_DATA_READ)
58 + state_mask = SDHCI_DOING_READ;
59 + else
60 + state_mask = SDHCI_DOING_WRITE;
61
62 - while (0 != (sdhci_bcm2708_raw_readl(host, SDHCI_PRESENT_STATE)
63 - & state_mask) && --timeout > 0)
64 - {
65 - udelay(30);
66 - continue;
67 + while (0 != (sdhci_bcm2708_raw_readl(host, SDHCI_PRESENT_STATE)
68 + & state_mask) && --timeout > 0)
69 + {
70 + udelay(1);
71 + continue;
72 + }
73 + if (timeout <= 0)
74 + printk(KERN_ERR"%s: final %s to SD card still "
75 + "running\n",
76 + mmc_hostname(host->mmc),
77 + data->flags & MMC_DATA_READ? "read": "write");
78 }
79 - if (timeout <= 0)
80 - printk(KERN_ERR"%s: final %s to SD card still "
81 - "running\n",
82 - mmc_hostname(host->mmc),
83 - data->flags & MMC_DATA_READ? "read": "write");
84 -#endif
85 if (host_priv->complete) {
86 (*host_priv->complete)(host);
87 DBG("PDMA %s complete\n",
88 @@ -1193,7 +1193,9 @@ static int sdhci_bcm2708_probe(struct pl
89 SDHCI_QUIRK_DATA_TIMEOUT_USES_SDCLK |
90 SDHCI_QUIRK_BROKEN_TIMEOUT_VAL |
91 SDHCI_QUIRK_MISSING_CAPS |
92 - SDHCI_QUIRK_NO_HISPD_BIT;
93 + SDHCI_QUIRK_NO_HISPD_BIT |
94 + (sync_after_dma ? 0:SDHCI_QUIRK_MULTIBLOCK_READ_ACMD12);
95 +
96
97 #ifdef CONFIG_MMC_SDHCI_BCM2708_DMA
98 host->flags = SDHCI_USE_PLATDMA;
99 @@ -1363,6 +1365,7 @@ module_exit(sdhci_drv_exit);
100
101 module_param(allow_highspeed, bool, 0444);
102 module_param(emmc_clock_freq, int, 0444);
103 +module_param(sync_after_dma, bool, 0444);
104
105 MODULE_DESCRIPTION("Secure Digital Host Controller Interface platform driver");
106 MODULE_AUTHOR("Broadcom <info@broadcom.com>");
107 @@ -1371,5 +1374,6 @@ MODULE_ALIAS("platform:"DRIVER_NAME);
108
109 MODULE_PARM_DESC(allow_highspeed, "Allow high speed transfers modes");
110 MODULE_PARM_DESC(emmc_clock_freq, "Specify the speed of emmc clock");
111 +MODULE_PARM_DESC(sync_after_dma, "Block in driver until dma complete");
112
113