diff options
author | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
---|---|---|
committer | Jonathan Herman <hermanjl@cs.unc.edu> | 2013-01-17 16:15:55 -0500 |
commit | 8dea78da5cee153b8af9c07a2745f6c55057fe12 (patch) | |
tree | a8f4d49d63b1ecc92f2fddceba0655b2472c5bd9 /arch/arm/mach-at91/at91sam9263_devices.c | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'arch/arm/mach-at91/at91sam9263_devices.c')
-rw-r--r-- | arch/arm/mach-at91/at91sam9263_devices.c | 439 |
1 files changed, 165 insertions, 274 deletions
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c index ed666f5cb01..863e4661409 100644 --- a/arch/arm/mach-at91/at91sam9263_devices.c +++ b/arch/arm/mach-at91/at91sam9263_devices.c | |||
@@ -13,19 +13,18 @@ | |||
13 | #include <asm/mach/map.h> | 13 | #include <asm/mach/map.h> |
14 | 14 | ||
15 | #include <linux/dma-mapping.h> | 15 | #include <linux/dma-mapping.h> |
16 | #include <linux/gpio.h> | ||
17 | #include <linux/platform_device.h> | 16 | #include <linux/platform_device.h> |
18 | #include <linux/i2c-gpio.h> | 17 | #include <linux/i2c-gpio.h> |
19 | 18 | ||
20 | #include <linux/fb.h> | 19 | #include <linux/fb.h> |
21 | #include <video/atmel_lcdc.h> | 20 | #include <video/atmel_lcdc.h> |
22 | 21 | ||
22 | #include <mach/board.h> | ||
23 | #include <mach/gpio.h> | ||
23 | #include <mach/at91sam9263.h> | 24 | #include <mach/at91sam9263.h> |
24 | #include <mach/at91sam9263_matrix.h> | 25 | #include <mach/at91sam9263_matrix.h> |
25 | #include <mach/at91_matrix.h> | ||
26 | #include <mach/at91sam9_smc.h> | 26 | #include <mach/at91sam9_smc.h> |
27 | 27 | ||
28 | #include "board.h" | ||
29 | #include "generic.h" | 28 | #include "generic.h" |
30 | 29 | ||
31 | 30 | ||
@@ -44,8 +43,8 @@ static struct resource usbh_resources[] = { | |||
44 | .flags = IORESOURCE_MEM, | 43 | .flags = IORESOURCE_MEM, |
45 | }, | 44 | }, |
46 | [1] = { | 45 | [1] = { |
47 | .start = NR_IRQS_LEGACY + AT91SAM9263_ID_UHP, | 46 | .start = AT91SAM9263_ID_UHP, |
48 | .end = NR_IRQS_LEGACY + AT91SAM9263_ID_UHP, | 47 | .end = AT91SAM9263_ID_UHP, |
49 | .flags = IORESOURCE_IRQ, | 48 | .flags = IORESOURCE_IRQ, |
50 | }, | 49 | }, |
51 | }; | 50 | }; |
@@ -71,15 +70,8 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) | |||
71 | 70 | ||
72 | /* Enable VBus control for UHP ports */ | 71 | /* Enable VBus control for UHP ports */ |
73 | for (i = 0; i < data->ports; i++) { | 72 | for (i = 0; i < data->ports; i++) { |
74 | if (gpio_is_valid(data->vbus_pin[i])) | 73 | if (data->vbus_pin[i]) |
75 | at91_set_gpio_output(data->vbus_pin[i], | 74 | at91_set_gpio_output(data->vbus_pin[i], 0); |
76 | data->vbus_pin_active_low[i]); | ||
77 | } | ||
78 | |||
79 | /* Enable overcurrent notification */ | ||
80 | for (i = 0; i < data->ports; i++) { | ||
81 | if (gpio_is_valid(data->overcurrent_pin[i])) | ||
82 | at91_set_gpio_input(data->overcurrent_pin[i], 1); | ||
83 | } | 75 | } |
84 | 76 | ||
85 | usbh_data = *data; | 77 | usbh_data = *data; |
@@ -94,7 +86,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) {} | |||
94 | * USB Device (Gadget) | 86 | * USB Device (Gadget) |
95 | * -------------------------------------------------------------------- */ | 87 | * -------------------------------------------------------------------- */ |
96 | 88 | ||
97 | #if defined(CONFIG_USB_AT91) || defined(CONFIG_USB_AT91_MODULE) | 89 | #ifdef CONFIG_USB_AT91 |
98 | static struct at91_udc_data udc_data; | 90 | static struct at91_udc_data udc_data; |
99 | 91 | ||
100 | static struct resource udc_resources[] = { | 92 | static struct resource udc_resources[] = { |
@@ -104,8 +96,8 @@ static struct resource udc_resources[] = { | |||
104 | .flags = IORESOURCE_MEM, | 96 | .flags = IORESOURCE_MEM, |
105 | }, | 97 | }, |
106 | [1] = { | 98 | [1] = { |
107 | .start = NR_IRQS_LEGACY + AT91SAM9263_ID_UDP, | 99 | .start = AT91SAM9263_ID_UDP, |
108 | .end = NR_IRQS_LEGACY + AT91SAM9263_ID_UDP, | 100 | .end = AT91SAM9263_ID_UDP, |
109 | .flags = IORESOURCE_IRQ, | 101 | .flags = IORESOURCE_IRQ, |
110 | }, | 102 | }, |
111 | }; | 103 | }; |
@@ -125,7 +117,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) | |||
125 | if (!data) | 117 | if (!data) |
126 | return; | 118 | return; |
127 | 119 | ||
128 | if (gpio_is_valid(data->vbus_pin)) { | 120 | if (data->vbus_pin) { |
129 | at91_set_gpio_input(data->vbus_pin, 0); | 121 | at91_set_gpio_input(data->vbus_pin, 0); |
130 | at91_set_deglitch(data->vbus_pin, 1); | 122 | at91_set_deglitch(data->vbus_pin, 1); |
131 | } | 123 | } |
@@ -146,7 +138,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {} | |||
146 | 138 | ||
147 | #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE) | 139 | #if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE) |
148 | static u64 eth_dmamask = DMA_BIT_MASK(32); | 140 | static u64 eth_dmamask = DMA_BIT_MASK(32); |
149 | static struct macb_platform_data eth_data; | 141 | static struct at91_eth_data eth_data; |
150 | 142 | ||
151 | static struct resource eth_resources[] = { | 143 | static struct resource eth_resources[] = { |
152 | [0] = { | 144 | [0] = { |
@@ -155,8 +147,8 @@ static struct resource eth_resources[] = { | |||
155 | .flags = IORESOURCE_MEM, | 147 | .flags = IORESOURCE_MEM, |
156 | }, | 148 | }, |
157 | [1] = { | 149 | [1] = { |
158 | .start = NR_IRQS_LEGACY + AT91SAM9263_ID_EMAC, | 150 | .start = AT91SAM9263_ID_EMAC, |
159 | .end = NR_IRQS_LEGACY + AT91SAM9263_ID_EMAC, | 151 | .end = AT91SAM9263_ID_EMAC, |
160 | .flags = IORESOURCE_IRQ, | 152 | .flags = IORESOURCE_IRQ, |
161 | }, | 153 | }, |
162 | }; | 154 | }; |
@@ -173,12 +165,12 @@ static struct platform_device at91sam9263_eth_device = { | |||
173 | .num_resources = ARRAY_SIZE(eth_resources), | 165 | .num_resources = ARRAY_SIZE(eth_resources), |
174 | }; | 166 | }; |
175 | 167 | ||
176 | void __init at91_add_device_eth(struct macb_platform_data *data) | 168 | void __init at91_add_device_eth(struct at91_eth_data *data) |
177 | { | 169 | { |
178 | if (!data) | 170 | if (!data) |
179 | return; | 171 | return; |
180 | 172 | ||
181 | if (gpio_is_valid(data->phy_irq_pin)) { | 173 | if (data->phy_irq_pin) { |
182 | at91_set_gpio_input(data->phy_irq_pin, 0); | 174 | at91_set_gpio_input(data->phy_irq_pin, 0); |
183 | at91_set_deglitch(data->phy_irq_pin, 1); | 175 | at91_set_deglitch(data->phy_irq_pin, 1); |
184 | } | 176 | } |
@@ -210,7 +202,7 @@ void __init at91_add_device_eth(struct macb_platform_data *data) | |||
210 | platform_device_register(&at91sam9263_eth_device); | 202 | platform_device_register(&at91sam9263_eth_device); |
211 | } | 203 | } |
212 | #else | 204 | #else |
213 | void __init at91_add_device_eth(struct macb_platform_data *data) {} | 205 | void __init at91_add_device_eth(struct at91_eth_data *data) {} |
214 | #endif | 206 | #endif |
215 | 207 | ||
216 | 208 | ||
@@ -218,9 +210,9 @@ void __init at91_add_device_eth(struct macb_platform_data *data) {} | |||
218 | * MMC / SD | 210 | * MMC / SD |
219 | * -------------------------------------------------------------------- */ | 211 | * -------------------------------------------------------------------- */ |
220 | 212 | ||
221 | #if IS_ENABLED(CONFIG_MMC_ATMELMCI) | 213 | #if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) |
222 | static u64 mmc_dmamask = DMA_BIT_MASK(32); | 214 | static u64 mmc_dmamask = DMA_BIT_MASK(32); |
223 | static struct mci_platform_data mmc0_data, mmc1_data; | 215 | static struct at91_mmc_data mmc0_data, mmc1_data; |
224 | 216 | ||
225 | static struct resource mmc0_resources[] = { | 217 | static struct resource mmc0_resources[] = { |
226 | [0] = { | 218 | [0] = { |
@@ -229,14 +221,14 @@ static struct resource mmc0_resources[] = { | |||
229 | .flags = IORESOURCE_MEM, | 221 | .flags = IORESOURCE_MEM, |
230 | }, | 222 | }, |
231 | [1] = { | 223 | [1] = { |
232 | .start = NR_IRQS_LEGACY + AT91SAM9263_ID_MCI0, | 224 | .start = AT91SAM9263_ID_MCI0, |
233 | .end = NR_IRQS_LEGACY + AT91SAM9263_ID_MCI0, | 225 | .end = AT91SAM9263_ID_MCI0, |
234 | .flags = IORESOURCE_IRQ, | 226 | .flags = IORESOURCE_IRQ, |
235 | }, | 227 | }, |
236 | }; | 228 | }; |
237 | 229 | ||
238 | static struct platform_device at91sam9263_mmc0_device = { | 230 | static struct platform_device at91sam9263_mmc0_device = { |
239 | .name = "atmel_mci", | 231 | .name = "at91_mci", |
240 | .id = 0, | 232 | .id = 0, |
241 | .dev = { | 233 | .dev = { |
242 | .dma_mask = &mmc_dmamask, | 234 | .dma_mask = &mmc_dmamask, |
@@ -254,14 +246,14 @@ static struct resource mmc1_resources[] = { | |||
254 | .flags = IORESOURCE_MEM, | 246 | .flags = IORESOURCE_MEM, |
255 | }, | 247 | }, |
256 | [1] = { | 248 | [1] = { |
257 | .start = NR_IRQS_LEGACY + AT91SAM9263_ID_MCI1, | 249 | .start = AT91SAM9263_ID_MCI1, |
258 | .end = NR_IRQS_LEGACY + AT91SAM9263_ID_MCI1, | 250 | .end = AT91SAM9263_ID_MCI1, |
259 | .flags = IORESOURCE_IRQ, | 251 | .flags = IORESOURCE_IRQ, |
260 | }, | 252 | }, |
261 | }; | 253 | }; |
262 | 254 | ||
263 | static struct platform_device at91sam9263_mmc1_device = { | 255 | static struct platform_device at91sam9263_mmc1_device = { |
264 | .name = "atmel_mci", | 256 | .name = "at91_mci", |
265 | .id = 1, | 257 | .id = 1, |
266 | .dev = { | 258 | .dev = { |
267 | .dma_mask = &mmc_dmamask, | 259 | .dma_mask = &mmc_dmamask, |
@@ -272,118 +264,93 @@ static struct platform_device at91sam9263_mmc1_device = { | |||
272 | .num_resources = ARRAY_SIZE(mmc1_resources), | 264 | .num_resources = ARRAY_SIZE(mmc1_resources), |
273 | }; | 265 | }; |
274 | 266 | ||
275 | void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) | 267 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) |
276 | { | 268 | { |
277 | unsigned int i; | ||
278 | unsigned int slot_count = 0; | ||
279 | |||
280 | if (!data) | 269 | if (!data) |
281 | return; | 270 | return; |
282 | 271 | ||
283 | for (i = 0; i < ATMCI_MAX_NR_SLOTS; i++) { | 272 | /* input/irq */ |
273 | if (data->det_pin) { | ||
274 | at91_set_gpio_input(data->det_pin, 1); | ||
275 | at91_set_deglitch(data->det_pin, 1); | ||
276 | } | ||
277 | if (data->wp_pin) | ||
278 | at91_set_gpio_input(data->wp_pin, 1); | ||
279 | if (data->vcc_pin) | ||
280 | at91_set_gpio_output(data->vcc_pin, 0); | ||
284 | 281 | ||
285 | if (!data->slot[i].bus_width) | 282 | if (mmc_id == 0) { /* MCI0 */ |
286 | continue; | 283 | /* CLK */ |
284 | at91_set_A_periph(AT91_PIN_PA12, 0); | ||
287 | 285 | ||
288 | /* input/irq */ | 286 | if (data->slot_b) { |
289 | if (gpio_is_valid(data->slot[i].detect_pin)) { | 287 | /* CMD */ |
290 | at91_set_gpio_input(data->slot[i].detect_pin, | 288 | at91_set_A_periph(AT91_PIN_PA16, 1); |
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); | ||
332 | 289 | ||
333 | mmc0_data = *data; | 290 | /* DAT0, maybe DAT1..DAT3 */ |
334 | platform_device_register(&at91sam9263_mmc0_device); | 291 | at91_set_A_periph(AT91_PIN_PA17, 1); |
292 | if (data->wire4) { | ||
293 | at91_set_A_periph(AT91_PIN_PA18, 1); | ||
294 | at91_set_A_periph(AT91_PIN_PA19, 1); | ||
295 | at91_set_A_periph(AT91_PIN_PA20, 1); | ||
335 | } | 296 | } |
336 | } else if (mmc_id == 1) { /* MCI1 */ | 297 | } else { |
337 | switch (i) { | 298 | /* CMD */ |
338 | case 0: /* slot A */ | 299 | at91_set_A_periph(AT91_PIN_PA1, 1); |
339 | /* CMD */ | 300 | |
340 | at91_set_A_periph(AT91_PIN_PA7, 1); | 301 | /* DAT0, maybe DAT1..DAT3 */ |
341 | /* DAT0, maybe DAT1..DAT3 */ | 302 | at91_set_A_periph(AT91_PIN_PA0, 1); |
342 | at91_set_A_periph(AT91_PIN_PA8, 1); | 303 | if (data->wire4) { |
343 | if (data->slot[i].bus_width == 4) { | 304 | at91_set_A_periph(AT91_PIN_PA3, 1); |
344 | at91_set_A_periph(AT91_PIN_PA9, 1); | 305 | at91_set_A_periph(AT91_PIN_PA4, 1); |
345 | at91_set_A_periph(AT91_PIN_PA10, 1); | 306 | at91_set_A_periph(AT91_PIN_PA5, 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; | ||
366 | } | 307 | } |
367 | if (slot_count) { | 308 | } |
368 | /* CLK */ | ||
369 | at91_set_A_periph(AT91_PIN_PA6, 0); | ||
370 | 309 | ||
371 | mmc1_data = *data; | 310 | mmc0_data = *data; |
372 | platform_device_register(&at91sam9263_mmc1_device); | 311 | platform_device_register(&at91sam9263_mmc0_device); |
312 | } else { /* MCI1 */ | ||
313 | /* CLK */ | ||
314 | at91_set_A_periph(AT91_PIN_PA6, 0); | ||
315 | |||
316 | if (data->slot_b) { | ||
317 | /* CMD */ | ||
318 | at91_set_A_periph(AT91_PIN_PA21, 1); | ||
319 | |||
320 | /* DAT0, maybe DAT1..DAT3 */ | ||
321 | at91_set_A_periph(AT91_PIN_PA22, 1); | ||
322 | if (data->wire4) { | ||
323 | at91_set_A_periph(AT91_PIN_PA23, 1); | ||
324 | at91_set_A_periph(AT91_PIN_PA24, 1); | ||
325 | at91_set_A_periph(AT91_PIN_PA25, 1); | ||
326 | } | ||
327 | } else { | ||
328 | /* CMD */ | ||
329 | at91_set_A_periph(AT91_PIN_PA7, 1); | ||
330 | |||
331 | /* DAT0, maybe DAT1..DAT3 */ | ||
332 | at91_set_A_periph(AT91_PIN_PA8, 1); | ||
333 | if (data->wire4) { | ||
334 | at91_set_A_periph(AT91_PIN_PA9, 1); | ||
335 | at91_set_A_periph(AT91_PIN_PA10, 1); | ||
336 | at91_set_A_periph(AT91_PIN_PA11, 1); | ||
373 | } | 337 | } |
374 | } | 338 | } |
339 | |||
340 | mmc1_data = *data; | ||
341 | platform_device_register(&at91sam9263_mmc1_device); | ||
375 | } | 342 | } |
376 | } | 343 | } |
377 | #else | 344 | #else |
378 | void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) {} | 345 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} |
379 | #endif | 346 | #endif |
380 | 347 | ||
381 | /* -------------------------------------------------------------------- | 348 | /* -------------------------------------------------------------------- |
382 | * Compact Flash (PCMCIA or IDE) | 349 | * Compact Flash (PCMCIA or IDE) |
383 | * -------------------------------------------------------------------- */ | 350 | * -------------------------------------------------------------------- */ |
384 | 351 | ||
385 | #if defined(CONFIG_PATA_AT91) || defined(CONFIG_PATA_AT91_MODULE) || \ | 352 | #if defined(CONFIG_AT91_CF) || defined(CONFIG_AT91_CF_MODULE) || \ |
386 | defined(CONFIG_AT91_CF) || defined(CONFIG_AT91_CF_MODULE) | 353 | defined(CONFIG_BLK_DEV_IDE_AT91) || defined(CONFIG_BLK_DEV_IDE_AT91_MODULE) |
387 | 354 | ||
388 | static struct at91_cf_data cf0_data; | 355 | static struct at91_cf_data cf0_data; |
389 | 356 | ||
@@ -436,7 +403,7 @@ void __init at91_add_device_cf(struct at91_cf_data *data) | |||
436 | * we assume SMC timings are configured by board code, | 403 | * we assume SMC timings are configured by board code, |
437 | * except True IDE where timings are controlled by driver | 404 | * except True IDE where timings are controlled by driver |
438 | */ | 405 | */ |
439 | ebi0_csa = at91_matrix_read(AT91_MATRIX_EBI0CSA); | 406 | ebi0_csa = at91_sys_read(AT91_MATRIX_EBI0CSA); |
440 | switch (data->chipselect) { | 407 | switch (data->chipselect) { |
441 | case 4: | 408 | case 4: |
442 | at91_set_A_periph(AT91_PIN_PD6, 0); /* EBI0_NCS4/CFCS0 */ | 409 | at91_set_A_periph(AT91_PIN_PD6, 0); /* EBI0_NCS4/CFCS0 */ |
@@ -455,19 +422,19 @@ void __init at91_add_device_cf(struct at91_cf_data *data) | |||
455 | data->chipselect); | 422 | data->chipselect); |
456 | return; | 423 | return; |
457 | } | 424 | } |
458 | at91_matrix_write(AT91_MATRIX_EBI0CSA, ebi0_csa); | 425 | at91_sys_write(AT91_MATRIX_EBI0CSA, ebi0_csa); |
459 | 426 | ||
460 | if (gpio_is_valid(data->det_pin)) { | 427 | if (data->det_pin) { |
461 | at91_set_gpio_input(data->det_pin, 1); | 428 | at91_set_gpio_input(data->det_pin, 1); |
462 | at91_set_deglitch(data->det_pin, 1); | 429 | at91_set_deglitch(data->det_pin, 1); |
463 | } | 430 | } |
464 | 431 | ||
465 | if (gpio_is_valid(data->irq_pin)) { | 432 | if (data->irq_pin) { |
466 | at91_set_gpio_input(data->irq_pin, 1); | 433 | at91_set_gpio_input(data->irq_pin, 1); |
467 | at91_set_deglitch(data->irq_pin, 1); | 434 | at91_set_deglitch(data->irq_pin, 1); |
468 | } | 435 | } |
469 | 436 | ||
470 | if (gpio_is_valid(data->vcc_pin)) | 437 | if (data->vcc_pin) |
471 | /* initially off */ | 438 | /* initially off */ |
472 | at91_set_gpio_output(data->vcc_pin, 0); | 439 | at91_set_gpio_output(data->vcc_pin, 0); |
473 | 440 | ||
@@ -477,7 +444,7 @@ void __init at91_add_device_cf(struct at91_cf_data *data) | |||
477 | at91_set_A_periph(AT91_PIN_PD9, 0); /* CFCE2 */ | 444 | at91_set_A_periph(AT91_PIN_PD9, 0); /* CFCE2 */ |
478 | at91_set_A_periph(AT91_PIN_PD14, 0); /* CFNRW */ | 445 | at91_set_A_periph(AT91_PIN_PD14, 0); /* CFNRW */ |
479 | 446 | ||
480 | pdev->name = (data->flags & AT91_CF_TRUE_IDE) ? "pata_at91" : "at91_cf"; | 447 | pdev->name = (data->flags & AT91_CF_TRUE_IDE) ? "at91_ide" : "at91_cf"; |
481 | platform_device_register(pdev); | 448 | platform_device_register(pdev); |
482 | } | 449 | } |
483 | #else | 450 | #else |
@@ -500,8 +467,8 @@ static struct resource nand_resources[] = { | |||
500 | .flags = IORESOURCE_MEM, | 467 | .flags = IORESOURCE_MEM, |
501 | }, | 468 | }, |
502 | [1] = { | 469 | [1] = { |
503 | .start = AT91SAM9263_BASE_ECC0, | 470 | .start = AT91_BASE_SYS + AT91_ECC0, |
504 | .end = AT91SAM9263_BASE_ECC0 + SZ_512 - 1, | 471 | .end = AT91_BASE_SYS + AT91_ECC0 + SZ_512 - 1, |
505 | .flags = IORESOURCE_MEM, | 472 | .flags = IORESOURCE_MEM, |
506 | } | 473 | } |
507 | }; | 474 | }; |
@@ -523,19 +490,19 @@ void __init at91_add_device_nand(struct atmel_nand_data *data) | |||
523 | if (!data) | 490 | if (!data) |
524 | return; | 491 | return; |
525 | 492 | ||
526 | csa = at91_matrix_read(AT91_MATRIX_EBI0CSA); | 493 | csa = at91_sys_read(AT91_MATRIX_EBI0CSA); |
527 | at91_matrix_write(AT91_MATRIX_EBI0CSA, csa | AT91_MATRIX_EBI0_CS3A_SMC_SMARTMEDIA); | 494 | at91_sys_write(AT91_MATRIX_EBI0CSA, csa | AT91_MATRIX_EBI0_CS3A_SMC_SMARTMEDIA); |
528 | 495 | ||
529 | /* enable pin */ | 496 | /* enable pin */ |
530 | if (gpio_is_valid(data->enable_pin)) | 497 | if (data->enable_pin) |
531 | at91_set_gpio_output(data->enable_pin, 1); | 498 | at91_set_gpio_output(data->enable_pin, 1); |
532 | 499 | ||
533 | /* ready/busy pin */ | 500 | /* ready/busy pin */ |
534 | if (gpio_is_valid(data->rdy_pin)) | 501 | if (data->rdy_pin) |
535 | at91_set_gpio_input(data->rdy_pin, 1); | 502 | at91_set_gpio_input(data->rdy_pin, 1); |
536 | 503 | ||
537 | /* card detect pin */ | 504 | /* card detect pin */ |
538 | if (gpio_is_valid(data->det_pin)) | 505 | if (data->det_pin) |
539 | at91_set_gpio_input(data->det_pin, 1); | 506 | at91_set_gpio_input(data->det_pin, 1); |
540 | 507 | ||
541 | nand_data = *data; | 508 | nand_data = *data; |
@@ -567,7 +534,7 @@ static struct i2c_gpio_platform_data pdata = { | |||
567 | 534 | ||
568 | static struct platform_device at91sam9263_twi_device = { | 535 | static struct platform_device at91sam9263_twi_device = { |
569 | .name = "i2c-gpio", | 536 | .name = "i2c-gpio", |
570 | .id = 0, | 537 | .id = -1, |
571 | .dev.platform_data = &pdata, | 538 | .dev.platform_data = &pdata, |
572 | }; | 539 | }; |
573 | 540 | ||
@@ -592,15 +559,15 @@ static struct resource twi_resources[] = { | |||
592 | .flags = IORESOURCE_MEM, | 559 | .flags = IORESOURCE_MEM, |
593 | }, | 560 | }, |
594 | [1] = { | 561 | [1] = { |
595 | .start = NR_IRQS_LEGACY + AT91SAM9263_ID_TWI, | 562 | .start = AT91SAM9263_ID_TWI, |
596 | .end = NR_IRQS_LEGACY + AT91SAM9263_ID_TWI, | 563 | .end = AT91SAM9263_ID_TWI, |
597 | .flags = IORESOURCE_IRQ, | 564 | .flags = IORESOURCE_IRQ, |
598 | }, | 565 | }, |
599 | }; | 566 | }; |
600 | 567 | ||
601 | static struct platform_device at91sam9263_twi_device = { | 568 | static struct platform_device at91sam9263_twi_device = { |
602 | .name = "i2c-at91sam9260", | 569 | .name = "at91_i2c", |
603 | .id = 0, | 570 | .id = -1, |
604 | .resource = twi_resources, | 571 | .resource = twi_resources, |
605 | .num_resources = ARRAY_SIZE(twi_resources), | 572 | .num_resources = ARRAY_SIZE(twi_resources), |
606 | }; | 573 | }; |
@@ -636,8 +603,8 @@ static struct resource spi0_resources[] = { | |||
636 | .flags = IORESOURCE_MEM, | 603 | .flags = IORESOURCE_MEM, |
637 | }, | 604 | }, |
638 | [1] = { | 605 | [1] = { |
639 | .start = NR_IRQS_LEGACY + AT91SAM9263_ID_SPI0, | 606 | .start = AT91SAM9263_ID_SPI0, |
640 | .end = NR_IRQS_LEGACY + AT91SAM9263_ID_SPI0, | 607 | .end = AT91SAM9263_ID_SPI0, |
641 | .flags = IORESOURCE_IRQ, | 608 | .flags = IORESOURCE_IRQ, |
642 | }, | 609 | }, |
643 | }; | 610 | }; |
@@ -662,8 +629,8 @@ static struct resource spi1_resources[] = { | |||
662 | .flags = IORESOURCE_MEM, | 629 | .flags = IORESOURCE_MEM, |
663 | }, | 630 | }, |
664 | [1] = { | 631 | [1] = { |
665 | .start = NR_IRQS_LEGACY + AT91SAM9263_ID_SPI1, | 632 | .start = AT91SAM9263_ID_SPI1, |
666 | .end = NR_IRQS_LEGACY + AT91SAM9263_ID_SPI1, | 633 | .end = AT91SAM9263_ID_SPI1, |
667 | .flags = IORESOURCE_IRQ, | 634 | .flags = IORESOURCE_IRQ, |
668 | }, | 635 | }, |
669 | }; | 636 | }; |
@@ -697,9 +664,6 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) | |||
697 | else | 664 | else |
698 | cs_pin = spi1_standard_cs[devices[i].chip_select]; | 665 | cs_pin = spi1_standard_cs[devices[i].chip_select]; |
699 | 666 | ||
700 | if (!gpio_is_valid(cs_pin)) | ||
701 | continue; | ||
702 | |||
703 | if (devices[i].bus_num == 0) | 667 | if (devices[i].bus_num == 0) |
704 | enable_spi0 = 1; | 668 | enable_spi0 = 1; |
705 | else | 669 | else |
@@ -750,8 +714,8 @@ static struct resource ac97_resources[] = { | |||
750 | .flags = IORESOURCE_MEM, | 714 | .flags = IORESOURCE_MEM, |
751 | }, | 715 | }, |
752 | [1] = { | 716 | [1] = { |
753 | .start = NR_IRQS_LEGACY + AT91SAM9263_ID_AC97C, | 717 | .start = AT91SAM9263_ID_AC97C, |
754 | .end = NR_IRQS_LEGACY + AT91SAM9263_ID_AC97C, | 718 | .end = AT91SAM9263_ID_AC97C, |
755 | .flags = IORESOURCE_IRQ, | 719 | .flags = IORESOURCE_IRQ, |
756 | }, | 720 | }, |
757 | }; | 721 | }; |
@@ -779,7 +743,7 @@ void __init at91_add_device_ac97(struct ac97c_platform_data *data) | |||
779 | at91_set_A_periph(AT91_PIN_PB3, 0); /* AC97RX */ | 743 | at91_set_A_periph(AT91_PIN_PB3, 0); /* AC97RX */ |
780 | 744 | ||
781 | /* reset */ | 745 | /* reset */ |
782 | if (gpio_is_valid(data->reset_pin)) | 746 | if (data->reset_pin) |
783 | at91_set_gpio_output(data->reset_pin, 0); | 747 | at91_set_gpio_output(data->reset_pin, 0); |
784 | 748 | ||
785 | ac97_data = *data; | 749 | ac97_data = *data; |
@@ -801,8 +765,8 @@ static struct resource can_resources[] = { | |||
801 | .flags = IORESOURCE_MEM, | 765 | .flags = IORESOURCE_MEM, |
802 | }, | 766 | }, |
803 | [1] = { | 767 | [1] = { |
804 | .start = NR_IRQS_LEGACY + AT91SAM9263_ID_CAN, | 768 | .start = AT91SAM9263_ID_CAN, |
805 | .end = NR_IRQS_LEGACY + AT91SAM9263_ID_CAN, | 769 | .end = AT91SAM9263_ID_CAN, |
806 | .flags = IORESOURCE_IRQ, | 770 | .flags = IORESOURCE_IRQ, |
807 | }, | 771 | }, |
808 | }; | 772 | }; |
@@ -841,8 +805,8 @@ static struct resource lcdc_resources[] = { | |||
841 | .flags = IORESOURCE_MEM, | 805 | .flags = IORESOURCE_MEM, |
842 | }, | 806 | }, |
843 | [1] = { | 807 | [1] = { |
844 | .start = NR_IRQS_LEGACY + AT91SAM9263_ID_LCDC, | 808 | .start = AT91SAM9263_ID_LCDC, |
845 | .end = NR_IRQS_LEGACY + AT91SAM9263_ID_LCDC, | 809 | .end = AT91SAM9263_ID_LCDC, |
846 | .flags = IORESOURCE_IRQ, | 810 | .flags = IORESOURCE_IRQ, |
847 | }, | 811 | }, |
848 | }; | 812 | }; |
@@ -908,8 +872,8 @@ struct resource isi_resources[] = { | |||
908 | .flags = IORESOURCE_MEM, | 872 | .flags = IORESOURCE_MEM, |
909 | }, | 873 | }, |
910 | [1] = { | 874 | [1] = { |
911 | .start = NR_IRQS_LEGACY + AT91SAM9263_ID_ISI, | 875 | .start = AT91SAM9263_ID_ISI, |
912 | .end = NR_IRQS_LEGACY + AT91SAM9263_ID_ISI, | 876 | .end = AT91SAM9263_ID_ISI, |
913 | .flags = IORESOURCE_IRQ, | 877 | .flags = IORESOURCE_IRQ, |
914 | }, | 878 | }, |
915 | }; | 879 | }; |
@@ -921,8 +885,7 @@ static struct platform_device at91sam9263_isi_device = { | |||
921 | .num_resources = ARRAY_SIZE(isi_resources), | 885 | .num_resources = ARRAY_SIZE(isi_resources), |
922 | }; | 886 | }; |
923 | 887 | ||
924 | void __init at91_add_device_isi(struct isi_platform_data *data, | 888 | void __init at91_add_device_isi(void) |
925 | bool use_pck_as_mck) | ||
926 | { | 889 | { |
927 | at91_set_A_periph(AT91_PIN_PE0, 0); /* ISI_D0 */ | 890 | at91_set_A_periph(AT91_PIN_PE0, 0); /* ISI_D0 */ |
928 | at91_set_A_periph(AT91_PIN_PE1, 0); /* ISI_D1 */ | 891 | at91_set_A_periph(AT91_PIN_PE1, 0); /* ISI_D1 */ |
@@ -935,20 +898,14 @@ void __init at91_add_device_isi(struct isi_platform_data *data, | |||
935 | at91_set_A_periph(AT91_PIN_PE8, 0); /* ISI_PCK */ | 898 | at91_set_A_periph(AT91_PIN_PE8, 0); /* ISI_PCK */ |
936 | at91_set_A_periph(AT91_PIN_PE9, 0); /* ISI_HSYNC */ | 899 | at91_set_A_periph(AT91_PIN_PE9, 0); /* ISI_HSYNC */ |
937 | at91_set_A_periph(AT91_PIN_PE10, 0); /* ISI_VSYNC */ | 900 | at91_set_A_periph(AT91_PIN_PE10, 0); /* ISI_VSYNC */ |
901 | at91_set_B_periph(AT91_PIN_PE11, 0); /* ISI_MCK (PCK3) */ | ||
938 | at91_set_B_periph(AT91_PIN_PE12, 0); /* ISI_PD8 */ | 902 | at91_set_B_periph(AT91_PIN_PE12, 0); /* ISI_PD8 */ |
939 | at91_set_B_periph(AT91_PIN_PE13, 0); /* ISI_PD9 */ | 903 | at91_set_B_periph(AT91_PIN_PE13, 0); /* ISI_PD9 */ |
940 | at91_set_B_periph(AT91_PIN_PE14, 0); /* ISI_PD10 */ | 904 | at91_set_B_periph(AT91_PIN_PE14, 0); /* ISI_PD10 */ |
941 | at91_set_B_periph(AT91_PIN_PE15, 0); /* ISI_PD11 */ | 905 | at91_set_B_periph(AT91_PIN_PE15, 0); /* ISI_PD11 */ |
942 | |||
943 | if (use_pck_as_mck) { | ||
944 | at91_set_B_periph(AT91_PIN_PE11, 0); /* ISI_MCK (PCK3) */ | ||
945 | |||
946 | /* TODO: register the PCK for ISI_MCK and set its parent */ | ||
947 | } | ||
948 | } | 906 | } |
949 | #else | 907 | #else |
950 | void __init at91_add_device_isi(struct isi_platform_data *data, | 908 | void __init at91_add_device_isi(void) {} |
951 | bool use_pck_as_mck) {} | ||
952 | #endif | 909 | #endif |
953 | 910 | ||
954 | 911 | ||
@@ -965,8 +922,8 @@ static struct resource tcb_resources[] = { | |||
965 | .flags = IORESOURCE_MEM, | 922 | .flags = IORESOURCE_MEM, |
966 | }, | 923 | }, |
967 | [1] = { | 924 | [1] = { |
968 | .start = NR_IRQS_LEGACY + AT91SAM9263_ID_TCB, | 925 | .start = AT91SAM9263_ID_TCB, |
969 | .end = NR_IRQS_LEGACY + AT91SAM9263_ID_TCB, | 926 | .end = AT91SAM9263_ID_TCB, |
970 | .flags = IORESOURCE_IRQ, | 927 | .flags = IORESOURCE_IRQ, |
971 | }, | 928 | }, |
972 | }; | 929 | }; |
@@ -978,25 +935,8 @@ static struct platform_device at91sam9263_tcb_device = { | |||
978 | .num_resources = ARRAY_SIZE(tcb_resources), | 935 | .num_resources = ARRAY_SIZE(tcb_resources), |
979 | }; | 936 | }; |
980 | 937 | ||
981 | #if defined(CONFIG_OF) | ||
982 | static struct of_device_id tcb_ids[] = { | ||
983 | { .compatible = "atmel,at91rm9200-tcb" }, | ||
984 | { /*sentinel*/ } | ||
985 | }; | ||
986 | #endif | ||
987 | |||
988 | static void __init at91_add_device_tc(void) | 938 | static void __init at91_add_device_tc(void) |
989 | { | 939 | { |
990 | #if defined(CONFIG_OF) | ||
991 | struct device_node *np; | ||
992 | |||
993 | np = of_find_matching_node(NULL, tcb_ids); | ||
994 | if (np) { | ||
995 | of_node_put(np); | ||
996 | return; | ||
997 | } | ||
998 | #endif | ||
999 | |||
1000 | platform_device_register(&at91sam9263_tcb_device); | 940 | platform_device_register(&at91sam9263_tcb_device); |
1001 | } | 941 | } |
1002 | #else | 942 | #else |
@@ -1010,13 +950,9 @@ static void __init at91_add_device_tc(void) { } | |||
1010 | 950 | ||
1011 | static struct resource rtt0_resources[] = { | 951 | static struct resource rtt0_resources[] = { |
1012 | { | 952 | { |
1013 | .start = AT91SAM9263_BASE_RTT0, | 953 | .start = AT91_BASE_SYS + AT91_RTT0, |
1014 | .end = AT91SAM9263_BASE_RTT0 + SZ_16 - 1, | 954 | .end = AT91_BASE_SYS + AT91_RTT0 + SZ_16 - 1, |
1015 | .flags = IORESOURCE_MEM, | 955 | .flags = IORESOURCE_MEM, |
1016 | }, { | ||
1017 | .flags = IORESOURCE_MEM, | ||
1018 | }, { | ||
1019 | .flags = IORESOURCE_IRQ, | ||
1020 | } | 956 | } |
1021 | }; | 957 | }; |
1022 | 958 | ||
@@ -1024,17 +960,14 @@ static struct platform_device at91sam9263_rtt0_device = { | |||
1024 | .name = "at91_rtt", | 960 | .name = "at91_rtt", |
1025 | .id = 0, | 961 | .id = 0, |
1026 | .resource = rtt0_resources, | 962 | .resource = rtt0_resources, |
963 | .num_resources = ARRAY_SIZE(rtt0_resources), | ||
1027 | }; | 964 | }; |
1028 | 965 | ||
1029 | static struct resource rtt1_resources[] = { | 966 | static struct resource rtt1_resources[] = { |
1030 | { | 967 | { |
1031 | .start = AT91SAM9263_BASE_RTT1, | 968 | .start = AT91_BASE_SYS + AT91_RTT1, |
1032 | .end = AT91SAM9263_BASE_RTT1 + SZ_16 - 1, | 969 | .end = AT91_BASE_SYS + AT91_RTT1 + SZ_16 - 1, |
1033 | .flags = IORESOURCE_MEM, | ||
1034 | }, { | ||
1035 | .flags = IORESOURCE_MEM, | 970 | .flags = IORESOURCE_MEM, |
1036 | }, { | ||
1037 | .flags = IORESOURCE_IRQ, | ||
1038 | } | 971 | } |
1039 | }; | 972 | }; |
1040 | 973 | ||
@@ -1042,55 +975,11 @@ static struct platform_device at91sam9263_rtt1_device = { | |||
1042 | .name = "at91_rtt", | 975 | .name = "at91_rtt", |
1043 | .id = 1, | 976 | .id = 1, |
1044 | .resource = rtt1_resources, | 977 | .resource = rtt1_resources, |
978 | .num_resources = ARRAY_SIZE(rtt1_resources), | ||
1045 | }; | 979 | }; |
1046 | 980 | ||
1047 | #if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9) | ||
1048 | static void __init at91_add_device_rtt_rtc(void) | ||
1049 | { | ||
1050 | struct platform_device *pdev; | ||
1051 | struct resource *r; | ||
1052 | |||
1053 | switch (CONFIG_RTC_DRV_AT91SAM9_RTT) { | ||
1054 | case 0: | ||
1055 | /* | ||
1056 | * The second resource is needed only for the chosen RTT: | ||
1057 | * GPBR will serve as the storage for RTC time offset | ||
1058 | */ | ||
1059 | at91sam9263_rtt0_device.num_resources = 3; | ||
1060 | at91sam9263_rtt1_device.num_resources = 1; | ||
1061 | pdev = &at91sam9263_rtt0_device; | ||
1062 | r = rtt0_resources; | ||
1063 | break; | ||
1064 | case 1: | ||
1065 | at91sam9263_rtt0_device.num_resources = 1; | ||
1066 | at91sam9263_rtt1_device.num_resources = 3; | ||
1067 | pdev = &at91sam9263_rtt1_device; | ||
1068 | r = rtt1_resources; | ||
1069 | break; | ||
1070 | default: | ||
1071 | pr_err("at91sam9263: only supports 2 RTT (%d)\n", | ||
1072 | CONFIG_RTC_DRV_AT91SAM9_RTT); | ||
1073 | return; | ||
1074 | } | ||
1075 | |||
1076 | pdev->name = "rtc-at91sam9"; | ||
1077 | r[1].start = AT91SAM9263_BASE_GPBR + 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR; | ||
1078 | r[1].end = r[1].start + 3; | ||
1079 | r[2].start = NR_IRQS_LEGACY + AT91_ID_SYS; | ||
1080 | r[2].end = NR_IRQS_LEGACY + AT91_ID_SYS; | ||
1081 | } | ||
1082 | #else | ||
1083 | static void __init at91_add_device_rtt_rtc(void) | ||
1084 | { | ||
1085 | /* Only one resource is needed: RTT not used as RTC */ | ||
1086 | at91sam9263_rtt0_device.num_resources = 1; | ||
1087 | at91sam9263_rtt1_device.num_resources = 1; | ||
1088 | } | ||
1089 | #endif | ||
1090 | |||
1091 | static void __init at91_add_device_rtt(void) | 981 | static void __init at91_add_device_rtt(void) |
1092 | { | 982 | { |
1093 | at91_add_device_rtt_rtc(); | ||
1094 | platform_device_register(&at91sam9263_rtt0_device); | 983 | platform_device_register(&at91sam9263_rtt0_device); |
1095 | platform_device_register(&at91sam9263_rtt1_device); | 984 | platform_device_register(&at91sam9263_rtt1_device); |
1096 | } | 985 | } |
@@ -1101,19 +990,10 @@ static void __init at91_add_device_rtt(void) | |||
1101 | * -------------------------------------------------------------------- */ | 990 | * -------------------------------------------------------------------- */ |
1102 | 991 | ||
1103 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) | 992 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) |
1104 | static struct resource wdt_resources[] = { | ||
1105 | { | ||
1106 | .start = AT91SAM9263_BASE_WDT, | ||
1107 | .end = AT91SAM9263_BASE_WDT + SZ_16 - 1, | ||
1108 | .flags = IORESOURCE_MEM, | ||
1109 | } | ||
1110 | }; | ||
1111 | |||
1112 | static struct platform_device at91sam9263_wdt_device = { | 993 | static struct platform_device at91sam9263_wdt_device = { |
1113 | .name = "at91_wdt", | 994 | .name = "at91_wdt", |
1114 | .id = -1, | 995 | .id = -1, |
1115 | .resource = wdt_resources, | 996 | .num_resources = 0, |
1116 | .num_resources = ARRAY_SIZE(wdt_resources), | ||
1117 | }; | 997 | }; |
1118 | 998 | ||
1119 | static void __init at91_add_device_watchdog(void) | 999 | static void __init at91_add_device_watchdog(void) |
@@ -1139,8 +1019,8 @@ static struct resource pwm_resources[] = { | |||
1139 | .flags = IORESOURCE_MEM, | 1019 | .flags = IORESOURCE_MEM, |
1140 | }, | 1020 | }, |
1141 | [1] = { | 1021 | [1] = { |
1142 | .start = NR_IRQS_LEGACY + AT91SAM9263_ID_PWMC, | 1022 | .start = AT91SAM9263_ID_PWMC, |
1143 | .end = NR_IRQS_LEGACY + AT91SAM9263_ID_PWMC, | 1023 | .end = AT91SAM9263_ID_PWMC, |
1144 | .flags = IORESOURCE_IRQ, | 1024 | .flags = IORESOURCE_IRQ, |
1145 | }, | 1025 | }, |
1146 | }; | 1026 | }; |
@@ -1192,14 +1072,14 @@ static struct resource ssc0_resources[] = { | |||
1192 | .flags = IORESOURCE_MEM, | 1072 | .flags = IORESOURCE_MEM, |
1193 | }, | 1073 | }, |
1194 | [1] = { | 1074 | [1] = { |
1195 | .start = NR_IRQS_LEGACY + AT91SAM9263_ID_SSC0, | 1075 | .start = AT91SAM9263_ID_SSC0, |
1196 | .end = NR_IRQS_LEGACY + AT91SAM9263_ID_SSC0, | 1076 | .end = AT91SAM9263_ID_SSC0, |
1197 | .flags = IORESOURCE_IRQ, | 1077 | .flags = IORESOURCE_IRQ, |
1198 | }, | 1078 | }, |
1199 | }; | 1079 | }; |
1200 | 1080 | ||
1201 | static struct platform_device at91sam9263_ssc0_device = { | 1081 | static struct platform_device at91sam9263_ssc0_device = { |
1202 | .name = "at91rm9200_ssc", | 1082 | .name = "ssc", |
1203 | .id = 0, | 1083 | .id = 0, |
1204 | .dev = { | 1084 | .dev = { |
1205 | .dma_mask = &ssc0_dmamask, | 1085 | .dma_mask = &ssc0_dmamask, |
@@ -1234,14 +1114,14 @@ static struct resource ssc1_resources[] = { | |||
1234 | .flags = IORESOURCE_MEM, | 1114 | .flags = IORESOURCE_MEM, |
1235 | }, | 1115 | }, |
1236 | [1] = { | 1116 | [1] = { |
1237 | .start = NR_IRQS_LEGACY + AT91SAM9263_ID_SSC1, | 1117 | .start = AT91SAM9263_ID_SSC1, |
1238 | .end = NR_IRQS_LEGACY + AT91SAM9263_ID_SSC1, | 1118 | .end = AT91SAM9263_ID_SSC1, |
1239 | .flags = IORESOURCE_IRQ, | 1119 | .flags = IORESOURCE_IRQ, |
1240 | }, | 1120 | }, |
1241 | }; | 1121 | }; |
1242 | 1122 | ||
1243 | static struct platform_device at91sam9263_ssc1_device = { | 1123 | static struct platform_device at91sam9263_ssc1_device = { |
1244 | .name = "at91rm9200_ssc", | 1124 | .name = "ssc", |
1245 | .id = 1, | 1125 | .id = 1, |
1246 | .dev = { | 1126 | .dev = { |
1247 | .dma_mask = &ssc1_dmamask, | 1127 | .dma_mask = &ssc1_dmamask, |
@@ -1310,13 +1190,13 @@ void __init at91_add_device_ssc(unsigned id, unsigned pins) {} | |||
1310 | 1190 | ||
1311 | static struct resource dbgu_resources[] = { | 1191 | static struct resource dbgu_resources[] = { |
1312 | [0] = { | 1192 | [0] = { |
1313 | .start = AT91SAM9263_BASE_DBGU, | 1193 | .start = AT91_VA_BASE_SYS + AT91_DBGU, |
1314 | .end = AT91SAM9263_BASE_DBGU + SZ_512 - 1, | 1194 | .end = AT91_VA_BASE_SYS + AT91_DBGU + SZ_512 - 1, |
1315 | .flags = IORESOURCE_MEM, | 1195 | .flags = IORESOURCE_MEM, |
1316 | }, | 1196 | }, |
1317 | [1] = { | 1197 | [1] = { |
1318 | .start = NR_IRQS_LEGACY + AT91_ID_SYS, | 1198 | .start = AT91_ID_SYS, |
1319 | .end = NR_IRQS_LEGACY + AT91_ID_SYS, | 1199 | .end = AT91_ID_SYS, |
1320 | .flags = IORESOURCE_IRQ, | 1200 | .flags = IORESOURCE_IRQ, |
1321 | }, | 1201 | }, |
1322 | }; | 1202 | }; |
@@ -1324,6 +1204,7 @@ static struct resource dbgu_resources[] = { | |||
1324 | static struct atmel_uart_data dbgu_data = { | 1204 | static struct atmel_uart_data dbgu_data = { |
1325 | .use_dma_tx = 0, | 1205 | .use_dma_tx = 0, |
1326 | .use_dma_rx = 0, /* DBGU not capable of receive DMA */ | 1206 | .use_dma_rx = 0, /* DBGU not capable of receive DMA */ |
1207 | .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU), | ||
1327 | }; | 1208 | }; |
1328 | 1209 | ||
1329 | static u64 dbgu_dmamask = DMA_BIT_MASK(32); | 1210 | static u64 dbgu_dmamask = DMA_BIT_MASK(32); |
@@ -1353,8 +1234,8 @@ static struct resource uart0_resources[] = { | |||
1353 | .flags = IORESOURCE_MEM, | 1234 | .flags = IORESOURCE_MEM, |
1354 | }, | 1235 | }, |
1355 | [1] = { | 1236 | [1] = { |
1356 | .start = NR_IRQS_LEGACY + AT91SAM9263_ID_US0, | 1237 | .start = AT91SAM9263_ID_US0, |
1357 | .end = NR_IRQS_LEGACY + AT91SAM9263_ID_US0, | 1238 | .end = AT91SAM9263_ID_US0, |
1358 | .flags = IORESOURCE_IRQ, | 1239 | .flags = IORESOURCE_IRQ, |
1359 | }, | 1240 | }, |
1360 | }; | 1241 | }; |
@@ -1396,8 +1277,8 @@ static struct resource uart1_resources[] = { | |||
1396 | .flags = IORESOURCE_MEM, | 1277 | .flags = IORESOURCE_MEM, |
1397 | }, | 1278 | }, |
1398 | [1] = { | 1279 | [1] = { |
1399 | .start = NR_IRQS_LEGACY + AT91SAM9263_ID_US1, | 1280 | .start = AT91SAM9263_ID_US1, |
1400 | .end = NR_IRQS_LEGACY + AT91SAM9263_ID_US1, | 1281 | .end = AT91SAM9263_ID_US1, |
1401 | .flags = IORESOURCE_IRQ, | 1282 | .flags = IORESOURCE_IRQ, |
1402 | }, | 1283 | }, |
1403 | }; | 1284 | }; |
@@ -1439,8 +1320,8 @@ static struct resource uart2_resources[] = { | |||
1439 | .flags = IORESOURCE_MEM, | 1320 | .flags = IORESOURCE_MEM, |
1440 | }, | 1321 | }, |
1441 | [1] = { | 1322 | [1] = { |
1442 | .start = NR_IRQS_LEGACY + AT91SAM9263_ID_US2, | 1323 | .start = AT91SAM9263_ID_US2, |
1443 | .end = NR_IRQS_LEGACY + AT91SAM9263_ID_US2, | 1324 | .end = AT91SAM9263_ID_US2, |
1444 | .flags = IORESOURCE_IRQ, | 1325 | .flags = IORESOURCE_IRQ, |
1445 | }, | 1326 | }, |
1446 | }; | 1327 | }; |
@@ -1476,6 +1357,7 @@ static inline void configure_usart2_pins(unsigned pins) | |||
1476 | } | 1357 | } |
1477 | 1358 | ||
1478 | static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ | 1359 | static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ |
1360 | struct platform_device *atmel_default_console_device; /* the serial console device */ | ||
1479 | 1361 | ||
1480 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) | 1362 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) |
1481 | { | 1363 | { |
@@ -1509,6 +1391,14 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) | |||
1509 | at91_uarts[portnr] = pdev; | 1391 | at91_uarts[portnr] = pdev; |
1510 | } | 1392 | } |
1511 | 1393 | ||
1394 | void __init at91_set_serial_console(unsigned portnr) | ||
1395 | { | ||
1396 | if (portnr < ATMEL_MAX_UART) { | ||
1397 | atmel_default_console_device = at91_uarts[portnr]; | ||
1398 | at91sam9263_set_console_clock(at91_uarts[portnr]->id); | ||
1399 | } | ||
1400 | } | ||
1401 | |||
1512 | void __init at91_add_device_serial(void) | 1402 | void __init at91_add_device_serial(void) |
1513 | { | 1403 | { |
1514 | int i; | 1404 | int i; |
@@ -1517,9 +1407,13 @@ void __init at91_add_device_serial(void) | |||
1517 | if (at91_uarts[i]) | 1407 | if (at91_uarts[i]) |
1518 | platform_device_register(at91_uarts[i]); | 1408 | platform_device_register(at91_uarts[i]); |
1519 | } | 1409 | } |
1410 | |||
1411 | if (!atmel_default_console_device) | ||
1412 | printk(KERN_INFO "AT91: No default serial console defined.\n"); | ||
1520 | } | 1413 | } |
1521 | #else | 1414 | #else |
1522 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {} | 1415 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {} |
1416 | void __init at91_set_serial_console(unsigned portnr) {} | ||
1523 | void __init at91_add_device_serial(void) {} | 1417 | void __init at91_add_device_serial(void) {} |
1524 | #endif | 1418 | #endif |
1525 | 1419 | ||
@@ -1531,9 +1425,6 @@ void __init at91_add_device_serial(void) {} | |||
1531 | */ | 1425 | */ |
1532 | static int __init at91_add_standard_devices(void) | 1426 | static int __init at91_add_standard_devices(void) |
1533 | { | 1427 | { |
1534 | if (of_have_populated_dt()) | ||
1535 | return 0; | ||
1536 | |||
1537 | at91_add_device_rtt(); | 1428 | at91_add_device_rtt(); |
1538 | at91_add_device_watchdog(); | 1429 | at91_add_device_watchdog(); |
1539 | at91_add_device_tc(); | 1430 | at91_add_device_tc(); |