brcm2708: update 3.10 patches with raspberrypi/rpi-3.10.y of 27 Apr. 2014
[14.07/openwrt.git] / target / linux / brcm2708 / patches-3.10 / 0012-sdhci-bcm2708-remove-custom-clock-handling.patch
1 From d63cca1d57881d931236d101fe16fd249d91b060 Mon Sep 17 00:00:00 2001
2 From: Grigori Goronzy <greg@blackbox>
3 Date: Mon, 11 Jun 2012 18:52:04 +0200
4 Subject: [PATCH 012/196] sdhci-bcm2708: remove custom clock handling
5
6 The custom clock handling code is redundant and buggy. The MMC/SDHCI
7 subsystem does a better job than it, so remove it for good.
8 ---
9  drivers/mmc/host/sdhci-bcm2708.c | 65 +---------------------------------------
10  1 file changed, 1 insertion(+), 64 deletions(-)
11
12 diff --git a/drivers/mmc/host/sdhci-bcm2708.c b/drivers/mmc/host/sdhci-bcm2708.c
13 index a6bdc25..0ed4d85 100644
14 --- a/drivers/mmc/host/sdhci-bcm2708.c
15 +++ b/drivers/mmc/host/sdhci-bcm2708.c
16 @@ -353,68 +353,9 @@ void sdhci_bcm2708_writeb(struct sdhci_host *host, u8 val, int reg)
17  
18  static unsigned int sdhci_bcm2708_get_max_clock(struct sdhci_host *host)
19  {
20 -       return 20000000;        // this value is in Hz (20MHz)
21 +       return BCM2708_EMMC_CLOCK_FREQ;
22  }
23  
24 -static unsigned int sdhci_bcm2708_get_timeout_clock(struct sdhci_host *host)
25 -{
26 -       if(host->clock)
27 -               return (host->clock / 1000);            // this value is in kHz (100MHz)
28 -       else
29 -               return (sdhci_bcm2708_get_max_clock(host) / 1000);
30 -}
31 -
32 -static void sdhci_bcm2708_set_clock(struct sdhci_host *host, unsigned int clock)
33 -{
34 -       int div = 0;
35 -       u16 clk = 0;
36 -       unsigned long timeout;
37 -
38 -        if (clock == host->clock)
39 -                return;
40 -
41 -        sdhci_writew(host, 0, SDHCI_CLOCK_CONTROL);
42 -
43 -        if (clock == 0)
44 -                goto out;
45 -
46 -       if (BCM2708_EMMC_CLOCK_FREQ <= clock)
47 -               div = 1;
48 -       else {
49 -               for (div = 2; div < SDHCI_MAX_DIV_SPEC_300; div += 2) {
50 -                       if ((BCM2708_EMMC_CLOCK_FREQ / div) <= clock)
51 -                               break;
52 -               }
53 -       }
54 -
55 -        DBG( "desired SD clock: %d, actual: %d\n",
56 -                clock, BCM2708_EMMC_CLOCK_FREQ / div);
57 -
58 -       clk |= (div & SDHCI_DIV_MASK) << SDHCI_DIVIDER_SHIFT;
59 -       clk |= ((div & SDHCI_DIV_HI_MASK) >> SDHCI_DIV_MASK_LEN)
60 -               << SDHCI_DIVIDER_HI_SHIFT;
61 -       clk |= SDHCI_CLOCK_INT_EN;
62 -
63 -       sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
64 -
65 -        timeout = 20;
66 -        while (!((clk = sdhci_readw(host, SDHCI_CLOCK_CONTROL))
67 -                        & SDHCI_CLOCK_INT_STABLE)) {
68 -                if (timeout == 0) {
69 -                       printk(KERN_ERR "%s: Internal clock never "
70 -                               "stabilised.\n", mmc_hostname(host->mmc));
71 -                        return;
72 -                }
73 -                timeout--;
74 -                mdelay(1);
75 -        }
76 -
77 -        clk |= SDHCI_CLOCK_CARD_EN;
78 -        sdhci_writew(host, clk, SDHCI_CLOCK_CONTROL);
79 -out:
80 -        host->clock = clock;
81 - }
82 -
83  /*****************************************************************************\
84   *                                                                          *
85   * DMA Operation                                                            *
86 @@ -1189,11 +1130,7 @@ static struct sdhci_ops sdhci_bcm2708_ops = {
87  #else
88  #error The BCM2708 SDHCI driver needs CONFIG_MMC_SDHCI_IO_ACCESSORS to be set
89  #endif
90 -       //.enable_dma = NULL,
91 -       .set_clock = sdhci_bcm2708_set_clock,
92         .get_max_clock = sdhci_bcm2708_get_max_clock,
93 -       //.get_min_clock = NULL,
94 -       .get_timeout_clock = sdhci_bcm2708_get_timeout_clock,
95  
96  #ifdef CONFIG_MMC_SDHCI_BCM2708_DMA
97         // Platform DMA operations
98 -- 
99 1.9.1
100