aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91/at91sam9260_devices.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-at91/at91sam9260_devices.c')
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c315
1 files changed, 260 insertions, 55 deletions
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 3091bf47d8c9..105f8403860b 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -12,6 +12,7 @@
12#include <asm/mach/arch.h> 12#include <asm/mach/arch.h>
13#include <asm/mach/map.h> 13#include <asm/mach/map.h>
14 14
15#include <linux/dma-mapping.h>
15#include <linux/platform_device.h> 16#include <linux/platform_device.h>
16#include <linux/i2c-gpio.h> 17#include <linux/i2c-gpio.h>
17 18
@@ -29,7 +30,7 @@
29 * -------------------------------------------------------------------- */ 30 * -------------------------------------------------------------------- */
30 31
31#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE) 32#if defined(CONFIG_USB_OHCI_HCD) || defined(CONFIG_USB_OHCI_HCD_MODULE)
32static u64 ohci_dmamask = 0xffffffffUL; 33static u64 ohci_dmamask = DMA_BIT_MASK(32);
33static struct at91_usbh_data usbh_data; 34static struct at91_usbh_data usbh_data;
34 35
35static struct resource usbh_resources[] = { 36static struct resource usbh_resources[] = {
@@ -50,7 +51,7 @@ static struct platform_device at91_usbh_device = {
50 .id = -1, 51 .id = -1,
51 .dev = { 52 .dev = {
52 .dma_mask = &ohci_dmamask, 53 .dma_mask = &ohci_dmamask,
53 .coherent_dma_mask = 0xffffffff, 54 .coherent_dma_mask = DMA_BIT_MASK(32),
54 .platform_data = &usbh_data, 55 .platform_data = &usbh_data,
55 }, 56 },
56 .resource = usbh_resources, 57 .resource = usbh_resources,
@@ -125,7 +126,7 @@ void __init at91_add_device_udc(struct at91_udc_data *data) {}
125 * -------------------------------------------------------------------- */ 126 * -------------------------------------------------------------------- */
126 127
127#if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE) 128#if defined(CONFIG_MACB) || defined(CONFIG_MACB_MODULE)
128static u64 eth_dmamask = 0xffffffffUL; 129static u64 eth_dmamask = DMA_BIT_MASK(32);
129static struct at91_eth_data eth_data; 130static struct at91_eth_data eth_data;
130 131
131static struct resource eth_resources[] = { 132static struct resource eth_resources[] = {
@@ -146,7 +147,7 @@ static struct platform_device at91sam9260_eth_device = {
146 .id = -1, 147 .id = -1,
147 .dev = { 148 .dev = {
148 .dma_mask = &eth_dmamask, 149 .dma_mask = &eth_dmamask,
149 .coherent_dma_mask = 0xffffffff, 150 .coherent_dma_mask = DMA_BIT_MASK(32),
150 .platform_data = &eth_data, 151 .platform_data = &eth_data,
151 }, 152 },
152 .resource = eth_resources, 153 .resource = eth_resources,
@@ -199,7 +200,7 @@ void __init at91_add_device_eth(struct at91_eth_data *data) {}
199 * -------------------------------------------------------------------- */ 200 * -------------------------------------------------------------------- */
200 201
201#if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE) 202#if defined(CONFIG_MMC_AT91) || defined(CONFIG_MMC_AT91_MODULE)
202static u64 mmc_dmamask = 0xffffffffUL; 203static u64 mmc_dmamask = DMA_BIT_MASK(32);
203static struct at91_mmc_data mmc_data; 204static struct at91_mmc_data mmc_data;
204 205
205static struct resource mmc_resources[] = { 206static struct resource mmc_resources[] = {
@@ -220,7 +221,7 @@ static struct platform_device at91sam9260_mmc_device = {
220 .id = -1, 221 .id = -1,
221 .dev = { 222 .dev = {
222 .dma_mask = &mmc_dmamask, 223 .dma_mask = &mmc_dmamask,
223 .coherent_dma_mask = 0xffffffff, 224 .coherent_dma_mask = DMA_BIT_MASK(32),
224 .platform_data = &mmc_data, 225 .platform_data = &mmc_data,
225 }, 226 },
226 .resource = mmc_resources, 227 .resource = mmc_resources,
@@ -289,7 +290,7 @@ static struct at91_nand_data nand_data;
289static struct resource nand_resources[] = { 290static struct resource nand_resources[] = {
290 { 291 {
291 .start = NAND_BASE, 292 .start = NAND_BASE,
292 .end = NAND_BASE + SZ_8M - 1, 293 .end = NAND_BASE + SZ_256M - 1,
293 .flags = IORESOURCE_MEM, 294 .flags = IORESOURCE_MEM,
294 } 295 }
295}; 296};
@@ -312,7 +313,7 @@ void __init at91_add_device_nand(struct at91_nand_data *data)
312 return; 313 return;
313 314
314 csa = at91_sys_read(AT91_MATRIX_EBICSA); 315 csa = at91_sys_read(AT91_MATRIX_EBICSA);
315 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC); 316 at91_sys_write(AT91_MATRIX_EBICSA, csa | AT91_MATRIX_CS3A_SMC_SMARTMEDIA);
316 317
317 /* set the bus interface characteristics */ 318 /* set the bus interface characteristics */
318 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0) 319 at91_sys_write(AT91_SMC_SETUP(3), AT91_SMC_NWESETUP_(0) | AT91_SMC_NCS_WRSETUP_(0)
@@ -431,7 +432,7 @@ void __init at91_add_device_i2c(struct i2c_board_info *devices, int nr_devices)
431 * -------------------------------------------------------------------- */ 432 * -------------------------------------------------------------------- */
432 433
433#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE) 434#if defined(CONFIG_SPI_ATMEL) || defined(CONFIG_SPI_ATMEL_MODULE)
434static u64 spi_dmamask = 0xffffffffUL; 435static u64 spi_dmamask = DMA_BIT_MASK(32);
435 436
436static struct resource spi0_resources[] = { 437static struct resource spi0_resources[] = {
437 [0] = { 438 [0] = {
@@ -451,7 +452,7 @@ static struct platform_device at91sam9260_spi0_device = {
451 .id = 0, 452 .id = 0,
452 .dev = { 453 .dev = {
453 .dma_mask = &spi_dmamask, 454 .dma_mask = &spi_dmamask,
454 .coherent_dma_mask = 0xffffffff, 455 .coherent_dma_mask = DMA_BIT_MASK(32),
455 }, 456 },
456 .resource = spi0_resources, 457 .resource = spi0_resources,
457 .num_resources = ARRAY_SIZE(spi0_resources), 458 .num_resources = ARRAY_SIZE(spi0_resources),
@@ -477,7 +478,7 @@ static struct platform_device at91sam9260_spi1_device = {
477 .id = 1, 478 .id = 1,
478 .dev = { 479 .dev = {
479 .dma_mask = &spi_dmamask, 480 .dma_mask = &spi_dmamask,
480 .coherent_dma_mask = 0xffffffff, 481 .coherent_dma_mask = DMA_BIT_MASK(32),
481 }, 482 },
482 .resource = spi1_resources, 483 .resource = spi1_resources,
483 .num_resources = ARRAY_SIZE(spi1_resources), 484 .num_resources = ARRAY_SIZE(spi1_resources),
@@ -539,24 +540,126 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
539 540
540 541
541/* -------------------------------------------------------------------- 542/* --------------------------------------------------------------------
542 * LEDs 543 * RTT
543 * -------------------------------------------------------------------- */ 544 * -------------------------------------------------------------------- */
544 545
545#if defined(CONFIG_LEDS) 546static struct resource rtt_resources[] = {
546u8 at91_leds_cpu; 547 {
547u8 at91_leds_timer; 548 .start = AT91_BASE_SYS + AT91_RTT,
549 .end = AT91_BASE_SYS + AT91_RTT + SZ_16 - 1,
550 .flags = IORESOURCE_MEM,
551 }
552};
548 553
549void __init at91_init_leds(u8 cpu_led, u8 timer_led) 554static struct platform_device at91sam9260_rtt_device = {
555 .name = "at91_rtt",
556 .id = -1,
557 .resource = rtt_resources,
558 .num_resources = ARRAY_SIZE(rtt_resources),
559};
560
561static void __init at91_add_device_rtt(void)
550{ 562{
551 /* Enable GPIO to access the LEDs */ 563 platform_device_register(&at91sam9260_rtt_device);
552 at91_set_gpio_output(cpu_led, 1); 564}
553 at91_set_gpio_output(timer_led, 1); 565
554 566
555 at91_leds_cpu = cpu_led; 567/* --------------------------------------------------------------------
556 at91_leds_timer = timer_led; 568 * Watchdog
569 * -------------------------------------------------------------------- */
570
571#if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE)
572static struct platform_device at91sam9260_wdt_device = {
573 .name = "at91_wdt",
574 .id = -1,
575 .num_resources = 0,
576};
577
578static void __init at91_add_device_watchdog(void)
579{
580 platform_device_register(&at91sam9260_wdt_device);
557} 581}
558#else 582#else
559void __init at91_init_leds(u8 cpu_led, u8 timer_led) {} 583static void __init at91_add_device_watchdog(void) {}
584#endif
585
586
587/* --------------------------------------------------------------------
588 * SSC -- Synchronous Serial Controller
589 * -------------------------------------------------------------------- */
590
591#if defined(CONFIG_ATMEL_SSC) || defined(CONFIG_ATMEL_SSC_MODULE)
592static u64 ssc_dmamask = DMA_BIT_MASK(32);
593
594static struct resource ssc_resources[] = {
595 [0] = {
596 .start = AT91SAM9260_BASE_SSC,
597 .end = AT91SAM9260_BASE_SSC + SZ_16K - 1,
598 .flags = IORESOURCE_MEM,
599 },
600 [1] = {
601 .start = AT91SAM9260_ID_SSC,
602 .end = AT91SAM9260_ID_SSC,
603 .flags = IORESOURCE_IRQ,
604 },
605};
606
607static struct platform_device at91sam9260_ssc_device = {
608 .name = "ssc",
609 .id = 0,
610 .dev = {
611 .dma_mask = &ssc_dmamask,
612 .coherent_dma_mask = DMA_BIT_MASK(32),
613 },
614 .resource = ssc_resources,
615 .num_resources = ARRAY_SIZE(ssc_resources),
616};
617
618static inline void configure_ssc_pins(unsigned pins)
619{
620 if (pins & ATMEL_SSC_TF)
621 at91_set_A_periph(AT91_PIN_PB17, 1);
622 if (pins & ATMEL_SSC_TK)
623 at91_set_A_periph(AT91_PIN_PB16, 1);
624 if (pins & ATMEL_SSC_TD)
625 at91_set_A_periph(AT91_PIN_PB18, 1);
626 if (pins & ATMEL_SSC_RD)
627 at91_set_A_periph(AT91_PIN_PB19, 1);
628 if (pins & ATMEL_SSC_RK)
629 at91_set_A_periph(AT91_PIN_PB20, 1);
630 if (pins & ATMEL_SSC_RF)
631 at91_set_A_periph(AT91_PIN_PB21, 1);
632}
633
634/*
635 * SSC controllers are accessed through library code, instead of any
636 * kind of all-singing/all-dancing driver. For example one could be
637 * used by a particular I2S audio codec's driver, while another one
638 * on the same system might be used by a custom data capture driver.
639 */
640void __init at91_add_device_ssc(unsigned id, unsigned pins)
641{
642 struct platform_device *pdev;
643
644 /*
645 * NOTE: caller is responsible for passing information matching
646 * "pins" to whatever will be using each particular controller.
647 */
648 switch (id) {
649 case AT91SAM9260_ID_SSC:
650 pdev = &at91sam9260_ssc_device;
651 configure_ssc_pins(pins);
652 at91_clock_associate("ssc_clk", &pdev->dev, "pclk");
653 break;
654 default:
655 return;
656 }
657
658 platform_device_register(pdev);
659}
660
661#else
662void __init at91_add_device_ssc(unsigned id, unsigned pins) {}
560#endif 663#endif
561 664
562 665
@@ -583,12 +686,15 @@ static struct atmel_uart_data dbgu_data = {
583 .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU), 686 .regs = (void __iomem *)(AT91_VA_BASE_SYS + AT91_DBGU),
584}; 687};
585 688
689static u64 dbgu_dmamask = DMA_BIT_MASK(32);
690
586static struct platform_device at91sam9260_dbgu_device = { 691static struct platform_device at91sam9260_dbgu_device = {
587 .name = "atmel_usart", 692 .name = "atmel_usart",
588 .id = 0, 693 .id = 0,
589 .dev = { 694 .dev = {
590 .platform_data = &dbgu_data, 695 .dma_mask = &dbgu_dmamask,
591 .coherent_dma_mask = 0xffffffff, 696 .coherent_dma_mask = DMA_BIT_MASK(32),
697 .platform_data = &dbgu_data,
592 }, 698 },
593 .resource = dbgu_resources, 699 .resource = dbgu_resources,
594 .num_resources = ARRAY_SIZE(dbgu_resources), 700 .num_resources = ARRAY_SIZE(dbgu_resources),
@@ -618,27 +724,37 @@ static struct atmel_uart_data uart0_data = {
618 .use_dma_rx = 1, 724 .use_dma_rx = 1,
619}; 725};
620 726
727static u64 uart0_dmamask = DMA_BIT_MASK(32);
728
621static struct platform_device at91sam9260_uart0_device = { 729static struct platform_device at91sam9260_uart0_device = {
622 .name = "atmel_usart", 730 .name = "atmel_usart",
623 .id = 1, 731 .id = 1,
624 .dev = { 732 .dev = {
625 .platform_data = &uart0_data, 733 .dma_mask = &uart0_dmamask,
626 .coherent_dma_mask = 0xffffffff, 734 .coherent_dma_mask = DMA_BIT_MASK(32),
735 .platform_data = &uart0_data,
627 }, 736 },
628 .resource = uart0_resources, 737 .resource = uart0_resources,
629 .num_resources = ARRAY_SIZE(uart0_resources), 738 .num_resources = ARRAY_SIZE(uart0_resources),
630}; 739};
631 740
632static inline void configure_usart0_pins(void) 741static inline void configure_usart0_pins(unsigned pins)
633{ 742{
634 at91_set_A_periph(AT91_PIN_PB4, 1); /* TXD0 */ 743 at91_set_A_periph(AT91_PIN_PB4, 1); /* TXD0 */
635 at91_set_A_periph(AT91_PIN_PB5, 0); /* RXD0 */ 744 at91_set_A_periph(AT91_PIN_PB5, 0); /* RXD0 */
636 at91_set_A_periph(AT91_PIN_PB26, 0); /* RTS0 */ 745
637 at91_set_A_periph(AT91_PIN_PB27, 0); /* CTS0 */ 746 if (pins & ATMEL_UART_RTS)
638 at91_set_A_periph(AT91_PIN_PB24, 0); /* DTR0 */ 747 at91_set_A_periph(AT91_PIN_PB26, 0); /* RTS0 */
639 at91_set_A_periph(AT91_PIN_PB22, 0); /* DSR0 */ 748 if (pins & ATMEL_UART_CTS)
640 at91_set_A_periph(AT91_PIN_PB23, 0); /* DCD0 */ 749 at91_set_A_periph(AT91_PIN_PB27, 0); /* CTS0 */
641 at91_set_A_periph(AT91_PIN_PB25, 0); /* RI0 */ 750 if (pins & ATMEL_UART_DTR)
751 at91_set_A_periph(AT91_PIN_PB24, 0); /* DTR0 */
752 if (pins & ATMEL_UART_DSR)
753 at91_set_A_periph(AT91_PIN_PB22, 0); /* DSR0 */
754 if (pins & ATMEL_UART_DCD)
755 at91_set_A_periph(AT91_PIN_PB23, 0); /* DCD0 */
756 if (pins & ATMEL_UART_RI)
757 at91_set_A_periph(AT91_PIN_PB25, 0); /* RI0 */
642} 758}
643 759
644static struct resource uart1_resources[] = { 760static struct resource uart1_resources[] = {
@@ -659,23 +775,29 @@ static struct atmel_uart_data uart1_data = {
659 .use_dma_rx = 1, 775 .use_dma_rx = 1,
660}; 776};
661 777
778static u64 uart1_dmamask = DMA_BIT_MASK(32);
779
662static struct platform_device at91sam9260_uart1_device = { 780static struct platform_device at91sam9260_uart1_device = {
663 .name = "atmel_usart", 781 .name = "atmel_usart",
664 .id = 2, 782 .id = 2,
665 .dev = { 783 .dev = {
666 .platform_data = &uart1_data, 784 .dma_mask = &uart1_dmamask,
667 .coherent_dma_mask = 0xffffffff, 785 .coherent_dma_mask = DMA_BIT_MASK(32),
786 .platform_data = &uart1_data,
668 }, 787 },
669 .resource = uart1_resources, 788 .resource = uart1_resources,
670 .num_resources = ARRAY_SIZE(uart1_resources), 789 .num_resources = ARRAY_SIZE(uart1_resources),
671}; 790};
672 791
673static inline void configure_usart1_pins(void) 792static inline void configure_usart1_pins(unsigned pins)
674{ 793{
675 at91_set_A_periph(AT91_PIN_PB6, 1); /* TXD1 */ 794 at91_set_A_periph(AT91_PIN_PB6, 1); /* TXD1 */
676 at91_set_A_periph(AT91_PIN_PB7, 0); /* RXD1 */ 795 at91_set_A_periph(AT91_PIN_PB7, 0); /* RXD1 */
677 at91_set_A_periph(AT91_PIN_PB28, 0); /* RTS1 */ 796
678 at91_set_A_periph(AT91_PIN_PB29, 0); /* CTS1 */ 797 if (pins & ATMEL_UART_RTS)
798 at91_set_A_periph(AT91_PIN_PB28, 0); /* RTS1 */
799 if (pins & ATMEL_UART_CTS)
800 at91_set_A_periph(AT91_PIN_PB29, 0); /* CTS1 */
679} 801}
680 802
681static struct resource uart2_resources[] = { 803static struct resource uart2_resources[] = {
@@ -696,21 +818,29 @@ static struct atmel_uart_data uart2_data = {
696 .use_dma_rx = 1, 818 .use_dma_rx = 1,
697}; 819};
698 820
821static u64 uart2_dmamask = DMA_BIT_MASK(32);
822
699static struct platform_device at91sam9260_uart2_device = { 823static struct platform_device at91sam9260_uart2_device = {
700 .name = "atmel_usart", 824 .name = "atmel_usart",
701 .id = 3, 825 .id = 3,
702 .dev = { 826 .dev = {
703 .platform_data = &uart2_data, 827 .dma_mask = &uart2_dmamask,
704 .coherent_dma_mask = 0xffffffff, 828 .coherent_dma_mask = DMA_BIT_MASK(32),
829 .platform_data = &uart2_data,
705 }, 830 },
706 .resource = uart2_resources, 831 .resource = uart2_resources,
707 .num_resources = ARRAY_SIZE(uart2_resources), 832 .num_resources = ARRAY_SIZE(uart2_resources),
708}; 833};
709 834
710static inline void configure_usart2_pins(void) 835static inline void configure_usart2_pins(unsigned pins)
711{ 836{
712 at91_set_A_periph(AT91_PIN_PB8, 1); /* TXD2 */ 837 at91_set_A_periph(AT91_PIN_PB8, 1); /* TXD2 */
713 at91_set_A_periph(AT91_PIN_PB9, 0); /* RXD2 */ 838 at91_set_A_periph(AT91_PIN_PB9, 0); /* RXD2 */
839
840 if (pins & ATMEL_UART_RTS)
841 at91_set_A_periph(AT91_PIN_PA4, 0); /* RTS2 */
842 if (pins & ATMEL_UART_CTS)
843 at91_set_A_periph(AT91_PIN_PA5, 0); /* CTS2 */
714} 844}
715 845
716static struct resource uart3_resources[] = { 846static struct resource uart3_resources[] = {
@@ -731,21 +861,29 @@ static struct atmel_uart_data uart3_data = {
731 .use_dma_rx = 1, 861 .use_dma_rx = 1,
732}; 862};
733 863
864static u64 uart3_dmamask = DMA_BIT_MASK(32);
865
734static struct platform_device at91sam9260_uart3_device = { 866static struct platform_device at91sam9260_uart3_device = {
735 .name = "atmel_usart", 867 .name = "atmel_usart",
736 .id = 4, 868 .id = 4,
737 .dev = { 869 .dev = {
738 .platform_data = &uart3_data, 870 .dma_mask = &uart3_dmamask,
739 .coherent_dma_mask = 0xffffffff, 871 .coherent_dma_mask = DMA_BIT_MASK(32),
872 .platform_data = &uart3_data,
740 }, 873 },
741 .resource = uart3_resources, 874 .resource = uart3_resources,
742 .num_resources = ARRAY_SIZE(uart3_resources), 875 .num_resources = ARRAY_SIZE(uart3_resources),
743}; 876};
744 877
745static inline void configure_usart3_pins(void) 878static inline void configure_usart3_pins(unsigned pins)
746{ 879{
747 at91_set_A_periph(AT91_PIN_PB10, 1); /* TXD3 */ 880 at91_set_A_periph(AT91_PIN_PB10, 1); /* TXD3 */
748 at91_set_A_periph(AT91_PIN_PB11, 0); /* RXD3 */ 881 at91_set_A_periph(AT91_PIN_PB11, 0); /* RXD3 */
882
883 if (pins & ATMEL_UART_RTS)
884 at91_set_B_periph(AT91_PIN_PC8, 0); /* RTS3 */
885 if (pins & ATMEL_UART_CTS)
886 at91_set_B_periph(AT91_PIN_PC10, 0); /* CTS3 */
749} 887}
750 888
751static struct resource uart4_resources[] = { 889static struct resource uart4_resources[] = {
@@ -766,12 +904,15 @@ static struct atmel_uart_data uart4_data = {
766 .use_dma_rx = 1, 904 .use_dma_rx = 1,
767}; 905};
768 906
907static u64 uart4_dmamask = DMA_BIT_MASK(32);
908
769static struct platform_device at91sam9260_uart4_device = { 909static struct platform_device at91sam9260_uart4_device = {
770 .name = "atmel_usart", 910 .name = "atmel_usart",
771 .id = 5, 911 .id = 5,
772 .dev = { 912 .dev = {
773 .platform_data = &uart4_data, 913 .dma_mask = &uart4_dmamask,
774 .coherent_dma_mask = 0xffffffff, 914 .coherent_dma_mask = DMA_BIT_MASK(32),
915 .platform_data = &uart4_data,
775 }, 916 },
776 .resource = uart4_resources, 917 .resource = uart4_resources,
777 .num_resources = ARRAY_SIZE(uart4_resources), 918 .num_resources = ARRAY_SIZE(uart4_resources),
@@ -801,12 +942,15 @@ static struct atmel_uart_data uart5_data = {
801 .use_dma_rx = 1, 942 .use_dma_rx = 1,
802}; 943};
803 944
945static u64 uart5_dmamask = DMA_BIT_MASK(32);
946
804static struct platform_device at91sam9260_uart5_device = { 947static struct platform_device at91sam9260_uart5_device = {
805 .name = "atmel_usart", 948 .name = "atmel_usart",
806 .id = 6, 949 .id = 6,
807 .dev = { 950 .dev = {
808 .platform_data = &uart5_data, 951 .dma_mask = &uart5_dmamask,
809 .coherent_dma_mask = 0xffffffff, 952 .coherent_dma_mask = DMA_BIT_MASK(32),
953 .platform_data = &uart5_data,
810 }, 954 },
811 .resource = uart5_resources, 955 .resource = uart5_resources,
812 .num_resources = ARRAY_SIZE(uart5_resources), 956 .num_resources = ARRAY_SIZE(uart5_resources),
@@ -818,10 +962,10 @@ static inline void configure_usart5_pins(void)
818 at91_set_A_periph(AT91_PIN_PB13, 0); /* RXD5 */ 962 at91_set_A_periph(AT91_PIN_PB13, 0); /* RXD5 */
819} 963}
820 964
821struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ 965static struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
822struct platform_device *atmel_default_console_device; /* the serial console device */ 966struct platform_device *atmel_default_console_device; /* the serial console device */
823 967
824void __init at91_init_serial(struct at91_uart_config *config) 968void __init __deprecated at91_init_serial(struct at91_uart_config *config)
825{ 969{
826 int i; 970 int i;
827 971
@@ -829,22 +973,22 @@ void __init at91_init_serial(struct at91_uart_config *config)
829 for (i = 0; i < config->nr_tty; i++) { 973 for (i = 0; i < config->nr_tty; i++) {
830 switch (config->tty_map[i]) { 974 switch (config->tty_map[i]) {
831 case 0: 975 case 0:
832 configure_usart0_pins(); 976 configure_usart0_pins(ATMEL_UART_CTS | ATMEL_UART_RTS | ATMEL_UART_DSR | ATMEL_UART_DTR | ATMEL_UART_DCD | ATMEL_UART_RI);
833 at91_uarts[i] = &at91sam9260_uart0_device; 977 at91_uarts[i] = &at91sam9260_uart0_device;
834 at91_clock_associate("usart0_clk", &at91sam9260_uart0_device.dev, "usart"); 978 at91_clock_associate("usart0_clk", &at91sam9260_uart0_device.dev, "usart");
835 break; 979 break;
836 case 1: 980 case 1:
837 configure_usart1_pins(); 981 configure_usart1_pins(ATMEL_UART_CTS | ATMEL_UART_RTS);
838 at91_uarts[i] = &at91sam9260_uart1_device; 982 at91_uarts[i] = &at91sam9260_uart1_device;
839 at91_clock_associate("usart1_clk", &at91sam9260_uart1_device.dev, "usart"); 983 at91_clock_associate("usart1_clk", &at91sam9260_uart1_device.dev, "usart");
840 break; 984 break;
841 case 2: 985 case 2:
842 configure_usart2_pins(); 986 configure_usart2_pins(0);
843 at91_uarts[i] = &at91sam9260_uart2_device; 987 at91_uarts[i] = &at91sam9260_uart2_device;
844 at91_clock_associate("usart2_clk", &at91sam9260_uart2_device.dev, "usart"); 988 at91_clock_associate("usart2_clk", &at91sam9260_uart2_device.dev, "usart");
845 break; 989 break;
846 case 3: 990 case 3:
847 configure_usart3_pins(); 991 configure_usart3_pins(0);
848 at91_uarts[i] = &at91sam9260_uart3_device; 992 at91_uarts[i] = &at91sam9260_uart3_device;
849 at91_clock_associate("usart3_clk", &at91sam9260_uart3_device.dev, "usart"); 993 at91_clock_associate("usart3_clk", &at91sam9260_uart3_device.dev, "usart");
850 break; 994 break;
@@ -876,6 +1020,63 @@ void __init at91_init_serial(struct at91_uart_config *config)
876 printk(KERN_INFO "AT91: No default serial console defined.\n"); 1020 printk(KERN_INFO "AT91: No default serial console defined.\n");
877} 1021}
878 1022
1023void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
1024{
1025 struct platform_device *pdev;
1026
1027 switch (id) {
1028 case 0: /* DBGU */
1029 pdev = &at91sam9260_dbgu_device;
1030 configure_dbgu_pins();
1031 at91_clock_associate("mck", &pdev->dev, "usart");
1032 break;
1033 case AT91SAM9260_ID_US0:
1034 pdev = &at91sam9260_uart0_device;
1035 configure_usart0_pins(pins);
1036 at91_clock_associate("usart0_clk", &pdev->dev, "usart");
1037 break;
1038 case AT91SAM9260_ID_US1:
1039 pdev = &at91sam9260_uart1_device;
1040 configure_usart1_pins(pins);
1041 at91_clock_associate("usart1_clk", &pdev->dev, "usart");
1042 break;
1043 case AT91SAM9260_ID_US2:
1044 pdev = &at91sam9260_uart2_device;
1045 configure_usart2_pins(pins);
1046 at91_clock_associate("usart2_clk", &pdev->dev, "usart");
1047 break;
1048 case AT91SAM9260_ID_US3:
1049 pdev = &at91sam9260_uart3_device;
1050 configure_usart3_pins(pins);
1051 at91_clock_associate("usart3_clk", &pdev->dev, "usart");
1052 break;
1053 case AT91SAM9260_ID_US4:
1054 pdev = &at91sam9260_uart4_device;
1055 configure_usart4_pins();
1056 at91_clock_associate("usart4_clk", &pdev->dev, "usart");
1057 break;
1058 case AT91SAM9260_ID_US5:
1059 pdev = &at91sam9260_uart5_device;
1060 configure_usart5_pins();
1061 at91_clock_associate("usart5_clk", &pdev->dev, "usart");
1062 break;
1063 default:
1064 return;
1065 }
1066 pdev->id = portnr; /* update to mapped ID */
1067
1068 if (portnr < ATMEL_MAX_UART)
1069 at91_uarts[portnr] = pdev;
1070}
1071
1072void __init at91_set_serial_console(unsigned portnr)
1073{
1074 if (portnr < ATMEL_MAX_UART)
1075 atmel_default_console_device = at91_uarts[portnr];
1076 if (!atmel_default_console_device)
1077 printk(KERN_INFO "AT91: No default serial console defined.\n");
1078}
1079
879void __init at91_add_device_serial(void) 1080void __init at91_add_device_serial(void)
880{ 1081{
881 int i; 1082 int i;
@@ -886,7 +1087,9 @@ void __init at91_add_device_serial(void)
886 } 1087 }
887} 1088}
888#else 1089#else
889void __init at91_init_serial(struct at91_uart_config *config) {} 1090void __init __deprecated at91_init_serial(struct at91_uart_config *config) {}
1091void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {}
1092void __init at91_set_serial_console(unsigned portnr) {}
890void __init at91_add_device_serial(void) {} 1093void __init at91_add_device_serial(void) {}
891#endif 1094#endif
892 1095
@@ -898,6 +1101,8 @@ void __init at91_add_device_serial(void) {}
898 */ 1101 */
899static int __init at91_add_standard_devices(void) 1102static int __init at91_add_standard_devices(void)
900{ 1103{
1104 at91_add_device_rtt();
1105 at91_add_device_watchdog();
901 return 0; 1106 return 0;
902} 1107}
903 1108