ixp4xx: remove linux 3.10 support
[openwrt/svn-archive/archive.git] / target / linux / brcm2708 / patches-3.10 / 0099-mmc-Report-3.3V-support-in-caps.patch
1 From f88d56e9c6976ebd217993062e0e53d65877685b Mon Sep 17 00:00:00 2001
2 From: popcornmix <popcornmix@gmail.com>
3 Date: Sat, 9 Nov 2013 17:42:58 +0000
4 Subject: [PATCH 099/196] mmc: Report 3.3V support in caps
5
6 sdhci: Use macros for out spin lock/unlock functions to reduce diffs with upstream code
7 ---
8 drivers/mmc/host/sdhci-bcm2708.c | 2 +
9 drivers/mmc/host/sdhci.c | 82 ++++++++++++++++++++++------------------
10 2 files changed, 47 insertions(+), 37 deletions(-)
11
12 diff --git a/drivers/mmc/host/sdhci-bcm2708.c b/drivers/mmc/host/sdhci-bcm2708.c
13 index 4770680..7fdd815 100644
14 --- a/drivers/mmc/host/sdhci-bcm2708.c
15 +++ b/drivers/mmc/host/sdhci-bcm2708.c
16 @@ -1282,6 +1282,8 @@ static int sdhci_bcm2708_probe(struct platform_device *pdev)
17 host_priv->dma_chan, host_priv->dma_chan_base,
18 host_priv->dma_irq);
19
20 + // we support 3.3V
21 + host->caps |= SDHCI_CAN_VDD_330;
22 if (allow_highspeed)
23 host->mmc->caps |= MMC_CAP_SD_HIGHSPEED | MMC_CAP_MMC_HIGHSPEED;
24
25 diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c
26 index 470860b..13e4e11 100644
27 --- a/drivers/mmc/host/sdhci.c
28 +++ b/drivers/mmc/host/sdhci.c
29 @@ -210,6 +210,14 @@ static void sdhci_spin_disable_schedule(struct sdhci_host *host)
30 #endif
31 }
32
33 +
34 +#undef spin_lock_irqsave
35 +#define spin_lock_irqsave(host_lock, flags) sdhci_spin_lock_irqsave(container_of(host_lock, struct sdhci_host, lock), &flags)
36 +#define spin_unlock_irqrestore(host_lock, flags) sdhci_spin_unlock_irqrestore(container_of(host_lock, struct sdhci_host, lock), flags)
37 +
38 +#define spin_lock(host_lock) sdhci_spin_lock(container_of(host_lock, struct sdhci_host, lock))
39 +#define spin_unlock(host_lock) sdhci_spin_unlock(container_of(host_lock, struct sdhci_host, lock))
40 +
41 static void sdhci_clear_set_irqs(struct sdhci_host *host, u32 clear, u32 set)
42 {
43 u32 ier;
44 @@ -374,7 +382,7 @@ static void sdhci_led_control(struct led_classdev *led,
45 struct sdhci_host *host = container_of(led, struct sdhci_host, led);
46 unsigned long flags;
47
48 - sdhci_spin_lock_irqsave(host, &flags);
49 + spin_lock_irqsave(&host->lock, flags);
50
51 if (host->runtime_suspended)
52 goto out;
53 @@ -384,7 +392,7 @@ static void sdhci_led_control(struct led_classdev *led,
54 else
55 sdhci_activate_led(host);
56 out:
57 - sdhci_spin_unlock_irqrestore(host, flags);
58 + spin_unlock_irqrestore(&host->lock, flags);
59 }
60 #endif
61
62 @@ -1419,7 +1427,7 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
63
64 sdhci_runtime_pm_get(host);
65
66 - sdhci_spin_lock_irqsave(host, &flags);
67 + spin_lock_irqsave(&host->lock, flags);
68
69 WARN_ON(host->mrq != NULL);
70
71 @@ -1477,9 +1485,9 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
72 mmc->card->type == MMC_TYPE_MMC ?
73 MMC_SEND_TUNING_BLOCK_HS200 :
74 MMC_SEND_TUNING_BLOCK;
75 - sdhci_spin_unlock_irqrestore(host, flags);
76 + spin_unlock_irqrestore(&host->lock, flags);
77 sdhci_execute_tuning(mmc, tuning_opcode);
78 - sdhci_spin_lock_irqsave(host, &flags);
79 + spin_lock_irqsave(&host->lock, flags);
80
81 /* Restore original mmc_request structure */
82 host->mrq = mrq;
83 @@ -1493,7 +1501,7 @@ static void sdhci_request(struct mmc_host *mmc, struct mmc_request *mrq)
84 }
85
86 mmiowb();
87 - sdhci_spin_unlock_irqrestore(host, flags);
88 + spin_unlock_irqrestore(&host->lock, flags);
89 }
90
91 static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
92 @@ -1502,10 +1510,10 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
93 int vdd_bit = -1;
94 u8 ctrl;
95
96 - sdhci_spin_lock_irqsave(host, &flags);
97 + spin_lock_irqsave(&host->lock, flags);
98
99 if (host->flags & SDHCI_DEVICE_DEAD) {
100 - sdhci_spin_unlock_irqrestore(host, flags);
101 + spin_unlock_irqrestore(&host->lock, flags);
102 if (host->vmmc && ios->power_mode == MMC_POWER_OFF)
103 mmc_regulator_set_ocr(host->mmc, host->vmmc, 0);
104 return;
105 @@ -1532,9 +1540,9 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
106 vdd_bit = sdhci_set_power(host, ios->vdd);
107
108 if (host->vmmc && vdd_bit != -1) {
109 - sdhci_spin_unlock_irqrestore(host, flags);
110 + spin_unlock_irqrestore(&host->lock, flags);
111 mmc_regulator_set_ocr(host->mmc, host->vmmc, vdd_bit);
112 - sdhci_spin_lock_irqsave(host, &flags);
113 + spin_lock_irqsave(&host->lock, flags);
114 }
115
116 if (host->ops->platform_send_init_74_clocks)
117 @@ -1672,7 +1680,7 @@ static void sdhci_do_set_ios(struct sdhci_host *host, struct mmc_ios *ios)
118 sdhci_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA);
119
120 mmiowb();
121 - sdhci_spin_unlock_irqrestore(host, flags);
122 + spin_unlock_irqrestore(&host->lock, flags);
123 }
124
125 static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
126 @@ -1720,7 +1728,7 @@ static int sdhci_check_ro(struct sdhci_host *host)
127 unsigned long flags;
128 int is_readonly;
129
130 - sdhci_spin_lock_irqsave(host, &flags);
131 + spin_lock_irqsave(&host->lock, flags);
132
133 if (host->flags & SDHCI_DEVICE_DEAD)
134 is_readonly = 0;
135 @@ -1730,7 +1738,7 @@ static int sdhci_check_ro(struct sdhci_host *host)
136 is_readonly = !(sdhci_readl(host, SDHCI_PRESENT_STATE)
137 & SDHCI_WRITE_PROTECT);
138
139 - sdhci_spin_unlock_irqrestore(host, flags);
140 + spin_unlock_irqrestore(&host->lock, flags);
141
142 /* This quirk needs to be replaced by a callback-function later */
143 return host->quirks & SDHCI_QUIRK_INVERTED_WRITE_PROTECT ?
144 @@ -1803,9 +1811,9 @@ static void sdhci_enable_sdio_irq(struct mmc_host *mmc, int enable)
145 struct sdhci_host *host = mmc_priv(mmc);
146 unsigned long flags;
147
148 - sdhci_spin_lock_irqsave(host, &flags);
149 + spin_lock_irqsave(&host->lock, flags);
150 sdhci_enable_sdio_irq_nolock(host, enable);
151 - sdhci_spin_unlock_irqrestore(host, flags);
152 + spin_unlock_irqrestore(&host->lock, flags);
153 }
154
155 static int sdhci_do_start_signal_voltage_switch(struct sdhci_host *host,
156 @@ -2149,7 +2157,7 @@ static void sdhci_card_event(struct mmc_host *mmc)
157 struct sdhci_host *host = mmc_priv(mmc);
158 unsigned long flags;
159
160 - sdhci_spin_lock_irqsave(host, &flags);
161 + spin_lock_irqsave(&host->lock, flags);
162
163 /* Check host->mrq first in case we are runtime suspended */
164 if (host->mrq &&
165 @@ -2166,7 +2174,7 @@ static void sdhci_card_event(struct mmc_host *mmc)
166 tasklet_schedule(&host->finish_tasklet);
167 }
168
169 - sdhci_spin_unlock_irqrestore(host, flags);
170 + spin_unlock_irqrestore(&host->lock, flags);
171 }
172
173 static const struct mmc_host_ops sdhci_ops = {
174 @@ -2205,14 +2213,14 @@ static void sdhci_tasklet_finish(unsigned long param)
175
176 host = (struct sdhci_host*)param;
177
178 - sdhci_spin_lock_irqsave(host, &flags);
179 + spin_lock_irqsave(&host->lock, flags);
180
181 /*
182 * If this tasklet gets rescheduled while running, it will
183 * be run again afterwards but without any active request.
184 */
185 if (!host->mrq) {
186 - sdhci_spin_unlock_irqrestore(host, flags);
187 + spin_unlock_irqrestore(&host->lock, flags);
188 return;
189 }
190
191 @@ -2250,7 +2258,7 @@ static void sdhci_tasklet_finish(unsigned long param)
192 #endif
193
194 mmiowb();
195 - sdhci_spin_unlock_irqrestore(host, flags);
196 + spin_unlock_irqrestore(&host->lock, flags);
197
198 mmc_request_done(host->mmc, mrq);
199 sdhci_runtime_pm_put(host);
200 @@ -2263,7 +2271,7 @@ static void sdhci_timeout_timer(unsigned long data)
201
202 host = (struct sdhci_host*)data;
203
204 - sdhci_spin_lock_irqsave(host, &flags);
205 + spin_lock_irqsave(&host->lock, flags);
206
207 if (host->mrq) {
208 pr_err("%s: Timeout waiting for hardware "
209 @@ -2284,7 +2292,7 @@ static void sdhci_timeout_timer(unsigned long data)
210 }
211
212 mmiowb();
213 - sdhci_spin_unlock_irqrestore(host, flags);
214 + spin_unlock_irqrestore(&host->lock, flags);
215 }
216
217 static void sdhci_tuning_timer(unsigned long data)
218 @@ -2294,11 +2302,11 @@ static void sdhci_tuning_timer(unsigned long data)
219
220 host = (struct sdhci_host *)data;
221
222 - sdhci_spin_lock_irqsave(host, &flags);
223 + spin_lock_irqsave(&host->lock, flags);
224
225 host->flags |= SDHCI_NEEDS_RETUNING;
226
227 - sdhci_spin_unlock_irqrestore(host, flags);
228 + spin_unlock_irqrestore(&host->lock, flags);
229 }
230
231 /*****************************************************************************\
232 @@ -2522,10 +2530,10 @@ static irqreturn_t sdhci_irq(int irq, void *dev_id)
233 u32 intmask, unexpected = 0;
234 int cardint = 0, max_loops = 16;
235
236 - sdhci_spin_lock(host);
237 + spin_lock(&host->lock);
238
239 if (host->runtime_suspended) {
240 - sdhci_spin_unlock(host);
241 + spin_unlock(&host->lock);
242 pr_warning("%s: got irq while runtime suspended\n",
243 mmc_hostname(host->mmc));
244 return IRQ_HANDLED;
245 @@ -2629,7 +2637,7 @@ again:
246 if (intmask && --max_loops)
247 goto again;
248 out:
249 - sdhci_spin_unlock(host);
250 + spin_unlock(&host->lock);
251
252 if (unexpected) {
253 pr_err("%s: Unexpected interrupt 0x%08x.\n",
254 @@ -2791,15 +2799,15 @@ int sdhci_runtime_suspend_host(struct sdhci_host *host)
255 host->flags &= ~SDHCI_NEEDS_RETUNING;
256 }
257
258 - sdhci_spin_lock_irqsave(host, &flags);
259 + spin_lock_irqsave(&host->lock, flags);
260 sdhci_mask_irqs(host, SDHCI_INT_ALL_MASK);
261 - sdhci_spin_unlock_irqrestore(host, flags);
262 + spin_unlock_irqrestore(&host->lock, flags);
263
264 synchronize_irq(host->irq);
265
266 - sdhci_spin_lock_irqsave(host, &flags);
267 + spin_lock_irqsave(&host->lock, flags);
268 host->runtime_suspended = true;
269 - sdhci_spin_unlock_irqrestore(host, flags);
270 + spin_unlock_irqrestore(&host->lock, flags);
271
272 return ret;
273 }
274 @@ -2825,16 +2833,16 @@ int sdhci_runtime_resume_host(struct sdhci_host *host)
275 sdhci_do_start_signal_voltage_switch(host, &host->mmc->ios);
276 if ((host_flags & SDHCI_PV_ENABLED) &&
277 !(host->quirks2 & SDHCI_QUIRK2_PRESET_VALUE_BROKEN)) {
278 - sdhci_spin_lock_irqsave(host, &flags);
279 + spin_lock_irqsave(&host->lock, flags);
280 sdhci_enable_preset_value(host, true);
281 - sdhci_spin_unlock_irqrestore(host, flags);
282 + spin_unlock_irqrestore(&host->lock, flags);
283 }
284
285 /* Set the re-tuning expiration flag */
286 if (host->flags & SDHCI_USING_RETUNING_TIMER)
287 host->flags |= SDHCI_NEEDS_RETUNING;
288
289 - sdhci_spin_lock_irqsave(host, &flags);
290 + spin_lock_irqsave(&host->lock, flags);
291
292 host->runtime_suspended = false;
293
294 @@ -2845,7 +2853,7 @@ int sdhci_runtime_resume_host(struct sdhci_host *host)
295 /* Enable Card Detection */
296 sdhci_enable_card_detection(host);
297
298 - sdhci_spin_unlock_irqrestore(host, flags);
299 + spin_unlock_irqrestore(&host->lock, flags);
300
301 return ret;
302 }
303 @@ -3401,7 +3409,7 @@ void sdhci_remove_host(struct sdhci_host *host, int dead)
304 unsigned long flags;
305
306 if (dead) {
307 - sdhci_spin_lock_irqsave(host, &flags);
308 + spin_lock_irqsave(&host->lock, flags);
309
310 host->flags |= SDHCI_DEVICE_DEAD;
311
312 @@ -3413,7 +3421,7 @@ void sdhci_remove_host(struct sdhci_host *host, int dead)
313 tasklet_schedule(&host->finish_tasklet);
314 }
315
316 - sdhci_spin_unlock_irqrestore(host, flags);
317 + spin_unlock_irqrestore(&host->lock, flags);
318 }
319
320 sdhci_disable_card_detection(host);
321 --
322 1.9.1
323