3ff7e12fa1916e908b9509988a97f0dafb15f327
[openwrt.git] / target / linux / brcm2708 / patches-3.10 / 0010-sdcard-patch-improvements-from-naren.patch
1 From c655ceea69b95ccf2cc486a83048e41c3f664d1f Mon Sep 17 00:00:00 2001
2 From: popcornmix <popcornmix@gmail.com>
3 Date: Thu, 17 May 2012 14:44:19 +0100
4 Subject: [PATCH 010/196] sdcard patch improvements from naren
5
6 ---
7  drivers/mmc/host/sdhci-bcm2708.c | 23 +++++++----------------
8  1 file changed, 7 insertions(+), 16 deletions(-)
9
10 diff --git a/drivers/mmc/host/sdhci-bcm2708.c b/drivers/mmc/host/sdhci-bcm2708.c
11 index a405114..ae8edf7 100644
12 --- a/drivers/mmc/host/sdhci-bcm2708.c
13 +++ b/drivers/mmc/host/sdhci-bcm2708.c
14 @@ -886,8 +886,7 @@ static void sdhci_bcm2708_dma_complete_irq(struct sdhci_host *host,
15                    We get CRC and DEND errors unless we wait for
16                    the SD controller to finish reading/writing to the card. */
17                 u32 state_mask;
18 -               int timeout=1000000;
19 -               hptime_t now = hptime();
20 +               int timeout=1000;
21  
22                 DBG("PDMA over - sync card\n");
23                 if (data->flags & MMC_DATA_READ)
24 @@ -895,17 +894,12 @@ static void sdhci_bcm2708_dma_complete_irq(struct sdhci_host *host,
25                 else
26                         state_mask = SDHCI_DOING_WRITE;
27  
28 -               while (0 != (sdhci_bcm2708_raw_readl(host,
29 -                                                    SDHCI_PRESENT_STATE) &
30 -                            state_mask) && --timeout > 0)
31 +               while (0 != (sdhci_bcm2708_raw_readl(host, SDHCI_PRESENT_STATE) 
32 +                       & state_mask) && --timeout > 0)
33 +               {
34 +                       udelay(100);
35                         continue;
36 -
37 -               if (1000000-timeout > 4000) /*ave. is about 3250*/
38 -                       DBG("%s: note - long %s sync %luns - "
39 -                              "%d its.\n",
40 -                              mmc_hostname(host->mmc),
41 -                              data->flags & MMC_DATA_READ? "read": "write",
42 -                              since_ns(now), 1000000-timeout);
43 +               }
44                 if (timeout <= 0)
45                         printk(KERN_ERR"%s: final %s to SD card still "
46                                "running\n",
47 @@ -1175,10 +1169,7 @@ static unsigned int sdhci_bcm2708_uhs_broken(struct sdhci_host *host)
48  
49  static unsigned int sdhci_bcm2708_missing_status(struct sdhci_host *host)
50  {
51 -       if(host->last_cmdop == MMC_SEND_STATUS)
52 -               return 1;
53 -       else
54 -               return 0;
55 +       return 1;
56  }
57  
58  /***************************************************************************** \
59 -- 
60 1.9.1
61