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/at91sam9261_devices.c | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'arch/arm/mach-at91/at91sam9261_devices.c')
-rw-r--r-- | arch/arm/mach-at91/at91sam9261_devices.c | 244 |
1 files changed, 102 insertions, 142 deletions
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c index 92e0f861084..9e113f60d25 100644 --- a/arch/arm/mach-at91/at91sam9261_devices.c +++ b/arch/arm/mach-at91/at91sam9261_devices.c | |||
@@ -14,19 +14,18 @@ | |||
14 | #include <asm/mach/map.h> | 14 | #include <asm/mach/map.h> |
15 | 15 | ||
16 | #include <linux/dma-mapping.h> | 16 | #include <linux/dma-mapping.h> |
17 | #include <linux/gpio.h> | ||
18 | #include <linux/platform_device.h> | 17 | #include <linux/platform_device.h> |
19 | #include <linux/i2c-gpio.h> | 18 | #include <linux/i2c-gpio.h> |
20 | 19 | ||
21 | #include <linux/fb.h> | 20 | #include <linux/fb.h> |
22 | #include <video/atmel_lcdc.h> | 21 | #include <video/atmel_lcdc.h> |
23 | 22 | ||
23 | #include <mach/board.h> | ||
24 | #include <mach/gpio.h> | ||
24 | #include <mach/at91sam9261.h> | 25 | #include <mach/at91sam9261.h> |
25 | #include <mach/at91sam9261_matrix.h> | 26 | #include <mach/at91sam9261_matrix.h> |
26 | #include <mach/at91_matrix.h> | ||
27 | #include <mach/at91sam9_smc.h> | 27 | #include <mach/at91sam9_smc.h> |
28 | 28 | ||
29 | #include "board.h" | ||
30 | #include "generic.h" | 29 | #include "generic.h" |
31 | 30 | ||
32 | 31 | ||
@@ -45,8 +44,8 @@ static struct resource usbh_resources[] = { | |||
45 | .flags = IORESOURCE_MEM, | 44 | .flags = IORESOURCE_MEM, |
46 | }, | 45 | }, |
47 | [1] = { | 46 | [1] = { |
48 | .start = NR_IRQS_LEGACY + AT91SAM9261_ID_UHP, | 47 | .start = AT91SAM9261_ID_UHP, |
49 | .end = NR_IRQS_LEGACY + AT91SAM9261_ID_UHP, | 48 | .end = AT91SAM9261_ID_UHP, |
50 | .flags = IORESOURCE_IRQ, | 49 | .flags = IORESOURCE_IRQ, |
51 | }, | 50 | }, |
52 | }; | 51 | }; |
@@ -65,17 +64,9 @@ static struct platform_device at91sam9261_usbh_device = { | |||
65 | 64 | ||
66 | void __init at91_add_device_usbh(struct at91_usbh_data *data) | 65 | void __init at91_add_device_usbh(struct at91_usbh_data *data) |
67 | { | 66 | { |
68 | int i; | ||
69 | |||
70 | if (!data) | 67 | if (!data) |
71 | return; | 68 | return; |
72 | 69 | ||
73 | /* Enable overcurrent notification */ | ||
74 | for (i = 0; i < data->ports; i++) { | ||
75 | if (gpio_is_valid(data->overcurrent_pin[i])) | ||
76 | at91_set_gpio_input(data->overcurrent_pin[i], 1); | ||
77 | } | ||
78 | |||
79 | usbh_data = *data; | 70 | usbh_data = *data; |
80 | platform_device_register(&at91sam9261_usbh_device); | 71 | platform_device_register(&at91sam9261_usbh_device); |
81 | } | 72 | } |
@@ -88,7 +79,7 @@ void __init at91_add_device_usbh(struct at91_usbh_data *data) {} | |||
88 | * USB Device (Gadget) | 79 | * USB Device (Gadget) |
89 | * -------------------------------------------------------------------- */ | 80 | * -------------------------------------------------------------------- */ |
90 | 81 | ||
91 | #if defined(CONFIG_USB_AT91) || defined(CONFIG_USB_AT91_MODULE) | 82 | #ifdef CONFIG_USB_AT91 |
92 | static struct at91_udc_data udc_data; | 83 | static struct at91_udc_data udc_data; |
93 | 84 | ||
94 | static struct resource udc_resources[] = { | 85 | static struct resource udc_resources[] = { |
@@ -98,8 +89,8 @@ static struct resource udc_resources[] = { | |||
98 | .flags = IORESOURCE_MEM, | 89 | .flags = IORESOURCE_MEM, |
99 | }, | 90 | }, |
100 | [1] = { | 91 | [1] = { |
101 | .start = NR_IRQS_LEGACY + AT91SAM9261_ID_UDP, | 92 | .start = AT91SAM9261_ID_UDP, |
102 | .end = NR_IRQS_LEGACY + AT91SAM9261_ID_UDP, | 93 | .end = AT91SAM9261_ID_UDP, |
103 | .flags = IORESOURCE_IRQ, | 94 | .flags = IORESOURCE_IRQ, |
104 | }, | 95 | }, |
105 | }; | 96 | }; |
@@ -119,7 +110,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) | |||
119 | if (!data) | 110 | if (!data) |
120 | return; | 111 | return; |
121 | 112 | ||
122 | if (gpio_is_valid(data->vbus_pin)) { | 113 | if (data->vbus_pin) { |
123 | at91_set_gpio_input(data->vbus_pin, 0); | 114 | at91_set_gpio_input(data->vbus_pin, 0); |
124 | at91_set_deglitch(data->vbus_pin, 1); | 115 | at91_set_deglitch(data->vbus_pin, 1); |
125 | } | 116 | } |
@@ -137,9 +128,9 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {} | |||
137 | * MMC / SD | 128 | * MMC / SD |
138 | * -------------------------------------------------------------------- */ | 129 | * -------------------------------------------------------------------- */ |
139 | 130 | ||
140 | #if IS_ENABLED(CONFIG_MMC_ATMELMCI) | 131 | #if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) |
141 | static u64 mmc_dmamask = DMA_BIT_MASK(32); | 132 | static u64 mmc_dmamask = DMA_BIT_MASK(32); |
142 | static struct mci_platform_data mmc_data; | 133 | static struct at91_mmc_data mmc_data; |
143 | 134 | ||
144 | static struct resource mmc_resources[] = { | 135 | static struct resource mmc_resources[] = { |
145 | [0] = { | 136 | [0] = { |
@@ -148,14 +139,14 @@ static struct resource mmc_resources[] = { | |||
148 | .flags = IORESOURCE_MEM, | 139 | .flags = IORESOURCE_MEM, |
149 | }, | 140 | }, |
150 | [1] = { | 141 | [1] = { |
151 | .start = NR_IRQS_LEGACY + AT91SAM9261_ID_MCI, | 142 | .start = AT91SAM9261_ID_MCI, |
152 | .end = NR_IRQS_LEGACY + AT91SAM9261_ID_MCI, | 143 | .end = AT91SAM9261_ID_MCI, |
153 | .flags = IORESOURCE_IRQ, | 144 | .flags = IORESOURCE_IRQ, |
154 | }, | 145 | }, |
155 | }; | 146 | }; |
156 | 147 | ||
157 | static struct platform_device at91sam9261_mmc_device = { | 148 | static struct platform_device at91sam9261_mmc_device = { |
158 | .name = "atmel_mci", | 149 | .name = "at91_mci", |
159 | .id = -1, | 150 | .id = -1, |
160 | .dev = { | 151 | .dev = { |
161 | .dma_mask = &mmc_dmamask, | 152 | .dma_mask = &mmc_dmamask, |
@@ -166,40 +157,40 @@ static struct platform_device at91sam9261_mmc_device = { | |||
166 | .num_resources = ARRAY_SIZE(mmc_resources), | 157 | .num_resources = ARRAY_SIZE(mmc_resources), |
167 | }; | 158 | }; |
168 | 159 | ||
169 | void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) | 160 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) |
170 | { | 161 | { |
171 | if (!data) | 162 | if (!data) |
172 | return; | 163 | return; |
173 | 164 | ||
174 | if (data->slot[0].bus_width) { | 165 | /* input/irq */ |
175 | /* input/irq */ | 166 | if (data->det_pin) { |
176 | if (gpio_is_valid(data->slot[0].detect_pin)) { | 167 | at91_set_gpio_input(data->det_pin, 1); |
177 | at91_set_gpio_input(data->slot[0].detect_pin, 1); | 168 | at91_set_deglitch(data->det_pin, 1); |
178 | at91_set_deglitch(data->slot[0].detect_pin, 1); | ||
179 | } | ||
180 | if (gpio_is_valid(data->slot[0].wp_pin)) | ||
181 | at91_set_gpio_input(data->slot[0].wp_pin, 1); | ||
182 | |||
183 | /* CLK */ | ||
184 | at91_set_B_periph(AT91_PIN_PA2, 0); | ||
185 | |||
186 | /* CMD */ | ||
187 | at91_set_B_periph(AT91_PIN_PA1, 1); | ||
188 | |||
189 | /* DAT0, maybe DAT1..DAT3 */ | ||
190 | at91_set_B_periph(AT91_PIN_PA0, 1); | ||
191 | if (data->slot[0].bus_width == 4) { | ||
192 | at91_set_B_periph(AT91_PIN_PA4, 1); | ||
193 | at91_set_B_periph(AT91_PIN_PA5, 1); | ||
194 | at91_set_B_periph(AT91_PIN_PA6, 1); | ||
195 | } | ||
196 | |||
197 | mmc_data = *data; | ||
198 | platform_device_register(&at91sam9261_mmc_device); | ||
199 | } | 169 | } |
170 | if (data->wp_pin) | ||
171 | at91_set_gpio_input(data->wp_pin, 1); | ||
172 | if (data->vcc_pin) | ||
173 | at91_set_gpio_output(data->vcc_pin, 0); | ||
174 | |||
175 | /* CLK */ | ||
176 | at91_set_B_periph(AT91_PIN_PA2, 0); | ||
177 | |||
178 | /* CMD */ | ||
179 | at91_set_B_periph(AT91_PIN_PA1, 1); | ||
180 | |||
181 | /* DAT0, maybe DAT1..DAT3 */ | ||
182 | at91_set_B_periph(AT91_PIN_PA0, 1); | ||
183 | if (data->wire4) { | ||
184 | at91_set_B_periph(AT91_PIN_PA4, 1); | ||
185 | at91_set_B_periph(AT91_PIN_PA5, 1); | ||
186 | at91_set_B_periph(AT91_PIN_PA6, 1); | ||
187 | } | ||
188 | |||
189 | mmc_data = *data; | ||
190 | platform_device_register(&at91sam9261_mmc_device); | ||
200 | } | 191 | } |
201 | #else | 192 | #else |
202 | void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) {} | 193 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} |
203 | #endif | 194 | #endif |
204 | 195 | ||
205 | 196 | ||
@@ -237,19 +228,19 @@ void __init at91_add_device_nand(struct atmel_nand_data *data) | |||
237 | if (!data) | 228 | if (!data) |
238 | return; | 229 | return; |
239 | 230 | ||
240 | csa = at91_matrix_read(AT91_MATRIX_EBICSA); | 231 | csa = at91_sys_read(AT91_MATRIX_EBICSA); |
241 | at91_matrix_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); | 232 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); |
242 | 233 | ||
243 | /* enable pin */ | 234 | /* enable pin */ |
244 | if (gpio_is_valid(data->enable_pin)) | 235 | if (data->enable_pin) |
245 | at91_set_gpio_output(data->enable_pin, 1); | 236 | at91_set_gpio_output(data->enable_pin, 1); |
246 | 237 | ||
247 | /* ready/busy pin */ | 238 | /* ready/busy pin */ |
248 | if (gpio_is_valid(data->rdy_pin)) | 239 | if (data->rdy_pin) |
249 | at91_set_gpio_input(data->rdy_pin, 1); | 240 | at91_set_gpio_input(data->rdy_pin, 1); |
250 | 241 | ||
251 | /* card detect pin */ | 242 | /* card detect pin */ |
252 | if (gpio_is_valid(data->det_pin)) | 243 | if (data->det_pin) |
253 | at91_set_gpio_input(data->det_pin, 1); | 244 | at91_set_gpio_input(data->det_pin, 1); |
254 | 245 | ||
255 | at91_set_A_periph(AT91_PIN_PC0, 0); /* NANDOE */ | 246 | at91_set_A_periph(AT91_PIN_PC0, 0); /* NANDOE */ |
@@ -285,7 +276,7 @@ static struct i2c_gpio_platform_data pdata = { | |||
285 | 276 | ||
286 | static struct platform_device at91sam9261_twi_device = { | 277 | static struct platform_device at91sam9261_twi_device = { |
287 | .name = "i2c-gpio", | 278 | .name = "i2c-gpio", |
288 | .id = 0, | 279 | .id = -1, |
289 | .dev.platform_data = &pdata, | 280 | .dev.platform_data = &pdata, |
290 | }; | 281 | }; |
291 | 282 | ||
@@ -310,33 +301,27 @@ static struct resource twi_resources[] = { | |||
310 | .flags = IORESOURCE_MEM, | 301 | .flags = IORESOURCE_MEM, |
311 | }, | 302 | }, |
312 | [1] = { | 303 | [1] = { |
313 | .start = NR_IRQS_LEGACY + AT91SAM9261_ID_TWI, | 304 | .start = AT91SAM9261_ID_TWI, |
314 | .end = NR_IRQS_LEGACY + AT91SAM9261_ID_TWI, | 305 | .end = AT91SAM9261_ID_TWI, |
315 | .flags = IORESOURCE_IRQ, | 306 | .flags = IORESOURCE_IRQ, |
316 | }, | 307 | }, |
317 | }; | 308 | }; |
318 | 309 | ||
319 | static struct platform_device at91sam9261_twi_device = { | 310 | static struct platform_device at91sam9261_twi_device = { |
320 | .id = 0, | 311 | .name = "at91_i2c", |
312 | .id = -1, | ||
321 | .resource = twi_resources, | 313 | .resource = twi_resources, |
322 | .num_resources = ARRAY_SIZE(twi_resources), | 314 | .num_resources = ARRAY_SIZE(twi_resources), |
323 | }; | 315 | }; |
324 | 316 | ||
325 | void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) | 317 | void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) |
326 | { | 318 | { |
327 | /* IP version is not the same on 9261 and g10 */ | ||
328 | if (cpu_is_at91sam9g10()) { | ||
329 | at91sam9261_twi_device.name = "i2c-at91sam9g10"; | ||
330 | /* I2C PIO must not be configured as open-drain on this chip */ | ||
331 | } else { | ||
332 | at91sam9261_twi_device.name = "i2c-at91sam9261"; | ||
333 | at91_set_multi_drive(AT91_PIN_PA7, 1); | ||
334 | at91_set_multi_drive(AT91_PIN_PA8, 1); | ||
335 | } | ||
336 | |||
337 | /* pins used for TWI interface */ | 319 | /* pins used for TWI interface */ |
338 | at91_set_A_periph(AT91_PIN_PA7, 0); /* TWD */ | 320 | at91_set_A_periph(AT91_PIN_PA7, 0); /* TWD */ |
321 | at91_set_multi_drive(AT91_PIN_PA7, 1); | ||
322 | |||
339 | at91_set_A_periph(AT91_PIN_PA8, 0); /* TWCK */ | 323 | at91_set_A_periph(AT91_PIN_PA8, 0); /* TWCK */ |
324 | at91_set_multi_drive(AT91_PIN_PA8, 1); | ||
340 | 325 | ||
341 | i2c_register_board_info(0, devices, nr_devices); | 326 | i2c_register_board_info(0, devices, nr_devices); |
342 | platform_device_register(&at91sam9261_twi_device); | 327 | platform_device_register(&at91sam9261_twi_device); |
@@ -360,8 +345,8 @@ static struct resource spi0_resources[] = { | |||
360 | .flags = IORESOURCE_MEM, | 345 | .flags = IORESOURCE_MEM, |
361 | }, | 346 | }, |
362 | [1] = { | 347 | [1] = { |
363 | .start = NR_IRQS_LEGACY + AT91SAM9261_ID_SPI0, | 348 | .start = AT91SAM9261_ID_SPI0, |
364 | .end = NR_IRQS_LEGACY + AT91SAM9261_ID_SPI0, | 349 | .end = AT91SAM9261_ID_SPI0, |
365 | .flags = IORESOURCE_IRQ, | 350 | .flags = IORESOURCE_IRQ, |
366 | }, | 351 | }, |
367 | }; | 352 | }; |
@@ -386,8 +371,8 @@ static struct resource spi1_resources[] = { | |||
386 | .flags = IORESOURCE_MEM, | 371 | .flags = IORESOURCE_MEM, |
387 | }, | 372 | }, |
388 | [1] = { | 373 | [1] = { |
389 | .start = NR_IRQS_LEGACY + AT91SAM9261_ID_SPI1, | 374 | .start = AT91SAM9261_ID_SPI1, |
390 | .end = NR_IRQS_LEGACY + AT91SAM9261_ID_SPI1, | 375 | .end = AT91SAM9261_ID_SPI1, |
391 | .flags = IORESOURCE_IRQ, | 376 | .flags = IORESOURCE_IRQ, |
392 | }, | 377 | }, |
393 | }; | 378 | }; |
@@ -421,9 +406,6 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) | |||
421 | else | 406 | else |
422 | cs_pin = spi1_standard_cs[devices[i].chip_select]; | 407 | cs_pin = spi1_standard_cs[devices[i].chip_select]; |
423 | 408 | ||
424 | if (!gpio_is_valid(cs_pin)) | ||
425 | continue; | ||
426 | |||
427 | if (devices[i].bus_num == 0) | 409 | if (devices[i].bus_num == 0) |
428 | enable_spi0 = 1; | 410 | enable_spi0 = 1; |
429 | else | 411 | else |
@@ -474,8 +456,8 @@ static struct resource lcdc_resources[] = { | |||
474 | .flags = IORESOURCE_MEM, | 456 | .flags = IORESOURCE_MEM, |
475 | }, | 457 | }, |
476 | [1] = { | 458 | [1] = { |
477 | .start = NR_IRQS_LEGACY + AT91SAM9261_ID_LCDC, | 459 | .start = AT91SAM9261_ID_LCDC, |
478 | .end = NR_IRQS_LEGACY + AT91SAM9261_ID_LCDC, | 460 | .end = AT91SAM9261_ID_LCDC, |
479 | .flags = IORESOURCE_IRQ, | 461 | .flags = IORESOURCE_IRQ, |
480 | }, | 462 | }, |
481 | #if defined(CONFIG_FB_INTSRAM) | 463 | #if defined(CONFIG_FB_INTSRAM) |
@@ -572,18 +554,18 @@ static struct resource tcb_resources[] = { | |||
572 | .flags = IORESOURCE_MEM, | 554 | .flags = IORESOURCE_MEM, |
573 | }, | 555 | }, |
574 | [1] = { | 556 | [1] = { |
575 | .start = NR_IRQS_LEGACY + AT91SAM9261_ID_TC0, | 557 | .start = AT91SAM9261_ID_TC0, |
576 | .end = NR_IRQS_LEGACY + AT91SAM9261_ID_TC0, | 558 | .end = AT91SAM9261_ID_TC0, |
577 | .flags = IORESOURCE_IRQ, | 559 | .flags = IORESOURCE_IRQ, |
578 | }, | 560 | }, |
579 | [2] = { | 561 | [2] = { |
580 | .start = NR_IRQS_LEGACY + AT91SAM9261_ID_TC1, | 562 | .start = AT91SAM9261_ID_TC1, |
581 | .end = NR_IRQS_LEGACY + AT91SAM9261_ID_TC1, | 563 | .end = AT91SAM9261_ID_TC1, |
582 | .flags = IORESOURCE_IRQ, | 564 | .flags = IORESOURCE_IRQ, |
583 | }, | 565 | }, |
584 | [3] = { | 566 | [3] = { |
585 | .start = NR_IRQS_LEGACY + AT91SAM9261_ID_TC2, | 567 | .start = AT91SAM9261_ID_TC2, |
586 | .end = NR_IRQS_LEGACY + AT91SAM9261_ID_TC2, | 568 | .end = AT91SAM9261_ID_TC2, |
587 | .flags = IORESOURCE_IRQ, | 569 | .flags = IORESOURCE_IRQ, |
588 | }, | 570 | }, |
589 | }; | 571 | }; |
@@ -610,13 +592,9 @@ static void __init at91_add_device_tc(void) { } | |||
610 | 592 | ||
611 | static struct resource rtt_resources[] = { | 593 | static struct resource rtt_resources[] = { |
612 | { | 594 | { |
613 | .start = AT91SAM9261_BASE_RTT, | 595 | .start = AT91_BASE_SYS + AT91_RTT, |
614 | .end = AT91SAM9261_BASE_RTT + SZ_16 - 1, | 596 | .end = AT91_BASE_SYS + AT91_RTT + SZ_16 - 1, |
615 | .flags = IORESOURCE_MEM, | 597 | .flags = IORESOURCE_MEM, |
616 | }, { | ||
617 | .flags = IORESOURCE_MEM, | ||
618 | }, { | ||
619 | .flags = IORESOURCE_IRQ, | ||
620 | } | 598 | } |
621 | }; | 599 | }; |
622 | 600 | ||
@@ -624,34 +602,11 @@ static struct platform_device at91sam9261_rtt_device = { | |||
624 | .name = "at91_rtt", | 602 | .name = "at91_rtt", |
625 | .id = 0, | 603 | .id = 0, |
626 | .resource = rtt_resources, | 604 | .resource = rtt_resources, |
605 | .num_resources = ARRAY_SIZE(rtt_resources), | ||
627 | }; | 606 | }; |
628 | 607 | ||
629 | #if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9) | ||
630 | static void __init at91_add_device_rtt_rtc(void) | ||
631 | { | ||
632 | at91sam9261_rtt_device.name = "rtc-at91sam9"; | ||
633 | /* | ||
634 | * The second resource is needed: | ||
635 | * GPBR will serve as the storage for RTC time offset | ||
636 | */ | ||
637 | at91sam9261_rtt_device.num_resources = 3; | ||
638 | rtt_resources[1].start = AT91SAM9261_BASE_GPBR + | ||
639 | 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR; | ||
640 | rtt_resources[1].end = rtt_resources[1].start + 3; | ||
641 | rtt_resources[2].start = NR_IRQS_LEGACY + AT91_ID_SYS; | ||
642 | rtt_resources[2].end = NR_IRQS_LEGACY + AT91_ID_SYS; | ||
643 | } | ||
644 | #else | ||
645 | static void __init at91_add_device_rtt_rtc(void) | ||
646 | { | ||
647 | /* Only one resource is needed: RTT not used as RTC */ | ||
648 | at91sam9261_rtt_device.num_resources = 1; | ||
649 | } | ||
650 | #endif | ||
651 | |||
652 | static void __init at91_add_device_rtt(void) | 608 | static void __init at91_add_device_rtt(void) |
653 | { | 609 | { |
654 | at91_add_device_rtt_rtc(); | ||
655 | platform_device_register(&at91sam9261_rtt_device); | 610 | platform_device_register(&at91sam9261_rtt_device); |
656 | } | 611 | } |
657 | 612 | ||
@@ -661,19 +616,10 @@ static void __init at91_add_device_rtt(void) | |||
661 | * -------------------------------------------------------------------- */ | 616 | * -------------------------------------------------------------------- */ |
662 | 617 | ||
663 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) | 618 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) |
664 | static struct resource wdt_resources[] = { | ||
665 | { | ||
666 | .start = AT91SAM9261_BASE_WDT, | ||
667 | .end = AT91SAM9261_BASE_WDT + SZ_16 - 1, | ||
668 | .flags = IORESOURCE_MEM, | ||
669 | } | ||
670 | }; | ||
671 | |||
672 | static struct platform_device at91sam9261_wdt_device = { | 619 | static struct platform_device at91sam9261_wdt_device = { |
673 | .name = "at91_wdt", | 620 | .name = "at91_wdt", |
674 | .id = -1, | 621 | .id = -1, |
675 | .resource = wdt_resources, | 622 | .num_resources = 0, |
676 | .num_resources = ARRAY_SIZE(wdt_resources), | ||
677 | }; | 623 | }; |
678 | 624 | ||
679 | static void __init at91_add_device_watchdog(void) | 625 | static void __init at91_add_device_watchdog(void) |
@@ -699,14 +645,14 @@ static struct resource ssc0_resources[] = { | |||
699 | .flags = IORESOURCE_MEM, | 645 | .flags = IORESOURCE_MEM, |
700 | }, | 646 | }, |
701 | [1] = { | 647 | [1] = { |
702 | .start = NR_IRQS_LEGACY + AT91SAM9261_ID_SSC0, | 648 | .start = AT91SAM9261_ID_SSC0, |
703 | .end = NR_IRQS_LEGACY + AT91SAM9261_ID_SSC0, | 649 | .end = AT91SAM9261_ID_SSC0, |
704 | .flags = IORESOURCE_IRQ, | 650 | .flags = IORESOURCE_IRQ, |
705 | }, | 651 | }, |
706 | }; | 652 | }; |
707 | 653 | ||
708 | static struct platform_device at91sam9261_ssc0_device = { | 654 | static struct platform_device at91sam9261_ssc0_device = { |
709 | .name = "at91rm9200_ssc", | 655 | .name = "ssc", |
710 | .id = 0, | 656 | .id = 0, |
711 | .dev = { | 657 | .dev = { |
712 | .dma_mask = &ssc0_dmamask, | 658 | .dma_mask = &ssc0_dmamask, |
@@ -741,14 +687,14 @@ static struct resource ssc1_resources[] = { | |||
741 | .flags = IORESOURCE_MEM, | 687 | .flags = IORESOURCE_MEM, |
742 | }, | 688 | }, |
743 | [1] = { | 689 | [1] = { |
744 | .start = NR_IRQS_LEGACY + AT91SAM9261_ID_SSC1, | 690 | .start = AT91SAM9261_ID_SSC1, |
745 | .end = NR_IRQS_LEGACY + AT91SAM9261_ID_SSC1, | 691 | .end = AT91SAM9261_ID_SSC1, |
746 | .flags = IORESOURCE_IRQ, | 692 | .flags = IORESOURCE_IRQ, |
747 | }, | 693 | }, |
748 | }; | 694 | }; |
749 | 695 | ||
750 | static struct platform_device at91sam9261_ssc1_device = { | 696 | static struct platform_device at91sam9261_ssc1_device = { |
751 | .name = "at91rm9200_ssc", | 697 | .name = "ssc", |
752 | .id = 1, | 698 | .id = 1, |
753 | .dev = { | 699 | .dev = { |
754 | .dma_mask = &ssc1_dmamask, | 700 | .dma_mask = &ssc1_dmamask, |
@@ -783,14 +729,14 @@ static struct resource ssc2_resources[] = { | |||
783 | .flags = IORESOURCE_MEM, | 729 | .flags = IORESOURCE_MEM, |
784 | }, | 730 | }, |
785 | [1] = { | 731 | [1] = { |
786 | .start = NR_IRQS_LEGACY + AT91SAM9261_ID_SSC2, | 732 | .start = AT91SAM9261_ID_SSC2, |
787 | .end = NR_IRQS_LEGACY + AT91SAM9261_ID_SSC2, | 733 | .end = AT91SAM9261_ID_SSC2, |
788 | .flags = IORESOURCE_IRQ, | 734 | .flags = IORESOURCE_IRQ, |
789 | }, | 735 | }, |
790 | }; | 736 | }; |
791 | 737 | ||
792 | static struct platform_device at91sam9261_ssc2_device = { | 738 | static struct platform_device at91sam9261_ssc2_device = { |
793 | .name = "at91rm9200_ssc", | 739 | .name = "ssc", |
794 | .id = 2, | 740 | .id = 2, |
795 | .dev = { | 741 | .dev = { |
796 | .dma_mask = &ssc2_dmamask, | 742 | .dma_mask = &ssc2_dmamask, |
@@ -862,13 +808,13 @@ void __init at91_add_device_ssc(unsigned id, unsigned pins) {} | |||
862 | #if defined(CONFIG_SERIAL_ATMEL) | 808 | #if defined(CONFIG_SERIAL_ATMEL) |
863 | static struct resource dbgu_resources[] = { | 809 | static struct resource dbgu_resources[] = { |
864 | [0] = { | 810 | [0] = { |
865 | .start = AT91SAM9261_BASE_DBGU, | 811 | .start = AT91_VA_BASE_SYS + AT91_DBGU, |
866 | .end = AT91SAM9261_BASE_DBGU + SZ_512 - 1, | 812 | .end = AT91_VA_BASE_SYS + AT91_DBGU + SZ_512 - 1, |
867 | .flags = IORESOURCE_MEM, | 813 | .flags = IORESOURCE_MEM, |
868 | }, | 814 | }, |
869 | [1] = { | 815 | [1] = { |
870 | .start = NR_IRQS_LEGACY + AT91_ID_SYS, | 816 | .start = AT91_ID_SYS, |
871 | .end = NR_IRQS_LEGACY + AT91_ID_SYS, | 817 | .end = AT91_ID_SYS, |
872 | .flags = IORESOURCE_IRQ, | 818 | .flags = IORESOURCE_IRQ, |
873 | }, | 819 | }, |
874 | }; | 820 | }; |
@@ -876,6 +822,7 @@ static struct resource dbgu_resources[] = { | |||
876 | static struct atmel_uart_data dbgu_data = { | 822 | static struct atmel_uart_data dbgu_data = { |
877 | .use_dma_tx = 0, | 823 | .use_dma_tx = 0, |
878 | .use_dma_rx = 0, /* DBGU not capable of receive DMA */ | 824 | .use_dma_rx = 0, /* DBGU not capable of receive DMA */ |
825 | .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU), | ||
879 | }; | 826 | }; |
880 | 827 | ||
881 | static u64 dbgu_dmamask = DMA_BIT_MASK(32); | 828 | static u64 dbgu_dmamask = DMA_BIT_MASK(32); |
@@ -905,8 +852,8 @@ static struct resource uart0_resources[] = { | |||
905 | .flags = IORESOURCE_MEM, | 852 | .flags = IORESOURCE_MEM, |
906 | }, | 853 | }, |
907 | [1] = { | 854 | [1] = { |
908 | .start = NR_IRQS_LEGACY + AT91SAM9261_ID_US0, | 855 | .start = AT91SAM9261_ID_US0, |
909 | .end = NR_IRQS_LEGACY + AT91SAM9261_ID_US0, | 856 | .end = AT91SAM9261_ID_US0, |
910 | .flags = IORESOURCE_IRQ, | 857 | .flags = IORESOURCE_IRQ, |
911 | }, | 858 | }, |
912 | }; | 859 | }; |
@@ -948,8 +895,8 @@ static struct resource uart1_resources[] = { | |||
948 | .flags = IORESOURCE_MEM, | 895 | .flags = IORESOURCE_MEM, |
949 | }, | 896 | }, |
950 | [1] = { | 897 | [1] = { |
951 | .start = NR_IRQS_LEGACY + AT91SAM9261_ID_US1, | 898 | .start = AT91SAM9261_ID_US1, |
952 | .end = NR_IRQS_LEGACY + AT91SAM9261_ID_US1, | 899 | .end = AT91SAM9261_ID_US1, |
953 | .flags = IORESOURCE_IRQ, | 900 | .flags = IORESOURCE_IRQ, |
954 | }, | 901 | }, |
955 | }; | 902 | }; |
@@ -991,8 +938,8 @@ static struct resource uart2_resources[] = { | |||
991 | .flags = IORESOURCE_MEM, | 938 | .flags = IORESOURCE_MEM, |
992 | }, | 939 | }, |
993 | [1] = { | 940 | [1] = { |
994 | .start = NR_IRQS_LEGACY + AT91SAM9261_ID_US2, | 941 | .start = AT91SAM9261_ID_US2, |
995 | .end = NR_IRQS_LEGACY + AT91SAM9261_ID_US2, | 942 | .end = AT91SAM9261_ID_US2, |
996 | .flags = IORESOURCE_IRQ, | 943 | .flags = IORESOURCE_IRQ, |
997 | }, | 944 | }, |
998 | }; | 945 | }; |
@@ -1028,6 +975,7 @@ static inline void configure_usart2_pins(unsigned pins) | |||
1028 | } | 975 | } |
1029 | 976 | ||
1030 | static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ | 977 | static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ |
978 | struct platform_device *atmel_default_console_device; /* the serial console device */ | ||
1031 | 979 | ||
1032 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) | 980 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) |
1033 | { | 981 | { |
@@ -1061,6 +1009,14 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) | |||
1061 | at91_uarts[portnr] = pdev; | 1009 | at91_uarts[portnr] = pdev; |
1062 | } | 1010 | } |
1063 | 1011 | ||
1012 | void __init at91_set_serial_console(unsigned portnr) | ||
1013 | { | ||
1014 | if (portnr < ATMEL_MAX_UART) { | ||
1015 | atmel_default_console_device = at91_uarts[portnr]; | ||
1016 | at91sam9261_set_console_clock(at91_uarts[portnr]->id); | ||
1017 | } | ||
1018 | } | ||
1019 | |||
1064 | void __init at91_add_device_serial(void) | 1020 | void __init at91_add_device_serial(void) |
1065 | { | 1021 | { |
1066 | int i; | 1022 | int i; |
@@ -1069,9 +1025,13 @@ void __init at91_add_device_serial(void) | |||
1069 | if (at91_uarts[i]) | 1025 | if (at91_uarts[i]) |
1070 | platform_device_register(at91_uarts[i]); | 1026 | platform_device_register(at91_uarts[i]); |
1071 | } | 1027 | } |
1028 | |||
1029 | if (!atmel_default_console_device) | ||
1030 | printk(KERN_INFO "AT91: No default serial console defined.\n"); | ||
1072 | } | 1031 | } |
1073 | #else | 1032 | #else |
1074 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {} | 1033 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {} |
1034 | void __init at91_set_serial_console(unsigned portnr) {} | ||
1075 | void __init at91_add_device_serial(void) {} | 1035 | void __init at91_add_device_serial(void) {} |
1076 | #endif | 1036 | #endif |
1077 | 1037 | ||