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/at91sam9rl_devices.c | |
parent | 406089d01562f1e2bf9f089fd7637009ebaad589 (diff) |
Patched in Tegra support.
Diffstat (limited to 'arch/arm/mach-at91/at91sam9rl_devices.c')
-rw-r--r-- | arch/arm/mach-at91/at91sam9rl_devices.c | 248 |
1 files changed, 114 insertions, 134 deletions
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c index ddf223ff35c..c884d590b00 100644 --- a/arch/arm/mach-at91/at91sam9rl_devices.c +++ b/arch/arm/mach-at91/at91sam9rl_devices.c | |||
@@ -10,20 +10,19 @@ | |||
10 | #include <asm/mach/map.h> | 10 | #include <asm/mach/map.h> |
11 | 11 | ||
12 | #include <linux/dma-mapping.h> | 12 | #include <linux/dma-mapping.h> |
13 | #include <linux/gpio.h> | ||
14 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
15 | #include <linux/i2c-gpio.h> | 14 | #include <linux/i2c-gpio.h> |
16 | 15 | ||
17 | #include <linux/fb.h> | 16 | #include <linux/fb.h> |
18 | #include <video/atmel_lcdc.h> | 17 | #include <video/atmel_lcdc.h> |
19 | 18 | ||
19 | #include <mach/board.h> | ||
20 | #include <mach/gpio.h> | ||
20 | #include <mach/at91sam9rl.h> | 21 | #include <mach/at91sam9rl.h> |
21 | #include <mach/at91sam9rl_matrix.h> | 22 | #include <mach/at91sam9rl_matrix.h> |
22 | #include <mach/at91_matrix.h> | ||
23 | #include <mach/at91sam9_smc.h> | 23 | #include <mach/at91sam9_smc.h> |
24 | #include <linux/platform_data/dma-atmel.h> | 24 | #include <mach/at_hdmac.h> |
25 | 25 | ||
26 | #include "board.h" | ||
27 | #include "generic.h" | 26 | #include "generic.h" |
28 | 27 | ||
29 | 28 | ||
@@ -34,25 +33,30 @@ | |||
34 | #if defined(CONFIG_AT_HDMAC) || defined(CONFIG_AT_HDMAC_MODULE) | 33 | #if defined(CONFIG_AT_HDMAC) || defined(CONFIG_AT_HDMAC_MODULE) |
35 | static u64 hdmac_dmamask = DMA_BIT_MASK(32); | 34 | static u64 hdmac_dmamask = DMA_BIT_MASK(32); |
36 | 35 | ||
36 | static struct at_dma_platform_data atdma_pdata = { | ||
37 | .nr_channels = 2, | ||
38 | }; | ||
39 | |||
37 | static struct resource hdmac_resources[] = { | 40 | static struct resource hdmac_resources[] = { |
38 | [0] = { | 41 | [0] = { |
39 | .start = AT91SAM9RL_BASE_DMA, | 42 | .start = AT91_BASE_SYS + AT91_DMA, |
40 | .end = AT91SAM9RL_BASE_DMA + SZ_512 - 1, | 43 | .end = AT91_BASE_SYS + AT91_DMA + SZ_512 - 1, |
41 | .flags = IORESOURCE_MEM, | 44 | .flags = IORESOURCE_MEM, |
42 | }, | 45 | }, |
43 | [2] = { | 46 | [2] = { |
44 | .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_DMA, | 47 | .start = AT91SAM9RL_ID_DMA, |
45 | .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_DMA, | 48 | .end = AT91SAM9RL_ID_DMA, |
46 | .flags = IORESOURCE_IRQ, | 49 | .flags = IORESOURCE_IRQ, |
47 | }, | 50 | }, |
48 | }; | 51 | }; |
49 | 52 | ||
50 | static struct platform_device at_hdmac_device = { | 53 | static struct platform_device at_hdmac_device = { |
51 | .name = "at91sam9rl_dma", | 54 | .name = "at_hdmac", |
52 | .id = -1, | 55 | .id = -1, |
53 | .dev = { | 56 | .dev = { |
54 | .dma_mask = &hdmac_dmamask, | 57 | .dma_mask = &hdmac_dmamask, |
55 | .coherent_dma_mask = DMA_BIT_MASK(32), | 58 | .coherent_dma_mask = DMA_BIT_MASK(32), |
59 | .platform_data = &atdma_pdata, | ||
56 | }, | 60 | }, |
57 | .resource = hdmac_resources, | 61 | .resource = hdmac_resources, |
58 | .num_resources = ARRAY_SIZE(hdmac_resources), | 62 | .num_resources = ARRAY_SIZE(hdmac_resources), |
@@ -60,6 +64,7 @@ static struct platform_device at_hdmac_device = { | |||
60 | 64 | ||
61 | void __init at91_add_device_hdmac(void) | 65 | void __init at91_add_device_hdmac(void) |
62 | { | 66 | { |
67 | dma_cap_set(DMA_MEMCPY, atdma_pdata.cap_mask); | ||
63 | platform_device_register(&at_hdmac_device); | 68 | platform_device_register(&at_hdmac_device); |
64 | } | 69 | } |
65 | #else | 70 | #else |
@@ -84,8 +89,8 @@ static struct resource usba_udc_resources[] = { | |||
84 | .flags = IORESOURCE_MEM, | 89 | .flags = IORESOURCE_MEM, |
85 | }, | 90 | }, |
86 | [2] = { | 91 | [2] = { |
87 | .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_UDPHS, | 92 | .start = AT91SAM9RL_ID_UDPHS, |
88 | .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_UDPHS, | 93 | .end = AT91SAM9RL_ID_UDPHS, |
89 | .flags = IORESOURCE_IRQ, | 94 | .flags = IORESOURCE_IRQ, |
90 | }, | 95 | }, |
91 | }; | 96 | }; |
@@ -142,7 +147,7 @@ void __init at91_add_device_usba(struct usba_platform_data *data) | |||
142 | usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep); | 147 | usba_udc_data.pdata.num_ep = ARRAY_SIZE(usba_udc_ep); |
143 | memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep)); | 148 | memcpy(usba_udc_data.ep, usba_udc_ep, sizeof(usba_udc_ep)); |
144 | 149 | ||
145 | if (data && gpio_is_valid(data->vbus_pin)) { | 150 | if (data && data->vbus_pin > 0) { |
146 | at91_set_gpio_input(data->vbus_pin, 0); | 151 | at91_set_gpio_input(data->vbus_pin, 0); |
147 | at91_set_deglitch(data->vbus_pin, 1); | 152 | at91_set_deglitch(data->vbus_pin, 1); |
148 | usba_udc_data.pdata.vbus_pin = data->vbus_pin; | 153 | usba_udc_data.pdata.vbus_pin = data->vbus_pin; |
@@ -161,9 +166,9 @@ void __init at91_add_device_usba(struct usba_platform_data *data) {} | |||
161 | * MMC / SD | 166 | * MMC / SD |
162 | * -------------------------------------------------------------------- */ | 167 | * -------------------------------------------------------------------- */ |
163 | 168 | ||
164 | #if IS_ENABLED(CONFIG_MMC_ATMELMCI) | 169 | #if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) |
165 | static u64 mmc_dmamask = DMA_BIT_MASK(32); | 170 | static u64 mmc_dmamask = DMA_BIT_MASK(32); |
166 | static struct mci_platform_data mmc_data; | 171 | static struct at91_mmc_data mmc_data; |
167 | 172 | ||
168 | static struct resource mmc_resources[] = { | 173 | static struct resource mmc_resources[] = { |
169 | [0] = { | 174 | [0] = { |
@@ -172,14 +177,14 @@ static struct resource mmc_resources[] = { | |||
172 | .flags = IORESOURCE_MEM, | 177 | .flags = IORESOURCE_MEM, |
173 | }, | 178 | }, |
174 | [1] = { | 179 | [1] = { |
175 | .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_MCI, | 180 | .start = AT91SAM9RL_ID_MCI, |
176 | .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_MCI, | 181 | .end = AT91SAM9RL_ID_MCI, |
177 | .flags = IORESOURCE_IRQ, | 182 | .flags = IORESOURCE_IRQ, |
178 | }, | 183 | }, |
179 | }; | 184 | }; |
180 | 185 | ||
181 | static struct platform_device at91sam9rl_mmc_device = { | 186 | static struct platform_device at91sam9rl_mmc_device = { |
182 | .name = "atmel_mci", | 187 | .name = "at91_mci", |
183 | .id = -1, | 188 | .id = -1, |
184 | .dev = { | 189 | .dev = { |
185 | .dma_mask = &mmc_dmamask, | 190 | .dma_mask = &mmc_dmamask, |
@@ -190,40 +195,40 @@ static struct platform_device at91sam9rl_mmc_device = { | |||
190 | .num_resources = ARRAY_SIZE(mmc_resources), | 195 | .num_resources = ARRAY_SIZE(mmc_resources), |
191 | }; | 196 | }; |
192 | 197 | ||
193 | void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) | 198 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) |
194 | { | 199 | { |
195 | if (!data) | 200 | if (!data) |
196 | return; | 201 | return; |
197 | 202 | ||
198 | if (data->slot[0].bus_width) { | 203 | /* input/irq */ |
199 | /* input/irq */ | 204 | if (data->det_pin) { |
200 | if (gpio_is_valid(data->slot[0].detect_pin)) { | 205 | at91_set_gpio_input(data->det_pin, 1); |
201 | at91_set_gpio_input(data->slot[0].detect_pin, 1); | 206 | at91_set_deglitch(data->det_pin, 1); |
202 | at91_set_deglitch(data->slot[0].detect_pin, 1); | 207 | } |
203 | } | 208 | if (data->wp_pin) |
204 | if (gpio_is_valid(data->slot[0].wp_pin)) | 209 | at91_set_gpio_input(data->wp_pin, 1); |
205 | at91_set_gpio_input(data->slot[0].wp_pin, 1); | 210 | if (data->vcc_pin) |
206 | 211 | at91_set_gpio_output(data->vcc_pin, 0); | |
207 | /* CLK */ | 212 | |
208 | at91_set_A_periph(AT91_PIN_PA2, 0); | 213 | /* CLK */ |
209 | 214 | at91_set_A_periph(AT91_PIN_PA2, 0); | |
210 | /* CMD */ | 215 | |
211 | at91_set_A_periph(AT91_PIN_PA1, 1); | 216 | /* CMD */ |
212 | 217 | at91_set_A_periph(AT91_PIN_PA1, 1); | |
213 | /* DAT0, maybe DAT1..DAT3 */ | 218 | |
214 | at91_set_A_periph(AT91_PIN_PA0, 1); | 219 | /* DAT0, maybe DAT1..DAT3 */ |
215 | if (data->slot[0].bus_width == 4) { | 220 | at91_set_A_periph(AT91_PIN_PA0, 1); |
216 | at91_set_A_periph(AT91_PIN_PA3, 1); | 221 | if (data->wire4) { |
217 | at91_set_A_periph(AT91_PIN_PA4, 1); | 222 | at91_set_A_periph(AT91_PIN_PA3, 1); |
218 | at91_set_A_periph(AT91_PIN_PA5, 1); | 223 | at91_set_A_periph(AT91_PIN_PA4, 1); |
219 | } | 224 | at91_set_A_periph(AT91_PIN_PA5, 1); |
220 | |||
221 | mmc_data = *data; | ||
222 | platform_device_register(&at91sam9rl_mmc_device); | ||
223 | } | 225 | } |
226 | |||
227 | mmc_data = *data; | ||
228 | platform_device_register(&at91sam9rl_mmc_device); | ||
224 | } | 229 | } |
225 | #else | 230 | #else |
226 | void __init at91_add_device_mci(short mmc_id, struct mci_platform_data *data) {} | 231 | void __init at91_add_device_mmc(short mmc_id, struct at91_mmc_data *data) {} |
227 | #endif | 232 | #endif |
228 | 233 | ||
229 | 234 | ||
@@ -243,8 +248,8 @@ static struct resource nand_resources[] = { | |||
243 | .flags = IORESOURCE_MEM, | 248 | .flags = IORESOURCE_MEM, |
244 | }, | 249 | }, |
245 | [1] = { | 250 | [1] = { |
246 | .start = AT91SAM9RL_BASE_ECC, | 251 | .start = AT91_BASE_SYS + AT91_ECC, |
247 | .end = AT91SAM9RL_BASE_ECC + SZ_512 - 1, | 252 | .end = AT91_BASE_SYS + AT91_ECC + SZ_512 - 1, |
248 | .flags = IORESOURCE_MEM, | 253 | .flags = IORESOURCE_MEM, |
249 | } | 254 | } |
250 | }; | 255 | }; |
@@ -266,19 +271,19 @@ void __init at91_add_device_nand(struct atmel_nand_data *data) | |||
266 | if (!data) | 271 | if (!data) |
267 | return; | 272 | return; |
268 | 273 | ||
269 | csa = at91_matrix_read(AT91_MATRIX_EBICSA); | 274 | csa = at91_sys_read(AT91_MATRIX_EBICSA); |
270 | at91_matrix_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); | 275 | at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA); |
271 | 276 | ||
272 | /* enable pin */ | 277 | /* enable pin */ |
273 | if (gpio_is_valid(data->enable_pin)) | 278 | if (data->enable_pin) |
274 | at91_set_gpio_output(data->enable_pin, 1); | 279 | at91_set_gpio_output(data->enable_pin, 1); |
275 | 280 | ||
276 | /* ready/busy pin */ | 281 | /* ready/busy pin */ |
277 | if (gpio_is_valid(data->rdy_pin)) | 282 | if (data->rdy_pin) |
278 | at91_set_gpio_input(data->rdy_pin, 1); | 283 | at91_set_gpio_input(data->rdy_pin, 1); |
279 | 284 | ||
280 | /* card detect pin */ | 285 | /* card detect pin */ |
281 | if (gpio_is_valid(data->det_pin)) | 286 | if (data->det_pin) |
282 | at91_set_gpio_input(data->det_pin, 1); | 287 | at91_set_gpio_input(data->det_pin, 1); |
283 | 288 | ||
284 | at91_set_A_periph(AT91_PIN_PB4, 0); /* NANDOE */ | 289 | at91_set_A_periph(AT91_PIN_PB4, 0); /* NANDOE */ |
@@ -314,7 +319,7 @@ static struct i2c_gpio_platform_data pdata = { | |||
314 | 319 | ||
315 | static struct platform_device at91sam9rl_twi_device = { | 320 | static struct platform_device at91sam9rl_twi_device = { |
316 | .name = "i2c-gpio", | 321 | .name = "i2c-gpio", |
317 | .id = 0, | 322 | .id = -1, |
318 | .dev.platform_data = &pdata, | 323 | .dev.platform_data = &pdata, |
319 | }; | 324 | }; |
320 | 325 | ||
@@ -339,15 +344,15 @@ static struct resource twi_resources[] = { | |||
339 | .flags = IORESOURCE_MEM, | 344 | .flags = IORESOURCE_MEM, |
340 | }, | 345 | }, |
341 | [1] = { | 346 | [1] = { |
342 | .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_TWI0, | 347 | .start = AT91SAM9RL_ID_TWI0, |
343 | .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_TWI0, | 348 | .end = AT91SAM9RL_ID_TWI0, |
344 | .flags = IORESOURCE_IRQ, | 349 | .flags = IORESOURCE_IRQ, |
345 | }, | 350 | }, |
346 | }; | 351 | }; |
347 | 352 | ||
348 | static struct platform_device at91sam9rl_twi_device = { | 353 | static struct platform_device at91sam9rl_twi_device = { |
349 | .name = "i2c-at91sam9g20", | 354 | .name = "at91_i2c", |
350 | .id = 0, | 355 | .id = -1, |
351 | .resource = twi_resources, | 356 | .resource = twi_resources, |
352 | .num_resources = ARRAY_SIZE(twi_resources), | 357 | .num_resources = ARRAY_SIZE(twi_resources), |
353 | }; | 358 | }; |
@@ -383,8 +388,8 @@ static struct resource spi_resources[] = { | |||
383 | .flags = IORESOURCE_MEM, | 388 | .flags = IORESOURCE_MEM, |
384 | }, | 389 | }, |
385 | [1] = { | 390 | [1] = { |
386 | .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_SPI, | 391 | .start = AT91SAM9RL_ID_SPI, |
387 | .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_SPI, | 392 | .end = AT91SAM9RL_ID_SPI, |
388 | .flags = IORESOURCE_IRQ, | 393 | .flags = IORESOURCE_IRQ, |
389 | }, | 394 | }, |
390 | }; | 395 | }; |
@@ -419,9 +424,6 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) | |||
419 | else | 424 | else |
420 | cs_pin = spi_standard_cs[devices[i].chip_select]; | 425 | cs_pin = spi_standard_cs[devices[i].chip_select]; |
421 | 426 | ||
422 | if (!gpio_is_valid(cs_pin)) | ||
423 | continue; | ||
424 | |||
425 | /* enable chip-select pin */ | 427 | /* enable chip-select pin */ |
426 | at91_set_gpio_output(cs_pin, 1); | 428 | at91_set_gpio_output(cs_pin, 1); |
427 | 429 | ||
@@ -452,8 +454,8 @@ static struct resource ac97_resources[] = { | |||
452 | .flags = IORESOURCE_MEM, | 454 | .flags = IORESOURCE_MEM, |
453 | }, | 455 | }, |
454 | [1] = { | 456 | [1] = { |
455 | .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_AC97C, | 457 | .start = AT91SAM9RL_ID_AC97C, |
456 | .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_AC97C, | 458 | .end = AT91SAM9RL_ID_AC97C, |
457 | .flags = IORESOURCE_IRQ, | 459 | .flags = IORESOURCE_IRQ, |
458 | }, | 460 | }, |
459 | }; | 461 | }; |
@@ -481,7 +483,7 @@ void __init at91_add_device_ac97(struct ac97c_platform_data *data) | |||
481 | at91_set_A_periph(AT91_PIN_PD4, 0); /* AC97RX */ | 483 | at91_set_A_periph(AT91_PIN_PD4, 0); /* AC97RX */ |
482 | 484 | ||
483 | /* reset */ | 485 | /* reset */ |
484 | if (gpio_is_valid(data->reset_pin)) | 486 | if (data->reset_pin) |
485 | at91_set_gpio_output(data->reset_pin, 0); | 487 | at91_set_gpio_output(data->reset_pin, 0); |
486 | 488 | ||
487 | ac97_data = *data; | 489 | ac97_data = *data; |
@@ -507,8 +509,8 @@ static struct resource lcdc_resources[] = { | |||
507 | .flags = IORESOURCE_MEM, | 509 | .flags = IORESOURCE_MEM, |
508 | }, | 510 | }, |
509 | [1] = { | 511 | [1] = { |
510 | .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_LCDC, | 512 | .start = AT91SAM9RL_ID_LCDC, |
511 | .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_LCDC, | 513 | .end = AT91SAM9RL_ID_LCDC, |
512 | .flags = IORESOURCE_IRQ, | 514 | .flags = IORESOURCE_IRQ, |
513 | }, | 515 | }, |
514 | }; | 516 | }; |
@@ -574,18 +576,18 @@ static struct resource tcb_resources[] = { | |||
574 | .flags = IORESOURCE_MEM, | 576 | .flags = IORESOURCE_MEM, |
575 | }, | 577 | }, |
576 | [1] = { | 578 | [1] = { |
577 | .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_TC0, | 579 | .start = AT91SAM9RL_ID_TC0, |
578 | .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_TC0, | 580 | .end = AT91SAM9RL_ID_TC0, |
579 | .flags = IORESOURCE_IRQ, | 581 | .flags = IORESOURCE_IRQ, |
580 | }, | 582 | }, |
581 | [2] = { | 583 | [2] = { |
582 | .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_TC1, | 584 | .start = AT91SAM9RL_ID_TC1, |
583 | .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_TC1, | 585 | .end = AT91SAM9RL_ID_TC1, |
584 | .flags = IORESOURCE_IRQ, | 586 | .flags = IORESOURCE_IRQ, |
585 | }, | 587 | }, |
586 | [3] = { | 588 | [3] = { |
587 | .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_TC2, | 589 | .start = AT91SAM9RL_ID_TC2, |
588 | .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_TC2, | 590 | .end = AT91SAM9RL_ID_TC2, |
589 | .flags = IORESOURCE_IRQ, | 591 | .flags = IORESOURCE_IRQ, |
590 | }, | 592 | }, |
591 | }; | 593 | }; |
@@ -621,8 +623,8 @@ static struct resource tsadcc_resources[] = { | |||
621 | .flags = IORESOURCE_MEM, | 623 | .flags = IORESOURCE_MEM, |
622 | }, | 624 | }, |
623 | [1] = { | 625 | [1] = { |
624 | .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_TSC, | 626 | .start = AT91SAM9RL_ID_TSC, |
625 | .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_TSC, | 627 | .end = AT91SAM9RL_ID_TSC, |
626 | .flags = IORESOURCE_IRQ, | 628 | .flags = IORESOURCE_IRQ, |
627 | } | 629 | } |
628 | }; | 630 | }; |
@@ -683,13 +685,9 @@ static void __init at91_add_device_rtc(void) {} | |||
683 | 685 | ||
684 | static struct resource rtt_resources[] = { | 686 | static struct resource rtt_resources[] = { |
685 | { | 687 | { |
686 | .start = AT91SAM9RL_BASE_RTT, | 688 | .start = AT91_BASE_SYS + AT91_RTT, |
687 | .end = AT91SAM9RL_BASE_RTT + SZ_16 - 1, | 689 | .end = AT91_BASE_SYS + AT91_RTT + SZ_16 - 1, |
688 | .flags = IORESOURCE_MEM, | 690 | .flags = IORESOURCE_MEM, |
689 | }, { | ||
690 | .flags = IORESOURCE_MEM, | ||
691 | }, { | ||
692 | .flags = IORESOURCE_IRQ, | ||
693 | } | 691 | } |
694 | }; | 692 | }; |
695 | 693 | ||
@@ -697,34 +695,11 @@ static struct platform_device at91sam9rl_rtt_device = { | |||
697 | .name = "at91_rtt", | 695 | .name = "at91_rtt", |
698 | .id = 0, | 696 | .id = 0, |
699 | .resource = rtt_resources, | 697 | .resource = rtt_resources, |
698 | .num_resources = ARRAY_SIZE(rtt_resources), | ||
700 | }; | 699 | }; |
701 | 700 | ||
702 | #if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9) | ||
703 | static void __init at91_add_device_rtt_rtc(void) | ||
704 | { | ||
705 | at91sam9rl_rtt_device.name = "rtc-at91sam9"; | ||
706 | /* | ||
707 | * The second resource is needed: | ||
708 | * GPBR will serve as the storage for RTC time offset | ||
709 | */ | ||
710 | at91sam9rl_rtt_device.num_resources = 3; | ||
711 | rtt_resources[1].start = AT91SAM9RL_BASE_GPBR + | ||
712 | 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR; | ||
713 | rtt_resources[1].end = rtt_resources[1].start + 3; | ||
714 | rtt_resources[2].start = NR_IRQS_LEGACY + AT91_ID_SYS; | ||
715 | rtt_resources[2].end = NR_IRQS_LEGACY + AT91_ID_SYS; | ||
716 | } | ||
717 | #else | ||
718 | static void __init at91_add_device_rtt_rtc(void) | ||
719 | { | ||
720 | /* Only one resource is needed: RTT not used as RTC */ | ||
721 | at91sam9rl_rtt_device.num_resources = 1; | ||
722 | } | ||
723 | #endif | ||
724 | |||
725 | static void __init at91_add_device_rtt(void) | 701 | static void __init at91_add_device_rtt(void) |
726 | { | 702 | { |
727 | at91_add_device_rtt_rtc(); | ||
728 | platform_device_register(&at91sam9rl_rtt_device); | 703 | platform_device_register(&at91sam9rl_rtt_device); |
729 | } | 704 | } |
730 | 705 | ||
@@ -734,19 +709,10 @@ static void __init at91_add_device_rtt(void) | |||
734 | * -------------------------------------------------------------------- */ | 709 | * -------------------------------------------------------------------- */ |
735 | 710 | ||
736 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) | 711 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) |
737 | static struct resource wdt_resources[] = { | ||
738 | { | ||
739 | .start = AT91SAM9RL_BASE_WDT, | ||
740 | .end = AT91SAM9RL_BASE_WDT + SZ_16 - 1, | ||
741 | .flags = IORESOURCE_MEM, | ||
742 | } | ||
743 | }; | ||
744 | |||
745 | static struct platform_device at91sam9rl_wdt_device = { | 712 | static struct platform_device at91sam9rl_wdt_device = { |
746 | .name = "at91_wdt", | 713 | .name = "at91_wdt", |
747 | .id = -1, | 714 | .id = -1, |
748 | .resource = wdt_resources, | 715 | .num_resources = 0, |
749 | .num_resources = ARRAY_SIZE(wdt_resources), | ||
750 | }; | 716 | }; |
751 | 717 | ||
752 | static void __init at91_add_device_watchdog(void) | 718 | static void __init at91_add_device_watchdog(void) |
@@ -772,8 +738,8 @@ static struct resource pwm_resources[] = { | |||
772 | .flags = IORESOURCE_MEM, | 738 | .flags = IORESOURCE_MEM, |
773 | }, | 739 | }, |
774 | [1] = { | 740 | [1] = { |
775 | .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_PWMC, | 741 | .start = AT91SAM9RL_ID_PWMC, |
776 | .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_PWMC, | 742 | .end = AT91SAM9RL_ID_PWMC, |
777 | .flags = IORESOURCE_IRQ, | 743 | .flags = IORESOURCE_IRQ, |
778 | }, | 744 | }, |
779 | }; | 745 | }; |
@@ -825,14 +791,14 @@ static struct resource ssc0_resources[] = { | |||
825 | .flags = IORESOURCE_MEM, | 791 | .flags = IORESOURCE_MEM, |
826 | }, | 792 | }, |
827 | [1] = { | 793 | [1] = { |
828 | .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_SSC0, | 794 | .start = AT91SAM9RL_ID_SSC0, |
829 | .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_SSC0, | 795 | .end = AT91SAM9RL_ID_SSC0, |
830 | .flags = IORESOURCE_IRQ, | 796 | .flags = IORESOURCE_IRQ, |
831 | }, | 797 | }, |
832 | }; | 798 | }; |
833 | 799 | ||
834 | static struct platform_device at91sam9rl_ssc0_device = { | 800 | static struct platform_device at91sam9rl_ssc0_device = { |
835 | .name = "at91rm9200_ssc", | 801 | .name = "ssc", |
836 | .id = 0, | 802 | .id = 0, |
837 | .dev = { | 803 | .dev = { |
838 | .dma_mask = &ssc0_dmamask, | 804 | .dma_mask = &ssc0_dmamask, |
@@ -867,14 +833,14 @@ static struct resource ssc1_resources[] = { | |||
867 | .flags = IORESOURCE_MEM, | 833 | .flags = IORESOURCE_MEM, |
868 | }, | 834 | }, |
869 | [1] = { | 835 | [1] = { |
870 | .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_SSC1, | 836 | .start = AT91SAM9RL_ID_SSC1, |
871 | .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_SSC1, | 837 | .end = AT91SAM9RL_ID_SSC1, |
872 | .flags = IORESOURCE_IRQ, | 838 | .flags = IORESOURCE_IRQ, |
873 | }, | 839 | }, |
874 | }; | 840 | }; |
875 | 841 | ||
876 | static struct platform_device at91sam9rl_ssc1_device = { | 842 | static struct platform_device at91sam9rl_ssc1_device = { |
877 | .name = "at91rm9200_ssc", | 843 | .name = "ssc", |
878 | .id = 1, | 844 | .id = 1, |
879 | .dev = { | 845 | .dev = { |
880 | .dma_mask = &ssc1_dmamask, | 846 | .dma_mask = &ssc1_dmamask, |
@@ -942,13 +908,13 @@ void __init at91_add_device_ssc(unsigned id, unsigned pins) {} | |||
942 | #if defined(CONFIG_SERIAL_ATMEL) | 908 | #if defined(CONFIG_SERIAL_ATMEL) |
943 | static struct resource dbgu_resources[] = { | 909 | static struct resource dbgu_resources[] = { |
944 | [0] = { | 910 | [0] = { |
945 | .start = AT91SAM9RL_BASE_DBGU, | 911 | .start = AT91_VA_BASE_SYS + AT91_DBGU, |
946 | .end = AT91SAM9RL_BASE_DBGU + SZ_512 - 1, | 912 | .end = AT91_VA_BASE_SYS + AT91_DBGU + SZ_512 - 1, |
947 | .flags = IORESOURCE_MEM, | 913 | .flags = IORESOURCE_MEM, |
948 | }, | 914 | }, |
949 | [1] = { | 915 | [1] = { |
950 | .start = NR_IRQS_LEGACY + AT91_ID_SYS, | 916 | .start = AT91_ID_SYS, |
951 | .end = NR_IRQS_LEGACY + AT91_ID_SYS, | 917 | .end = AT91_ID_SYS, |
952 | .flags = IORESOURCE_IRQ, | 918 | .flags = IORESOURCE_IRQ, |
953 | }, | 919 | }, |
954 | }; | 920 | }; |
@@ -956,6 +922,7 @@ static struct resource dbgu_resources[] = { | |||
956 | static struct atmel_uart_data dbgu_data = { | 922 | static struct atmel_uart_data dbgu_data = { |
957 | .use_dma_tx = 0, | 923 | .use_dma_tx = 0, |
958 | .use_dma_rx = 0, /* DBGU not capable of receive DMA */ | 924 | .use_dma_rx = 0, /* DBGU not capable of receive DMA */ |
925 | .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU), | ||
959 | }; | 926 | }; |
960 | 927 | ||
961 | static u64 dbgu_dmamask = DMA_BIT_MASK(32); | 928 | static u64 dbgu_dmamask = DMA_BIT_MASK(32); |
@@ -985,8 +952,8 @@ static struct resource uart0_resources[] = { | |||
985 | .flags = IORESOURCE_MEM, | 952 | .flags = IORESOURCE_MEM, |
986 | }, | 953 | }, |
987 | [1] = { | 954 | [1] = { |
988 | .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_US0, | 955 | .start = AT91SAM9RL_ID_US0, |
989 | .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_US0, | 956 | .end = AT91SAM9RL_ID_US0, |
990 | .flags = IORESOURCE_IRQ, | 957 | .flags = IORESOURCE_IRQ, |
991 | }, | 958 | }, |
992 | }; | 959 | }; |
@@ -1036,8 +1003,8 @@ static struct resource uart1_resources[] = { | |||
1036 | .flags = IORESOURCE_MEM, | 1003 | .flags = IORESOURCE_MEM, |
1037 | }, | 1004 | }, |
1038 | [1] = { | 1005 | [1] = { |
1039 | .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_US1, | 1006 | .start = AT91SAM9RL_ID_US1, |
1040 | .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_US1, | 1007 | .end = AT91SAM9RL_ID_US1, |
1041 | .flags = IORESOURCE_IRQ, | 1008 | .flags = IORESOURCE_IRQ, |
1042 | }, | 1009 | }, |
1043 | }; | 1010 | }; |
@@ -1079,8 +1046,8 @@ static struct resource uart2_resources[] = { | |||
1079 | .flags = IORESOURCE_MEM, | 1046 | .flags = IORESOURCE_MEM, |
1080 | }, | 1047 | }, |
1081 | [1] = { | 1048 | [1] = { |
1082 | .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_US2, | 1049 | .start = AT91SAM9RL_ID_US2, |
1083 | .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_US2, | 1050 | .end = AT91SAM9RL_ID_US2, |
1084 | .flags = IORESOURCE_IRQ, | 1051 | .flags = IORESOURCE_IRQ, |
1085 | }, | 1052 | }, |
1086 | }; | 1053 | }; |
@@ -1122,8 +1089,8 @@ static struct resource uart3_resources[] = { | |||
1122 | .flags = IORESOURCE_MEM, | 1089 | .flags = IORESOURCE_MEM, |
1123 | }, | 1090 | }, |
1124 | [1] = { | 1091 | [1] = { |
1125 | .start = NR_IRQS_LEGACY + AT91SAM9RL_ID_US3, | 1092 | .start = AT91SAM9RL_ID_US3, |
1126 | .end = NR_IRQS_LEGACY + AT91SAM9RL_ID_US3, | 1093 | .end = AT91SAM9RL_ID_US3, |
1127 | .flags = IORESOURCE_IRQ, | 1094 | .flags = IORESOURCE_IRQ, |
1128 | }, | 1095 | }, |
1129 | }; | 1096 | }; |
@@ -1159,6 +1126,7 @@ static inline void configure_usart3_pins(unsigned pins) | |||
1159 | } | 1126 | } |
1160 | 1127 | ||
1161 | static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ | 1128 | static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ |
1129 | struct platform_device *atmel_default_console_device; /* the serial console device */ | ||
1162 | 1130 | ||
1163 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) | 1131 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) |
1164 | { | 1132 | { |
@@ -1196,6 +1164,14 @@ void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) | |||
1196 | at91_uarts[portnr] = pdev; | 1164 | at91_uarts[portnr] = pdev; |
1197 | } | 1165 | } |
1198 | 1166 | ||
1167 | void __init at91_set_serial_console(unsigned portnr) | ||
1168 | { | ||
1169 | if (portnr < ATMEL_MAX_UART) { | ||
1170 | atmel_default_console_device = at91_uarts[portnr]; | ||
1171 | at91sam9rl_set_console_clock(at91_uarts[portnr]->id); | ||
1172 | } | ||
1173 | } | ||
1174 | |||
1199 | void __init at91_add_device_serial(void) | 1175 | void __init at91_add_device_serial(void) |
1200 | { | 1176 | { |
1201 | int i; | 1177 | int i; |
@@ -1204,9 +1180,13 @@ void __init at91_add_device_serial(void) | |||
1204 | if (at91_uarts[i]) | 1180 | if (at91_uarts[i]) |
1205 | platform_device_register(at91_uarts[i]); | 1181 | platform_device_register(at91_uarts[i]); |
1206 | } | 1182 | } |
1183 | |||
1184 | if (!atmel_default_console_device) | ||
1185 | printk(KERN_INFO "AT91: No default serial console defined.\n"); | ||
1207 | } | 1186 | } |
1208 | #else | 1187 | #else |
1209 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {} | 1188 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {} |
1189 | void __init at91_set_serial_console(unsigned portnr) {} | ||
1210 | void __init at91_add_device_serial(void) {} | 1190 | void __init at91_add_device_serial(void) {} |
1211 | #endif | 1191 | #endif |
1212 | 1192 | ||