aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91/at91sam9261_devices.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-at91/at91sam9261_devices.c')
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c102
1 files changed, 56 insertions, 46 deletions
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 245641263fce..37cd547855b1 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -24,7 +24,7 @@
24#include <asm/arch/gpio.h> 24#include <asm/arch/gpio.h>
25#include <asm/arch/at91sam9261.h> 25#include <asm/arch/at91sam9261.h>
26#include <asm/arch/at91sam9261_matrix.h> 26#include <asm/arch/at91sam9261_matrix.h>
27#include <asm/arch/at91sam926x_mc.h> 27#include <asm/arch/at91sam9_smc.h>
28 28
29#include "generic.h" 29#include "generic.h"
30 30
@@ -548,6 +548,55 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {}
548 548
549 549
550/* -------------------------------------------------------------------- 550/* --------------------------------------------------------------------
551 * Timer/Counter block
552 * -------------------------------------------------------------------- */
553
554#ifdef CONFIG_ATMEL_TCLIB
555
556static struct resource tcb_resources[] = {
557 [0] = {
558 .start = AT91SAM9261_BASE_TCB0,
559 .end = AT91SAM9261_BASE_TCB0 + SZ_16K - 1,
560 .flags = IORESOURCE_MEM,
561 },
562 [1] = {
563 .start = AT91SAM9261_ID_TC0,
564 .end = AT91SAM9261_ID_TC0,
565 .flags = IORESOURCE_IRQ,
566 },
567 [2] = {
568 .start = AT91SAM9261_ID_TC1,
569 .end = AT91SAM9261_ID_TC1,
570 .flags = IORESOURCE_IRQ,
571 },
572 [3] = {
573 .start = AT91SAM9261_ID_TC2,
574 .end = AT91SAM9261_ID_TC2,
575 .flags = IORESOURCE_IRQ,
576 },
577};
578
579static struct platform_device at91sam9261_tcb_device = {
580 .name = "atmel_tcb",
581 .id = 0,
582 .resource = tcb_resources,
583 .num_resources = ARRAY_SIZE(tcb_resources),
584};
585
586static void __init at91_add_device_tc(void)
587{
588 /* this chip has a separate clock and irq for each TC channel */
589 at91_clock_associate("tc0_clk", &at91sam9261_tcb_device.dev, "t0_clk");
590 at91_clock_associate("tc1_clk", &at91sam9261_tcb_device.dev, "t1_clk");
591 at91_clock_associate("tc2_clk", &at91sam9261_tcb_device.dev, "t2_clk");
592 platform_device_register(&at91sam9261_tcb_device);
593}
594#else
595static void __init at91_add_device_tc(void) { }
596#endif
597
598
599/* --------------------------------------------------------------------
551 * RTT 600 * RTT
552 * -------------------------------------------------------------------- */ 601 * -------------------------------------------------------------------- */
553 602
@@ -561,7 +610,7 @@ static struct resource rtt_resources[] = {
561 610
562static struct platform_device at91sam9261_rtt_device = { 611static struct platform_device at91sam9261_rtt_device = {
563 .name = "at91_rtt", 612 .name = "at91_rtt",
564 .id = -1, 613 .id = 0,
565 .resource = rtt_resources, 614 .resource = rtt_resources,
566 .num_resources = ARRAY_SIZE(rtt_resources), 615 .num_resources = ARRAY_SIZE(rtt_resources),
567}; 616};
@@ -938,49 +987,9 @@ static inline void configure_usart2_pins(unsigned pins)
938 at91_set_B_periph(AT91_PIN_PA16, 0); /* CTS2 */ 987 at91_set_B_periph(AT91_PIN_PA16, 0); /* CTS2 */
939} 988}
940 989
941static struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ 990static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
942struct platform_device *atmel_default_console_device; /* the serial console device */ 991struct platform_device *atmel_default_console_device; /* the serial console device */
943 992
944void __init __deprecated at91_init_serial(struct at91_uart_config *config)
945{
946 int i;
947
948 /* Fill in list of supported UARTs */
949 for (i = 0; i < config->nr_tty; i++) {
950 switch (config->tty_map[i]) {
951 case 0:
952 configure_usart0_pins(ATMEL_UART_CTS | ATMEL_UART_RTS);
953 at91_uarts[i] = &at91sam9261_uart0_device;
954 at91_clock_associate("usart0_clk", &at91sam9261_uart0_device.dev, "usart");
955 break;
956 case 1:
957 configure_usart1_pins(0);
958 at91_uarts[i] = &at91sam9261_uart1_device;
959 at91_clock_associate("usart1_clk", &at91sam9261_uart1_device.dev, "usart");
960 break;
961 case 2:
962 configure_usart2_pins(0);
963 at91_uarts[i] = &at91sam9261_uart2_device;
964 at91_clock_associate("usart2_clk", &at91sam9261_uart2_device.dev, "usart");
965 break;
966 case 3:
967 configure_dbgu_pins();
968 at91_uarts[i] = &at91sam9261_dbgu_device;
969 at91_clock_associate("mck", &at91sam9261_dbgu_device.dev, "usart");
970 break;
971 default:
972 continue;
973 }
974 at91_uarts[i]->id = i; /* update ID number to mapped ID */
975 }
976
977 /* Set serial console device */
978 if (config->console_tty < ATMEL_MAX_UART)
979 atmel_default_console_device = at91_uarts[config->console_tty];
980 if (!atmel_default_console_device)
981 printk(KERN_INFO "AT91: No default serial console defined.\n");
982}
983
984void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) 993void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
985{ 994{
986 struct platform_device *pdev; 995 struct platform_device *pdev;
@@ -1019,8 +1028,6 @@ void __init at91_set_serial_console(unsigned portnr)
1019{ 1028{
1020 if (portnr < ATMEL_MAX_UART) 1029 if (portnr < ATMEL_MAX_UART)
1021 atmel_default_console_device = at91_uarts[portnr]; 1030 atmel_default_console_device = at91_uarts[portnr];
1022 if (!atmel_default_console_device)
1023 printk(KERN_INFO "AT91: No default serial console defined.\n");
1024} 1031}
1025 1032
1026void __init at91_add_device_serial(void) 1033void __init at91_add_device_serial(void)
@@ -1031,9 +1038,11 @@ void __init at91_add_device_serial(void)
1031 if (at91_uarts[i]) 1038 if (at91_uarts[i])
1032 platform_device_register(at91_uarts[i]); 1039 platform_device_register(at91_uarts[i]);
1033 } 1040 }
1041
1042 if (!atmel_default_console_device)
1043 printk(KERN_INFO "AT91: No default serial console defined.\n");
1034} 1044}
1035#else 1045#else
1036void __init __deprecated at91_init_serial(struct at91_uart_config *config) {}
1037void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {} 1046void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {}
1038void __init at91_set_serial_console(unsigned portnr) {} 1047void __init at91_set_serial_console(unsigned portnr) {}
1039void __init at91_add_device_serial(void) {} 1048void __init at91_add_device_serial(void) {}
@@ -1050,6 +1059,7 @@ static int __init at91_add_standard_devices(void)
1050{ 1059{
1051 at91_add_device_rtt(); 1060 at91_add_device_rtt();
1052 at91_add_device_watchdog(); 1061 at91_add_device_watchdog();
1062 at91_add_device_tc();
1053 return 0; 1063 return 0;
1054} 1064}
1055 1065