blob: 95fc23aab4321d0c1ab4d07ad610770cd860e6da [file] [log] [blame]
Andrew Victor86ad76b2006-11-30 16:45:01 +01001/*
Andrew Victor9d041262007-02-05 11:42:07 +01002 * arch/arm/mach-at91/at91sam9260_devices.c
Andrew Victor86ad76b2006-11-30 16:45:01 +01003 *
4 * Copyright (C) 2006 Atmel
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 */
12#include <asm/mach/arch.h>
13#include <asm/mach/map.h>
14
Andrew Victorc6686ff2008-01-23 09:13:53 +010015#include <linux/dma-mapping.h>
Russell King2f8163b2011-07-26 10:53:52 +010016#include <linux/gpio.h>
Andrew Victor86ad76b2006-11-30 16:45:01 +010017#include <linux/platform_device.h>
Andrew Victorf230d3f2007-11-19 13:47:20 +010018#include <linux/i2c-gpio.h>
Andrew Victor86ad76b2006-11-30 16:45:01 +010019
Maxime Ripard67b5d7b2012-05-11 15:35:34 +020020#include <linux/platform_data/at91_adc.h>
21
Russell Kinga09e64f2008-08-05 16:14:15 +010022#include <mach/board.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010023#include <mach/cpu.h>
24#include <mach/at91sam9260.h>
25#include <mach/at91sam9260_matrix.h>
Jean-Christophe PLAGNIOL-VILLARD4342d642011-11-27 23:15:50 +080026#include <mach/at91_matrix.h>
Russell Kinga09e64f2008-08-05 16:14:15 +010027#include <mach/at91sam9_smc.h>
Maxime Ripard67b5d7b2012-05-11 15:35:34 +020028#include <mach/at91_adc.h>
Andrew Victor86ad76b2006-11-30 16:45:01 +010029
30#include "generic.h"
31
Andrew Victor86ad76b2006-11-30 16:45:01 +010032
33/* --------------------------------------------------------------------
34 * USB Host
35 * -------------------------------------------------------------------- */
36
37#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
Andrew Victorc6686ff2008-01-23 09:13:53 +010038static u64 ohci_dmamask = DMA_BIT_MASK(32);
Andrew Victor86ad76b2006-11-30 16:45:01 +010039static struct at91_usbh_data usbh_data;
40
41static struct resource usbh_resources[] = {
42 [0] = {
43 .start = AT91SAM9260_UHP_BASE,
44 .end = AT91SAM9260_UHP_BASE + SZ_1M - 1,
45 .flags = IORESOURCE_MEM,
46 },
47 [1] = {
Ludovic Desroches8fe82a52012-06-21 14:47:27 +020048 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_UHP,
49 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_UHP,
Andrew Victor86ad76b2006-11-30 16:45:01 +010050 .flags = IORESOURCE_IRQ,
51 },
52};
53
54static struct platform_device at91_usbh_device = {
55 .name = "at91_ohci",
56 .id = -1,
57 .dev = {
58 .dma_mask = &ohci_dmamask,
Andrew Victorc6686ff2008-01-23 09:13:53 +010059 .coherent_dma_mask = DMA_BIT_MASK(32),
Andrew Victor86ad76b2006-11-30 16:45:01 +010060 .platform_data = &usbh_data,
61 },
62 .resource = usbh_resources,
63 .num_resources = ARRAY_SIZE(usbh_resources),
64};
65
66void __init at91_add_device_usbh(struct at91_usbh_data *data)
67{
Thomas Petazzoni1fcaea72011-07-13 11:29:18 +020068 int i;
69
Andrew Victor86ad76b2006-11-30 16:45:01 +010070 if (!data)
71 return;
72
Thomas Petazzoni1fcaea72011-07-13 11:29:18 +020073 /* Enable overcurrent notification */
74 for (i = 0; i < data->ports; i++) {
75 if (data->overcurrent_pin[i])
76 at91_set_gpio_input(data->overcurrent_pin[i], 1);
77 }
78
Andrew Victor86ad76b2006-11-30 16:45:01 +010079 usbh_data = *data;
80 platform_device_register(&at91_usbh_device);
81}
82#else
83void __init at91_add_device_usbh(struct at91_usbh_data *data) {}
84#endif
85
86
87/* --------------------------------------------------------------------
88 * USB Device (Gadget)
89 * -------------------------------------------------------------------- */
90
Nicolas Ferree8c9dc92012-01-27 11:14:44 +010091#if defined(CONFIG_USB_AT91) || defined(CONFIG_USB_AT91_MODULE)
Andrew Victor86ad76b2006-11-30 16:45:01 +010092static struct at91_udc_data udc_data;
93
94static struct resource udc_resources[] = {
95 [0] = {
96 .start = AT91SAM9260_BASE_UDP,
97 .end = AT91SAM9260_BASE_UDP + SZ_16K - 1,
98 .flags = IORESOURCE_MEM,
99 },
100 [1] = {
Ludovic Desroches8fe82a52012-06-21 14:47:27 +0200101 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_UDP,
102 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_UDP,
Andrew Victor86ad76b2006-11-30 16:45:01 +0100103 .flags = IORESOURCE_IRQ,
104 },
105};
106
107static struct platform_device at91_udc_device = {
108 .name = "at91_udc",
109 .id = -1,
110 .dev = {
111 .platform_data = &udc_data,
112 },
113 .resource = udc_resources,
114 .num_resources = ARRAY_SIZE(udc_resources),
115};
116
117void __init at91_add_device_udc(struct at91_udc_data *data)
118{
119 if (!data)
120 return;
121
Jean-Christophe PLAGNIOL-VILLARDcc9f9ae2011-09-19 15:28:25 +0800122 if (gpio_is_valid(data->vbus_pin)) {
Andrew Victor86ad76b2006-11-30 16:45:01 +0100123 at91_set_gpio_input(data->vbus_pin, 0);
124 at91_set_deglitch(data->vbus_pin, 1);
125 }
126
127 /* Pullup pin is handled internally by USB device peripheral */
128
129 udc_data = *data;
130 platform_device_register(&at91_udc_device);
131}
132#else
133void __init at91_add_device_udc(struct at91_udc_data *data) {}
134#endif
135
136
137/* --------------------------------------------------------------------
138 * Ethernet
139 * -------------------------------------------------------------------- */
140
141#if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
Andrew Victorc6686ff2008-01-23 09:13:53 +0100142static u64 eth_dmamask = DMA_BIT_MASK(32);
Jamie Iles84e0cdb2011-03-08 20:17:06 +0000143static struct macb_platform_data eth_data;
Andrew Victor86ad76b2006-11-30 16:45:01 +0100144
145static struct resource eth_resources[] = {
146 [0] = {
147 .start = AT91SAM9260_BASE_EMAC,
148 .end = AT91SAM9260_BASE_EMAC + SZ_16K - 1,
149 .flags = IORESOURCE_MEM,
150 },
151 [1] = {
Ludovic Desroches8fe82a52012-06-21 14:47:27 +0200152 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_EMAC,
153 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_EMAC,
Andrew Victor86ad76b2006-11-30 16:45:01 +0100154 .flags = IORESOURCE_IRQ,
155 },
156};
157
158static struct platform_device at91sam9260_eth_device = {
159 .name = "macb",
160 .id = -1,
161 .dev = {
162 .dma_mask = &eth_dmamask,
Andrew Victorc6686ff2008-01-23 09:13:53 +0100163 .coherent_dma_mask = DMA_BIT_MASK(32),
Andrew Victor86ad76b2006-11-30 16:45:01 +0100164 .platform_data = &eth_data,
165 },
166 .resource = eth_resources,
167 .num_resources = ARRAY_SIZE(eth_resources),
168};
169
Jamie Iles84e0cdb2011-03-08 20:17:06 +0000170void __init at91_add_device_eth(struct macb_platform_data *data)
Andrew Victor86ad76b2006-11-30 16:45:01 +0100171{
172 if (!data)
173 return;
174
Jean-Christophe PLAGNIOL-VILLARDcc9f9ae2011-09-19 15:28:25 +0800175 if (gpio_is_valid(data->phy_irq_pin)) {
Andrew Victor86ad76b2006-11-30 16:45:01 +0100176 at91_set_gpio_input(data->phy_irq_pin, 0);
177 at91_set_deglitch(data->phy_irq_pin, 1);
178 }
179
180 /* Pins used for MII and RMII */
181 at91_set_A_periph(AT91_PIN_PA19, 0); /* ETXCK_EREFCK */
182 at91_set_A_periph(AT91_PIN_PA17, 0); /* ERXDV */
183 at91_set_A_periph(AT91_PIN_PA14, 0); /* ERX0 */
184 at91_set_A_periph(AT91_PIN_PA15, 0); /* ERX1 */
185 at91_set_A_periph(AT91_PIN_PA18, 0); /* ERXER */
186 at91_set_A_periph(AT91_PIN_PA16, 0); /* ETXEN */
187 at91_set_A_periph(AT91_PIN_PA12, 0); /* ETX0 */
188 at91_set_A_periph(AT91_PIN_PA13, 0); /* ETX1 */
189 at91_set_A_periph(AT91_PIN_PA21, 0); /* EMDIO */
190 at91_set_A_periph(AT91_PIN_PA20, 0); /* EMDC */
191
192 if (!data->is_rmii) {
193 at91_set_B_periph(AT91_PIN_PA28, 0); /* ECRS */
194 at91_set_B_periph(AT91_PIN_PA29, 0); /* ECOL */
195 at91_set_B_periph(AT91_PIN_PA25, 0); /* ERX2 */
196 at91_set_B_periph(AT91_PIN_PA26, 0); /* ERX3 */
197 at91_set_B_periph(AT91_PIN_PA27, 0); /* ERXCK */
198 at91_set_B_periph(AT91_PIN_PA23, 0); /* ETX2 */
199 at91_set_B_periph(AT91_PIN_PA24, 0); /* ETX3 */
200 at91_set_B_periph(AT91_PIN_PA22, 0); /* ETXER */
201 }
202
203 eth_data = *data;
204 platform_device_register(&at91sam9260_eth_device);
205}
206#else
Jamie Iles84e0cdb2011-03-08 20:17:06 +0000207void __init at91_add_device_eth(struct macb_platform_data *data) {}
Andrew Victor86ad76b2006-11-30 16:45:01 +0100208#endif
209
210
211/* --------------------------------------------------------------------
212 * MMC / SD
213 * -------------------------------------------------------------------- */
214
215#if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE)
Andrew Victorc6686ff2008-01-23 09:13:53 +0100216static u64 mmc_dmamask = DMA_BIT_MASK(32);
Andrew Victor86ad76b2006-11-30 16:45:01 +0100217static 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] = {
Ludovic Desroches8fe82a52012-06-21 14:47:27 +0200226 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_MCI,
227 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_MCI,
Andrew Victor86ad76b2006-11-30 16:45:01 +0100228 .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,
Andrew Victorc6686ff2008-01-23 09:13:53 +0100237 .coherent_dma_mask = DMA_BIT_MASK(32),
Andrew Victor86ad76b2006-11-30 16:45:01 +0100238 .platform_data = &mmc_data,
239 },
240 .resource = mmc_resources,
241 .num_resources = ARRAY_SIZE(mmc_resources),
242};
243
Andrew Victord0760b32007-02-08 09:00:39 +0100244void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data)
Andrew Victor86ad76b2006-11-30 16:45:01 +0100245{
246 if (!data)
247 return;
248
249 /* input/irq */
Jean-Christophe PLAGNIOL-VILLARDcc9f9ae2011-09-19 15:28:25 +0800250 if (gpio_is_valid(data->det_pin)) {
Andrew Victor86ad76b2006-11-30 16:45:01 +0100251 at91_set_gpio_input(data->det_pin, 1);
252 at91_set_deglitch(data->det_pin, 1);
253 }
Jean-Christophe PLAGNIOL-VILLARDcc9f9ae2011-09-19 15:28:25 +0800254 if (gpio_is_valid(data->wp_pin))
Andrew Victor86ad76b2006-11-30 16:45:01 +0100255 at91_set_gpio_input(data->wp_pin, 1);
Jean-Christophe PLAGNIOL-VILLARDcc9f9ae2011-09-19 15:28:25 +0800256 if (gpio_is_valid(data->vcc_pin))
Andrew Victor86ad76b2006-11-30 16:45:01 +0100257 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
Andrew Victord0760b32007-02-08 09:00:39 +0100290void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {}
Andrew Victor86ad76b2006-11-30 16:45:01 +0100291#endif
292
Rob Emanuele864f38e2009-09-22 16:45:22 -0700293/* --------------------------------------------------------------------
294 * MMC / SD Slot for Atmel MCI Driver
295 * -------------------------------------------------------------------- */
296
297#if defined(CONFIG_MMC_ATMELMCI) || defined(CONFIG_MMC_ATMELMCI_MODULE)
298static u64 mmc_dmamask = DMA_BIT_MASK(32);
299static struct mci_platform_data mmc_data;
300
301static struct resource mmc_resources[] = {
302 [0] = {
303 .start = AT91SAM9260_BASE_MCI,
304 .end = AT91SAM9260_BASE_MCI + SZ_16K - 1,
305 .flags = IORESOURCE_MEM,
306 },
307 [1] = {
Ludovic Desroches8fe82a52012-06-21 14:47:27 +0200308 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_MCI,
309 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_MCI,
Rob Emanuele864f38e2009-09-22 16:45:22 -0700310 .flags = IORESOURCE_IRQ,
311 },
312};
313
314static struct platform_device at91sam9260_mmc_device = {
315 .name = "atmel_mci",
316 .id = -1,
317 .dev = {
318 .dma_mask = &mmc_dmamask,
319 .coherent_dma_mask = DMA_BIT_MASK(32),
320 .platform_data = &mmc_data,
321 },
322 .resource = mmc_resources,
323 .num_resources = ARRAY_SIZE(mmc_resources),
324};
325
326void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data)
327{
328 unsigned int i;
329 unsigned int slot_count = 0;
330
331 if (!data)
332 return;
333
Ludovic Desroches2c96a292011-08-11 15:25:41 +0000334 for (i = 0; i < ATMCI_MAX_NR_SLOTS; i++) {
Rob Emanuele864f38e2009-09-22 16:45:22 -0700335 if (data->slot[i].bus_width) {
336 /* input/irq */
Jean-Christophe PLAGNIOL-VILLARDcc9f9ae2011-09-19 15:28:25 +0800337 if (gpio_is_valid(data->slot[i].detect_pin)) {
Rob Emanuele864f38e2009-09-22 16:45:22 -0700338 at91_set_gpio_input(data->slot[i].detect_pin, 1);
339 at91_set_deglitch(data->slot[i].detect_pin, 1);
340 }
Jean-Christophe PLAGNIOL-VILLARDcc9f9ae2011-09-19 15:28:25 +0800341 if (gpio_is_valid(data->slot[i].wp_pin))
Rob Emanuele864f38e2009-09-22 16:45:22 -0700342 at91_set_gpio_input(data->slot[i].wp_pin, 1);
343
344 switch (i) {
345 case 0:
346 /* CMD */
347 at91_set_A_periph(AT91_PIN_PA7, 1);
348 /* DAT0, maybe DAT1..DAT3 */
349 at91_set_A_periph(AT91_PIN_PA6, 1);
350 if (data->slot[i].bus_width == 4) {
351 at91_set_A_periph(AT91_PIN_PA9, 1);
352 at91_set_A_periph(AT91_PIN_PA10, 1);
353 at91_set_A_periph(AT91_PIN_PA11, 1);
354 }
355 slot_count++;
356 break;
357 case 1:
358 /* CMD */
359 at91_set_B_periph(AT91_PIN_PA1, 1);
360 /* DAT0, maybe DAT1..DAT3 */
361 at91_set_B_periph(AT91_PIN_PA0, 1);
362 if (data->slot[i].bus_width == 4) {
363 at91_set_B_periph(AT91_PIN_PA5, 1);
364 at91_set_B_periph(AT91_PIN_PA4, 1);
365 at91_set_B_periph(AT91_PIN_PA3, 1);
366 }
367 slot_count++;
368 break;
369 default:
370 printk(KERN_ERR
371 "AT91: SD/MMC slot %d not available\n", i);
372 break;
373 }
374 }
375 }
376
377 if (slot_count) {
378 /* CLK */
379 at91_set_A_periph(AT91_PIN_PA8, 0);
380
381 mmc_data = *data;
382 platform_device_register(&at91sam9260_mmc_device);
383 }
384}
385#else
386void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) {}
387#endif
388
Andrew Victor86ad76b2006-11-30 16:45:01 +0100389
390/* --------------------------------------------------------------------
391 * NAND / SmartMedia
392 * -------------------------------------------------------------------- */
393
Pieter du Preezf6ed6f72008-08-01 10:06:40 +0100394#if defined(CONFIG_MTD_NAND_ATMEL) || defined(CONFIG_MTD_NAND_ATMEL_MODULE)
HÃ¥vard Skinnemoen3c3796c2008-06-06 18:04:53 +0200395static struct atmel_nand_data nand_data;
Andrew Victor86ad76b2006-11-30 16:45:01 +0100396
397#define NAND_BASE AT91_CHIPSELECT_3
398
399static struct resource nand_resources[] = {
Andrew Victord7a24152008-04-02 21:44:44 +0100400 [0] = {
Andrew Victor86ad76b2006-11-30 16:45:01 +0100401 .start = NAND_BASE,
Andrew Victor22823552008-01-23 09:21:02 +0100402 .end = NAND_BASE + SZ_256M - 1,
Andrew Victor86ad76b2006-11-30 16:45:01 +0100403 .flags = IORESOURCE_MEM,
Andrew Victord7a24152008-04-02 21:44:44 +0100404 },
405 [1] = {
Jean-Christophe PLAGNIOL-VILLARDd28edd12011-09-18 09:31:56 +0800406 .start = AT91SAM9260_BASE_ECC,
407 .end = AT91SAM9260_BASE_ECC + SZ_512 - 1,
Andrew Victord7a24152008-04-02 21:44:44 +0100408 .flags = IORESOURCE_MEM,
Andrew Victor86ad76b2006-11-30 16:45:01 +0100409 }
410};
411
412static struct platform_device at91sam9260_nand_device = {
HÃ¥vard Skinnemoen3c3796c2008-06-06 18:04:53 +0200413 .name = "atmel_nand",
Andrew Victor86ad76b2006-11-30 16:45:01 +0100414 .id = -1,
415 .dev = {
416 .platform_data = &nand_data,
417 },
418 .resource = nand_resources,
419 .num_resources = ARRAY_SIZE(nand_resources),
420};
421
HÃ¥vard Skinnemoen3c3796c2008-06-06 18:04:53 +0200422void __init at91_add_device_nand(struct atmel_nand_data *data)
Andrew Victor86ad76b2006-11-30 16:45:01 +0100423{
Andrew Victor461d3b42008-10-06 20:01:00 +0100424 unsigned long csa;
Andrew Victor86ad76b2006-11-30 16:45:01 +0100425
426 if (!data)
427 return;
428
Jean-Christophe PLAGNIOL-VILLARD4342d642011-11-27 23:15:50 +0800429 csa = at91_matrix_read(AT91_MATRIX_EBICSA);
430 at91_matrix_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA);
Andrew Victor86ad76b2006-11-30 16:45:01 +0100431
Andrew Victor86ad76b2006-11-30 16:45:01 +0100432 /* enable pin */
Jean-Christophe PLAGNIOL-VILLARDcc9f9ae2011-09-19 15:28:25 +0800433 if (gpio_is_valid(data->enable_pin))
Andrew Victor86ad76b2006-11-30 16:45:01 +0100434 at91_set_gpio_output(data->enable_pin, 1);
435
436 /* ready/busy pin */
Jean-Christophe PLAGNIOL-VILLARDcc9f9ae2011-09-19 15:28:25 +0800437 if (gpio_is_valid(data->rdy_pin))
Andrew Victor86ad76b2006-11-30 16:45:01 +0100438 at91_set_gpio_input(data->rdy_pin, 1);
439
440 /* card detect pin */
Jean-Christophe PLAGNIOL-VILLARDcc9f9ae2011-09-19 15:28:25 +0800441 if (gpio_is_valid(data->det_pin))
Andrew Victor86ad76b2006-11-30 16:45:01 +0100442 at91_set_gpio_input(data->det_pin, 1);
443
444 nand_data = *data;
445 platform_device_register(&at91sam9260_nand_device);
446}
447#else
HÃ¥vard Skinnemoen3c3796c2008-06-06 18:04:53 +0200448void __init at91_add_device_nand(struct atmel_nand_data *data) {}
Andrew Victor86ad76b2006-11-30 16:45:01 +0100449#endif
450
451
452/* --------------------------------------------------------------------
453 * TWI (i2c)
454 * -------------------------------------------------------------------- */
455
Andrew Victorf230d3f2007-11-19 13:47:20 +0100456/*
457 * Prefer the GPIO code since the TWI controller isn't robust
458 * (gets overruns and underruns under load) and can only issue
459 * repeated STARTs in one scenario (the driver doesn't yet handle them).
460 */
461
462#if defined(CONFIG_I2C_GPIO) || defined(CONFIG_I2C_GPIO_MODULE)
463
464static struct i2c_gpio_platform_data pdata = {
465 .sda_pin = AT91_PIN_PA23,
466 .sda_is_open_drain = 1,
467 .scl_pin = AT91_PIN_PA24,
468 .scl_is_open_drain = 1,
469 .udelay = 2, /* ~100 kHz */
470};
471
472static struct platform_device at91sam9260_twi_device = {
473 .name = "i2c-gpio",
474 .id = -1,
475 .dev.platform_data = &pdata,
476};
477
478void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
479{
480 at91_set_GPIO_periph(AT91_PIN_PA23, 1); /* TWD (SDA) */
481 at91_set_multi_drive(AT91_PIN_PA23, 1);
482
483 at91_set_GPIO_periph(AT91_PIN_PA24, 1); /* TWCK (SCL) */
484 at91_set_multi_drive(AT91_PIN_PA24, 1);
485
486 i2c_register_board_info(0, devices, nr_devices);
487 platform_device_register(&at91sam9260_twi_device);
488}
489
490#elif defined(CONFIG_I2C_AT91) || defined(CONFIG_I2C_AT91_MODULE)
Andrew Victor86ad76b2006-11-30 16:45:01 +0100491
492static struct resource twi_resources[] = {
493 [0] = {
494 .start = AT91SAM9260_BASE_TWI,
495 .end = AT91SAM9260_BASE_TWI + SZ_16K - 1,
496 .flags = IORESOURCE_MEM,
497 },
498 [1] = {
Ludovic Desroches8fe82a52012-06-21 14:47:27 +0200499 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_TWI,
500 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_TWI,
Andrew Victor86ad76b2006-11-30 16:45:01 +0100501 .flags = IORESOURCE_IRQ,
502 },
503};
504
505static struct platform_device at91sam9260_twi_device = {
Andrew Victor86ad76b2006-11-30 16:45:01 +0100506 .id = -1,
507 .resource = twi_resources,
508 .num_resources = ARRAY_SIZE(twi_resources),
509};
510
Andrew Victorf230d3f2007-11-19 13:47:20 +0100511void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
Andrew Victor86ad76b2006-11-30 16:45:01 +0100512{
Nikolaus Vossfac368a2011-11-08 11:49:46 +0100513 /* IP version is not the same on 9260 and g20 */
514 if (cpu_is_at91sam9g20()) {
515 at91sam9260_twi_device.name = "i2c-at91sam9g20";
516 } else {
517 at91sam9260_twi_device.name = "i2c-at91sam9260";
518 }
519
Andrew Victor86ad76b2006-11-30 16:45:01 +0100520 /* pins used for TWI interface */
521 at91_set_A_periph(AT91_PIN_PA23, 0); /* TWD */
522 at91_set_multi_drive(AT91_PIN_PA23, 1);
523
524 at91_set_A_periph(AT91_PIN_PA24, 0); /* TWCK */
525 at91_set_multi_drive(AT91_PIN_PA24, 1);
526
Andrew Victorf230d3f2007-11-19 13:47:20 +0100527 i2c_register_board_info(0, devices, nr_devices);
Andrew Victor86ad76b2006-11-30 16:45:01 +0100528 platform_device_register(&at91sam9260_twi_device);
529}
530#else
Andrew Victorf230d3f2007-11-19 13:47:20 +0100531void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) {}
Andrew Victor86ad76b2006-11-30 16:45:01 +0100532#endif
533
534
535/* --------------------------------------------------------------------
536 * SPI
537 * -------------------------------------------------------------------- */
538
539#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
Andrew Victorc6686ff2008-01-23 09:13:53 +0100540static u64 spi_dmamask = DMA_BIT_MASK(32);
Andrew Victor86ad76b2006-11-30 16:45:01 +0100541
542static struct resource spi0_resources[] = {
543 [0] = {
544 .start = AT91SAM9260_BASE_SPI0,
545 .end = AT91SAM9260_BASE_SPI0 + SZ_16K - 1,
546 .flags = IORESOURCE_MEM,
547 },
548 [1] = {
Ludovic Desroches8fe82a52012-06-21 14:47:27 +0200549 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_SPI0,
550 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_SPI0,
Andrew Victor86ad76b2006-11-30 16:45:01 +0100551 .flags = IORESOURCE_IRQ,
552 },
553};
554
555static struct platform_device at91sam9260_spi0_device = {
556 .name = "atmel_spi",
557 .id = 0,
558 .dev = {
559 .dma_mask = &spi_dmamask,
Andrew Victorc6686ff2008-01-23 09:13:53 +0100560 .coherent_dma_mask = DMA_BIT_MASK(32),
Andrew Victor86ad76b2006-11-30 16:45:01 +0100561 },
562 .resource = spi0_resources,
563 .num_resources = ARRAY_SIZE(spi0_resources),
564};
565
566static const unsigned spi0_standard_cs[4] = { AT91_PIN_PA3, AT91_PIN_PC11, AT91_PIN_PC16, AT91_PIN_PC17 };
567
568static struct resource spi1_resources[] = {
569 [0] = {
570 .start = AT91SAM9260_BASE_SPI1,
571 .end = AT91SAM9260_BASE_SPI1 + SZ_16K - 1,
572 .flags = IORESOURCE_MEM,
573 },
574 [1] = {
Ludovic Desroches8fe82a52012-06-21 14:47:27 +0200575 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_SPI1,
576 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_SPI1,
Andrew Victor86ad76b2006-11-30 16:45:01 +0100577 .flags = IORESOURCE_IRQ,
578 },
579};
580
581static struct platform_device at91sam9260_spi1_device = {
582 .name = "atmel_spi",
583 .id = 1,
584 .dev = {
585 .dma_mask = &spi_dmamask,
Andrew Victorc6686ff2008-01-23 09:13:53 +0100586 .coherent_dma_mask = DMA_BIT_MASK(32),
Andrew Victor86ad76b2006-11-30 16:45:01 +0100587 },
588 .resource = spi1_resources,
589 .num_resources = ARRAY_SIZE(spi1_resources),
590};
591
592static const unsigned spi1_standard_cs[4] = { AT91_PIN_PB3, AT91_PIN_PC5, AT91_PIN_PC4, AT91_PIN_PC3 };
593
594void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
595{
596 int i;
597 unsigned long cs_pin;
598 short enable_spi0 = 0;
599 short enable_spi1 = 0;
600
601 /* Choose SPI chip-selects */
602 for (i = 0; i < nr_devices; i++) {
603 if (devices[i].controller_data)
604 cs_pin = (unsigned long) devices[i].controller_data;
605 else if (devices[i].bus_num == 0)
606 cs_pin = spi0_standard_cs[devices[i].chip_select];
607 else
608 cs_pin = spi1_standard_cs[devices[i].chip_select];
609
Nicolas Ferre0c2c1f62012-03-28 11:58:58 +0200610 if (!gpio_is_valid(cs_pin))
611 continue;
612
Andrew Victor86ad76b2006-11-30 16:45:01 +0100613 if (devices[i].bus_num == 0)
614 enable_spi0 = 1;
615 else
616 enable_spi1 = 1;
617
618 /* enable chip-select pin */
619 at91_set_gpio_output(cs_pin, 1);
620
621 /* pass chip-select pin to driver */
622 devices[i].controller_data = (void *) cs_pin;
623 }
624
625 spi_register_board_info(devices, nr_devices);
626
627 /* Configure SPI bus(es) */
628 if (enable_spi0) {
629 at91_set_A_periph(AT91_PIN_PA0, 0); /* SPI0_MISO */
630 at91_set_A_periph(AT91_PIN_PA1, 0); /* SPI0_MOSI */
631 at91_set_A_periph(AT91_PIN_PA2, 0); /* SPI1_SPCK */
632
Andrew Victor86ad76b2006-11-30 16:45:01 +0100633 platform_device_register(&at91sam9260_spi0_device);
634 }
635 if (enable_spi1) {
636 at91_set_A_periph(AT91_PIN_PB0, 0); /* SPI1_MISO */
637 at91_set_A_periph(AT91_PIN_PB1, 0); /* SPI1_MOSI */
638 at91_set_A_periph(AT91_PIN_PB2, 0); /* SPI1_SPCK */
639
Andrew Victor86ad76b2006-11-30 16:45:01 +0100640 platform_device_register(&at91sam9260_spi1_device);
641 }
642}
643#else
644void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) {}
645#endif
646
647
648/* --------------------------------------------------------------------
Andrew Victore5f40bf2008-04-02 21:58:00 +0100649 * Timer/Counter blocks
650 * -------------------------------------------------------------------- */
651
652#ifdef CONFIG_ATMEL_TCLIB
653
654static struct resource tcb0_resources[] = {
655 [0] = {
656 .start = AT91SAM9260_BASE_TCB0,
Nicolas Ferre29831292012-01-18 16:56:36 +0100657 .end = AT91SAM9260_BASE_TCB0 + SZ_256 - 1,
Andrew Victore5f40bf2008-04-02 21:58:00 +0100658 .flags = IORESOURCE_MEM,
659 },
660 [1] = {
Ludovic Desroches8fe82a52012-06-21 14:47:27 +0200661 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_TC0,
662 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_TC0,
Andrew Victore5f40bf2008-04-02 21:58:00 +0100663 .flags = IORESOURCE_IRQ,
664 },
665 [2] = {
Ludovic Desroches8fe82a52012-06-21 14:47:27 +0200666 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_TC1,
667 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_TC1,
Andrew Victore5f40bf2008-04-02 21:58:00 +0100668 .flags = IORESOURCE_IRQ,
669 },
670 [3] = {
Ludovic Desroches8fe82a52012-06-21 14:47:27 +0200671 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_TC2,
672 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_TC2,
Andrew Victore5f40bf2008-04-02 21:58:00 +0100673 .flags = IORESOURCE_IRQ,
674 },
675};
676
677static struct platform_device at91sam9260_tcb0_device = {
678 .name = "atmel_tcb",
679 .id = 0,
680 .resource = tcb0_resources,
681 .num_resources = ARRAY_SIZE(tcb0_resources),
682};
683
684static struct resource tcb1_resources[] = {
685 [0] = {
686 .start = AT91SAM9260_BASE_TCB1,
Nicolas Ferre29831292012-01-18 16:56:36 +0100687 .end = AT91SAM9260_BASE_TCB1 + SZ_256 - 1,
Andrew Victore5f40bf2008-04-02 21:58:00 +0100688 .flags = IORESOURCE_MEM,
689 },
690 [1] = {
Ludovic Desroches8fe82a52012-06-21 14:47:27 +0200691 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_TC3,
692 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_TC3,
Andrew Victore5f40bf2008-04-02 21:58:00 +0100693 .flags = IORESOURCE_IRQ,
694 },
695 [2] = {
Ludovic Desroches8fe82a52012-06-21 14:47:27 +0200696 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_TC4,
697 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_TC4,
Andrew Victore5f40bf2008-04-02 21:58:00 +0100698 .flags = IORESOURCE_IRQ,
699 },
700 [3] = {
Ludovic Desroches8fe82a52012-06-21 14:47:27 +0200701 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_TC5,
702 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_TC5,
Andrew Victore5f40bf2008-04-02 21:58:00 +0100703 .flags = IORESOURCE_IRQ,
704 },
705};
706
707static struct platform_device at91sam9260_tcb1_device = {
708 .name = "atmel_tcb",
709 .id = 1,
710 .resource = tcb1_resources,
711 .num_resources = ARRAY_SIZE(tcb1_resources),
712};
713
714static void __init at91_add_device_tc(void)
715{
Andrew Victore5f40bf2008-04-02 21:58:00 +0100716 platform_device_register(&at91sam9260_tcb0_device);
Andrew Victore5f40bf2008-04-02 21:58:00 +0100717 platform_device_register(&at91sam9260_tcb1_device);
718}
719#else
720static void __init at91_add_device_tc(void) { }
721#endif
722
723
724/* --------------------------------------------------------------------
Andrew Victor884f5a62008-01-23 09:11:13 +0100725 * RTT
726 * -------------------------------------------------------------------- */
727
728static struct resource rtt_resources[] = {
729 {
Jean-Christophe PLAGNIOL-VILLARDeab5fd62011-09-18 10:12:00 +0800730 .start = AT91SAM9260_BASE_RTT,
731 .end = AT91SAM9260_BASE_RTT + SZ_16 - 1,
Andrew Victor884f5a62008-01-23 09:11:13 +0100732 .flags = IORESOURCE_MEM,
Jean-Christophe PLAGNIOL-VILLARDb3af8b42012-02-15 21:24:46 +0800733 }, {
734 .flags = IORESOURCE_MEM,
Ludovic Desrochese402af62012-08-14 11:19:22 +0200735 }, {
736 .flags = IORESOURCE_IRQ,
Jean-Christophe PLAGNIOL-VILLARDb3af8b42012-02-15 21:24:46 +0800737 },
Andrew Victor884f5a62008-01-23 09:11:13 +0100738};
739
740static struct platform_device at91sam9260_rtt_device = {
741 .name = "at91_rtt",
Andrew Victor4fd92122008-04-02 21:55:19 +0100742 .id = 0,
Andrew Victor884f5a62008-01-23 09:11:13 +0100743 .resource = rtt_resources,
Andrew Victor884f5a62008-01-23 09:11:13 +0100744};
745
Jean-Christophe PLAGNIOL-VILLARD205056a2012-02-15 20:51:37 +0800746
747#if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9)
748static void __init at91_add_device_rtt_rtc(void)
749{
750 at91sam9260_rtt_device.name = "rtc-at91sam9";
Jean-Christophe PLAGNIOL-VILLARDb3af8b42012-02-15 21:24:46 +0800751 /*
752 * The second resource is needed:
753 * GPBR will serve as the storage for RTC time offset
754 */
Ludovic Desrochese402af62012-08-14 11:19:22 +0200755 at91sam9260_rtt_device.num_resources = 3;
Jean-Christophe PLAGNIOL-VILLARDb3af8b42012-02-15 21:24:46 +0800756 rtt_resources[1].start = AT91SAM9260_BASE_GPBR +
757 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR;
758 rtt_resources[1].end = rtt_resources[1].start + 3;
Ludovic Desrochese402af62012-08-14 11:19:22 +0200759 rtt_resources[2].start = NR_IRQS_LEGACY + AT91_ID_SYS;
760 rtt_resources[2].end = NR_IRQS_LEGACY + AT91_ID_SYS;
Jean-Christophe PLAGNIOL-VILLARD205056a2012-02-15 20:51:37 +0800761}
762#else
Jean-Christophe PLAGNIOL-VILLARDb3af8b42012-02-15 21:24:46 +0800763static void __init at91_add_device_rtt_rtc(void)
764{
765 /* Only one resource is needed: RTT not used as RTC */
766 at91sam9260_rtt_device.num_resources = 1;
767}
Jean-Christophe PLAGNIOL-VILLARD205056a2012-02-15 20:51:37 +0800768#endif
769
Andrew Victor884f5a62008-01-23 09:11:13 +0100770static void __init at91_add_device_rtt(void)
771{
Jean-Christophe PLAGNIOL-VILLARD205056a2012-02-15 20:51:37 +0800772 at91_add_device_rtt_rtc();
Andrew Victor884f5a62008-01-23 09:11:13 +0100773 platform_device_register(&at91sam9260_rtt_device);
774}
775
776
777/* --------------------------------------------------------------------
778 * Watchdog
779 * -------------------------------------------------------------------- */
780
Andrew Victor2af29b72009-02-11 21:23:10 +0100781#if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE)
Jean-Christophe PLAGNIOL-VILLARDc1c30a22011-11-02 01:43:31 +0800782static struct resource wdt_resources[] = {
783 {
784 .start = AT91SAM9260_BASE_WDT,
785 .end = AT91SAM9260_BASE_WDT + SZ_16 - 1,
786 .flags = IORESOURCE_MEM,
787 }
788};
789
Andrew Victor884f5a62008-01-23 09:11:13 +0100790static struct platform_device at91sam9260_wdt_device = {
791 .name = "at91_wdt",
792 .id = -1,
Jean-Christophe PLAGNIOL-VILLARDc1c30a22011-11-02 01:43:31 +0800793 .resource = wdt_resources,
794 .num_resources = ARRAY_SIZE(wdt_resources),
Andrew Victor884f5a62008-01-23 09:11:13 +0100795};
796
797static void __init at91_add_device_watchdog(void)
798{
799 platform_device_register(&at91sam9260_wdt_device);
800}
801#else
802static void __init at91_add_device_watchdog(void) {}
803#endif
804
805
806/* --------------------------------------------------------------------
Andrew Victorbfbc3262008-01-23 09:18:06 +0100807 * SSC -- Synchronous Serial Controller
808 * -------------------------------------------------------------------- */
809
810#if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE)
811static u64 ssc_dmamask = DMA_BIT_MASK(32);
812
813static struct resource ssc_resources[] = {
814 [0] = {
815 .start = AT91SAM9260_BASE_SSC,
816 .end = AT91SAM9260_BASE_SSC + SZ_16K - 1,
817 .flags = IORESOURCE_MEM,
818 },
819 [1] = {
Ludovic Desroches8fe82a52012-06-21 14:47:27 +0200820 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_SSC,
821 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_SSC,
Andrew Victorbfbc3262008-01-23 09:18:06 +0100822 .flags = IORESOURCE_IRQ,
823 },
824};
825
826static struct platform_device at91sam9260_ssc_device = {
827 .name = "ssc",
828 .id = 0,
829 .dev = {
830 .dma_mask = &ssc_dmamask,
831 .coherent_dma_mask = DMA_BIT_MASK(32),
832 },
833 .resource = ssc_resources,
834 .num_resources = ARRAY_SIZE(ssc_resources),
835};
836
837static inline void configure_ssc_pins(unsigned pins)
838{
839 if (pins & ATMEL_SSC_TF)
840 at91_set_A_periph(AT91_PIN_PB17, 1);
841 if (pins & ATMEL_SSC_TK)
842 at91_set_A_periph(AT91_PIN_PB16, 1);
843 if (pins & ATMEL_SSC_TD)
844 at91_set_A_periph(AT91_PIN_PB18, 1);
845 if (pins & ATMEL_SSC_RD)
846 at91_set_A_periph(AT91_PIN_PB19, 1);
847 if (pins & ATMEL_SSC_RK)
848 at91_set_A_periph(AT91_PIN_PB20, 1);
849 if (pins & ATMEL_SSC_RF)
850 at91_set_A_periph(AT91_PIN_PB21, 1);
851}
852
853/*
854 * SSC controllers are accessed through library code, instead of any
855 * kind of all-singing/all-dancing driver. For example one could be
856 * used by a particular I2S audio codec's driver, while another one
857 * on the same system might be used by a custom data capture driver.
858 */
859void __init at91_add_device_ssc(unsigned id, unsigned pins)
860{
861 struct platform_device *pdev;
862
863 /*
864 * NOTE: caller is responsible for passing information matching
865 * "pins" to whatever will be using each particular controller.
866 */
867 switch (id) {
868 case AT91SAM9260_ID_SSC:
869 pdev = &at91sam9260_ssc_device;
870 configure_ssc_pins(pins);
Andrew Victorbfbc3262008-01-23 09:18:06 +0100871 break;
872 default:
873 return;
874 }
875
876 platform_device_register(pdev);
877}
878
879#else
880void __init at91_add_device_ssc(unsigned id, unsigned pins) {}
881#endif
882
883
884/* --------------------------------------------------------------------
Andrew Victor86ad76b2006-11-30 16:45:01 +0100885 * UART
886 * -------------------------------------------------------------------- */
887#if defined(CONFIG_SERIAL_ATMEL)
888static struct resource dbgu_resources[] = {
889 [0] = {
Jean-Christophe PLAGNIOL-VILLARD13079a72011-11-02 01:43:31 +0800890 .start = AT91SAM9260_BASE_DBGU,
891 .end = AT91SAM9260_BASE_DBGU + SZ_512 - 1,
Andrew Victor86ad76b2006-11-30 16:45:01 +0100892 .flags = IORESOURCE_MEM,
893 },
894 [1] = {
Ludovic Desroches8fe82a52012-06-21 14:47:27 +0200895 .start = NR_IRQS_LEGACY + AT91_ID_SYS,
896 .end = NR_IRQS_LEGACY + AT91_ID_SYS,
Andrew Victor86ad76b2006-11-30 16:45:01 +0100897 .flags = IORESOURCE_IRQ,
898 },
899};
900
901static struct atmel_uart_data dbgu_data = {
902 .use_dma_tx = 0,
903 .use_dma_rx = 0, /* DBGU not capable of receive DMA */
Andrew Victor86ad76b2006-11-30 16:45:01 +0100904};
905
Andrew Victorc6686ff2008-01-23 09:13:53 +0100906static u64 dbgu_dmamask = DMA_BIT_MASK(32);
907
Andrew Victor86ad76b2006-11-30 16:45:01 +0100908static struct platform_device at91sam9260_dbgu_device = {
909 .name = "atmel_usart",
910 .id = 0,
911 .dev = {
Andrew Victorc6686ff2008-01-23 09:13:53 +0100912 .dma_mask = &dbgu_dmamask,
913 .coherent_dma_mask = DMA_BIT_MASK(32),
914 .platform_data = &dbgu_data,
Andrew Victor86ad76b2006-11-30 16:45:01 +0100915 },
916 .resource = dbgu_resources,
917 .num_resources = ARRAY_SIZE(dbgu_resources),
918};
919
920static inline void configure_dbgu_pins(void)
921{
922 at91_set_A_periph(AT91_PIN_PB14, 0); /* DRXD */
923 at91_set_A_periph(AT91_PIN_PB15, 1); /* DTXD */
924}
925
926static struct resource uart0_resources[] = {
927 [0] = {
928 .start = AT91SAM9260_BASE_US0,
929 .end = AT91SAM9260_BASE_US0 + SZ_16K - 1,
930 .flags = IORESOURCE_MEM,
931 },
932 [1] = {
Ludovic Desroches8fe82a52012-06-21 14:47:27 +0200933 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_US0,
934 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_US0,
Andrew Victor86ad76b2006-11-30 16:45:01 +0100935 .flags = IORESOURCE_IRQ,
936 },
937};
938
939static struct atmel_uart_data uart0_data = {
940 .use_dma_tx = 1,
941 .use_dma_rx = 1,
942};
943
Andrew Victorc6686ff2008-01-23 09:13:53 +0100944static u64 uart0_dmamask = DMA_BIT_MASK(32);
945
Andrew Victor86ad76b2006-11-30 16:45:01 +0100946static struct platform_device at91sam9260_uart0_device = {
947 .name = "atmel_usart",
948 .id = 1,
949 .dev = {
Andrew Victorc6686ff2008-01-23 09:13:53 +0100950 .dma_mask = &uart0_dmamask,
951 .coherent_dma_mask = DMA_BIT_MASK(32),
952 .platform_data = &uart0_data,
Andrew Victor86ad76b2006-11-30 16:45:01 +0100953 },
954 .resource = uart0_resources,
955 .num_resources = ARRAY_SIZE(uart0_resources),
956};
957
Andrew Victorc8f385a2008-01-23 09:25:15 +0100958static inline void configure_usart0_pins(unsigned pins)
Andrew Victor86ad76b2006-11-30 16:45:01 +0100959{
960 at91_set_A_periph(AT91_PIN_PB4, 1); /* TXD0 */
961 at91_set_A_periph(AT91_PIN_PB5, 0); /* RXD0 */
Andrew Victorc8f385a2008-01-23 09:25:15 +0100962
963 if (pins & ATMEL_UART_RTS)
964 at91_set_A_periph(AT91_PIN_PB26, 0); /* RTS0 */
965 if (pins & ATMEL_UART_CTS)
966 at91_set_A_periph(AT91_PIN_PB27, 0); /* CTS0 */
967 if (pins & ATMEL_UART_DTR)
968 at91_set_A_periph(AT91_PIN_PB24, 0); /* DTR0 */
969 if (pins & ATMEL_UART_DSR)
970 at91_set_A_periph(AT91_PIN_PB22, 0); /* DSR0 */
971 if (pins & ATMEL_UART_DCD)
972 at91_set_A_periph(AT91_PIN_PB23, 0); /* DCD0 */
973 if (pins & ATMEL_UART_RI)
974 at91_set_A_periph(AT91_PIN_PB25, 0); /* RI0 */
Andrew Victor86ad76b2006-11-30 16:45:01 +0100975}
976
977static struct resource uart1_resources[] = {
978 [0] = {
979 .start = AT91SAM9260_BASE_US1,
980 .end = AT91SAM9260_BASE_US1 + SZ_16K - 1,
981 .flags = IORESOURCE_MEM,
982 },
983 [1] = {
Ludovic Desroches8fe82a52012-06-21 14:47:27 +0200984 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_US1,
985 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_US1,
Andrew Victor86ad76b2006-11-30 16:45:01 +0100986 .flags = IORESOURCE_IRQ,
987 },
988};
989
990static struct atmel_uart_data uart1_data = {
991 .use_dma_tx = 1,
992 .use_dma_rx = 1,
993};
994
Andrew Victorc6686ff2008-01-23 09:13:53 +0100995static u64 uart1_dmamask = DMA_BIT_MASK(32);
996
Andrew Victor86ad76b2006-11-30 16:45:01 +0100997static struct platform_device at91sam9260_uart1_device = {
998 .name = "atmel_usart",
999 .id = 2,
1000 .dev = {
Andrew Victorc6686ff2008-01-23 09:13:53 +01001001 .dma_mask = &uart1_dmamask,
1002 .coherent_dma_mask = DMA_BIT_MASK(32),
1003 .platform_data = &uart1_data,
Andrew Victor86ad76b2006-11-30 16:45:01 +01001004 },
1005 .resource = uart1_resources,
1006 .num_resources = ARRAY_SIZE(uart1_resources),
1007};
1008
Andrew Victorc8f385a2008-01-23 09:25:15 +01001009static inline void configure_usart1_pins(unsigned pins)
Andrew Victor86ad76b2006-11-30 16:45:01 +01001010{
1011 at91_set_A_periph(AT91_PIN_PB6, 1); /* TXD1 */
1012 at91_set_A_periph(AT91_PIN_PB7, 0); /* RXD1 */
Andrew Victorc8f385a2008-01-23 09:25:15 +01001013
1014 if (pins & ATMEL_UART_RTS)
1015 at91_set_A_periph(AT91_PIN_PB28, 0); /* RTS1 */
1016 if (pins & ATMEL_UART_CTS)
1017 at91_set_A_periph(AT91_PIN_PB29, 0); /* CTS1 */
Andrew Victor86ad76b2006-11-30 16:45:01 +01001018}
1019
1020static struct resource uart2_resources[] = {
1021 [0] = {
1022 .start = AT91SAM9260_BASE_US2,
1023 .end = AT91SAM9260_BASE_US2 + SZ_16K - 1,
1024 .flags = IORESOURCE_MEM,
1025 },
1026 [1] = {
Ludovic Desroches8fe82a52012-06-21 14:47:27 +02001027 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_US2,
1028 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_US2,
Andrew Victor86ad76b2006-11-30 16:45:01 +01001029 .flags = IORESOURCE_IRQ,
1030 },
1031};
1032
1033static struct atmel_uart_data uart2_data = {
1034 .use_dma_tx = 1,
1035 .use_dma_rx = 1,
1036};
1037
Andrew Victorc6686ff2008-01-23 09:13:53 +01001038static u64 uart2_dmamask = DMA_BIT_MASK(32);
1039
Andrew Victor86ad76b2006-11-30 16:45:01 +01001040static struct platform_device at91sam9260_uart2_device = {
1041 .name = "atmel_usart",
1042 .id = 3,
1043 .dev = {
Andrew Victorc6686ff2008-01-23 09:13:53 +01001044 .dma_mask = &uart2_dmamask,
1045 .coherent_dma_mask = DMA_BIT_MASK(32),
1046 .platform_data = &uart2_data,
Andrew Victor86ad76b2006-11-30 16:45:01 +01001047 },
1048 .resource = uart2_resources,
1049 .num_resources = ARRAY_SIZE(uart2_resources),
1050};
1051
Andrew Victorc8f385a2008-01-23 09:25:15 +01001052static inline void configure_usart2_pins(unsigned pins)
Andrew Victor86ad76b2006-11-30 16:45:01 +01001053{
1054 at91_set_A_periph(AT91_PIN_PB8, 1); /* TXD2 */
1055 at91_set_A_periph(AT91_PIN_PB9, 0); /* RXD2 */
Andrew Victorc8f385a2008-01-23 09:25:15 +01001056
1057 if (pins & ATMEL_UART_RTS)
1058 at91_set_A_periph(AT91_PIN_PA4, 0); /* RTS2 */
1059 if (pins & ATMEL_UART_CTS)
1060 at91_set_A_periph(AT91_PIN_PA5, 0); /* CTS2 */
Andrew Victor86ad76b2006-11-30 16:45:01 +01001061}
1062
1063static struct resource uart3_resources[] = {
1064 [0] = {
1065 .start = AT91SAM9260_BASE_US3,
1066 .end = AT91SAM9260_BASE_US3 + SZ_16K - 1,
1067 .flags = IORESOURCE_MEM,
1068 },
1069 [1] = {
Ludovic Desroches8fe82a52012-06-21 14:47:27 +02001070 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_US3,
1071 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_US3,
Andrew Victor86ad76b2006-11-30 16:45:01 +01001072 .flags = IORESOURCE_IRQ,
1073 },
1074};
1075
1076static struct atmel_uart_data uart3_data = {
1077 .use_dma_tx = 1,
1078 .use_dma_rx = 1,
1079};
1080
Andrew Victorc6686ff2008-01-23 09:13:53 +01001081static u64 uart3_dmamask = DMA_BIT_MASK(32);
1082
Andrew Victor86ad76b2006-11-30 16:45:01 +01001083static struct platform_device at91sam9260_uart3_device = {
1084 .name = "atmel_usart",
1085 .id = 4,
1086 .dev = {
Andrew Victorc6686ff2008-01-23 09:13:53 +01001087 .dma_mask = &uart3_dmamask,
1088 .coherent_dma_mask = DMA_BIT_MASK(32),
1089 .platform_data = &uart3_data,
Andrew Victor86ad76b2006-11-30 16:45:01 +01001090 },
1091 .resource = uart3_resources,
1092 .num_resources = ARRAY_SIZE(uart3_resources),
1093};
1094
Andrew Victorc8f385a2008-01-23 09:25:15 +01001095static inline void configure_usart3_pins(unsigned pins)
Andrew Victor86ad76b2006-11-30 16:45:01 +01001096{
1097 at91_set_A_periph(AT91_PIN_PB10, 1); /* TXD3 */
1098 at91_set_A_periph(AT91_PIN_PB11, 0); /* RXD3 */
Andrew Victorc8f385a2008-01-23 09:25:15 +01001099
1100 if (pins & ATMEL_UART_RTS)
1101 at91_set_B_periph(AT91_PIN_PC8, 0); /* RTS3 */
1102 if (pins & ATMEL_UART_CTS)
1103 at91_set_B_periph(AT91_PIN_PC10, 0); /* CTS3 */
Andrew Victor86ad76b2006-11-30 16:45:01 +01001104}
1105
1106static struct resource uart4_resources[] = {
1107 [0] = {
1108 .start = AT91SAM9260_BASE_US4,
1109 .end = AT91SAM9260_BASE_US4 + SZ_16K - 1,
1110 .flags = IORESOURCE_MEM,
1111 },
1112 [1] = {
Ludovic Desroches8fe82a52012-06-21 14:47:27 +02001113 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_US4,
1114 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_US4,
Andrew Victor86ad76b2006-11-30 16:45:01 +01001115 .flags = IORESOURCE_IRQ,
1116 },
1117};
1118
1119static struct atmel_uart_data uart4_data = {
1120 .use_dma_tx = 1,
1121 .use_dma_rx = 1,
1122};
1123
Andrew Victorc6686ff2008-01-23 09:13:53 +01001124static u64 uart4_dmamask = DMA_BIT_MASK(32);
1125
Andrew Victor86ad76b2006-11-30 16:45:01 +01001126static struct platform_device at91sam9260_uart4_device = {
1127 .name = "atmel_usart",
1128 .id = 5,
1129 .dev = {
Andrew Victorc6686ff2008-01-23 09:13:53 +01001130 .dma_mask = &uart4_dmamask,
1131 .coherent_dma_mask = DMA_BIT_MASK(32),
1132 .platform_data = &uart4_data,
Andrew Victor86ad76b2006-11-30 16:45:01 +01001133 },
1134 .resource = uart4_resources,
1135 .num_resources = ARRAY_SIZE(uart4_resources),
1136};
1137
1138static inline void configure_usart4_pins(void)
1139{
1140 at91_set_B_periph(AT91_PIN_PA31, 1); /* TXD4 */
1141 at91_set_B_periph(AT91_PIN_PA30, 0); /* RXD4 */
1142}
1143
1144static struct resource uart5_resources[] = {
1145 [0] = {
1146 .start = AT91SAM9260_BASE_US5,
1147 .end = AT91SAM9260_BASE_US5 + SZ_16K - 1,
1148 .flags = IORESOURCE_MEM,
1149 },
1150 [1] = {
Ludovic Desroches8fe82a52012-06-21 14:47:27 +02001151 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_US5,
1152 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_US5,
Andrew Victor86ad76b2006-11-30 16:45:01 +01001153 .flags = IORESOURCE_IRQ,
1154 },
1155};
1156
1157static struct atmel_uart_data uart5_data = {
1158 .use_dma_tx = 1,
1159 .use_dma_rx = 1,
1160};
1161
Andrew Victorc6686ff2008-01-23 09:13:53 +01001162static u64 uart5_dmamask = DMA_BIT_MASK(32);
1163
Andrew Victor86ad76b2006-11-30 16:45:01 +01001164static struct platform_device at91sam9260_uart5_device = {
1165 .name = "atmel_usart",
1166 .id = 6,
1167 .dev = {
Andrew Victorc6686ff2008-01-23 09:13:53 +01001168 .dma_mask = &uart5_dmamask,
1169 .coherent_dma_mask = DMA_BIT_MASK(32),
1170 .platform_data = &uart5_data,
Andrew Victor86ad76b2006-11-30 16:45:01 +01001171 },
1172 .resource = uart5_resources,
1173 .num_resources = ARRAY_SIZE(uart5_resources),
1174};
1175
1176static inline void configure_usart5_pins(void)
1177{
1178 at91_set_A_periph(AT91_PIN_PB12, 1); /* TXD5 */
1179 at91_set_A_periph(AT91_PIN_PB13, 0); /* RXD5 */
1180}
1181
Andrew Victor11aadac2008-04-15 21:16:38 +01001182static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
Andrew Victor86ad76b2006-11-30 16:45:01 +01001183
Andrew Victorc8f385a2008-01-23 09:25:15 +01001184void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
1185{
1186 struct platform_device *pdev;
Jean-Christophe PLAGNIOL-VILLARD2b348e22011-04-10 14:10:05 +08001187 struct atmel_uart_data *pdata;
Andrew Victorc8f385a2008-01-23 09:25:15 +01001188
1189 switch (id) {
1190 case 0: /* DBGU */
1191 pdev = &at91sam9260_dbgu_device;
1192 configure_dbgu_pins();
Andrew Victorc8f385a2008-01-23 09:25:15 +01001193 break;
1194 case AT91SAM9260_ID_US0:
1195 pdev = &at91sam9260_uart0_device;
1196 configure_usart0_pins(pins);
Andrew Victorc8f385a2008-01-23 09:25:15 +01001197 break;
1198 case AT91SAM9260_ID_US1:
1199 pdev = &at91sam9260_uart1_device;
1200 configure_usart1_pins(pins);
Andrew Victorc8f385a2008-01-23 09:25:15 +01001201 break;
1202 case AT91SAM9260_ID_US2:
1203 pdev = &at91sam9260_uart2_device;
1204 configure_usart2_pins(pins);
Andrew Victorc8f385a2008-01-23 09:25:15 +01001205 break;
1206 case AT91SAM9260_ID_US3:
1207 pdev = &at91sam9260_uart3_device;
1208 configure_usart3_pins(pins);
Andrew Victorc8f385a2008-01-23 09:25:15 +01001209 break;
1210 case AT91SAM9260_ID_US4:
1211 pdev = &at91sam9260_uart4_device;
1212 configure_usart4_pins();
Andrew Victorc8f385a2008-01-23 09:25:15 +01001213 break;
1214 case AT91SAM9260_ID_US5:
1215 pdev = &at91sam9260_uart5_device;
1216 configure_usart5_pins();
Andrew Victorc8f385a2008-01-23 09:25:15 +01001217 break;
1218 default:
1219 return;
1220 }
Jean-Christophe PLAGNIOL-VILLARD2b348e22011-04-10 14:10:05 +08001221 pdata = pdev->dev.platform_data;
1222 pdata->num = portnr; /* update to mapped ID */
Andrew Victorc8f385a2008-01-23 09:25:15 +01001223
1224 if (portnr < ATMEL_MAX_UART)
1225 at91_uarts[portnr] = pdev;
1226}
1227
Andrew Victor86ad76b2006-11-30 16:45:01 +01001228void __init at91_add_device_serial(void)
1229{
1230 int i;
1231
1232 for (i = 0; i < ATMEL_MAX_UART; i++) {
1233 if (at91_uarts[i])
1234 platform_device_register(at91_uarts[i]);
1235 }
1236}
1237#else
Andrew Victorc8f385a2008-01-23 09:25:15 +01001238void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {}
Andrew Victor86ad76b2006-11-30 16:45:01 +01001239void __init at91_add_device_serial(void) {}
1240#endif
1241
Sergey Matyukevichfb852052009-07-30 22:23:24 +01001242/* --------------------------------------------------------------------
1243 * CF/IDE
1244 * -------------------------------------------------------------------- */
1245
Jean-Christophe PLAGNIOL-VILLARDcf844752011-12-15 21:24:03 +08001246#if defined(CONFIG_PATA_AT91) || defined(CONFIG_PATA_AT91_MODULE) || \
Sergey Matyukevichfb852052009-07-30 22:23:24 +01001247 defined(CONFIG_AT91_CF) || defined(CONFIG_AT91_CF_MODULE)
1248
1249static struct at91_cf_data cf0_data;
1250
1251static struct resource cf0_resources[] = {
1252 [0] = {
1253 .start = AT91_CHIPSELECT_4,
1254 .end = AT91_CHIPSELECT_4 + SZ_256M - 1,
1255 .flags = IORESOURCE_MEM,
1256 }
1257};
1258
1259static struct platform_device cf0_device = {
1260 .id = 0,
1261 .dev = {
1262 .platform_data = &cf0_data,
1263 },
1264 .resource = cf0_resources,
1265 .num_resources = ARRAY_SIZE(cf0_resources),
1266};
1267
1268static struct at91_cf_data cf1_data;
1269
1270static struct resource cf1_resources[] = {
1271 [0] = {
1272 .start = AT91_CHIPSELECT_5,
1273 .end = AT91_CHIPSELECT_5 + SZ_256M - 1,
1274 .flags = IORESOURCE_MEM,
1275 }
1276};
1277
1278static struct platform_device cf1_device = {
1279 .id = 1,
1280 .dev = {
1281 .platform_data = &cf1_data,
1282 },
1283 .resource = cf1_resources,
1284 .num_resources = ARRAY_SIZE(cf1_resources),
1285};
1286
1287void __init at91_add_device_cf(struct at91_cf_data *data)
1288{
1289 struct platform_device *pdev;
1290 unsigned long csa;
1291
1292 if (!data)
1293 return;
1294
Jean-Christophe PLAGNIOL-VILLARD4342d642011-11-27 23:15:50 +08001295 csa = at91_matrix_read(AT91_MATRIX_EBICSA);
Sergey Matyukevichfb852052009-07-30 22:23:24 +01001296
1297 switch (data->chipselect) {
1298 case 4:
1299 at91_set_multi_drive(AT91_PIN_PC8, 0);
1300 at91_set_A_periph(AT91_PIN_PC8, 0);
1301 csa |= AT91_MATRIX_CS4A_SMC_CF1;
1302 cf0_data = *data;
1303 pdev = &cf0_device;
1304 break;
1305 case 5:
1306 at91_set_multi_drive(AT91_PIN_PC9, 0);
1307 at91_set_A_periph(AT91_PIN_PC9, 0);
1308 csa |= AT91_MATRIX_CS5A_SMC_CF2;
1309 cf1_data = *data;
1310 pdev = &cf1_device;
1311 break;
1312 default:
1313 printk(KERN_ERR "AT91 CF: bad chip-select requested (%u)\n",
1314 data->chipselect);
1315 return;
1316 }
1317
Jean-Christophe PLAGNIOL-VILLARD4342d642011-11-27 23:15:50 +08001318 at91_matrix_write(AT91_MATRIX_EBICSA, csa);
Sergey Matyukevichfb852052009-07-30 22:23:24 +01001319
Jean-Christophe PLAGNIOL-VILLARDcc9f9ae2011-09-19 15:28:25 +08001320 if (gpio_is_valid(data->rst_pin)) {
Sergey Matyukevichfb852052009-07-30 22:23:24 +01001321 at91_set_multi_drive(data->rst_pin, 0);
1322 at91_set_gpio_output(data->rst_pin, 1);
1323 }
1324
Jean-Christophe PLAGNIOL-VILLARDcc9f9ae2011-09-19 15:28:25 +08001325 if (gpio_is_valid(data->irq_pin)) {
Sergey Matyukevichfb852052009-07-30 22:23:24 +01001326 at91_set_gpio_input(data->irq_pin, 0);
1327 at91_set_deglitch(data->irq_pin, 1);
1328 }
1329
Jean-Christophe PLAGNIOL-VILLARDcc9f9ae2011-09-19 15:28:25 +08001330 if (gpio_is_valid(data->det_pin)) {
Sergey Matyukevichfb852052009-07-30 22:23:24 +01001331 at91_set_gpio_input(data->det_pin, 0);
1332 at91_set_deglitch(data->det_pin, 1);
1333 }
1334
1335 at91_set_B_periph(AT91_PIN_PC6, 0); /* CFCE1 */
1336 at91_set_B_periph(AT91_PIN_PC7, 0); /* CFCE2 */
1337 at91_set_A_periph(AT91_PIN_PC10, 0); /* CFRNW */
1338 at91_set_A_periph(AT91_PIN_PC15, 1); /* NWAIT */
1339
1340 if (data->flags & AT91_CF_TRUE_IDE)
1341#if defined(CONFIG_PATA_AT91) || defined(CONFIG_PATA_AT91_MODULE)
1342 pdev->name = "pata_at91";
Sergey Matyukevichfb852052009-07-30 22:23:24 +01001343#else
Jean-Christophe PLAGNIOL-VILLARDcf844752011-12-15 21:24:03 +08001344#warning "board requires AT91_CF_TRUE_IDE: enable pata_at91"
Sergey Matyukevichfb852052009-07-30 22:23:24 +01001345#endif
1346 else
1347 pdev->name = "at91_cf";
1348
1349 platform_device_register(pdev);
1350}
1351
1352#else
1353void __init at91_add_device_cf(struct at91_cf_data * data) {}
1354#endif
Andrew Victor86ad76b2006-11-30 16:45:01 +01001355
Maxime Ripard67b5d7b2012-05-11 15:35:34 +02001356/* --------------------------------------------------------------------
1357 * ADCs
1358 * -------------------------------------------------------------------- */
1359
1360#if IS_ENABLED(CONFIG_AT91_ADC)
1361static struct at91_adc_data adc_data;
1362
1363static struct resource adc_resources[] = {
1364 [0] = {
1365 .start = AT91SAM9260_BASE_ADC,
1366 .end = AT91SAM9260_BASE_ADC + SZ_16K - 1,
1367 .flags = IORESOURCE_MEM,
1368 },
1369 [1] = {
Ludovic Desroches8fe82a52012-06-21 14:47:27 +02001370 .start = NR_IRQS_LEGACY + AT91SAM9260_ID_ADC,
1371 .end = NR_IRQS_LEGACY + AT91SAM9260_ID_ADC,
Maxime Ripard67b5d7b2012-05-11 15:35:34 +02001372 .flags = IORESOURCE_IRQ,
1373 },
1374};
1375
1376static struct platform_device at91_adc_device = {
1377 .name = "at91_adc",
1378 .id = -1,
1379 .dev = {
1380 .platform_data = &adc_data,
1381 },
1382 .resource = adc_resources,
1383 .num_resources = ARRAY_SIZE(adc_resources),
1384};
1385
1386static struct at91_adc_trigger at91_adc_triggers[] = {
1387 [0] = {
1388 .name = "timer-counter-0",
1389 .value = AT91_ADC_TRGSEL_TC0 | AT91_ADC_TRGEN,
1390 },
1391 [1] = {
1392 .name = "timer-counter-1",
1393 .value = AT91_ADC_TRGSEL_TC1 | AT91_ADC_TRGEN,
1394 },
1395 [2] = {
1396 .name = "timer-counter-2",
1397 .value = AT91_ADC_TRGSEL_TC2 | AT91_ADC_TRGEN,
1398 },
1399 [3] = {
1400 .name = "external",
1401 .value = AT91_ADC_TRGSEL_EXTERNAL | AT91_ADC_TRGEN,
1402 .is_external = true,
1403 },
1404};
1405
1406static struct at91_adc_reg_desc at91_adc_register_g20 = {
1407 .channel_base = AT91_ADC_CHR(0),
1408 .drdy_mask = AT91_ADC_DRDY,
1409 .status_register = AT91_ADC_SR,
1410 .trigger_register = AT91_ADC_MR,
1411};
1412
1413void __init at91_add_device_adc(struct at91_adc_data *data)
1414{
1415 if (!data)
1416 return;
1417
1418 if (test_bit(0, &data->channels_used))
1419 at91_set_A_periph(AT91_PIN_PC0, 0);
1420 if (test_bit(1, &data->channels_used))
1421 at91_set_A_periph(AT91_PIN_PC1, 0);
1422 if (test_bit(2, &data->channels_used))
1423 at91_set_A_periph(AT91_PIN_PC2, 0);
1424 if (test_bit(3, &data->channels_used))
1425 at91_set_A_periph(AT91_PIN_PC3, 0);
1426
1427 if (data->use_external_triggers)
1428 at91_set_A_periph(AT91_PIN_PA22, 0);
1429
1430 data->num_channels = 4;
1431 data->startup_time = 10;
1432 data->registers = &at91_adc_register_g20;
1433 data->trigger_number = 4;
1434 data->trigger_list = at91_adc_triggers;
1435
1436 adc_data = *data;
1437 platform_device_register(&at91_adc_device);
1438}
1439#else
1440void __init at91_add_device_adc(struct at91_adc_data *data) {}
1441#endif
1442
Andrew Victor86ad76b2006-11-30 16:45:01 +01001443/* -------------------------------------------------------------------- */
1444/*
1445 * These devices are always present and don't need any board-specific
1446 * setup.
1447 */
1448static int __init at91_add_standard_devices(void)
1449{
Jean-Christophe PLAGNIOL-VILLARD8cf93b92012-02-28 15:23:43 +08001450 if (of_have_populated_dt())
1451 return 0;
1452
Andrew Victor884f5a62008-01-23 09:11:13 +01001453 at91_add_device_rtt();
1454 at91_add_device_watchdog();
Andrew Victore5f40bf2008-04-02 21:58:00 +01001455 at91_add_device_tc();
Andrew Victor86ad76b2006-11-30 16:45:01 +01001456 return 0;
1457}
1458
1459arch_initcall(at91_add_standard_devices);