diff options
Diffstat (limited to 'arch/arm/mach-at91/at91sam9260_devices.c')
-rw-r--r-- | arch/arm/mach-at91/at91sam9260_devices.c | 159 |
1 files changed, 97 insertions, 62 deletions
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c index 105f8403860b..393a32aefce5 100644 --- a/arch/arm/mach-at91/at91sam9260_devices.c +++ b/arch/arm/mach-at91/at91sam9260_devices.c | |||
@@ -19,8 +19,8 @@ | |||
19 | #include <asm/arch/board.h> | 19 | #include <asm/arch/board.h> |
20 | #include <asm/arch/gpio.h> | 20 | #include <asm/arch/gpio.h> |
21 | #include <asm/arch/at91sam9260.h> | 21 | #include <asm/arch/at91sam9260.h> |
22 | #include <asm/arch/at91sam926x_mc.h> | ||
23 | #include <asm/arch/at91sam9260_matrix.h> | 22 | #include <asm/arch/at91sam9260_matrix.h> |
23 | #include <asm/arch/at91sam9_smc.h> | ||
24 | 24 | ||
25 | #include "generic.h" | 25 | #include "generic.h" |
26 | 26 | ||
@@ -288,10 +288,15 @@ static struct at91_nand_data nand_data; | |||
288 | #define NAND_BASE AT91_CHIPSELECT_3 | 288 | #define NAND_BASE AT91_CHIPSELECT_3 |
289 | 289 | ||
290 | static struct resource nand_resources[] = { | 290 | static struct resource nand_resources[] = { |
291 | { | 291 | [0] = { |
292 | .start = NAND_BASE, | 292 | .start = NAND_BASE, |
293 | .end = NAND_BASE + SZ_256M - 1, | 293 | .end = NAND_BASE + SZ_256M - 1, |
294 | .flags = IORESOURCE_MEM, | 294 | .flags = IORESOURCE_MEM, |
295 | }, | ||
296 | [1] = { | ||
297 | .start = AT91_BASE_SYS + AT91_ECC, | ||
298 | .end = AT91_BASE_SYS + AT91_ECC + SZ_512 - 1, | ||
299 | .flags = IORESOURCE_MEM, | ||
295 | } | 300 | } |
296 | }; | 301 | }; |
297 | 302 | ||
@@ -540,6 +545,90 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) | |||
540 | 545 | ||
541 | 546 | ||
542 | /* -------------------------------------------------------------------- | 547 | /* -------------------------------------------------------------------- |
548 | * Timer/Counter blocks | ||
549 | * -------------------------------------------------------------------- */ | ||
550 | |||
551 | #ifdef CONFIG_ATMEL_TCLIB | ||
552 | |||
553 | static struct resource tcb0_resources[] = { | ||
554 | [0] = { | ||
555 | .start = AT91SAM9260_BASE_TCB0, | ||
556 | .end = AT91SAM9260_BASE_TCB0 + SZ_16K - 1, | ||
557 | .flags = IORESOURCE_MEM, | ||
558 | }, | ||
559 | [1] = { | ||
560 | .start = AT91SAM9260_ID_TC0, | ||
561 | .end = AT91SAM9260_ID_TC0, | ||
562 | .flags = IORESOURCE_IRQ, | ||
563 | }, | ||
564 | [2] = { | ||
565 | .start = AT91SAM9260_ID_TC1, | ||
566 | .end = AT91SAM9260_ID_TC1, | ||
567 | .flags = IORESOURCE_IRQ, | ||
568 | }, | ||
569 | [3] = { | ||
570 | .start = AT91SAM9260_ID_TC2, | ||
571 | .end = AT91SAM9260_ID_TC2, | ||
572 | .flags = IORESOURCE_IRQ, | ||
573 | }, | ||
574 | }; | ||
575 | |||
576 | static struct platform_device at91sam9260_tcb0_device = { | ||
577 | .name = "atmel_tcb", | ||
578 | .id = 0, | ||
579 | .resource = tcb0_resources, | ||
580 | .num_resources = ARRAY_SIZE(tcb0_resources), | ||
581 | }; | ||
582 | |||
583 | static struct resource tcb1_resources[] = { | ||
584 | [0] = { | ||
585 | .start = AT91SAM9260_BASE_TCB1, | ||
586 | .end = AT91SAM9260_BASE_TCB1 + SZ_16K - 1, | ||
587 | .flags = IORESOURCE_MEM, | ||
588 | }, | ||
589 | [1] = { | ||
590 | .start = AT91SAM9260_ID_TC3, | ||
591 | .end = AT91SAM9260_ID_TC3, | ||
592 | .flags = IORESOURCE_IRQ, | ||
593 | }, | ||
594 | [2] = { | ||
595 | .start = AT91SAM9260_ID_TC4, | ||
596 | .end = AT91SAM9260_ID_TC4, | ||
597 | .flags = IORESOURCE_IRQ, | ||
598 | }, | ||
599 | [3] = { | ||
600 | .start = AT91SAM9260_ID_TC5, | ||
601 | .end = AT91SAM9260_ID_TC5, | ||
602 | .flags = IORESOURCE_IRQ, | ||
603 | }, | ||
604 | }; | ||
605 | |||
606 | static struct platform_device at91sam9260_tcb1_device = { | ||
607 | .name = "atmel_tcb", | ||
608 | .id = 1, | ||
609 | .resource = tcb1_resources, | ||
610 | .num_resources = ARRAY_SIZE(tcb1_resources), | ||
611 | }; | ||
612 | |||
613 | static void __init at91_add_device_tc(void) | ||
614 | { | ||
615 | /* this chip has a separate clock and irq for each TC channel */ | ||
616 | at91_clock_associate("tc0_clk", &at91sam9260_tcb0_device.dev, "t0_clk"); | ||
617 | at91_clock_associate("tc1_clk", &at91sam9260_tcb0_device.dev, "t1_clk"); | ||
618 | at91_clock_associate("tc2_clk", &at91sam9260_tcb0_device.dev, "t2_clk"); | ||
619 | platform_device_register(&at91sam9260_tcb0_device); | ||
620 | |||
621 | at91_clock_associate("tc3_clk", &at91sam9260_tcb1_device.dev, "t0_clk"); | ||
622 | at91_clock_associate("tc4_clk", &at91sam9260_tcb1_device.dev, "t1_clk"); | ||
623 | at91_clock_associate("tc5_clk", &at91sam9260_tcb1_device.dev, "t2_clk"); | ||
624 | platform_device_register(&at91sam9260_tcb1_device); | ||
625 | } | ||
626 | #else | ||
627 | static void __init at91_add_device_tc(void) { } | ||
628 | #endif | ||
629 | |||
630 | |||
631 | /* -------------------------------------------------------------------- | ||
543 | * RTT | 632 | * RTT |
544 | * -------------------------------------------------------------------- */ | 633 | * -------------------------------------------------------------------- */ |
545 | 634 | ||
@@ -553,7 +642,7 @@ static struct resource rtt_resources[] = { | |||
553 | 642 | ||
554 | static struct platform_device at91sam9260_rtt_device = { | 643 | static struct platform_device at91sam9260_rtt_device = { |
555 | .name = "at91_rtt", | 644 | .name = "at91_rtt", |
556 | .id = -1, | 645 | .id = 0, |
557 | .resource = rtt_resources, | 646 | .resource = rtt_resources, |
558 | .num_resources = ARRAY_SIZE(rtt_resources), | 647 | .num_resources = ARRAY_SIZE(rtt_resources), |
559 | }; | 648 | }; |
@@ -962,64 +1051,9 @@ static inline void configure_usart5_pins(void) | |||
962 | at91_set_A_periph(AT91_PIN_PB13, 0); /* RXD5 */ | 1051 | at91_set_A_periph(AT91_PIN_PB13, 0); /* RXD5 */ |
963 | } | 1052 | } |
964 | 1053 | ||
965 | static struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ | 1054 | static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ |
966 | struct platform_device *atmel_default_console_device; /* the serial console device */ | 1055 | struct platform_device *atmel_default_console_device; /* the serial console device */ |
967 | 1056 | ||
968 | void __init __deprecated at91_init_serial(struct at91_uart_config *config) | ||
969 | { | ||
970 | int i; | ||
971 | |||
972 | /* Fill in list of supported UARTs */ | ||
973 | for (i = 0; i < config->nr_tty; i++) { | ||
974 | switch (config->tty_map[i]) { | ||
975 | case 0: | ||
976 | configure_usart0_pins(ATMEL_UART_CTS | ATMEL_UART_RTS | ATMEL_UART_DSR | ATMEL_UART_DTR | ATMEL_UART_DCD | ATMEL_UART_RI); | ||
977 | at91_uarts[i] = &at91sam9260_uart0_device; | ||
978 | at91_clock_associate("usart0_clk", &at91sam9260_uart0_device.dev, "usart"); | ||
979 | break; | ||
980 | case 1: | ||
981 | configure_usart1_pins(ATMEL_UART_CTS | ATMEL_UART_RTS); | ||
982 | at91_uarts[i] = &at91sam9260_uart1_device; | ||
983 | at91_clock_associate("usart1_clk", &at91sam9260_uart1_device.dev, "usart"); | ||
984 | break; | ||
985 | case 2: | ||
986 | configure_usart2_pins(0); | ||
987 | at91_uarts[i] = &at91sam9260_uart2_device; | ||
988 | at91_clock_associate("usart2_clk", &at91sam9260_uart2_device.dev, "usart"); | ||
989 | break; | ||
990 | case 3: | ||
991 | configure_usart3_pins(0); | ||
992 | at91_uarts[i] = &at91sam9260_uart3_device; | ||
993 | at91_clock_associate("usart3_clk", &at91sam9260_uart3_device.dev, "usart"); | ||
994 | break; | ||
995 | case 4: | ||
996 | configure_usart4_pins(); | ||
997 | at91_uarts[i] = &at91sam9260_uart4_device; | ||
998 | at91_clock_associate("usart4_clk", &at91sam9260_uart4_device.dev, "usart"); | ||
999 | break; | ||
1000 | case 5: | ||
1001 | configure_usart5_pins(); | ||
1002 | at91_uarts[i] = &at91sam9260_uart5_device; | ||
1003 | at91_clock_associate("usart5_clk", &at91sam9260_uart5_device.dev, "usart"); | ||
1004 | break; | ||
1005 | case 6: | ||
1006 | configure_dbgu_pins(); | ||
1007 | at91_uarts[i] = &at91sam9260_dbgu_device; | ||
1008 | at91_clock_associate("mck", &at91sam9260_dbgu_device.dev, "usart"); | ||
1009 | break; | ||
1010 | default: | ||
1011 | continue; | ||
1012 | } | ||
1013 | at91_uarts[i]->id = i; /* update ID number to mapped ID */ | ||
1014 | } | ||
1015 | |||
1016 | /* Set serial console device */ | ||
1017 | if (config->console_tty < ATMEL_MAX_UART) | ||
1018 | atmel_default_console_device = at91_uarts[config->console_tty]; | ||
1019 | if (!atmel_default_console_device) | ||
1020 | printk(KERN_INFO "AT91: No default serial console defined.\n"); | ||
1021 | } | ||
1022 | |||
1023 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) | 1057 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) |
1024 | { | 1058 | { |
1025 | struct platform_device *pdev; | 1059 | struct platform_device *pdev; |
@@ -1073,8 +1107,6 @@ void __init at91_set_serial_console(unsigned portnr) | |||
1073 | { | 1107 | { |
1074 | if (portnr < ATMEL_MAX_UART) | 1108 | if (portnr < ATMEL_MAX_UART) |
1075 | atmel_default_console_device = at91_uarts[portnr]; | 1109 | 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 | } | 1110 | } |
1079 | 1111 | ||
1080 | void __init at91_add_device_serial(void) | 1112 | void __init at91_add_device_serial(void) |
@@ -1085,9 +1117,11 @@ void __init at91_add_device_serial(void) | |||
1085 | if (at91_uarts[i]) | 1117 | if (at91_uarts[i]) |
1086 | platform_device_register(at91_uarts[i]); | 1118 | platform_device_register(at91_uarts[i]); |
1087 | } | 1119 | } |
1120 | |||
1121 | if (!atmel_default_console_device) | ||
1122 | printk(KERN_INFO "AT91: No default serial console defined.\n"); | ||
1088 | } | 1123 | } |
1089 | #else | 1124 | #else |
1090 | void __init __deprecated at91_init_serial(struct at91_uart_config *config) {} | ||
1091 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {} | 1125 | void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {} |
1092 | void __init at91_set_serial_console(unsigned portnr) {} | 1126 | void __init at91_set_serial_console(unsigned portnr) {} |
1093 | void __init at91_add_device_serial(void) {} | 1127 | void __init at91_add_device_serial(void) {} |
@@ -1103,6 +1137,7 @@ static int __init at91_add_standard_devices(void) | |||
1103 | { | 1137 | { |
1104 | at91_add_device_rtt(); | 1138 | at91_add_device_rtt(); |
1105 | at91_add_device_watchdog(); | 1139 | at91_add_device_watchdog(); |
1140 | at91_add_device_tc(); | ||
1106 | return 0; | 1141 | return 0; |
1107 | } | 1142 | } |
1108 | 1143 | ||