aboutsummaryrefslogtreecommitdiffstats
path: root/arch
diff options
context:
space:
mode:
authorLudovic Desroches <ludovic.desroches@atmel.com>2012-05-21 06:23:27 -0400
committerNicolas Ferre <nicolas.ferre@atmel.com>2012-07-02 12:03:01 -0400
commit4cf3326ab5f34a333a46c59d0d3783db9cef13bf (patch)
tree4d8b5f494f0c99b2f261b6145c91cbc97f492795 /arch
parent24f5c4b6e6f2933eb22979283db6174f378d9b36 (diff)
ARM: at91: add atmel-mci support for chips and boards which can use it
Since atmel-mci driver supports all atmel mci versions, use it instead of the deprecated at91_mci driver. Platform data and all related configuration are removed. Signed-off-by: Ludovic Desroches <ludovic.desroches@atmel.com> [nicolas.ferre@atmel.com: remove at91_mci platform data] Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Diffstat (limited to 'arch')
-rw-r--r--arch/arm/mach-at91/at91rm9200_devices.c92
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c84
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c60
-rw-r--r--arch/arm/mach-at91/at91sam9263.c4
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c161
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c60
-rw-r--r--arch/arm/mach-at91/board-afeb-9260v1.c14
-rw-r--r--arch/arm/mach-at91/board-carmeva.c14
-rw-r--r--arch/arm/mach-at91/board-cpu9krea.c14
-rw-r--r--arch/arm/mach-at91/board-cpuat91.c13
-rw-r--r--arch/arm/mach-at91/board-csb337.c14
-rw-r--r--arch/arm/mach-at91/board-eb9200.c14
-rw-r--r--arch/arm/mach-at91/board-ecbat91.c14
-rw-r--r--arch/arm/mach-at91/board-eco920.c14
-rw-r--r--arch/arm/mach-at91/board-flexibity.c14
-rw-r--r--arch/arm/mach-at91/board-foxg20.c16
-rw-r--r--arch/arm/mach-at91/board-kb9202.c14
-rw-r--r--arch/arm/mach-at91/board-neocore926.c13
-rw-r--r--arch/arm/mach-at91/board-picotux200.c14
-rw-r--r--arch/arm/mach-at91/board-qil-a9260.c14
-rw-r--r--arch/arm/mach-at91/board-rm9200dk.c14
-rw-r--r--arch/arm/mach-at91/board-rm9200ek.c14
-rw-r--r--arch/arm/mach-at91/board-rsi-ews.c13
-rw-r--r--arch/arm/mach-at91/board-sam9-l9260.c16
-rw-r--r--arch/arm/mach-at91/board-sam9260ek.c16
-rw-r--r--arch/arm/mach-at91/board-sam9261ek.c13
-rw-r--r--arch/arm/mach-at91/board-sam9263ek.c13
-rw-r--r--arch/arm/mach-at91/board-sam9g20ek.c16
-rw-r--r--arch/arm/mach-at91/board-sam9rlek.c13
-rw-r--r--arch/arm/mach-at91/board-stamp9g20.c14
-rw-r--r--arch/arm/mach-at91/board-usb-a926x.c2
-rw-r--r--arch/arm/mach-at91/board-yl-9200.c13
32 files changed, 375 insertions, 439 deletions
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index e6b7d0533dd7..f6c09b8f5fc9 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -294,9 +294,9 @@ void __init at91_add_device_cf(struct at91_cf_data *data) {}
294 * MMC / SD 294 * MMC / SD
295 * -------------------------------------------------------------------- */ 295 * -------------------------------------------------------------------- */
296 296
297#if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) 297#if IS_ENABLED(CONFIG_MMC_ATMELMCI)
298static u64 mmc_dmamask = DMA_BIT_MASK(32); 298static u64 mmc_dmamask = DMA_BIT_MASK(32);
299static struct at91_mmc_data mmc_data; 299static struct mci_platform_data mmc_data;
300 300
301static struct resource mmc_resources[] = { 301static struct resource mmc_resources[] = {
302 [0] = { 302 [0] = {
@@ -312,7 +312,7 @@ static struct resource mmc_resources[] = {
312}; 312};
313 313
314static struct platform_device at91rm9200_mmc_device = { 314static struct platform_device at91rm9200_mmc_device = {
315 .name = "at91_mci", 315 .name = "atmel_mci",
316 .id = -1, 316 .id = -1,
317 .dev = { 317 .dev = {
318 .dma_mask = &mmc_dmamask, 318 .dma_mask = &mmc_dmamask,
@@ -323,53 +323,69 @@ static struct platform_device at91rm9200_mmc_device = {
323 .num_resources = ARRAY_SIZE(mmc_resources), 323 .num_resources = ARRAY_SIZE(mmc_resources),
324}; 324};
325 325
326void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) 326void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data)
327{ 327{
328 unsigned int i;
329 unsigned int slot_count = 0;
330
328 if (!data) 331 if (!data)
329 return; 332 return;
330 333
331 /* input/irq */ 334 for (i = 0; i < ATMCI_MAX_NR_SLOTS; i++) {
332 if (gpio_is_valid(data->det_pin)) {
333 at91_set_gpio_input(data->det_pin, 1);
334 at91_set_deglitch(data->det_pin, 1);
335 }
336 if (gpio_is_valid(data->wp_pin))
337 at91_set_gpio_input(data->wp_pin, 1);
338 if (gpio_is_valid(data->vcc_pin))
339 at91_set_gpio_output(data->vcc_pin, 0);
340
341 /* CLK */
342 at91_set_A_periph(AT91_PIN_PA27, 0);
343 335
344 if (data->slot_b) { 336 if (!data->slot[i].bus_width)
345 /* CMD */ 337 continue;
346 at91_set_B_periph(AT91_PIN_PA8, 1);
347 338
348 /* DAT0, maybe DAT1..DAT3 */ 339 /* input/irq */
349 at91_set_B_periph(AT91_PIN_PA9, 1); 340 if (gpio_is_valid(data->slot[i].detect_pin)) {
350 if (data->wire4) { 341 at91_set_gpio_input(data->slot[i].detect_pin, 1);
351 at91_set_B_periph(AT91_PIN_PA10, 1); 342 at91_set_deglitch(data->slot[i].detect_pin, 1);
352 at91_set_B_periph(AT91_PIN_PA11, 1);
353 at91_set_B_periph(AT91_PIN_PA12, 1);
354 } 343 }
355 } else { 344 if (gpio_is_valid(data->slot[i].wp_pin))
356 /* CMD */ 345 at91_set_gpio_input(data->slot[i].wp_pin, 1);
357 at91_set_A_periph(AT91_PIN_PA28, 1); 346
358 347 switch (i) {
359 /* DAT0, maybe DAT1..DAT3 */ 348 case 0: /* slot A */
360 at91_set_A_periph(AT91_PIN_PA29, 1); 349 /* CMD */
361 if (data->wire4) { 350 at91_set_A_periph(AT91_PIN_PA28, 1);
362 at91_set_B_periph(AT91_PIN_PB3, 1); 351 /* DAT0, maybe DAT1..DAT3 */
363 at91_set_B_periph(AT91_PIN_PB4, 1); 352 at91_set_A_periph(AT91_PIN_PA29, 1);
364 at91_set_B_periph(AT91_PIN_PB5, 1); 353 if (data->slot[i].bus_width == 4) {
354 at91_set_B_periph(AT91_PIN_PB3, 1);
355 at91_set_B_periph(AT91_PIN_PB4, 1);
356 at91_set_B_periph(AT91_PIN_PB5, 1);
357 }
358 slot_count++;
359 break;
360 case 1: /* slot B */
361 /* CMD */
362 at91_set_B_periph(AT91_PIN_PA8, 1);
363 /* DAT0, maybe DAT1..DAT3 */
364 at91_set_B_periph(AT91_PIN_PA9, 1);
365 if (data->slot[i].bus_width == 4) {
366 at91_set_B_periph(AT91_PIN_PA10, 1);
367 at91_set_B_periph(AT91_PIN_PA11, 1);
368 at91_set_B_periph(AT91_PIN_PA12, 1);
369 }
370 slot_count++;
371 break;
372 default:
373 printk(KERN_ERR
374 "AT91: SD/MMC slot %d not available\n", i);
375 break;
376 }
377 if (slot_count) {
378 /* CLK */
379 at91_set_A_periph(AT91_PIN_PA27, 0);
380
381 mmc_data = *data;
382 platform_device_register(&at91rm9200_mmc_device);
365 } 383 }
366 } 384 }
367 385
368 mmc_data = *data;
369 platform_device_register(&at91rm9200_mmc_device);
370} 386}
371#else 387#else
372void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} 388void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) {}
373#endif 389#endif
374 390
375 391
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 0ded951f785a..95f8395f4ebb 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -209,92 +209,10 @@ void __init at91_add_device_eth(struct macb_platform_data *data) {}
209 209
210 210
211/* -------------------------------------------------------------------- 211/* --------------------------------------------------------------------
212 * MMC / SD
213 * -------------------------------------------------------------------- */
214
215#if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE)
216static u64 mmc_dmamask = DMA_BIT_MASK(32);
217static struct at91_mmc_data mmc_data;
218
219static struct resource mmc_resources[] = {
220 [0] = {
221 .start = AT91SAM9260_BASE_MCI,
222 .end = AT91SAM9260_BASE_MCI + SZ_16K - 1,
223 .flags = IORESOURCE_MEM,
224 },
225 [1] = {
226 .start = AT91SAM9260_ID_MCI,
227 .end = AT91SAM9260_ID_MCI,
228 .flags = IORESOURCE_IRQ,
229 },
230};
231
232static struct platform_device at91sam9260_mmc_device = {
233 .name = "at91_mci",
234 .id = -1,
235 .dev = {
236 .dma_mask = &mmc_dmamask,
237 .coherent_dma_mask = DMA_BIT_MASK(32),
238 .platform_data = &mmc_data,
239 },
240 .resource = mmc_resources,
241 .num_resources = ARRAY_SIZE(mmc_resources),
242};
243
244void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data)
245{
246 if (!data)
247 return;
248
249 /* input/irq */
250 if (gpio_is_valid(data->det_pin)) {
251 at91_set_gpio_input(data->det_pin, 1);
252 at91_set_deglitch(data->det_pin, 1);
253 }
254 if (gpio_is_valid(data->wp_pin))
255 at91_set_gpio_input(data->wp_pin, 1);
256 if (gpio_is_valid(data->vcc_pin))
257 at91_set_gpio_output(data->vcc_pin, 0);
258
259 /* CLK */
260 at91_set_A_periph(AT91_PIN_PA8, 0);
261
262 if (data->slot_b) {
263 /* CMD */
264 at91_set_B_periph(AT91_PIN_PA1, 1);
265
266 /* DAT0, maybe DAT1..DAT3 */
267 at91_set_B_periph(AT91_PIN_PA0, 1);
268 if (data->wire4) {
269 at91_set_B_periph(AT91_PIN_PA5, 1);
270 at91_set_B_periph(AT91_PIN_PA4, 1);
271 at91_set_B_periph(AT91_PIN_PA3, 1);
272 }
273 } else {
274 /* CMD */
275 at91_set_A_periph(AT91_PIN_PA7, 1);
276
277 /* DAT0, maybe DAT1..DAT3 */
278 at91_set_A_periph(AT91_PIN_PA6, 1);
279 if (data->wire4) {
280 at91_set_A_periph(AT91_PIN_PA9, 1);
281 at91_set_A_periph(AT91_PIN_PA10, 1);
282 at91_set_A_periph(AT91_PIN_PA11, 1);
283 }
284 }
285
286 mmc_data = *data;
287 platform_device_register(&at91sam9260_mmc_device);
288}
289#else
290void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {}
291#endif
292
293/* --------------------------------------------------------------------
294 * MMC / SD Slot for Atmel MCI Driver 212 * MMC / SD Slot for Atmel MCI Driver
295 * -------------------------------------------------------------------- */ 213 * -------------------------------------------------------------------- */
296 214
297#if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE) 215#if IS_ENABLED(CONFIG_MMC_ATMELMCI)
298static u64 mmc_dmamask = DMA_BIT_MASK(32); 216static u64 mmc_dmamask = DMA_BIT_MASK(32);
299static struct mci_platform_data mmc_data; 217static struct mci_platform_data mmc_data;
300 218
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 9295e90b08ff..5d9d4c876a44 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -137,9 +137,9 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {}
137 * MMC / SD 137 * MMC / SD
138 * -------------------------------------------------------------------- */ 138 * -------------------------------------------------------------------- */
139 139
140#if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) 140#if IS_ENABLED(CONFIG_MMC_ATMELMCI)
141static u64 mmc_dmamask = DMA_BIT_MASK(32); 141static u64 mmc_dmamask = DMA_BIT_MASK(32);
142static struct at91_mmc_data mmc_data; 142static struct mci_platform_data mmc_data;
143 143
144static struct resource mmc_resources[] = { 144static struct resource mmc_resources[] = {
145 [0] = { 145 [0] = {
@@ -155,7 +155,7 @@ static struct resource mmc_resources[] = {
155}; 155};
156 156
157static struct platform_device at91sam9261_mmc_device = { 157static struct platform_device at91sam9261_mmc_device = {
158 .name = "at91_mci", 158 .name = "atmel_mci",
159 .id = -1, 159 .id = -1,
160 .dev = { 160 .dev = {
161 .dma_mask = &mmc_dmamask, 161 .dma_mask = &mmc_dmamask,
@@ -166,40 +166,40 @@ static struct platform_device at91sam9261_mmc_device = {
166 .num_resources = ARRAY_SIZE(mmc_resources), 166 .num_resources = ARRAY_SIZE(mmc_resources),
167}; 167};
168 168
169void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) 169void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data)
170{ 170{
171 if (!data) 171 if (!data)
172 return; 172 return;
173 173
174 /* input/irq */ 174 if (data->slot[0].bus_width) {
175 if (gpio_is_valid(data->det_pin)) { 175 /* input/irq */
176 at91_set_gpio_input(data->det_pin, 1); 176 if (gpio_is_valid(data->slot[0].detect_pin)) {
177 at91_set_deglitch(data->det_pin, 1); 177 at91_set_gpio_input(data->slot[0].detect_pin, 1);
178 } 178 at91_set_deglitch(data->slot[0].detect_pin, 1);
179 if (gpio_is_valid(data->wp_pin)) 179 }
180 at91_set_gpio_input(data->wp_pin, 1); 180 if (gpio_is_valid(data->slot[0].wp_pin))
181 if (gpio_is_valid(data->vcc_pin)) 181 at91_set_gpio_input(data->slot[0].wp_pin, 1);
182 at91_set_gpio_output(data->vcc_pin, 0); 182
183 183 /* CLK */
184 /* CLK */ 184 at91_set_B_periph(AT91_PIN_PA2, 0);
185 at91_set_B_periph(AT91_PIN_PA2, 0);
186
187 /* CMD */
188 at91_set_B_periph(AT91_PIN_PA1, 1);
189
190 /* DAT0, maybe DAT1..DAT3 */
191 at91_set_B_periph(AT91_PIN_PA0, 1);
192 if (data->wire4) {
193 at91_set_B_periph(AT91_PIN_PA4, 1);
194 at91_set_B_periph(AT91_PIN_PA5, 1);
195 at91_set_B_periph(AT91_PIN_PA6, 1);
196 }
197 185
198 mmc_data = *data; 186 /* CMD */
199 platform_device_register(&at91sam9261_mmc_device); 187 at91_set_B_periph(AT91_PIN_PA1, 1);
188
189 /* DAT0, maybe DAT1..DAT3 */
190 at91_set_B_periph(AT91_PIN_PA0, 1);
191 if (data->slot[0].bus_width == 4) {
192 at91_set_B_periph(AT91_PIN_PA4, 1);
193 at91_set_B_periph(AT91_PIN_PA5, 1);
194 at91_set_B_periph(AT91_PIN_PA6, 1);
195 }
196
197 mmc_data = *data;
198 platform_device_register(&at91sam9261_mmc_device);
199 }
200} 200}
201#else 201#else
202void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} 202void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) {}
203#endif 203#endif
204 204
205 205
diff --git a/arch/arm/mach-at91/at91sam9263.c b/arch/arm/mach-at91/at91sam9263.c
index ed91c7e9f7c2..7ccf6d0c2427 100644
--- a/arch/arm/mach-at91/at91sam9263.c
+++ b/arch/arm/mach-at91/at91sam9263.c
@@ -187,8 +187,8 @@ static struct clk_lookup periph_clocks_lookups[] = {
187 CLKDEV_CON_ID("hclk", &macb_clk), 187 CLKDEV_CON_ID("hclk", &macb_clk),
188 CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk), 188 CLKDEV_CON_DEV_ID("pclk", "ssc.0", &ssc0_clk),
189 CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk), 189 CLKDEV_CON_DEV_ID("pclk", "ssc.1", &ssc1_clk),
190 CLKDEV_CON_DEV_ID("mci_clk", "at91_mci.0", &mmc0_clk), 190 CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.0", &mmc0_clk),
191 CLKDEV_CON_DEV_ID("mci_clk", "at91_mci.1", &mmc1_clk), 191 CLKDEV_CON_DEV_ID("mci_clk", "atmel_mci.1", &mmc1_clk),
192 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk), 192 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.0", &spi0_clk),
193 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk), 193 CLKDEV_CON_DEV_ID("spi_clk", "atmel_spi.1", &spi1_clk),
194 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk), 194 CLKDEV_CON_DEV_ID("t0_clk", "atmel_tcb.0", &tcb_clk),
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index 175e0009eaa9..aa15997ec9eb 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -218,9 +218,9 @@ void __init at91_add_device_eth(struct macb_platform_data *data) {}
218 * MMC / SD 218 * MMC / SD
219 * -------------------------------------------------------------------- */ 219 * -------------------------------------------------------------------- */
220 220
221#if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) 221#if IS_ENABLED(CONFIG_MMC_ATMELMCI)
222static u64 mmc_dmamask = DMA_BIT_MASK(32); 222static u64 mmc_dmamask = DMA_BIT_MASK(32);
223static struct at91_mmc_data mmc0_data, mmc1_data; 223static struct mci_platform_data mmc0_data, mmc1_data;
224 224
225static struct resource mmc0_resources[] = { 225static struct resource mmc0_resources[] = {
226 [0] = { 226 [0] = {
@@ -236,7 +236,7 @@ static struct resource mmc0_resources[] = {
236}; 236};
237 237
238static struct platform_device at91sam9263_mmc0_device = { 238static struct platform_device at91sam9263_mmc0_device = {
239 .name = "at91_mci", 239 .name = "atmel_mci",
240 .id = 0, 240 .id = 0,
241 .dev = { 241 .dev = {
242 .dma_mask = &mmc_dmamask, 242 .dma_mask = &mmc_dmamask,
@@ -261,7 +261,7 @@ static struct resource mmc1_resources[] = {
261}; 261};
262 262
263static struct platform_device at91sam9263_mmc1_device = { 263static struct platform_device at91sam9263_mmc1_device = {
264 .name = "at91_mci", 264 .name = "atmel_mci",
265 .id = 1, 265 .id = 1,
266 .dev = { 266 .dev = {
267 .dma_mask = &mmc_dmamask, 267 .dma_mask = &mmc_dmamask,
@@ -272,85 +272,110 @@ static struct platform_device at91sam9263_mmc1_device = {
272 .num_resources = ARRAY_SIZE(mmc1_resources), 272 .num_resources = ARRAY_SIZE(mmc1_resources),
273}; 273};
274 274
275void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) 275void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data)
276{ 276{
277 unsigned int i;
278 unsigned int slot_count = 0;
279
277 if (!data) 280 if (!data)
278 return; 281 return;
279 282
280 /* input/irq */ 283 for (i = 0; i < ATMCI_MAX_NR_SLOTS; i++) {
281 if (gpio_is_valid(data->det_pin)) {
282 at91_set_gpio_input(data->det_pin, 1);
283 at91_set_deglitch(data->det_pin, 1);
284 }
285 if (gpio_is_valid(data->wp_pin))
286 at91_set_gpio_input(data->wp_pin, 1);
287 if (gpio_is_valid(data->vcc_pin))
288 at91_set_gpio_output(data->vcc_pin, 0);
289 284
290 if (mmc_id == 0) { /* MCI0 */ 285 if (!data->slot[i].bus_width)
291 /* CLK */ 286 continue;
292 at91_set_A_periph(AT91_PIN_PA12, 0);
293 287
294 if (data->slot_b) { 288 /* input/irq */
295 /* CMD */ 289 if (gpio_is_valid(data->slot[i].detect_pin)) {
296 at91_set_A_periph(AT91_PIN_PA16, 1); 290 at91_set_gpio_input(data->slot[i].detect_pin,
291 1);
292 at91_set_deglitch(data->slot[i].detect_pin,
293 1);
294 }
295 if (gpio_is_valid(data->slot[i].wp_pin))
296 at91_set_gpio_input(data->slot[i].wp_pin, 1);
297
298 if (mmc_id == 0) { /* MCI0 */
299 switch (i) {
300 case 0: /* slot A */
301 /* CMD */
302 at91_set_A_periph(AT91_PIN_PA1, 1);
303 /* DAT0, maybe DAT1..DAT3 */
304 at91_set_A_periph(AT91_PIN_PA0, 1);
305 if (data->slot[i].bus_width == 4) {
306 at91_set_A_periph(AT91_PIN_PA3, 1);
307 at91_set_A_periph(AT91_PIN_PA4, 1);
308 at91_set_A_periph(AT91_PIN_PA5, 1);
309 }
310 slot_count++;
311 break;
312 case 1: /* slot B */
313 /* CMD */
314 at91_set_A_periph(AT91_PIN_PA16, 1);
315 /* DAT0, maybe DAT1..DAT3 */
316 at91_set_A_periph(AT91_PIN_PA17, 1);
317 if (data->slot[i].bus_width == 4) {
318 at91_set_A_periph(AT91_PIN_PA18, 1);
319 at91_set_A_periph(AT91_PIN_PA19, 1);
320 at91_set_A_periph(AT91_PIN_PA20, 1);
321 }
322 slot_count++;
323 break;
324 default:
325 printk(KERN_ERR
326 "AT91: SD/MMC slot %d not available\n", i);
327 break;
328 }
329 if (slot_count) {
330 /* CLK */
331 at91_set_A_periph(AT91_PIN_PA12, 0);
297 332
298 /* DAT0, maybe DAT1..DAT3 */ 333 mmc0_data = *data;
299 at91_set_A_periph(AT91_PIN_PA17, 1); 334 platform_device_register(&at91sam9263_mmc0_device);
300 if (data->wire4) {
301 at91_set_A_periph(AT91_PIN_PA18, 1);
302 at91_set_A_periph(AT91_PIN_PA19, 1);
303 at91_set_A_periph(AT91_PIN_PA20, 1);
304 } 335 }
305 } else { 336 } else if (mmc_id == 1) { /* MCI1 */
306 /* CMD */ 337 switch (i) {
307 at91_set_A_periph(AT91_PIN_PA1, 1); 338 case 0: /* slot A */
308 339 /* CMD */
309 /* DAT0, maybe DAT1..DAT3 */ 340 at91_set_A_periph(AT91_PIN_PA7, 1);
310 at91_set_A_periph(AT91_PIN_PA0, 1); 341 /* DAT0, maybe DAT1..DAT3 */
311 if (data->wire4) { 342 at91_set_A_periph(AT91_PIN_PA8, 1);
312 at91_set_A_periph(AT91_PIN_PA3, 1); 343 if (data->slot[i].bus_width == 4) {
313 at91_set_A_periph(AT91_PIN_PA4, 1); 344 at91_set_A_periph(AT91_PIN_PA9, 1);
314 at91_set_A_periph(AT91_PIN_PA5, 1); 345 at91_set_A_periph(AT91_PIN_PA10, 1);
346 at91_set_A_periph(AT91_PIN_PA11, 1);
347 }
348 slot_count++;
349 break;
350 case 1: /* slot B */
351 /* CMD */
352 at91_set_A_periph(AT91_PIN_PA21, 1);
353 /* DAT0, maybe DAT1..DAT3 */
354 at91_set_A_periph(AT91_PIN_PA22, 1);
355 if (data->slot[i].bus_width == 4) {
356 at91_set_A_periph(AT91_PIN_PA23, 1);
357 at91_set_A_periph(AT91_PIN_PA24, 1);
358 at91_set_A_periph(AT91_PIN_PA25, 1);
359 }
360 slot_count++;
361 break;
362 default:
363 printk(KERN_ERR
364 "AT91: SD/MMC slot %d not available\n", i);
365 break;
315 } 366 }
316 } 367 if (slot_count) {
368 /* CLK */
369 at91_set_A_periph(AT91_PIN_PA6, 0);
317 370
318 mmc0_data = *data; 371 mmc1_data = *data;
319 platform_device_register(&at91sam9263_mmc0_device); 372 platform_device_register(&at91sam9263_mmc1_device);
320 } else { /* MCI1 */
321 /* CLK */
322 at91_set_A_periph(AT91_PIN_PA6, 0);
323
324 if (data->slot_b) {
325 /* CMD */
326 at91_set_A_periph(AT91_PIN_PA21, 1);
327
328 /* DAT0, maybe DAT1..DAT3 */
329 at91_set_A_periph(AT91_PIN_PA22, 1);
330 if (data->wire4) {
331 at91_set_A_periph(AT91_PIN_PA23, 1);
332 at91_set_A_periph(AT91_PIN_PA24, 1);
333 at91_set_A_periph(AT91_PIN_PA25, 1);
334 }
335 } else {
336 /* CMD */
337 at91_set_A_periph(AT91_PIN_PA7, 1);
338
339 /* DAT0, maybe DAT1..DAT3 */
340 at91_set_A_periph(AT91_PIN_PA8, 1);
341 if (data->wire4) {
342 at91_set_A_periph(AT91_PIN_PA9, 1);
343 at91_set_A_periph(AT91_PIN_PA10, 1);
344 at91_set_A_periph(AT91_PIN_PA11, 1);
345 } 373 }
346 } 374 }
347
348 mmc1_data = *data;
349 platform_device_register(&at91sam9263_mmc1_device);
350 } 375 }
351} 376}
352#else 377#else
353void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} 378void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) {}
354#endif 379#endif
355 380
356/* -------------------------------------------------------------------- 381/* --------------------------------------------------------------------
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index 9c0b1481a9a7..7359472f2764 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -161,9 +161,9 @@ void __init at91_add_device_usba(struct usba_platform_data *data) {}
161 * MMC / SD 161 * MMC / SD
162 * -------------------------------------------------------------------- */ 162 * -------------------------------------------------------------------- */
163 163
164#if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) 164#if IS_ENABLED(CONFIG_MMC_ATMELMCI)
165static u64 mmc_dmamask = DMA_BIT_MASK(32); 165static u64 mmc_dmamask = DMA_BIT_MASK(32);
166static struct at91_mmc_data mmc_data; 166static struct mci_platform_data mmc_data;
167 167
168static struct resource mmc_resources[] = { 168static struct resource mmc_resources[] = {
169 [0] = { 169 [0] = {
@@ -179,7 +179,7 @@ static struct resource mmc_resources[] = {
179}; 179};
180 180
181static struct platform_device at91sam9rl_mmc_device = { 181static struct platform_device at91sam9rl_mmc_device = {
182 .name = "at91_mci", 182 .name = "atmel_mci",
183 .id = -1, 183 .id = -1,
184 .dev = { 184 .dev = {
185 .dma_mask = &mmc_dmamask, 185 .dma_mask = &mmc_dmamask,
@@ -190,40 +190,40 @@ static struct platform_device at91sam9rl_mmc_device = {
190 .num_resources = ARRAY_SIZE(mmc_resources), 190 .num_resources = ARRAY_SIZE(mmc_resources),
191}; 191};
192 192
193void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) 193void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data)
194{ 194{
195 if (!data) 195 if (!data)
196 return; 196 return;
197 197
198 /* input/irq */ 198 if (data->slot[0].bus_width) {
199 if (gpio_is_valid(data->det_pin)) { 199 /* input/irq */
200 at91_set_gpio_input(data->det_pin, 1); 200 if (gpio_is_valid(data->slot[0].detect_pin)) {
201 at91_set_deglitch(data->det_pin, 1); 201 at91_set_gpio_input(data->slot[0].detect_pin, 1);
202 } 202 at91_set_deglitch(data->slot[0].detect_pin, 1);
203 if (gpio_is_valid(data->wp_pin)) 203 }
204 at91_set_gpio_input(data->wp_pin, 1); 204 if (gpio_is_valid(data->slot[0].wp_pin))
205 if (gpio_is_valid(data->vcc_pin)) 205 at91_set_gpio_input(data->slot[0].wp_pin, 1);
206 at91_set_gpio_output(data->vcc_pin, 0); 206
207 207 /* CLK */
208 /* CLK */ 208 at91_set_A_periph(AT91_PIN_PA2, 0);
209 at91_set_A_periph(AT91_PIN_PA2, 0); 209
210 210 /* CMD */
211 /* CMD */ 211 at91_set_A_periph(AT91_PIN_PA1, 1);
212 at91_set_A_periph(AT91_PIN_PA1, 1); 212
213 213 /* DAT0, maybe DAT1..DAT3 */
214 /* DAT0, maybe DAT1..DAT3 */ 214 at91_set_A_periph(AT91_PIN_PA0, 1);
215 at91_set_A_periph(AT91_PIN_PA0, 1); 215 if (data->slot[0].bus_width == 4) {
216 if (data->wire4) { 216 at91_set_A_periph(AT91_PIN_PA3, 1);
217 at91_set_A_periph(AT91_PIN_PA3, 1); 217 at91_set_A_periph(AT91_PIN_PA4, 1);
218 at91_set_A_periph(AT91_PIN_PA4, 1); 218 at91_set_A_periph(AT91_PIN_PA5, 1);
219 at91_set_A_periph(AT91_PIN_PA5, 1); 219 }
220
221 mmc_data = *data;
222 platform_device_register(&at91sam9rl_mmc_device);
220 } 223 }
221
222 mmc_data = *data;
223 platform_device_register(&at91sam9rl_mmc_device);
224} 224}
225#else 225#else
226void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} 226void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) {}
227#endif 227#endif
228 228
229 229
diff --git a/arch/arm/mach-at91/board-afeb-9260v1.c b/arch/arm/mach-at91/board-afeb-9260v1.c
index b7d8aa7b81e6..e49907c25508 100644
--- a/arch/arm/mach-at91/board-afeb-9260v1.c
+++ b/arch/arm/mach-at91/board-afeb-9260v1.c
@@ -132,12 +132,12 @@ static struct atmel_nand_data __initdata afeb9260_nand_data = {
132/* 132/*
133 * MCI (SD/MMC) 133 * MCI (SD/MMC)
134 */ 134 */
135static struct at91_mmc_data __initdata afeb9260_mmc_data = { 135static struct mci_platform_data __initdata afeb9260_mci0_data = {
136 .det_pin = AT91_PIN_PC9, 136 .slot[1] = {
137 .wp_pin = AT91_PIN_PC4, 137 .bus_width = 4,
138 .slot_b = 1, 138 .detect_pin = AT91_PIN_PC9,
139 .wire4 = 1, 139 .wp_pin = AT91_PIN_PC4,
140 .vcc_pin = -EINVAL, 140 },
141}; 141};
142 142
143 143
@@ -198,7 +198,7 @@ static void __init afeb9260_board_init(void)
198 at91_set_B_periph(AT91_PIN_PA10, 0); /* ETX2 */ 198 at91_set_B_periph(AT91_PIN_PA10, 0); /* ETX2 */
199 at91_set_B_periph(AT91_PIN_PA11, 0); /* ETX3 */ 199 at91_set_B_periph(AT91_PIN_PA11, 0); /* ETX3 */
200 /* MMC */ 200 /* MMC */
201 at91_add_device_mmc(0, &afeb9260_mmc_data); 201 at91_add_device_mci(0, &afeb9260_mci0_data);
202 /* I2C */ 202 /* I2C */
203 at91_add_device_i2c(afeb9260_i2c_devices, 203 at91_add_device_i2c(afeb9260_i2c_devices,
204 ARRAY_SIZE(afeb9260_i2c_devices)); 204 ARRAY_SIZE(afeb9260_i2c_devices));
diff --git a/arch/arm/mach-at91/board-carmeva.c b/arch/arm/mach-at91/board-carmeva.c
index 44328a6d4609..99e2de74429b 100644
--- a/arch/arm/mach-at91/board-carmeva.c
+++ b/arch/arm/mach-at91/board-carmeva.c
@@ -70,12 +70,12 @@ static struct at91_udc_data __initdata carmeva_udc_data = {
70 // .vcc_pin = -EINVAL, 70 // .vcc_pin = -EINVAL,
71// }; 71// };
72 72
73static struct at91_mmc_data __initdata carmeva_mmc_data = { 73static struct mci_platform_data __initdata carmeva_mci0_data = {
74 .slot_b = 0, 74 .slot[0] = {
75 .wire4 = 1, 75 .bus_width = 4,
76 .det_pin = AT91_PIN_PB10, 76 .detect_pin = AT91_PIN_PB10,
77 .wp_pin = AT91_PIN_PC14, 77 .wp_pin = AT91_PIN_PC14,
78 .vcc_pin = -EINVAL, 78 },
79}; 79};
80 80
81static struct spi_board_info carmeva_spi_devices[] = { 81static struct spi_board_info carmeva_spi_devices[] = {
@@ -149,7 +149,7 @@ static void __init carmeva_board_init(void)
149 /* Compact Flash */ 149 /* Compact Flash */
150// at91_add_device_cf(&carmeva_cf_data); 150// at91_add_device_cf(&carmeva_cf_data);
151 /* MMC */ 151 /* MMC */
152 at91_add_device_mmc(0, &carmeva_mmc_data); 152 at91_add_device_mci(0, &carmeva_mci0_data);
153 /* LEDs */ 153 /* LEDs */
154 at91_gpio_leds(carmeva_leds, ARRAY_SIZE(carmeva_leds)); 154 at91_gpio_leds(carmeva_leds, ARRAY_SIZE(carmeva_leds));
155} 155}
diff --git a/arch/arm/mach-at91/board-cpu9krea.c b/arch/arm/mach-at91/board-cpu9krea.c
index ece0d76fd0f8..202c3b99fda8 100644
--- a/arch/arm/mach-at91/board-cpu9krea.c
+++ b/arch/arm/mach-at91/board-cpu9krea.c
@@ -310,12 +310,12 @@ static void __init cpu9krea_add_device_buttons(void)
310/* 310/*
311 * MCI (SD/MMC) 311 * MCI (SD/MMC)
312 */ 312 */
313static struct at91_mmc_data __initdata cpu9krea_mmc_data = { 313static struct mci_platform_data __initdata cpu9krea_mci0_data = {
314 .slot_b = 0, 314 .slot[0] = {
315 .wire4 = 1, 315 .bus_width = 4,
316 .det_pin = AT91_PIN_PA29, 316 .detect_pin = AT91_PIN_PA29,
317 .wp_pin = -EINVAL, 317 .wp_pin = -EINVAL,
318 .vcc_pin = -EINVAL, 318 },
319}; 319};
320 320
321static void __init cpu9krea_board_init(void) 321static void __init cpu9krea_board_init(void)
@@ -357,7 +357,7 @@ static void __init cpu9krea_board_init(void)
357 /* Ethernet */ 357 /* Ethernet */
358 at91_add_device_eth(&cpu9krea_macb_data); 358 at91_add_device_eth(&cpu9krea_macb_data);
359 /* MMC */ 359 /* MMC */
360 at91_add_device_mmc(0, &cpu9krea_mmc_data); 360 at91_add_device_mci(0, &cpu9krea_mci0_data);
361 /* I2C */ 361 /* I2C */
362 at91_add_device_i2c(cpu9krea_i2c_devices, 362 at91_add_device_i2c(cpu9krea_i2c_devices,
363 ARRAY_SIZE(cpu9krea_i2c_devices)); 363 ARRAY_SIZE(cpu9krea_i2c_devices));
diff --git a/arch/arm/mach-at91/board-cpuat91.c b/arch/arm/mach-at91/board-cpuat91.c
index 895cf2dba612..7f64920a41c0 100644
--- a/arch/arm/mach-at91/board-cpuat91.c
+++ b/arch/arm/mach-at91/board-cpuat91.c
@@ -77,11 +77,12 @@ static struct at91_udc_data __initdata cpuat91_udc_data = {
77 .pullup_pin = AT91_PIN_PC14, 77 .pullup_pin = AT91_PIN_PC14,
78}; 78};
79 79
80static struct at91_mmc_data __initdata cpuat91_mmc_data = { 80static struct mci_platform_data __initdata cpuat91_mci0_data = {
81 .det_pin = AT91_PIN_PC2, 81 .slot[0] = {
82 .wire4 = 1, 82 .bus_width = 4,
83 .wp_pin = -EINVAL, 83 .detect_pin = AT91_PIN_PC2,
84 .vcc_pin = -EINVAL, 84 .wp_pin = -EINVAL,
85 },
85}; 86};
86 87
87static struct physmap_flash_data cpuat91_flash_data = { 88static struct physmap_flash_data cpuat91_flash_data = {
@@ -167,7 +168,7 @@ static void __init cpuat91_board_init(void)
167 /* USB Device */ 168 /* USB Device */
168 at91_add_device_udc(&cpuat91_udc_data); 169 at91_add_device_udc(&cpuat91_udc_data);
169 /* MMC */ 170 /* MMC */
170 at91_add_device_mmc(0, &cpuat91_mmc_data); 171 at91_add_device_mci(0, &cpuat91_mci0_data);
171 /* I2C */ 172 /* I2C */
172 at91_add_device_i2c(NULL, 0); 173 at91_add_device_i2c(NULL, 0);
173 /* Platform devices */ 174 /* Platform devices */
diff --git a/arch/arm/mach-at91/board-csb337.c b/arch/arm/mach-at91/board-csb337.c
index cd813361cd26..a17693540a15 100644
--- a/arch/arm/mach-at91/board-csb337.c
+++ b/arch/arm/mach-at91/board-csb337.c
@@ -86,12 +86,12 @@ static struct at91_cf_data __initdata csb337_cf_data = {
86 .rst_pin = AT91_PIN_PD2, 86 .rst_pin = AT91_PIN_PD2,
87}; 87};
88 88
89static struct at91_mmc_data __initdata csb337_mmc_data = { 89static struct mci_platform_data __initdata csb337_mci0_data = {
90 .det_pin = AT91_PIN_PD5, 90 .slot[0] = {
91 .slot_b = 0, 91 .bus_width = 4,
92 .wire4 = 1, 92 .detect_pin = AT91_PIN_PD5,
93 .wp_pin = AT91_PIN_PD6, 93 .wp_pin = AT91_PIN_PD6,
94 .vcc_pin = -EINVAL, 94 },
95}; 95};
96 96
97static struct spi_board_info csb337_spi_devices[] = { 97static struct spi_board_info csb337_spi_devices[] = {
@@ -239,7 +239,7 @@ static void __init csb337_board_init(void)
239 /* SPI */ 239 /* SPI */
240 at91_add_device_spi(csb337_spi_devices, ARRAY_SIZE(csb337_spi_devices)); 240 at91_add_device_spi(csb337_spi_devices, ARRAY_SIZE(csb337_spi_devices));
241 /* MMC */ 241 /* MMC */
242 at91_add_device_mmc(0, &csb337_mmc_data); 242 at91_add_device_mci(0, &csb337_mci0_data);
243 /* NOR flash */ 243 /* NOR flash */
244 platform_device_register(&csb_flash); 244 platform_device_register(&csb_flash);
245 /* LEDs */ 245 /* LEDs */
diff --git a/arch/arm/mach-at91/board-eb9200.c b/arch/arm/mach-at91/board-eb9200.c
index bd1017297989..d9f4f75a1c0a 100644
--- a/arch/arm/mach-at91/board-eb9200.c
+++ b/arch/arm/mach-at91/board-eb9200.c
@@ -69,12 +69,12 @@ static struct at91_cf_data __initdata eb9200_cf_data = {
69 .rst_pin = AT91_PIN_PC5, 69 .rst_pin = AT91_PIN_PC5,
70}; 70};
71 71
72static struct at91_mmc_data __initdata eb9200_mmc_data = { 72static struct mci_platform_data __initdata eb9200_mci0_data = {
73 .slot_b = 0, 73 .slot[0] = {
74 .wire4 = 1, 74 .bus_width = 4,
75 .det_pin = -EINVAL, 75 .detect_pin = -EINVAL,
76 .wp_pin = -EINVAL, 76 .wp_pin = -EINVAL,
77 .vcc_pin = -EINVAL, 77 },
78}; 78};
79 79
80static struct i2c_board_info __initdata eb9200_i2c_devices[] = { 80static struct i2c_board_info __initdata eb9200_i2c_devices[] = {
@@ -112,7 +112,7 @@ static void __init eb9200_board_init(void)
112 at91_add_device_spi(NULL, 0); 112 at91_add_device_spi(NULL, 0);
113 /* MMC */ 113 /* MMC */
114 /* only supports 1 or 4 bit interface, not wired through to SPI */ 114 /* only supports 1 or 4 bit interface, not wired through to SPI */
115 at91_add_device_mmc(0, &eb9200_mmc_data); 115 at91_add_device_mci(0, &eb9200_mci0_data);
116} 116}
117 117
118MACHINE_START(ATEB9200, "Embest ATEB9200") 118MACHINE_START(ATEB9200, "Embest ATEB9200")
diff --git a/arch/arm/mach-at91/board-ecbat91.c b/arch/arm/mach-at91/board-ecbat91.c
index 89cc3726a9ce..086ec5b3ebe8 100644
--- a/arch/arm/mach-at91/board-ecbat91.c
+++ b/arch/arm/mach-at91/board-ecbat91.c
@@ -63,12 +63,12 @@ static struct at91_usbh_data __initdata ecb_at91usbh_data = {
63 .overcurrent_pin= {-EINVAL, -EINVAL}, 63 .overcurrent_pin= {-EINVAL, -EINVAL},
64}; 64};
65 65
66static struct at91_mmc_data __initdata ecb_at91mmc_data = { 66static struct mci_platform_data __initdata ecbat91_mci0_data = {
67 .slot_b = 0, 67 .slot[0] = {
68 .wire4 = 1, 68 .bus_width = 4,
69 .det_pin = -EINVAL, 69 .detect_pin = -EINVAL,
70 .wp_pin = -EINVAL, 70 .wp_pin = -EINVAL,
71 .vcc_pin = -EINVAL, 71 },
72}; 72};
73 73
74 74
@@ -160,7 +160,7 @@ static void __init ecb_at91board_init(void)
160 at91_add_device_i2c(NULL, 0); 160 at91_add_device_i2c(NULL, 0);
161 161
162 /* MMC */ 162 /* MMC */
163 at91_add_device_mmc(0, &ecb_at91mmc_data); 163 at91_add_device_mci(0, &ecbat91_mci0_data);
164 164
165 /* SPI */ 165 /* SPI */
166 at91_add_device_spi(ecb_at91spi_devices, ARRAY_SIZE(ecb_at91spi_devices)); 166 at91_add_device_spi(ecb_at91spi_devices, ARRAY_SIZE(ecb_at91spi_devices));
diff --git a/arch/arm/mach-at91/board-eco920.c b/arch/arm/mach-at91/board-eco920.c
index 558546cf63f4..40e957d1a612 100644
--- a/arch/arm/mach-at91/board-eco920.c
+++ b/arch/arm/mach-at91/board-eco920.c
@@ -55,12 +55,12 @@ static struct at91_udc_data __initdata eco920_udc_data = {
55 .pullup_pin = AT91_PIN_PB13, 55 .pullup_pin = AT91_PIN_PB13,
56}; 56};
57 57
58static struct at91_mmc_data __initdata eco920_mmc_data = { 58static struct mci_platform_data __initdata eco920_mci0_data = {
59 .slot_b = 0, 59 .slot[0] = {
60 .wire4 = 0, 60 .bus_width = 1,
61 .det_pin = -EINVAL, 61 .detect_pin = -EINVAL,
62 .wp_pin = -EINVAL, 62 .wp_pin = -EINVAL,
63 .vcc_pin = -EINVAL, 63 },
64}; 64};
65 65
66static struct physmap_flash_data eco920_flash_data = { 66static struct physmap_flash_data eco920_flash_data = {
@@ -103,7 +103,7 @@ static void __init eco920_board_init(void)
103 at91_add_device_usbh(&eco920_usbh_data); 103 at91_add_device_usbh(&eco920_usbh_data);
104 at91_add_device_udc(&eco920_udc_data); 104 at91_add_device_udc(&eco920_udc_data);
105 105
106 at91_add_device_mmc(0, &eco920_mmc_data); 106 at91_add_device_mci(0, &eco920_mci0_data);
107 platform_device_register(&eco920_flash); 107 platform_device_register(&eco920_flash);
108 108
109 at91_ramc_write(0, AT91_SMC_CSR(7), AT91_SMC_RWHOLD_(1) 109 at91_ramc_write(0, AT91_SMC_CSR(7), AT91_SMC_RWHOLD_(1)
diff --git a/arch/arm/mach-at91/board-flexibity.c b/arch/arm/mach-at91/board-flexibity.c
index 47658f78105d..23ad652edad4 100644
--- a/arch/arm/mach-at91/board-flexibity.c
+++ b/arch/arm/mach-at91/board-flexibity.c
@@ -74,12 +74,12 @@ static struct spi_board_info flexibity_spi_devices[] = {
74}; 74};
75 75
76/* MCI (SD/MMC) */ 76/* MCI (SD/MMC) */
77static struct at91_mmc_data __initdata flexibity_mmc_data = { 77static struct mci_platform_data __initdata flexibity_mci0_data = {
78 .slot_b = 0, 78 .slot[0] = {
79 .wire4 = 1, 79 .bus_width = 4,
80 .det_pin = AT91_PIN_PC9, 80 .detect_pin = AT91_PIN_PC9,
81 .wp_pin = AT91_PIN_PC4, 81 .wp_pin = AT91_PIN_PC4,
82 .vcc_pin = -EINVAL, 82 },
83}; 83};
84 84
85/* LEDs */ 85/* LEDs */
@@ -151,7 +151,7 @@ static void __init flexibity_board_init(void)
151 at91_add_device_spi(flexibity_spi_devices, 151 at91_add_device_spi(flexibity_spi_devices,
152 ARRAY_SIZE(flexibity_spi_devices)); 152 ARRAY_SIZE(flexibity_spi_devices));
153 /* MMC */ 153 /* MMC */
154 at91_add_device_mmc(0, &flexibity_mmc_data); 154 at91_add_device_mci(0, &flexibity_mci0_data);
155 /* LEDs */ 155 /* LEDs */
156 at91_gpio_leds(flexibity_leds, ARRAY_SIZE(flexibity_leds)); 156 at91_gpio_leds(flexibity_leds, ARRAY_SIZE(flexibity_leds));
157} 157}
diff --git a/arch/arm/mach-at91/board-foxg20.c b/arch/arm/mach-at91/board-foxg20.c
index 33411e6ecb1f..0fc218160ae2 100644
--- a/arch/arm/mach-at91/board-foxg20.c
+++ b/arch/arm/mach-at91/board-foxg20.c
@@ -85,7 +85,7 @@ static struct at91_udc_data __initdata foxg20_udc_data = {
85 * SPI devices. 85 * SPI devices.
86 */ 86 */
87static struct spi_board_info foxg20_spi_devices[] = { 87static struct spi_board_info foxg20_spi_devices[] = {
88#if !defined(CONFIG_MMC_AT91) 88#if !IS_ENABLED(CONFIG_MMC_ATMELMCI)
89 { 89 {
90 .modalias = "mtd_dataflash", 90 .modalias = "mtd_dataflash",
91 .chip_select = 1, 91 .chip_select = 1,
@@ -108,12 +108,12 @@ static struct macb_platform_data __initdata foxg20_macb_data = {
108 * MCI (SD/MMC) 108 * MCI (SD/MMC)
109 * det_pin, wp_pin and vcc_pin are not connected 109 * det_pin, wp_pin and vcc_pin are not connected
110 */ 110 */
111static struct at91_mmc_data __initdata foxg20_mmc_data = { 111static struct mci_platform_data __initdata foxg20_mci0_data = {
112 .slot_b = 1, 112 .slot[1] = {
113 .wire4 = 1, 113 .bus_width = 4,
114 .det_pin = -EINVAL, 114 .detect_pin = -EINVAL,
115 .wp_pin = -EINVAL, 115 .wp_pin = -EINVAL,
116 .vcc_pin = -EINVAL, 116 },
117}; 117};
118 118
119 119
@@ -246,7 +246,7 @@ static void __init foxg20_board_init(void)
246 /* Ethernet */ 246 /* Ethernet */
247 at91_add_device_eth(&foxg20_macb_data); 247 at91_add_device_eth(&foxg20_macb_data);
248 /* MMC */ 248 /* MMC */
249 at91_add_device_mmc(0, &foxg20_mmc_data); 249 at91_add_device_mci(0, &foxg20_mci0_data);
250 /* I2C */ 250 /* I2C */
251 at91_add_device_i2c(foxg20_i2c_devices, ARRAY_SIZE(foxg20_i2c_devices)); 251 at91_add_device_i2c(foxg20_i2c_devices, ARRAY_SIZE(foxg20_i2c_devices));
252 /* LEDs */ 252 /* LEDs */
diff --git a/arch/arm/mach-at91/board-kb9202.c b/arch/arm/mach-at91/board-kb9202.c
index ba39db5482b9..1fa6010ca504 100644
--- a/arch/arm/mach-at91/board-kb9202.c
+++ b/arch/arm/mach-at91/board-kb9202.c
@@ -68,12 +68,12 @@ static struct at91_udc_data __initdata kb9202_udc_data = {
68 .pullup_pin = AT91_PIN_PB22, 68 .pullup_pin = AT91_PIN_PB22,
69}; 69};
70 70
71static struct at91_mmc_data __initdata kb9202_mmc_data = { 71static struct mci_platform_data __initdata kb9202_mci0_data = {
72 .det_pin = AT91_PIN_PB2, 72 .slot[0] = {
73 .slot_b = 0, 73 .bus_width = 4,
74 .wire4 = 1, 74 .detect_pin = AT91_PIN_PB2,
75 .wp_pin = -EINVAL, 75 .wp_pin = -EINVAL,
76 .vcc_pin = -EINVAL, 76 },
77}; 77};
78 78
79static struct mtd_partition __initdata kb9202_nand_partition[] = { 79static struct mtd_partition __initdata kb9202_nand_partition[] = {
@@ -120,7 +120,7 @@ static void __init kb9202_board_init(void)
120 /* USB Device */ 120 /* USB Device */
121 at91_add_device_udc(&kb9202_udc_data); 121 at91_add_device_udc(&kb9202_udc_data);
122 /* MMC */ 122 /* MMC */
123 at91_add_device_mmc(0, &kb9202_mmc_data); 123 at91_add_device_mci(0, &kb9202_mci0_data);
124 /* I2C */ 124 /* I2C */
125 at91_add_device_i2c(NULL, 0); 125 at91_add_device_i2c(NULL, 0);
126 /* SPI */ 126 /* SPI */
diff --git a/arch/arm/mach-at91/board-neocore926.c b/arch/arm/mach-at91/board-neocore926.c
index d2f4cc161766..061168ee4f10 100644
--- a/arch/arm/mach-at91/board-neocore926.c
+++ b/arch/arm/mach-at91/board-neocore926.c
@@ -137,11 +137,12 @@ static struct spi_board_info neocore926_spi_devices[] = {
137/* 137/*
138 * MCI (SD/MMC) 138 * MCI (SD/MMC)
139 */ 139 */
140static struct at91_mmc_data __initdata neocore926_mmc_data = { 140static struct mci_platform_data __initdata neocore926_mci0_data = {
141 .wire4 = 1, 141 .slot[0] = {
142 .det_pin = AT91_PIN_PE18, 142 .bus_width = 4,
143 .wp_pin = AT91_PIN_PE19, 143 .detect_pin = AT91_PIN_PE18,
144 .vcc_pin = -EINVAL, 144 .wp_pin = AT91_PIN_PE19,
145 },
145}; 146};
146 147
147 148
@@ -353,7 +354,7 @@ static void __init neocore926_board_init(void)
353 neocore926_add_device_ts(); 354 neocore926_add_device_ts();
354 355
355 /* MMC */ 356 /* MMC */
356 at91_add_device_mmc(1, &neocore926_mmc_data); 357 at91_add_device_mci(0, &neocore926_mci0_data);
357 358
358 /* Ethernet */ 359 /* Ethernet */
359 at91_add_device_eth(&neocore926_macb_data); 360 at91_add_device_eth(&neocore926_macb_data);
diff --git a/arch/arm/mach-at91/board-picotux200.c b/arch/arm/mach-at91/board-picotux200.c
index b45c0a5d5ca7..96db6b259f86 100644
--- a/arch/arm/mach-at91/board-picotux200.c
+++ b/arch/arm/mach-at91/board-picotux200.c
@@ -61,12 +61,12 @@ static struct at91_usbh_data __initdata picotux200_usbh_data = {
61 .overcurrent_pin= {-EINVAL, -EINVAL}, 61 .overcurrent_pin= {-EINVAL, -EINVAL},
62}; 62};
63 63
64static struct at91_mmc_data __initdata picotux200_mmc_data = { 64static struct mci_platform_data __initdata picotux200_mci0_data = {
65 .det_pin = AT91_PIN_PB27, 65 .slot[0] = {
66 .slot_b = 0, 66 .bus_width = 4,
67 .wire4 = 1, 67 .detect_pin = AT91_PIN_PB27,
68 .wp_pin = AT91_PIN_PA17, 68 .wp_pin = AT91_PIN_PA17,
69 .vcc_pin = -EINVAL, 69 },
70}; 70};
71 71
72#define PICOTUX200_FLASH_BASE AT91_CHIPSELECT_0 72#define PICOTUX200_FLASH_BASE AT91_CHIPSELECT_0
@@ -111,7 +111,7 @@ static void __init picotux200_board_init(void)
111 at91_add_device_i2c(NULL, 0); 111 at91_add_device_i2c(NULL, 0);
112 /* MMC */ 112 /* MMC */
113 at91_set_gpio_output(AT91_PIN_PB22, 1); /* this MMC card slot can optionally use SPI signaling (CS3). */ 113 at91_set_gpio_output(AT91_PIN_PB22, 1); /* this MMC card slot can optionally use SPI signaling (CS3). */
114 at91_add_device_mmc(0, &picotux200_mmc_data); 114 at91_add_device_mci(0, &picotux200_mci0_data);
115 /* NOR Flash */ 115 /* NOR Flash */
116 platform_device_register(&picotux200_flash); 116 platform_device_register(&picotux200_flash);
117} 117}
diff --git a/arch/arm/mach-at91/board-qil-a9260.c b/arch/arm/mach-at91/board-qil-a9260.c
index 0c61bf0d272c..847cc00e23df 100644
--- a/arch/arm/mach-at91/board-qil-a9260.c
+++ b/arch/arm/mach-at91/board-qil-a9260.c
@@ -155,12 +155,12 @@ static void __init ek_add_device_nand(void)
155/* 155/*
156 * MCI (SD/MMC) 156 * MCI (SD/MMC)
157 */ 157 */
158static struct at91_mmc_data __initdata ek_mmc_data = { 158static struct mci_platform_data __initdata ek_mci0_data = {
159 .slot_b = 0, 159 .slot[0] = {
160 .wire4 = 1, 160 .bus_width = 4,
161 .det_pin = -EINVAL, 161 .detect_pin = -EINVAL,
162 .wp_pin = -EINVAL, 162 .wp_pin = -EINVAL,
163 .vcc_pin = -EINVAL, 163 },
164}; 164};
165 165
166/* 166/*
@@ -244,7 +244,7 @@ static void __init ek_board_init(void)
244 /* Ethernet */ 244 /* Ethernet */
245 at91_add_device_eth(&ek_macb_data); 245 at91_add_device_eth(&ek_macb_data);
246 /* MMC */ 246 /* MMC */
247 at91_add_device_mmc(0, &ek_mmc_data); 247 at91_add_device_mci(0, &ek_mci0_data);
248 /* Push Buttons */ 248 /* Push Buttons */
249 ek_add_device_buttons(); 249 ek_add_device_buttons();
250 /* LEDs */ 250 /* LEDs */
diff --git a/arch/arm/mach-at91/board-rm9200dk.c b/arch/arm/mach-at91/board-rm9200dk.c
index afd7a4713766..6564c13f5e22 100644
--- a/arch/arm/mach-at91/board-rm9200dk.c
+++ b/arch/arm/mach-at91/board-rm9200dk.c
@@ -76,12 +76,12 @@ static struct at91_cf_data __initdata dk_cf_data = {
76}; 76};
77 77
78#ifndef CONFIG_MTD_AT91_DATAFLASH_CARD 78#ifndef CONFIG_MTD_AT91_DATAFLASH_CARD
79static struct at91_mmc_data __initdata dk_mmc_data = { 79static struct mci_platform_data __initdata dk_mci0_data = {
80 .slot_b = 0, 80 .slot[0] = {
81 .wire4 = 1, 81 .bus_width = 4,
82 .det_pin = -EINVAL, 82 .detect_pin = -EINVAL,
83 .wp_pin = -EINVAL, 83 .wp_pin = -EINVAL,
84 .vcc_pin = -EINVAL, 84 },
85}; 85};
86#endif 86#endif
87 87
@@ -207,7 +207,7 @@ static void __init dk_board_init(void)
207#else 207#else
208 /* MMC */ 208 /* MMC */
209 at91_set_gpio_output(AT91_PIN_PB7, 1); /* this MMC card slot can optionally use SPI signaling (CS3). */ 209 at91_set_gpio_output(AT91_PIN_PB7, 1); /* this MMC card slot can optionally use SPI signaling (CS3). */
210 at91_add_device_mmc(0, &dk_mmc_data); 210 at91_add_device_mci(0, &dk_mci0_data);
211#endif 211#endif
212 /* NAND */ 212 /* NAND */
213 at91_add_device_nand(&dk_nand_data); 213 at91_add_device_nand(&dk_nand_data);
diff --git a/arch/arm/mach-at91/board-rm9200ek.c b/arch/arm/mach-at91/board-rm9200ek.c
index 2b15b8adec4c..58144a0a5388 100644
--- a/arch/arm/mach-at91/board-rm9200ek.c
+++ b/arch/arm/mach-at91/board-rm9200ek.c
@@ -69,12 +69,12 @@ static struct at91_udc_data __initdata ek_udc_data = {
69}; 69};
70 70
71#ifndef CONFIG_MTD_AT91_DATAFLASH_CARD 71#ifndef CONFIG_MTD_AT91_DATAFLASH_CARD
72static struct at91_mmc_data __initdata ek_mmc_data = { 72static struct mci_platform_data __initdata ek_mci0_data = {
73 .det_pin = AT91_PIN_PB27, 73 .slot[0] = {
74 .slot_b = 0, 74 .bus_width = 4,
75 .wire4 = 1, 75 .detect_pin = AT91_PIN_PB27,
76 .wp_pin = AT91_PIN_PA17, 76 .wp_pin = AT91_PIN_PA17,
77 .vcc_pin = -EINVAL, 77 }
78}; 78};
79#endif 79#endif
80 80
@@ -176,7 +176,7 @@ static void __init ek_board_init(void)
176#else 176#else
177 /* MMC */ 177 /* MMC */
178 at91_set_gpio_output(AT91_PIN_PB22, 1); /* this MMC card slot can optionally use SPI signaling (CS3). */ 178 at91_set_gpio_output(AT91_PIN_PB22, 1); /* this MMC card slot can optionally use SPI signaling (CS3). */
179 at91_add_device_mmc(0, &ek_mmc_data); 179 at91_add_device_mci(0, &ek_mci0_data);
180#endif 180#endif
181 /* NOR Flash */ 181 /* NOR Flash */
182 platform_device_register(&ek_flash); 182 platform_device_register(&ek_flash);
diff --git a/arch/arm/mach-at91/board-rsi-ews.c b/arch/arm/mach-at91/board-rsi-ews.c
index 24ab9be7510f..f63158f1f022 100644
--- a/arch/arm/mach-at91/board-rsi-ews.c
+++ b/arch/arm/mach-at91/board-rsi-ews.c
@@ -57,11 +57,12 @@ static struct at91_usbh_data rsi_ews_usbh_data __initdata = {
57/* 57/*
58 * SD/MC 58 * SD/MC
59 */ 59 */
60static struct at91_mmc_data rsi_ews_mmc_data __initdata = { 60static struct mci_platform_data __initdata rsi_ews_mci0_data = {
61 .slot_b = 0, 61 .slot[0] = {
62 .wire4 = 1, 62 .bus_width = 4,
63 .det_pin = AT91_PIN_PB27, 63 .detect_pin = AT91_PIN_PB27,
64 .wp_pin = AT91_PIN_PB29, 64 .wp_pin = AT91_PIN_PB29,
65 },
65}; 66};
66 67
67/* 68/*
@@ -214,7 +215,7 @@ static void __init rsi_ews_board_init(void)
214 at91_add_device_spi(rsi_ews_spi_devices, 215 at91_add_device_spi(rsi_ews_spi_devices,
215 ARRAY_SIZE(rsi_ews_spi_devices)); 216 ARRAY_SIZE(rsi_ews_spi_devices));
216 /* MMC */ 217 /* MMC */
217 at91_add_device_mmc(0, &rsi_ews_mmc_data); 218 at91_add_device_mci(0, &rsi_ews_mci0_data);
218 /* NOR Flash */ 219 /* NOR Flash */
219 platform_device_register(&rsiews_nor_flash); 220 platform_device_register(&rsiews_nor_flash);
220 /* LEDs */ 221 /* LEDs */
diff --git a/arch/arm/mach-at91/board-sam9-l9260.c b/arch/arm/mach-at91/board-sam9-l9260.c
index cdd21f2595d2..0af92e6cce64 100644
--- a/arch/arm/mach-at91/board-sam9-l9260.c
+++ b/arch/arm/mach-at91/board-sam9-l9260.c
@@ -72,7 +72,7 @@ static struct at91_udc_data __initdata ek_udc_data = {
72 * SPI devices. 72 * SPI devices.
73 */ 73 */
74static struct spi_board_info ek_spi_devices[] = { 74static struct spi_board_info ek_spi_devices[] = {
75#if !defined(CONFIG_MMC_AT91) 75#if !IS_ENABLED(CONFIG_MMC_ATMELMCI)
76 { /* DataFlash chip */ 76 { /* DataFlash chip */
77 .modalias = "mtd_dataflash", 77 .modalias = "mtd_dataflash",
78 .chip_select = 1, 78 .chip_select = 1,
@@ -157,12 +157,12 @@ static void __init ek_add_device_nand(void)
157/* 157/*
158 * MCI (SD/MMC) 158 * MCI (SD/MMC)
159 */ 159 */
160static struct at91_mmc_data __initdata ek_mmc_data = { 160static struct mci_platform_data __initdata ek_mci0_data = {
161 .slot_b = 1, 161 .slot[1] = {
162 .wire4 = 1, 162 .bus_width = 4,
163 .det_pin = AT91_PIN_PC8, 163 .detect_pin = AT91_PIN_PC8,
164 .wp_pin = AT91_PIN_PC4, 164 .wp_pin = AT91_PIN_PC4,
165 .vcc_pin = -EINVAL, 165 },
166}; 166};
167 167
168static void __init ek_board_init(void) 168static void __init ek_board_init(void)
@@ -193,7 +193,7 @@ static void __init ek_board_init(void)
193 /* Ethernet */ 193 /* Ethernet */
194 at91_add_device_eth(&ek_macb_data); 194 at91_add_device_eth(&ek_macb_data);
195 /* MMC */ 195 /* MMC */
196 at91_add_device_mmc(0, &ek_mmc_data); 196 at91_add_device_mci(0, &ek_mci0_data);
197 /* I2C */ 197 /* I2C */
198 at91_add_device_i2c(NULL, 0); 198 at91_add_device_i2c(NULL, 0);
199} 199}
diff --git a/arch/arm/mach-at91/board-sam9260ek.c b/arch/arm/mach-at91/board-sam9260ek.c
index 7b3c3913551a..55f0104c0a4b 100644
--- a/arch/arm/mach-at91/board-sam9260ek.c
+++ b/arch/arm/mach-at91/board-sam9260ek.c
@@ -107,7 +107,7 @@ static void __init at73c213_set_clk(struct at73c213_board_info *info) {}
107 * SPI devices. 107 * SPI devices.
108 */ 108 */
109static struct spi_board_info ek_spi_devices[] = { 109static struct spi_board_info ek_spi_devices[] = {
110#if !defined(CONFIG_MMC_AT91) 110#if !IS_ENABLED(CONFIG_MMC_ATMELMCI)
111 { /* DataFlash chip */ 111 { /* DataFlash chip */
112 .modalias = "mtd_dataflash", 112 .modalias = "mtd_dataflash",
113 .chip_select = 1, 113 .chip_select = 1,
@@ -210,12 +210,12 @@ static void __init ek_add_device_nand(void)
210/* 210/*
211 * MCI (SD/MMC) 211 * MCI (SD/MMC)
212 */ 212 */
213static struct at91_mmc_data __initdata ek_mmc_data = { 213static struct mci_platform_data __initdata ek_mci0_data = {
214 .slot_b = 1, 214 .slot[1] = {
215 .wire4 = 1, 215 .bus_width = 4,
216 .det_pin = -EINVAL, 216 .detect_pin = -EINVAL,
217 .wp_pin = -EINVAL, 217 .wp_pin = -EINVAL,
218 .vcc_pin = -EINVAL, 218 },
219}; 219};
220 220
221 221
@@ -328,7 +328,7 @@ static void __init ek_board_init(void)
328 /* Ethernet */ 328 /* Ethernet */
329 at91_add_device_eth(&ek_macb_data); 329 at91_add_device_eth(&ek_macb_data);
330 /* MMC */ 330 /* MMC */
331 at91_add_device_mmc(0, &ek_mmc_data); 331 at91_add_device_mci(0, &ek_mci0_data);
332 /* I2C */ 332 /* I2C */
333 at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices)); 333 at91_add_device_i2c(ek_i2c_devices, ARRAY_SIZE(ek_i2c_devices));
334 /* SSC (to AT73C213) */ 334 /* SSC (to AT73C213) */
diff --git a/arch/arm/mach-at91/board-sam9261ek.c b/arch/arm/mach-at91/board-sam9261ek.c
index 2736453821b0..f3b2fe24fc56 100644
--- a/arch/arm/mach-at91/board-sam9261ek.c
+++ b/arch/arm/mach-at91/board-sam9261ek.c
@@ -339,11 +339,12 @@ static struct spi_board_info ek_spi_devices[] = {
339 * MCI (SD/MMC) 339 * MCI (SD/MMC)
340 * det_pin, wp_pin and vcc_pin are not connected 340 * det_pin, wp_pin and vcc_pin are not connected
341 */ 341 */
342static struct at91_mmc_data __initdata ek_mmc_data = { 342static struct mci_platform_data __initdata mci0_data = {
343 .wire4 = 1, 343 .slot[0] = {
344 .det_pin = -EINVAL, 344 .bus_width = 4,
345 .wp_pin = -EINVAL, 345 .detect_pin = -EINVAL,
346 .vcc_pin = -EINVAL, 346 .wp_pin = -EINVAL,
347 },
347}; 348};
348 349
349#endif /* CONFIG_SPI_ATMEL_* */ 350#endif /* CONFIG_SPI_ATMEL_* */
@@ -597,7 +598,7 @@ static void __init ek_board_init(void)
597 at91_add_device_ssc(AT91SAM9261_ID_SSC1, ATMEL_SSC_TX); 598 at91_add_device_ssc(AT91SAM9261_ID_SSC1, ATMEL_SSC_TX);
598#else 599#else
599 /* MMC */ 600 /* MMC */
600 at91_add_device_mmc(0, &ek_mmc_data); 601 at91_add_device_mci(0, &mci0_data);
601#endif 602#endif
602 /* LCD Controller */ 603 /* LCD Controller */
603 at91_add_device_lcdc(&ek_lcdc_data); 604 at91_add_device_lcdc(&ek_lcdc_data);
diff --git a/arch/arm/mach-at91/board-sam9263ek.c b/arch/arm/mach-at91/board-sam9263ek.c
index 983cb98d2465..4c8d92a2ea17 100644
--- a/arch/arm/mach-at91/board-sam9263ek.c
+++ b/arch/arm/mach-at91/board-sam9263ek.c
@@ -140,11 +140,12 @@ static struct spi_board_info ek_spi_devices[] = {
140/* 140/*
141 * MCI (SD/MMC) 141 * MCI (SD/MMC)
142 */ 142 */
143static struct at91_mmc_data __initdata ek_mmc_data = { 143static struct mci_platform_data __initdata mci1_data = {
144 .wire4 = 1, 144 .slot[0] = {
145 .det_pin = AT91_PIN_PE18, 145 .bus_width = 4,
146 .wp_pin = AT91_PIN_PE19, 146 .detect_pin = AT91_PIN_PE18,
147 .vcc_pin = -EINVAL, 147 .wp_pin = AT91_PIN_PE19,
148 },
148}; 149};
149 150
150 151
@@ -419,7 +420,7 @@ static void __init ek_board_init(void)
419 /* Touchscreen */ 420 /* Touchscreen */
420 ek_add_device_ts(); 421 ek_add_device_ts();
421 /* MMC */ 422 /* MMC */
422 at91_add_device_mmc(1, &ek_mmc_data); 423 at91_add_device_mci(1, &mci1_data);
423 /* Ethernet */ 424 /* Ethernet */
424 at91_add_device_eth(&ek_macb_data); 425 at91_add_device_eth(&ek_macb_data);
425 /* NAND */ 426 /* NAND */
diff --git a/arch/arm/mach-at91/board-sam9g20ek.c b/arch/arm/mach-at91/board-sam9g20ek.c
index 6860d3451100..40d595aaed28 100644
--- a/arch/arm/mach-at91/board-sam9g20ek.c
+++ b/arch/arm/mach-at91/board-sam9g20ek.c
@@ -91,7 +91,7 @@ static struct at91_udc_data __initdata ek_udc_data = {
91 * SPI devices. 91 * SPI devices.
92 */ 92 */
93static struct spi_board_info ek_spi_devices[] = { 93static struct spi_board_info ek_spi_devices[] = {
94#if !(defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_AT91)) 94#if !IS_ENABLED(CONFIG_MMC_ATMELMCI)
95 { /* DataFlash chip */ 95 { /* DataFlash chip */
96 .modalias = "mtd_dataflash", 96 .modalias = "mtd_dataflash",
97 .chip_select = 1, 97 .chip_select = 1,
@@ -198,7 +198,6 @@ static void __init ek_add_device_nand(void)
198 * MCI (SD/MMC) 198 * MCI (SD/MMC)
199 * wp_pin and vcc_pin are not connected 199 * wp_pin and vcc_pin are not connected
200 */ 200 */
201#if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE)
202static struct mci_platform_data __initdata ek_mmc_data = { 201static struct mci_platform_data __initdata ek_mmc_data = {
203 .slot[1] = { 202 .slot[1] = {
204 .bus_width = 4, 203 .bus_width = 4,
@@ -207,28 +206,15 @@ static struct mci_platform_data __initdata ek_mmc_data = {
207 }, 206 },
208 207
209}; 208};
210#else
211static struct at91_mmc_data __initdata ek_mmc_data = {
212 .slot_b = 1, /* Only one slot so use slot B */
213 .wire4 = 1,
214 .det_pin = AT91_PIN_PC9,
215 .wp_pin = -EINVAL,
216 .vcc_pin = -EINVAL,
217};
218#endif
219 209
220static void __init ek_add_device_mmc(void) 210static void __init ek_add_device_mmc(void)
221{ 211{
222#if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE)
223 if (ek_have_2mmc()) { 212 if (ek_have_2mmc()) {
224 ek_mmc_data.slot[0].bus_width = 4; 213 ek_mmc_data.slot[0].bus_width = 4;
225 ek_mmc_data.slot[0].detect_pin = AT91_PIN_PC2; 214 ek_mmc_data.slot[0].detect_pin = AT91_PIN_PC2;
226 ek_mmc_data.slot[0].wp_pin = -1; 215 ek_mmc_data.slot[0].wp_pin = -1;
227 } 216 }
228 at91_add_device_mci(0, &ek_mmc_data); 217 at91_add_device_mci(0, &ek_mmc_data);
229#else
230 at91_add_device_mmc(0, &ek_mmc_data);
231#endif
232} 218}
233 219
234/* 220/*
diff --git a/arch/arm/mach-at91/board-sam9rlek.c b/arch/arm/mach-at91/board-sam9rlek.c
index be3239f13daa..61d2ba8a4e57 100644
--- a/arch/arm/mach-at91/board-sam9rlek.c
+++ b/arch/arm/mach-at91/board-sam9rlek.c
@@ -55,11 +55,12 @@ static struct usba_platform_data __initdata ek_usba_udc_data = {
55/* 55/*
56 * MCI (SD/MMC) 56 * MCI (SD/MMC)
57 */ 57 */
58static struct at91_mmc_data __initdata ek_mmc_data = { 58static struct mci_platform_data __initdata mci0_data = {
59 .wire4 = 1, 59 .slot[0] = {
60 .det_pin = AT91_PIN_PA15, 60 .bus_width = 4,
61 .wp_pin = -EINVAL, 61 .detect_pin = AT91_PIN_PA15,
62 .vcc_pin = -EINVAL, 62 .wp_pin = -EINVAL,
63 },
63}; 64};
64 65
65 66
@@ -302,7 +303,7 @@ static void __init ek_board_init(void)
302 /* SPI */ 303 /* SPI */
303 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices)); 304 at91_add_device_spi(ek_spi_devices, ARRAY_SIZE(ek_spi_devices));
304 /* MMC */ 305 /* MMC */
305 at91_add_device_mmc(0, &ek_mmc_data); 306 at91_add_device_mci(0, &mci0_data);
306 /* LCD Controller */ 307 /* LCD Controller */
307 at91_add_device_lcdc(&ek_lcdc_data); 308 at91_add_device_lcdc(&ek_lcdc_data);
308 /* AC97 */ 309 /* AC97 */
diff --git a/arch/arm/mach-at91/board-stamp9g20.c b/arch/arm/mach-at91/board-stamp9g20.c
index ee86f9d7ee72..7d890a065bb9 100644
--- a/arch/arm/mach-at91/board-stamp9g20.c
+++ b/arch/arm/mach-at91/board-stamp9g20.c
@@ -82,7 +82,6 @@ static void __init add_device_nand(void)
82 * MCI (SD/MMC) 82 * MCI (SD/MMC)
83 * det_pin, wp_pin and vcc_pin are not connected 83 * det_pin, wp_pin and vcc_pin are not connected
84 */ 84 */
85#if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE)
86static struct mci_platform_data __initdata mmc_data = { 85static struct mci_platform_data __initdata mmc_data = {
87 .slot[0] = { 86 .slot[0] = {
88 .bus_width = 4, 87 .bus_width = 4,
@@ -90,15 +89,6 @@ static struct mci_platform_data __initdata mmc_data = {
90 .wp_pin = -1, 89 .wp_pin = -1,
91 }, 90 },
92}; 91};
93#else
94static struct at91_mmc_data __initdata mmc_data = {
95 .slot_b = 0,
96 .wire4 = 1,
97 .det_pin = -EINVAL,
98 .wp_pin = -EINVAL,
99 .vcc_pin = -EINVAL,
100};
101#endif
102 92
103 93
104/* 94/*
@@ -222,11 +212,7 @@ void __init stamp9g20_board_init(void)
222 /* NAND */ 212 /* NAND */
223 add_device_nand(); 213 add_device_nand();
224 /* MMC */ 214 /* MMC */
225#if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE)
226 at91_add_device_mci(0, &mmc_data); 215 at91_add_device_mci(0, &mmc_data);
227#else
228 at91_add_device_mmc(0, &mmc_data);
229#endif
230 /* W1 */ 216 /* W1 */
231 add_w1(); 217 add_w1();
232} 218}
diff --git a/arch/arm/mach-at91/board-usb-a926x.c b/arch/arm/mach-at91/board-usb-a926x.c
index 95393fcaf199..c87ea80fd121 100644
--- a/arch/arm/mach-at91/board-usb-a926x.c
+++ b/arch/arm/mach-at91/board-usb-a926x.c
@@ -108,14 +108,12 @@ static struct mmc_spi_platform_data at91_mmc_spi_pdata = {
108 * SPI devices. 108 * SPI devices.
109 */ 109 */
110static struct spi_board_info usb_a9263_spi_devices[] = { 110static struct spi_board_info usb_a9263_spi_devices[] = {
111#if !defined(CONFIG_MMC_AT91)
112 { /* DataFlash chip */ 111 { /* DataFlash chip */
113 .modalias = "mtd_dataflash", 112 .modalias = "mtd_dataflash",
114 .chip_select = 0, 113 .chip_select = 0,
115 .max_speed_hz = 15 * 1000 * 1000, 114 .max_speed_hz = 15 * 1000 * 1000,
116 .bus_num = 0, 115 .bus_num = 0,
117 } 116 }
118#endif
119}; 117};
120 118
121static struct spi_board_info usb_a9g20_spi_devices[] = { 119static struct spi_board_info usb_a9g20_spi_devices[] = {
diff --git a/arch/arm/mach-at91/board-yl-9200.c b/arch/arm/mach-at91/board-yl-9200.c
index d56665ea4b55..6cb972e2f1e7 100644
--- a/arch/arm/mach-at91/board-yl-9200.c
+++ b/arch/arm/mach-at91/board-yl-9200.c
@@ -118,11 +118,12 @@ static struct at91_udc_data __initdata yl9200_udc_data = {
118/* 118/*
119 * MMC 119 * MMC
120 */ 120 */
121static struct at91_mmc_data __initdata yl9200_mmc_data = { 121static struct mci_platform_data __initdata yl9200_mci0_data = {
122 .det_pin = AT91_PIN_PB9, 122 .slot[0] = {
123 .wire4 = 1, 123 .bus_width = 4,
124 .wp_pin = -EINVAL, 124 .detect_pin = AT91_PIN_PB9,
125 .vcc_pin = -EINVAL, 125 .wp_pin = -EINVAL,
126 },
126}; 127};
127 128
128/* 129/*
@@ -567,7 +568,7 @@ static void __init yl9200_board_init(void)
567 /* I2C */ 568 /* I2C */
568 at91_add_device_i2c(yl9200_i2c_devices, ARRAY_SIZE(yl9200_i2c_devices)); 569 at91_add_device_i2c(yl9200_i2c_devices, ARRAY_SIZE(yl9200_i2c_devices));
569 /* MMC */ 570 /* MMC */
570 at91_add_device_mmc(0, &yl9200_mmc_data); 571 at91_add_device_mci(0, &yl9200_mci0_data);
571 /* NAND */ 572 /* NAND */
572 at91_add_device_nand(&yl9200_nand_data); 573 at91_add_device_nand(&yl9200_nand_data);
573 /* NOR Flash */ 574 /* NOR Flash */