aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm
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
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')
-rw-r--r--arch/arm/mach-at91/at91cap9_devices.c38
-rw-r--r--arch/arm/mach-at91/at91rm9200_devices.c85
-rw-r--r--arch/arm/mach-at91/at91sam9260_devices.c85
-rw-r--r--arch/arm/mach-at91/at91sam9261_devices.c50
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c38
-rw-r--r--arch/arm/mach-at91/at91sam9rl_devices.c50
6 files changed, 346 insertions, 0 deletions
diff --git a/arch/arm/mach-at91/at91cap9_devices.c b/arch/arm/mach-at91/at91cap9_devices.c
index 7d782ee4117b..2eeaf5d5bbf3 100644
--- a/arch/arm/mach-at91/at91cap9_devices.c
+++ b/arch/arm/mach-at91/at91cap9_devices.c
@@ -537,6 +537,43 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
537 537
538 538
539/* -------------------------------------------------------------------- 539/* --------------------------------------------------------------------
540 * Timer/Counter block
541 * -------------------------------------------------------------------- */
542
543#ifdef CONFIG_ATMEL_TCLIB
544
545static struct resource tcb_resources[] = {
546 [0] = {
547 .start = AT91CAP9_BASE_TCB0,
548 .end = AT91CAP9_BASE_TCB0 + SZ_16K - 1,
549 .flags = IORESOURCE_MEM,
550 },
551 [1] = {
552 .start = AT91CAP9_ID_TCB,
553 .end = AT91CAP9_ID_TCB,
554 .flags = IORESOURCE_IRQ,
555 },
556};
557
558static struct platform_device at91cap9_tcb_device = {
559 .name = "atmel_tcb",
560 .id = 0,
561 .resource = tcb_resources,
562 .num_resources = ARRAY_SIZE(tcb_resources),
563};
564
565static void __init at91_add_device_tc(void)
566{
567 /* this chip has one clock and irq for all three TC channels */
568 at91_clock_associate("tcb_clk", &at91cap9_tcb_device.dev, "t0_clk");
569 platform_device_register(&at91cap9_tcb_device);
570}
571#else
572static void __init at91_add_device_tc(void) { }
573#endif
574
575
576/* --------------------------------------------------------------------
540 * RTT 577 * RTT
541 * -------------------------------------------------------------------- */ 578 * -------------------------------------------------------------------- */
542 579
@@ -1074,6 +1111,7 @@ static int __init at91_add_standard_devices(void)
1074{ 1111{
1075 at91_add_device_rtt(); 1112 at91_add_device_rtt();
1076 at91_add_device_watchdog(); 1113 at91_add_device_watchdog();
1114 at91_add_device_tc();
1077 return 0; 1115 return 0;
1078} 1116}
1079 1117
diff --git a/arch/arm/mach-at91/at91rm9200_devices.c b/arch/arm/mach-at91/at91rm9200_devices.c
index ef6aeb86e980..70d3a0018530 100644
--- a/arch/arm/mach-at91/at91rm9200_devices.c
+++ b/arch/arm/mach-at91/at91rm9200_devices.c
@@ -577,6 +577,90 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices)
577 577
578 578
579/* -------------------------------------------------------------------- 579/* --------------------------------------------------------------------
580 * Timer/Counter blocks
581 * -------------------------------------------------------------------- */
582
583#ifdef CONFIG_ATMEL_TCLIB
584
585static struct resource tcb0_resources[] = {
586 [0] = {
587 .start = AT91RM9200_BASE_TCB0,
588 .end = AT91RM9200_BASE_TCB0 + SZ_16K - 1,
589 .flags = IORESOURCE_MEM,
590 },
591 [1] = {
592 .start = AT91RM9200_ID_TC0,
593 .end = AT91RM9200_ID_TC0,
594 .flags = IORESOURCE_IRQ,
595 },
596 [2] = {
597 .start = AT91RM9200_ID_TC1,
598 .end = AT91RM9200_ID_TC1,
599 .flags = IORESOURCE_IRQ,
600 },
601 [3] = {
602 .start = AT91RM9200_ID_TC2,
603 .end = AT91RM9200_ID_TC2,
604 .flags = IORESOURCE_IRQ,
605 },
606};
607
608static struct platform_device at91rm9200_tcb0_device = {
609 .name = "atmel_tcb",
610 .id = 0,
611 .resource = tcb0_resources,
612 .num_resources = ARRAY_SIZE(tcb0_resources),
613};
614
615static struct resource tcb1_resources[] = {
616 [0] = {
617 .start = AT91RM9200_BASE_TCB1,
618 .end = AT91RM9200_BASE_TCB1 + SZ_16K - 1,
619 .flags = IORESOURCE_MEM,
620 },
621 [1] = {
622 .start = AT91RM9200_ID_TC3,
623 .end = AT91RM9200_ID_TC3,
624 .flags = IORESOURCE_IRQ,
625 },
626 [2] = {
627 .start = AT91RM9200_ID_TC4,
628 .end = AT91RM9200_ID_TC4,
629 .flags = IORESOURCE_IRQ,
630 },
631 [3] = {
632 .start = AT91RM9200_ID_TC5,
633 .end = AT91RM9200_ID_TC5,
634 .flags = IORESOURCE_IRQ,
635 },
636};
637
638static struct platform_device at91rm9200_tcb1_device = {
639 .name = "atmel_tcb",
640 .id = 1,
641 .resource = tcb1_resources,
642 .num_resources = ARRAY_SIZE(tcb1_resources),
643};
644
645static void __init at91_add_device_tc(void)
646{
647 /* this chip has a separate clock and irq for each TC channel */
648 at91_clock_associate("tc0_clk", &at91rm9200_tcb0_device.dev, "t0_clk");
649 at91_clock_associate("tc1_clk", &at91rm9200_tcb0_device.dev, "t1_clk");
650 at91_clock_associate("tc2_clk", &at91rm9200_tcb0_device.dev, "t2_clk");
651 platform_device_register(&at91rm9200_tcb0_device);
652
653 at91_clock_associate("tc3_clk", &at91rm9200_tcb1_device.dev, "t0_clk");
654 at91_clock_associate("tc4_clk", &at91rm9200_tcb1_device.dev, "t1_clk");
655 at91_clock_associate("tc5_clk", &at91rm9200_tcb1_device.dev, "t2_clk");
656 platform_device_register(&at91rm9200_tcb1_device);
657}
658#else
659static void __init at91_add_device_tc(void) { }
660#endif
661
662
663/* --------------------------------------------------------------------
580 * RTC 664 * RTC
581 * -------------------------------------------------------------------- */ 665 * -------------------------------------------------------------------- */
582 666
@@ -1141,6 +1225,7 @@ static int __init at91_add_standard_devices(void)
1141{ 1225{
1142 at91_add_device_rtc(); 1226 at91_add_device_rtc();
1143 at91_add_device_watchdog(); 1227 at91_add_device_watchdog();
1228 at91_add_device_tc();
1144 return 0; 1229 return 0;
1145} 1230}
1146 1231
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
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 0bd0edf8fa3b..03cd32482eac 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -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
@@ -1050,6 +1099,7 @@ static int __init at91_add_standard_devices(void)
1050{ 1099{
1051 at91_add_device_rtt(); 1100 at91_add_device_rtt();
1052 at91_add_device_watchdog(); 1101 at91_add_device_watchdog();
1102 at91_add_device_tc();
1053 return 0; 1103 return 0;
1054} 1104}
1055 1105
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index 64aab9c9b97e..c81842c02706 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -788,6 +788,43 @@ void __init at91_add_device_isi(void) {}
788 788
789 789
790/* -------------------------------------------------------------------- 790/* --------------------------------------------------------------------
791 * Timer/Counter block
792 * -------------------------------------------------------------------- */
793
794#ifdef CONFIG_ATMEL_TCLIB
795
796static struct resource tcb_resources[] = {
797 [0] = {
798 .start = AT91SAM9263_BASE_TCB0,
799 .end = AT91SAM9263_BASE_TCB0 + SZ_16K - 1,
800 .flags = IORESOURCE_MEM,
801 },
802 [1] = {
803 .start = AT91SAM9263_ID_TCB,
804 .end = AT91SAM9263_ID_TCB,
805 .flags = IORESOURCE_IRQ,
806 },
807};
808
809static struct platform_device at91sam9263_tcb_device = {
810 .name = "atmel_tcb",
811 .id = 0,
812 .resource = tcb_resources,
813 .num_resources = ARRAY_SIZE(tcb_resources),
814};
815
816static void __init at91_add_device_tc(void)
817{
818 /* this chip has one clock and irq for all three TC channels */
819 at91_clock_associate("tcb_clk", &at91sam9263_tcb_device.dev, "t0_clk");
820 platform_device_register(&at91sam9263_tcb_device);
821}
822#else
823static void __init at91_add_device_tc(void) { }
824#endif
825
826
827/* --------------------------------------------------------------------
791 * RTT 828 * RTT
792 * -------------------------------------------------------------------- */ 829 * -------------------------------------------------------------------- */
793 830
@@ -1262,6 +1299,7 @@ static int __init at91_add_standard_devices(void)
1262{ 1299{
1263 at91_add_device_rtt(); 1300 at91_add_device_rtt();
1264 at91_add_device_watchdog(); 1301 at91_add_device_watchdog();
1302 at91_add_device_tc();
1265 return 0; 1303 return 0;
1266} 1304}
1267 1305
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c
index 8982b02c8b46..892262a71d01 100644
--- a/arch/arm/mach-at91/at91sam9rl_devices.c
+++ b/arch/arm/mach-at91/at91sam9rl_devices.c
@@ -390,6 +390,55 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {}
390 390
391 391
392/* -------------------------------------------------------------------- 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/* --------------------------------------------------------------------
393 * RTC 442 * RTC
394 * -------------------------------------------------------------------- */ 443 * -------------------------------------------------------------------- */
395 444
@@ -930,6 +979,7 @@ static int __init at91_add_standard_devices(void)
930 at91_add_device_rtc(); 979 at91_add_device_rtc();
931 at91_add_device_rtt(); 980 at91_add_device_rtt();
932 at91_add_device_watchdog(); 981 at91_add_device_watchdog();
982 at91_add_device_tc();
933 return 0; 983 return 0;
934} 984}
935 985