diff options
Diffstat (limited to 'arch/arm/mach-at91/at91sam9rl_devices.c')
-rw-r--r-- | arch/arm/mach-at91/at91sam9rl_devices.c | 346 |
1 files changed, 306 insertions, 40 deletions
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c index 2bd60a3dc623..f43b5c33e45d 100644 --- a/arch/arm/mach-at91/at91sam9rl_devices.c +++ b/arch/arm/mach-at91/at91sam9rl_devices.c | |||
@@ -9,6 +9,7 @@ | |||
9 | #include <asm/mach/arch.h> | 9 | #include <asm/mach/arch.h> |
10 | #include <asm/mach/map.h> | 10 | #include <asm/mach/map.h> |
11 | 11 | ||
12 | #include <linux/dma-mapping.h> | ||
12 | #include <linux/platform_device.h> | 13 | #include <linux/platform_device.h> |
13 | #include <linux/i2c-gpio.h> | 14 | #include <linux/i2c-gpio.h> |
14 | 15 | ||
@@ -29,7 +30,7 @@ | |||
29 | * -------------------------------------------------------------------- */ | 30 | * -------------------------------------------------------------------- */ |
30 | 31 | ||
31 | #if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) | 32 | #if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) |
32 | static u64 mmc_dmamask = 0xffffffffUL; | 33 | static u64 mmc_dmamask = DMA_BIT_MASK(32); |
33 | static struct at91_mmc_data mmc_data; | 34 | static struct at91_mmc_data mmc_data; |
34 | 35 | ||
35 | static struct resource mmc_resources[] = { | 36 | static struct resource mmc_resources[] = { |
@@ -50,7 +51,7 @@ static struct platform_device at91sam9rl_mmc_device = { | |||
50 | .id = -1, | 51 | .id = -1, |
51 | .dev = { | 52 | .dev = { |
52 | .dma_mask = &mmc_dmamask, | 53 | .dma_mask = &mmc_dmamask, |
53 | .coherent_dma_mask = 0xffffffff, | 54 | .coherent_dma_mask = DMA_BIT_MASK(32), |
54 | .platform_data = &mmc_data, | 55 | .platform_data = &mmc_data, |
55 | }, | 56 | }, |
56 | .resource = mmc_resources, | 57 | .resource = mmc_resources, |
@@ -247,7 +248,7 @@ void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices) | |||
247 | * -------------------------------------------------------------------- */ | 248 | * -------------------------------------------------------------------- */ |
248 | 249 | ||
249 | #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE) | 250 | #if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE) |
250 | static u64 spi_dmamask = 0xffffffffUL; | 251 | static u64 spi_dmamask = DMA_BIT_MASK(32); |
251 | 252 | ||
252 | static struct resource spi_resources[] = { | 253 | static struct resource spi_resources[] = { |
253 | [0] = { | 254 | [0] = { |
@@ -267,7 +268,7 @@ static struct platform_device at91sam9rl_spi_device = { | |||
267 | .id = 0, | 268 | .id = 0, |
268 | .dev = { | 269 | .dev = { |
269 | .dma_mask = &spi_dmamask, | 270 | .dma_mask = &spi_dmamask, |
270 | .coherent_dma_mask = 0xffffffff, | 271 | .coherent_dma_mask = DMA_BIT_MASK(32), |
271 | }, | 272 | }, |
272 | .resource = spi_resources, | 273 | .resource = spi_resources, |
273 | .num_resources = ARRAY_SIZE(spi_resources), | 274 | .num_resources = ARRAY_SIZE(spi_resources), |
@@ -312,7 +313,7 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) | |||
312 | * -------------------------------------------------------------------- */ | 313 | * -------------------------------------------------------------------- */ |
313 | 314 | ||
314 | #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) | 315 | #if defined(CONFIG_FB_ATMEL) || defined(CONFIG_FB_ATMEL_MODULE) |
315 | static u64 lcdc_dmamask = 0xffffffffUL; | 316 | static u64 lcdc_dmamask = DMA_BIT_MASK(32); |
316 | static struct atmel_lcdfb_info lcdc_data; | 317 | static struct atmel_lcdfb_info lcdc_data; |
317 | 318 | ||
318 | static struct resource lcdc_resources[] = { | 319 | static struct resource lcdc_resources[] = { |
@@ -340,7 +341,7 @@ static struct platform_device at91_lcdc_device = { | |||
340 | .id = 0, | 341 | .id = 0, |
341 | .dev = { | 342 | .dev = { |
342 | .dma_mask = &lcdc_dmamask, | 343 | .dma_mask = &lcdc_dmamask, |
343 | .coherent_dma_mask = 0xffffffff, | 344 | .coherent_dma_mask = DMA_BIT_MASK(32), |
344 | .platform_data = &lcdc_data, | 345 | .platform_data = &lcdc_data, |
345 | }, | 346 | }, |
346 | .resource = lcdc_resources, | 347 | .resource = lcdc_resources, |
@@ -384,24 +385,196 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {} | |||
384 | 385 | ||
385 | 386 | ||
386 | /* -------------------------------------------------------------------- | 387 | /* -------------------------------------------------------------------- |
387 | * LEDs | 388 | * RTC |
388 | * -------------------------------------------------------------------- */ | 389 | * -------------------------------------------------------------------- */ |
389 | 390 | ||
390 | #if defined(CONFIG_LEDS) | 391 | #if defined(CONFIG_RTC_DRV_AT91RM9200) || defined(CONFIG_RTC_DRV_AT91RM9200_MODULE) |
391 | u8 at91_leds_cpu; | 392 | static struct platform_device at91sam9rl_rtc_device = { |
392 | u8 at91_leds_timer; | 393 | .name = "at91_rtc", |
394 | .id = -1, | ||
395 | .num_resources = 0, | ||
396 | }; | ||
393 | 397 | ||
394 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) | 398 | static void __init at91_add_device_rtc(void) |
395 | { | 399 | { |
396 | /* Enable GPIO to access the LEDs */ | 400 | platform_device_register(&at91sam9rl_rtc_device); |
397 | at91_set_gpio_output(cpu_led, 1); | 401 | } |
398 | at91_set_gpio_output(timer_led, 1); | 402 | #else |
403 | static void __init at91_add_device_rtc(void) {} | ||
404 | #endif | ||
405 | |||
406 | |||
407 | /* -------------------------------------------------------------------- | ||
408 | * RTT | ||
409 | * -------------------------------------------------------------------- */ | ||
410 | |||
411 | static struct resource rtt_resources[] = { | ||
412 | { | ||
413 | .start = AT91_BASE_SYS + AT91_RTT, | ||
414 | .end = AT91_BASE_SYS + AT91_RTT + SZ_16 - 1, | ||
415 | .flags = IORESOURCE_MEM, | ||
416 | } | ||
417 | }; | ||
418 | |||
419 | static struct platform_device at91sam9rl_rtt_device = { | ||
420 | .name = "at91_rtt", | ||
421 | .id = -1, | ||
422 | .resource = rtt_resources, | ||
423 | .num_resources = ARRAY_SIZE(rtt_resources), | ||
424 | }; | ||
399 | 425 | ||
400 | at91_leds_cpu = cpu_led; | 426 | static void __init at91_add_device_rtt(void) |
401 | at91_leds_timer = timer_led; | 427 | { |
428 | platform_device_register(&at91sam9rl_rtt_device); | ||
429 | } | ||
430 | |||
431 | |||
432 | /* -------------------------------------------------------------------- | ||
433 | * Watchdog | ||
434 | * -------------------------------------------------------------------- */ | ||
435 | |||
436 | #if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE) | ||
437 | static struct platform_device at91sam9rl_wdt_device = { | ||
438 | .name = "at91_wdt", | ||
439 | .id = -1, | ||
440 | .num_resources = 0, | ||
441 | }; | ||
442 | |||
443 | static void __init at91_add_device_watchdog(void) | ||
444 | { | ||
445 | platform_device_register(&at91sam9rl_wdt_device); | ||
402 | } | 446 | } |
403 | #else | 447 | #else |
404 | void __init at91_init_leds(u8 cpu_led, u8 timer_led) {} | 448 | static void __init at91_add_device_watchdog(void) {} |
449 | #endif | ||
450 | |||
451 | |||
452 | /* -------------------------------------------------------------------- | ||
453 | * SSC -- Synchronous Serial Controller | ||
454 | * -------------------------------------------------------------------- */ | ||
455 | |||
456 | #if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE) | ||
457 | static u64 ssc0_dmamask = DMA_BIT_MASK(32); | ||
458 | |||
459 | static struct resource ssc0_resources[] = { | ||
460 | [0] = { | ||
461 | .start = AT91SAM9RL_BASE_SSC0, | ||
462 | .end = AT91SAM9RL_BASE_SSC0 + SZ_16K - 1, | ||
463 | .flags = IORESOURCE_MEM, | ||
464 | }, | ||
465 | [1] = { | ||
466 | .start = AT91SAM9RL_ID_SSC0, | ||
467 | .end = AT91SAM9RL_ID_SSC0, | ||
468 | .flags = IORESOURCE_IRQ, | ||
469 | }, | ||
470 | }; | ||
471 | |||
472 | static struct platform_device at91sam9rl_ssc0_device = { | ||
473 | .name = "ssc", | ||
474 | .id = 0, | ||
475 | .dev = { | ||
476 | .dma_mask = &ssc0_dmamask, | ||
477 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
478 | }, | ||
479 | .resource = ssc0_resources, | ||
480 | .num_resources = ARRAY_SIZE(ssc0_resources), | ||
481 | }; | ||
482 | |||
483 | static inline void configure_ssc0_pins(unsigned pins) | ||
484 | { | ||
485 | if (pins & ATMEL_SSC_TF) | ||
486 | at91_set_A_periph(AT91_PIN_PC0, 1); | ||
487 | if (pins & ATMEL_SSC_TK) | ||
488 | at91_set_A_periph(AT91_PIN_PC1, 1); | ||
489 | if (pins & ATMEL_SSC_TD) | ||
490 | at91_set_A_periph(AT91_PIN_PA15, 1); | ||
491 | if (pins & ATMEL_SSC_RD) | ||
492 | at91_set_A_periph(AT91_PIN_PA16, 1); | ||
493 | if (pins & ATMEL_SSC_RK) | ||
494 | at91_set_B_periph(AT91_PIN_PA10, 1); | ||
495 | if (pins & ATMEL_SSC_RF) | ||
496 | at91_set_B_periph(AT91_PIN_PA22, 1); | ||
497 | } | ||
498 | |||
499 | static u64 ssc1_dmamask = DMA_BIT_MASK(32); | ||
500 | |||
501 | static struct resource ssc1_resources[] = { | ||
502 | [0] = { | ||
503 | .start = AT91SAM9RL_BASE_SSC1, | ||
504 | .end = AT91SAM9RL_BASE_SSC1 + SZ_16K - 1, | ||
505 | .flags = IORESOURCE_MEM, | ||
506 | }, | ||
507 | [1] = { | ||
508 | .start = AT91SAM9RL_ID_SSC1, | ||
509 | .end = AT91SAM9RL_ID_SSC1, | ||
510 | .flags = IORESOURCE_IRQ, | ||
511 | }, | ||
512 | }; | ||
513 | |||
514 | static struct platform_device at91sam9rl_ssc1_device = { | ||
515 | .name = "ssc", | ||
516 | .id = 1, | ||
517 | .dev = { | ||
518 | .dma_mask = &ssc1_dmamask, | ||
519 | .coherent_dma_mask = DMA_BIT_MASK(32), | ||
520 | }, | ||
521 | .resource = ssc1_resources, | ||
522 | .num_resources = ARRAY_SIZE(ssc1_resources), | ||
523 | }; | ||
524 | |||
525 | static inline void configure_ssc1_pins(unsigned pins) | ||
526 | { | ||
527 | if (pins & ATMEL_SSC_TF) | ||
528 | at91_set_B_periph(AT91_PIN_PA29, 1); | ||
529 | if (pins & ATMEL_SSC_TK) | ||
530 | at91_set_B_periph(AT91_PIN_PA30, 1); | ||
531 | if (pins & ATMEL_SSC_TD) | ||
532 | at91_set_B_periph(AT91_PIN_PA13, 1); | ||
533 | if (pins & ATMEL_SSC_RD) | ||
534 | at91_set_B_periph(AT91_PIN_PA14, 1); | ||
535 | if (pins & ATMEL_SSC_RK) | ||
536 | at91_set_B_periph(AT91_PIN_PA9, 1); | ||
537 | if (pins & ATMEL_SSC_RF) | ||
538 | at91_set_B_periph(AT91_PIN_PA8, 1); | ||
539 | } | ||
540 | |||
541 | /* | ||
542 | * Return the device node so that board init code can use it as the | ||
543 | * parent for the device node reflecting how it's used on this board. | ||
544 | * | ||
545 | * SSC controllers are accessed through library code, instead of any | ||
546 | * kind of all-singing/all-dancing driver. For example one could be | ||
547 | * used by a particular I2S audio codec's driver, while another one | ||
548 | * on the same system might be used by a custom data capture driver. | ||
549 | */ | ||
550 | void __init at91_add_device_ssc(unsigned id, unsigned pins) | ||
551 | { | ||
552 | struct platform_device *pdev; | ||
553 | |||
554 | /* | ||
555 | * NOTE: caller is responsible for passing information matching | ||
556 | * "pins" to whatever will be using each particular controller. | ||
557 | */ | ||
558 | switch (id) { | ||
559 | case AT91SAM9RL_ID_SSC0: | ||
560 | pdev = &at91sam9rl_ssc0_device; | ||
561 | configure_ssc0_pins(pins); | ||
562 | at91_clock_associate("ssc0_clk", &pdev->dev, "pclk"); | ||
563 | break; | ||
564 | case AT91SAM9RL_ID_SSC1: | ||
565 | pdev = &at91sam9rl_ssc1_device; | ||
566 | configure_ssc1_pins(pins); | ||
567 | at91_clock_associate("ssc1_clk", &pdev->dev, "pclk"); | ||
568 | break; | ||
569 | default: | ||
570 | return; | ||
571 | } | ||
572 | |||
573 | platform_device_register(pdev); | ||
574 | } | ||
575 | |||
576 | #else | ||
577 | void __init at91_add_device_ssc(unsigned id, unsigned pins) {} | ||
405 | #endif | 578 | #endif |
406 | 579 | ||
407 | 580 | ||
@@ -429,12 +602,15 @@ static struct atmel_uart_data dbgu_data = { | |||
429 | .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU), | 602 | .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU), |
430 | }; | 603 | }; |
431 | 604 | ||
605 | static u64 dbgu_dmamask = DMA_BIT_MASK(32); | ||
606 | |||
432 | static struct platform_device at91sam9rl_dbgu_device = { | 607 | static struct platform_device at91sam9rl_dbgu_device = { |
433 | .name = "atmel_usart", | 608 | .name = "atmel_usart", |
434 | .id = 0, | 609 | .id = 0, |
435 | .dev = { | 610 | .dev = { |
436 | .platform_data = &dbgu_data, | 611 | .dma_mask = &dbgu_dmamask, |
437 | .coherent_dma_mask = 0xffffffff, | 612 | .coherent_dma_mask = DMA_BIT_MASK(32), |
613 | .platform_data = &dbgu_data, | ||
438 | }, | 614 | }, |
439 | .resource = dbgu_resources, | 615 | .resource = dbgu_resources, |
440 | .num_resources = ARRAY_SIZE(dbgu_resources), | 616 | .num_resources = ARRAY_SIZE(dbgu_resources), |
@@ -464,23 +640,37 @@ static struct atmel_uart_data uart0_data = { | |||
464 | .use_dma_rx = 1, | 640 | .use_dma_rx = 1, |
465 | }; | 641 | }; |
466 | 642 | ||
643 | static u64 uart0_dmamask = DMA_BIT_MASK(32); | ||
644 | |||
467 | static struct platform_device at91sam9rl_uart0_device = { | 645 | static struct platform_device at91sam9rl_uart0_device = { |
468 | .name = "atmel_usart", | 646 | .name = "atmel_usart", |
469 | .id = 1, | 647 | .id = 1, |
470 | .dev = { | 648 | .dev = { |
471 | .platform_data = &uart0_data, | 649 | .dma_mask = &uart0_dmamask, |
472 | .coherent_dma_mask = 0xffffffff, | 650 | .coherent_dma_mask = DMA_BIT_MASK(32), |
651 | .platform_data = &uart0_data, | ||
473 | }, | 652 | }, |
474 | .resource = uart0_resources, | 653 | .resource = uart0_resources, |
475 | .num_resources = ARRAY_SIZE(uart0_resources), | 654 | .num_resources = ARRAY_SIZE(uart0_resources), |
476 | }; | 655 | }; |
477 | 656 | ||
478 | static inline void configure_usart0_pins(void) | 657 | static inline void configure_usart0_pins(unsigned pins) |
479 | { | 658 | { |
480 | at91_set_A_periph(AT91_PIN_PA6, 1); /* TXD0 */ | 659 | at91_set_A_periph(AT91_PIN_PA6, 1); /* TXD0 */ |
481 | at91_set_A_periph(AT91_PIN_PA7, 0); /* RXD0 */ | 660 | at91_set_A_periph(AT91_PIN_PA7, 0); /* RXD0 */ |
482 | at91_set_A_periph(AT91_PIN_PA9, 0); /* RTS0 */ | 661 | |
483 | at91_set_A_periph(AT91_PIN_PA10, 0); /* CTS0 */ | 662 | if (pins & ATMEL_UART_RTS) |
663 | at91_set_A_periph(AT91_PIN_PA9, 0); /* RTS0 */ | ||
664 | if (pins & ATMEL_UART_CTS) | ||
665 | at91_set_A_periph(AT91_PIN_PA10, 0); /* CTS0 */ | ||
666 | if (pins & ATMEL_UART_DSR) | ||
667 | at91_set_A_periph(AT91_PIN_PD14, 0); /* DSR0 */ | ||
668 | if (pins & ATMEL_UART_DTR) | ||
669 | at91_set_A_periph(AT91_PIN_PD15, 0); /* DTR0 */ | ||
670 | if (pins & ATMEL_UART_DCD) | ||
671 | at91_set_A_periph(AT91_PIN_PD16, 0); /* DCD0 */ | ||
672 | if (pins & ATMEL_UART_RI) | ||
673 | at91_set_A_periph(AT91_PIN_PD17, 0); /* RI0 */ | ||
484 | } | 674 | } |
485 | 675 | ||
486 | static struct resource uart1_resources[] = { | 676 | static struct resource uart1_resources[] = { |
@@ -501,21 +691,29 @@ static struct atmel_uart_data uart1_data = { | |||
501 | .use_dma_rx = 1, | 691 | .use_dma_rx = 1, |
502 | }; | 692 | }; |
503 | 693 | ||
694 | static u64 uart1_dmamask = DMA_BIT_MASK(32); | ||
695 | |||
504 | static struct platform_device at91sam9rl_uart1_device = { | 696 | static struct platform_device at91sam9rl_uart1_device = { |
505 | .name = "atmel_usart", | 697 | .name = "atmel_usart", |
506 | .id = 2, | 698 | .id = 2, |
507 | .dev = { | 699 | .dev = { |
508 | .platform_data = &uart1_data, | 700 | .dma_mask = &uart1_dmamask, |
509 | .coherent_dma_mask = 0xffffffff, | 701 | .coherent_dma_mask = DMA_BIT_MASK(32), |
702 | .platform_data = &uart1_data, | ||
510 | }, | 703 | }, |
511 | .resource = uart1_resources, | 704 | .resource = uart1_resources, |
512 | .num_resources = ARRAY_SIZE(uart1_resources), | 705 | .num_resources = ARRAY_SIZE(uart1_resources), |
513 | }; | 706 | }; |
514 | 707 | ||
515 | static inline void configure_usart1_pins(void) | 708 | static inline void configure_usart1_pins(unsigned pins) |
516 | { | 709 | { |
517 | at91_set_A_periph(AT91_PIN_PA11, 1); /* TXD1 */ | 710 | at91_set_A_periph(AT91_PIN_PA11, 1); /* TXD1 */ |
518 | at91_set_A_periph(AT91_PIN_PA12, 0); /* RXD1 */ | 711 | at91_set_A_periph(AT91_PIN_PA12, 0); /* RXD1 */ |
712 | |||
713 | if (pins & ATMEL_UART_RTS) | ||
714 | at91_set_B_periph(AT91_PIN_PA18, 0); /* RTS1 */ | ||
715 | if (pins & ATMEL_UART_CTS) | ||
716 | at91_set_B_periph(AT91_PIN_PA19, 0); /* CTS1 */ | ||
519 | } | 717 | } |
520 | 718 | ||
521 | static struct resource uart2_resources[] = { | 719 | static struct resource uart2_resources[] = { |
@@ -536,21 +734,29 @@ static struct atmel_uart_data uart2_data = { | |||
536 | .use_dma_rx = 1, | 734 | .use_dma_rx = 1, |
537 | }; | 735 | }; |
538 | 736 | ||
737 | static u64 uart2_dmamask = DMA_BIT_MASK(32); | ||
738 | |||
539 | static struct platform_device at91sam9rl_uart2_device = { | 739 | static struct platform_device at91sam9rl_uart2_device = { |
540 | .name = "atmel_usart", | 740 | .name = "atmel_usart", |
541 | .id = 3, | 741 | .id = 3, |
542 | .dev = { | 742 | .dev = { |
543 | .platform_data = &uart2_data, | 743 | .dma_mask = &uart2_dmamask, |
544 | .coherent_dma_mask = 0xffffffff, | 744 | .coherent_dma_mask = DMA_BIT_MASK(32), |
745 | .platform_data = &uart2_data, | ||
545 | }, | 746 | }, |
546 | .resource = uart2_resources, | 747 | .resource = uart2_resources, |
547 | .num_resources = ARRAY_SIZE(uart2_resources), | 748 | .num_resources = ARRAY_SIZE(uart2_resources), |
548 | }; | 749 | }; |
549 | 750 | ||
550 | static inline void configure_usart2_pins(void) | 751 | static inline void configure_usart2_pins(unsigned pins) |
551 | { | 752 | { |
552 | at91_set_A_periph(AT91_PIN_PA13, 1); /* TXD2 */ | 753 | at91_set_A_periph(AT91_PIN_PA13, 1); /* TXD2 */ |
553 | at91_set_A_periph(AT91_PIN_PA14, 0); /* RXD2 */ | 754 | at91_set_A_periph(AT91_PIN_PA14, 0); /* RXD2 */ |
755 | |||
756 | if (pins & ATMEL_UART_RTS) | ||
757 | at91_set_A_periph(AT91_PIN_PA29, 0); /* RTS2 */ | ||
758 | if (pins & ATMEL_UART_CTS) | ||
759 | at91_set_A_periph(AT91_PIN_PA30, 0); /* CTS2 */ | ||
554 | } | 760 | } |
555 | 761 | ||
556 | static struct resource uart3_resources[] = { | 762 | static struct resource uart3_resources[] = { |
@@ -571,27 +777,35 @@ static struct atmel_uart_data uart3_data = { | |||
571 | .use_dma_rx = 1, | 777 | .use_dma_rx = 1, |
572 | }; | 778 | }; |
573 | 779 | ||
780 | static u64 uart3_dmamask = DMA_BIT_MASK(32); | ||
781 | |||
574 | static struct platform_device at91sam9rl_uart3_device = { | 782 | static struct platform_device at91sam9rl_uart3_device = { |
575 | .name = "atmel_usart", | 783 | .name = "atmel_usart", |
576 | .id = 4, | 784 | .id = 4, |
577 | .dev = { | 785 | .dev = { |
578 | .platform_data = &uart3_data, | 786 | .dma_mask = &uart3_dmamask, |
579 | .coherent_dma_mask = 0xffffffff, | 787 | .coherent_dma_mask = DMA_BIT_MASK(32), |
788 | .platform_data = &uart3_data, | ||
580 | }, | 789 | }, |
581 | .resource = uart3_resources, | 790 | .resource = uart3_resources, |
582 | .num_resources = ARRAY_SIZE(uart3_resources), | 791 | .num_resources = ARRAY_SIZE(uart3_resources), |
583 | }; | 792 | }; |
584 | 793 | ||
585 | static inline void configure_usart3_pins(void) | 794 | static inline void configure_usart3_pins(unsigned pins) |
586 | { | 795 | { |
587 | at91_set_A_periph(AT91_PIN_PB0, 1); /* TXD3 */ | 796 | at91_set_A_periph(AT91_PIN_PB0, 1); /* TXD3 */ |
588 | at91_set_A_periph(AT91_PIN_PB1, 0); /* RXD3 */ | 797 | at91_set_A_periph(AT91_PIN_PB1, 0); /* RXD3 */ |
798 | |||
799 | if (pins & ATMEL_UART_RTS) | ||
800 | at91_set_B_periph(AT91_PIN_PD4, 0); /* RTS3 */ | ||
801 | if (pins & ATMEL_UART_CTS) | ||
802 | at91_set_B_periph(AT91_PIN_PD3, 0); /* CTS3 */ | ||
589 | } | 803 | } |
590 | 804 | ||
591 | struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ | 805 | static struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ |
592 | struct platform_device *atmel_default_console_device; /* the serial console device */ | 806 | struct platform_device *atmel_default_console_device; /* the serial console device */ |
593 | 807 | ||
594 | void __init at91_init_serial(struct at91_uart_config *config) | 808 | void __init __deprecated at91_init_serial(struct at91_uart_config *config) |
595 | { | 809 | { |
596 | int i; | 810 | int i; |
597 | 811 | ||
@@ -599,22 +813,22 @@ void __init at91_init_serial(struct at91_uart_config *config) | |||
599 | for (i = 0; i < config->nr_tty; i++) { | 813 | for (i = 0; i < config->nr_tty; i++) { |
600 | switch (config->tty_map[i]) { | 814 | switch (config->tty_map[i]) { |
601 | case 0: | 815 | case 0: |
602 | configure_usart0_pins(); | 816 | configure_usart0_pins(ATMEL_UART_CTS | ATMEL_UART_RTS); |
603 | at91_uarts[i] = &at91sam9rl_uart0_device; | 817 | at91_uarts[i] = &at91sam9rl_uart0_device; |
604 | at91_clock_associate("usart0_clk", &at91sam9rl_uart0_device.dev, "usart"); | 818 | at91_clock_associate("usart0_clk", &at91sam9rl_uart0_device.dev, "usart"); |
605 | break; | 819 | break; |
606 | case 1: | 820 | case 1: |
607 | configure_usart1_pins(); | 821 | configure_usart1_pins(0); |
608 | at91_uarts[i] = &at91sam9rl_uart1_device; | 822 | at91_uarts[i] = &at91sam9rl_uart1_device; |
609 | at91_clock_associate("usart1_clk", &at91sam9rl_uart1_device.dev, "usart"); | 823 | at91_clock_associate("usart1_clk", &at91sam9rl_uart1_device.dev, "usart"); |
610 | break; | 824 | break; |
611 | case 2: | 825 | case 2: |
612 | configure_usart2_pins(); | 826 | configure_usart2_pins(0); |
613 | at91_uarts[i] = &at91sam9rl_uart2_device; | 827 | at91_uarts[i] = &at91sam9rl_uart2_device; |
614 | at91_clock_associate("usart2_clk", &at91sam9rl_uart2_device.dev, "usart"); | 828 | at91_clock_associate("usart2_clk", &at91sam9rl_uart2_device.dev, "usart"); |
615 | break; | 829 | break; |
616 | case 3: | 830 | case 3: |
617 | configure_usart3_pins(); | 831 | configure_usart3_pins(0); |
618 | at91_uarts[i] = &at91sam9rl_uart3_device; | 832 | at91_uarts[i] = &at91sam9rl_uart3_device; |
619 | at91_clock_associate("usart3_clk", &at91sam9rl_uart3_device.dev, "usart"); | 833 | at91_clock_associate("usart3_clk", &at91sam9rl_uart3_device.dev, "usart"); |
620 | break; | 834 | break; |
@@ -636,6 +850,53 @@ void __init at91_init_serial(struct at91_uart_config *config) | |||
636 | printk(KERN_INFO "AT91: No default serial console defined.\n"); | 850 | printk(KERN_INFO "AT91: No default serial console defined.\n"); |
637 | } | 851 | } |
638 | 852 | ||
853 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) | ||
854 | { | ||
855 | struct platform_device *pdev; | ||
856 | |||
857 | switch (id) { | ||
858 | case 0: /* DBGU */ | ||
859 | pdev = &at91sam9rl_dbgu_device; | ||
860 | configure_dbgu_pins(); | ||
861 | at91_clock_associate("mck", &pdev->dev, "usart"); | ||
862 | break; | ||
863 | case AT91SAM9RL_ID_US0: | ||
864 | pdev = &at91sam9rl_uart0_device; | ||
865 | configure_usart0_pins(pins); | ||
866 | at91_clock_associate("usart0_clk", &pdev->dev, "usart"); | ||
867 | break; | ||
868 | case AT91SAM9RL_ID_US1: | ||
869 | pdev = &at91sam9rl_uart1_device; | ||
870 | configure_usart1_pins(pins); | ||
871 | at91_clock_associate("usart1_clk", &pdev->dev, "usart"); | ||
872 | break; | ||
873 | case AT91SAM9RL_ID_US2: | ||
874 | pdev = &at91sam9rl_uart2_device; | ||
875 | configure_usart2_pins(pins); | ||
876 | at91_clock_associate("usart2_clk", &pdev->dev, "usart"); | ||
877 | break; | ||
878 | case AT91SAM9RL_ID_US3: | ||
879 | pdev = &at91sam9rl_uart3_device; | ||
880 | configure_usart3_pins(pins); | ||
881 | at91_clock_associate("usart3_clk", &pdev->dev, "usart"); | ||
882 | break; | ||
883 | default: | ||
884 | return; | ||
885 | } | ||
886 | pdev->id = portnr; /* update to mapped ID */ | ||
887 | |||
888 | if (portnr < ATMEL_MAX_UART) | ||
889 | at91_uarts[portnr] = pdev; | ||
890 | } | ||
891 | |||
892 | void __init at91_set_serial_console(unsigned portnr) | ||
893 | { | ||
894 | if (portnr < ATMEL_MAX_UART) | ||
895 | atmel_default_console_device = at91_uarts[portnr]; | ||
896 | if (!atmel_default_console_device) | ||
897 | printk(KERN_INFO "AT91: No default serial console defined.\n"); | ||
898 | } | ||
899 | |||
639 | void __init at91_add_device_serial(void) | 900 | void __init at91_add_device_serial(void) |
640 | { | 901 | { |
641 | int i; | 902 | int i; |
@@ -646,7 +907,9 @@ void __init at91_add_device_serial(void) | |||
646 | } | 907 | } |
647 | } | 908 | } |
648 | #else | 909 | #else |
649 | void __init at91_init_serial(struct at91_uart_config *config) {} | 910 | void __init __deprecated at91_init_serial(struct at91_uart_config *config) {} |
911 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {} | ||
912 | void __init at91_set_serial_console(unsigned portnr) {} | ||
650 | void __init at91_add_device_serial(void) {} | 913 | void __init at91_add_device_serial(void) {} |
651 | #endif | 914 | #endif |
652 | 915 | ||
@@ -659,6 +922,9 @@ void __init at91_add_device_serial(void) {} | |||
659 | */ | 922 | */ |
660 | static int __init at91_add_standard_devices(void) | 923 | static int __init at91_add_standard_devices(void) |
661 | { | 924 | { |
925 | at91_add_device_rtc(); | ||
926 | at91_add_device_rtt(); | ||
927 | at91_add_device_watchdog(); | ||
662 | return 0; | 928 | return 0; |
663 | } | 929 | } |
664 | 930 | ||