aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91/at91sam9260_devices.c
diff options
context:
space:
mode:
authorAndrew Victor <linux@maxim.org.za>2008-04-02 16:58:00 -0400
committerRussell King <rmk+kernel@arm.linux.org.uk>2008-04-04 04:52:25 -0400
commite5f40bfaf309ec4cc27b717d48fb0824313e5ef8 (patch)
treea35c3051d900708487b5f2ffc6c44304c6f0db61 /arch/arm/mach-at91/at91sam9260_devices.c
parent4fd9212cb9bad88ec7c8bf5313f53331905f957a (diff)
[ARM] 4909/1: [AT91] Timer/Counter Block platform_devices
Register platform_devices for the Timer/Counter Block peripherals found on the AT91RM9200, SAM9 & CAP9 processors. Original patch from David Brownell. Signed-off-by: Andrew Victor <linux@maxim.org.za> Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
Diffstat (limited to 'arch/arm/mach-at91/at91sam9260_devices.c')
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c85
1 files changed, 85 insertions, 0 deletions
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index f20afe4d156c..20ac09c02312 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -545,6 +545,90 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
545 545
546 546
547/* -------------------------------------------------------------------- 547/* --------------------------------------------------------------------
548 * Timer/Counter blocks
549 * -------------------------------------------------------------------- */
550
551#ifdef CONFIG_ATMEL_TCLIB
552
553static 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
576static 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
583static 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
606static 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
613static 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
627static void __init at91_add_device_tc(void) { }
628#endif
629
630
631/* --------------------------------------------------------------------
548 * RTT 632 * RTT
549 * -------------------------------------------------------------------- */ 633 * -------------------------------------------------------------------- */
550 634
@@ -1108,6 +1192,7 @@ static int __init at91_add_standard_devices(void)
1108{ 1192{
1109 at91_add_device_rtt(); 1193 at91_add_device_rtt();
1110 at91_add_device_watchdog(); 1194 at91_add_device_watchdog();
1195 at91_add_device_tc();
1111 return 0; 1196 return 0;
1112} 1197}
1113 1198