aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91/at91sam9rl_devices.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/arm/mach-at91/at91sam9rl_devices.c')
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c117
1 files changed, 62 insertions, 55 deletions
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index f43b5c33e45d..dbb9a5fc2090 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -20,7 +20,7 @@
20#include <asm/arch/gpio.h> 20#include <asm/arch/gpio.h>
21#include <asm/arch/at91sam9rl.h> 21#include <asm/arch/at91sam9rl.h>
22#include <asm/arch/at91sam9rl_matrix.h> 22#include <asm/arch/at91sam9rl_matrix.h>
23#include <asm/arch/at91sam926x_mc.h> 23#include <asm/arch/at91sam9_smc.h>
24 24
25#include "generic.h" 25#include "generic.h"
26 26
@@ -105,10 +105,15 @@ static struct at91_nand_data nand_data;
105#define NAND_BASE AT91_CHIPSELECT_3 105#define NAND_BASE AT91_CHIPSELECT_3
106 106
107static struct resource nand_resources[] = { 107static struct resource nand_resources[] = {
108 { 108 [0] = {
109 .start = NAND_BASE, 109 .start = NAND_BASE,
110 .end = NAND_BASE + SZ_256M - 1, 110 .end = NAND_BASE + SZ_256M - 1,
111 .flags = IORESOURCE_MEM, 111 .flags = IORESOURCE_MEM,
112 },
113 [1] = {
114 .start = AT91_BASE_SYS + AT91_ECC,
115 .end = AT91_BASE_SYS + AT91_ECC + SZ_512 - 1,
116 .flags = IORESOURCE_MEM,
112 } 117 }
113}; 118};
114 119
@@ -385,6 +390,55 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {}
385 390
386 391
387/* -------------------------------------------------------------------- 392/* --------------------------------------------------------------------
393 * Timer/Counter block
394 * -------------------------------------------------------------------- */
395
396#ifdef CONFIG_ATMEL_TCLIB
397
398static struct resource tcb_resources[] = {
399 [0] = {
400 .start = AT91SAM9RL_BASE_TCB0,
401 .end = AT91SAM9RL_BASE_TCB0 + SZ_16K - 1,
402 .flags = IORESOURCE_MEM,
403 },
404 [1] = {
405 .start = AT91SAM9RL_ID_TC0,
406 .end = AT91SAM9RL_ID_TC0,
407 .flags = IORESOURCE_IRQ,
408 },
409 [2] = {
410 .start = AT91SAM9RL_ID_TC1,
411 .end = AT91SAM9RL_ID_TC1,
412 .flags = IORESOURCE_IRQ,
413 },
414 [3] = {
415 .start = AT91SAM9RL_ID_TC2,
416 .end = AT91SAM9RL_ID_TC2,
417 .flags = IORESOURCE_IRQ,
418 },
419};
420
421static struct platform_device at91sam9rl_tcb_device = {
422 .name = "atmel_tcb",
423 .id = 0,
424 .resource = tcb_resources,
425 .num_resources = ARRAY_SIZE(tcb_resources),
426};
427
428static void __init at91_add_device_tc(void)
429{
430 /* this chip has a separate clock and irq for each TC channel */
431 at91_clock_associate("tc0_clk", &at91sam9rl_tcb_device.dev, "t0_clk");
432 at91_clock_associate("tc1_clk", &at91sam9rl_tcb_device.dev, "t1_clk");
433 at91_clock_associate("tc2_clk", &at91sam9rl_tcb_device.dev, "t2_clk");
434 platform_device_register(&at91sam9rl_tcb_device);
435}
436#else
437static void __init at91_add_device_tc(void) { }
438#endif
439
440
441/* --------------------------------------------------------------------
388 * RTC 442 * RTC
389 * -------------------------------------------------------------------- */ 443 * -------------------------------------------------------------------- */
390 444
@@ -418,7 +472,7 @@ static struct resource rtt_resources[] = {
418 472
419static struct platform_device at91sam9rl_rtt_device = { 473static struct platform_device at91sam9rl_rtt_device = {
420 .name = "at91_rtt", 474 .name = "at91_rtt",
421 .id = -1, 475 .id = 0,
422 .resource = rtt_resources, 476 .resource = rtt_resources,
423 .num_resources = ARRAY_SIZE(rtt_resources), 477 .num_resources = ARRAY_SIZE(rtt_resources),
424}; 478};
@@ -539,9 +593,6 @@ static inline void configure_ssc1_pins(unsigned pins)
539} 593}
540 594
541/* 595/*
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 596 * SSC controllers are accessed through library code, instead of any
546 * kind of all-singing/all-dancing driver. For example one could be 597 * 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 598 * used by a particular I2S audio codec's driver, while another one
@@ -802,54 +853,9 @@ static inline void configure_usart3_pins(unsigned pins)
802 at91_set_B_periph(AT91_PIN_PD3, 0); /* CTS3 */ 853 at91_set_B_periph(AT91_PIN_PD3, 0); /* CTS3 */
803} 854}
804 855
805static struct platform_device *at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */ 856static struct platform_device *__initdata at91_uarts[ATMEL_MAX_UART]; /* the UARTs to use */
806struct platform_device *atmel_default_console_device; /* the serial console device */ 857struct platform_device *atmel_default_console_device; /* the serial console device */
807 858
808void __init __deprecated at91_init_serial(struct at91_uart_config *config)
809{
810 int i;
811
812 /* Fill in list of supported UARTs */
813 for (i = 0; i < config->nr_tty; i++) {
814 switch (config->tty_map[i]) {
815 case 0:
816 configure_usart0_pins(ATMEL_UART_CTS | ATMEL_UART_RTS);
817 at91_uarts[i] = &at91sam9rl_uart0_device;
818 at91_clock_associate("usart0_clk", &at91sam9rl_uart0_device.dev, "usart");
819 break;
820 case 1:
821 configure_usart1_pins(0);
822 at91_uarts[i] = &at91sam9rl_uart1_device;
823 at91_clock_associate("usart1_clk", &at91sam9rl_uart1_device.dev, "usart");
824 break;
825 case 2:
826 configure_usart2_pins(0);
827 at91_uarts[i] = &at91sam9rl_uart2_device;
828 at91_clock_associate("usart2_clk", &at91sam9rl_uart2_device.dev, "usart");
829 break;
830 case 3:
831 configure_usart3_pins(0);
832 at91_uarts[i] = &at91sam9rl_uart3_device;
833 at91_clock_associate("usart3_clk", &at91sam9rl_uart3_device.dev, "usart");
834 break;
835 case 4:
836 configure_dbgu_pins();
837 at91_uarts[i] = &at91sam9rl_dbgu_device;
838 at91_clock_associate("mck", &at91sam9rl_dbgu_device.dev, "usart");
839 break;
840 default:
841 continue;
842 }
843 at91_uarts[i]->id = i; /* update ID number to mapped ID */
844 }
845
846 /* Set serial console device */
847 if (config->console_tty < ATMEL_MAX_UART)
848 atmel_default_console_device = at91_uarts[config->console_tty];
849 if (!atmel_default_console_device)
850 printk(KERN_INFO "AT91: No default serial console defined.\n");
851}
852
853void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) 859void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins)
854{ 860{
855 struct platform_device *pdev; 861 struct platform_device *pdev;
@@ -893,8 +899,6 @@ void __init at91_set_serial_console(unsigned portnr)
893{ 899{
894 if (portnr < ATMEL_MAX_UART) 900 if (portnr < ATMEL_MAX_UART)
895 atmel_default_console_device = at91_uarts[portnr]; 901 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} 902}
899 903
900void __init at91_add_device_serial(void) 904void __init at91_add_device_serial(void)
@@ -905,9 +909,11 @@ void __init at91_add_device_serial(void)
905 if (at91_uarts[i]) 909 if (at91_uarts[i])
906 platform_device_register(at91_uarts[i]); 910 platform_device_register(at91_uarts[i]);
907 } 911 }
912
913 if (!atmel_default_console_device)
914 printk(KERN_INFO "AT91: No default serial console defined.\n");
908} 915}
909#else 916#else
910void __init __deprecated at91_init_serial(struct at91_uart_config *config) {}
911void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {} 917void __init at91_register_uart(unsigned id, unsigned portnr, unsigned pins) {}
912void __init at91_set_serial_console(unsigned portnr) {} 918void __init at91_set_serial_console(unsigned portnr) {}
913void __init at91_add_device_serial(void) {} 919void __init at91_add_device_serial(void) {}
@@ -925,6 +931,7 @@ static int __init at91_add_standard_devices(void)
925 at91_add_device_rtc(); 931 at91_add_device_rtc();
926 at91_add_device_rtt(); 932 at91_add_device_rtt();
927 at91_add_device_watchdog(); 933 at91_add_device_watchdog();
934 at91_add_device_tc();
928 return 0; 935 return 0;
929} 936}
930 937