diff options
author | Andrew Victor <linux@maxim.org.za> | 2008-01-23 03:11:13 -0500 |
---|---|---|
committer | Russell King <rmk+kernel@arm.linux.org.uk> | 2008-01-26 10:00:31 -0500 |
commit | 884f5a6a8dc8646d5904f166adf3c558be57e1ab (patch) | |
tree | c8d6283782b9d0f00d380052276c066d289c73d5 /arch/arm/mach-at91 | |
parent | e2920802351b3e01a3e70a26bb1bbb22f29da4cb (diff) |
[ARM] 4752/1: [AT91] RTT, RTC and WDT peripherals on SAM9
Add platform_device and initialization for the RTT (Real Time Timer)
and WDT (Watchdog) integrated in the Atmel AT91SAM9 processors.
For SAM9263, register both RTT peripherals.
[From: David Brownell <dbrownell@users.sourceforge.net>]
Provide platform_resources for RTT peripherals
[From: David Brownell <dbrownell@users.sourceforge.net>]
Add support for RTC peripheral on AT91SAM9RL (same RTC peripherals as
AT91RM9200)
[From: David Brownell <dbrownell@users.sourceforge.net>]
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')
-rw-r--r-- | arch/arm/mach-at91/at91sam9260_devices.c | 47 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam9261_devices.c | 47 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam9263_devices.c | 63 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam9rl_devices.c | 68 |
4 files changed, 225 insertions, 0 deletions
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c index 3091bf47d8c9..1533556fb873 100644 --- a/arch/arm/mach-at91/at91sam9260_devices.c +++ b/arch/arm/mach-at91/at91sam9260_devices.c | |||
@@ -539,6 +539,51 @@ void __init at91_add_device_spi(struct spi_board_info *devices, int nr_devices) | |||
539 | 539 | ||
540 | 540 | ||
541 | /* -------------------------------------------------------------------- | 541 | /* -------------------------------------------------------------------- |
542 | * RTT | ||
543 | * -------------------------------------------------------------------- */ | ||
544 | |||
545 | static struct resource rtt_resources[] = { | ||
546 | { | ||
547 | .start = AT91_BASE_SYS + AT91_RTT, | ||
548 | .end = AT91_BASE_SYS + AT91_RTT + SZ_16 - 1, | ||
549 | .flags = IORESOURCE_MEM, | ||
550 | } | ||
551 | }; | ||
552 | |||
553 | static struct platform_device at91sam9260_rtt_device = { | ||
554 | .name = "at91_rtt", | ||
555 | .id = -1, | ||
556 | .resource = rtt_resources, | ||
557 | .num_resources = ARRAY_SIZE(rtt_resources), | ||
558 | }; | ||
559 | |||
560 | static void __init at91_add_device_rtt(void) | ||
561 | { | ||
562 | platform_device_register(&at91sam9260_rtt_device); | ||
563 | } | ||
564 | |||
565 | |||
566 | /* -------------------------------------------------------------------- | ||
567 | * Watchdog | ||
568 | * -------------------------------------------------------------------- */ | ||
569 | |||
570 | #if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE) | ||
571 | static struct platform_device at91sam9260_wdt_device = { | ||
572 | .name = "at91_wdt", | ||
573 | .id = -1, | ||
574 | .num_resources = 0, | ||
575 | }; | ||
576 | |||
577 | static void __init at91_add_device_watchdog(void) | ||
578 | { | ||
579 | platform_device_register(&at91sam9260_wdt_device); | ||
580 | } | ||
581 | #else | ||
582 | static void __init at91_add_device_watchdog(void) {} | ||
583 | #endif | ||
584 | |||
585 | |||
586 | /* -------------------------------------------------------------------- | ||
542 | * LEDs | 587 | * LEDs |
543 | * -------------------------------------------------------------------- */ | 588 | * -------------------------------------------------------------------- */ |
544 | 589 | ||
@@ -898,6 +943,8 @@ void __init at91_add_device_serial(void) {} | |||
898 | */ | 943 | */ |
899 | static int __init at91_add_standard_devices(void) | 944 | static int __init at91_add_standard_devices(void) |
900 | { | 945 | { |
946 | at91_add_device_rtt(); | ||
947 | at91_add_device_watchdog(); | ||
901 | return 0; | 948 | return 0; |
902 | } | 949 | } |
903 | 950 | ||
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c index 1d03844a607a..17f3f6a24796 100644 --- a/arch/arm/mach-at91/at91sam9261_devices.c +++ b/arch/arm/mach-at91/at91sam9261_devices.c | |||
@@ -551,6 +551,51 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {} | |||
551 | 551 | ||
552 | 552 | ||
553 | /* -------------------------------------------------------------------- | 553 | /* -------------------------------------------------------------------- |
554 | * RTT | ||
555 | * -------------------------------------------------------------------- */ | ||
556 | |||
557 | static struct resource rtt_resources[] = { | ||
558 | { | ||
559 | .start = AT91_BASE_SYS + AT91_RTT, | ||
560 | .end = AT91_BASE_SYS + AT91_RTT + SZ_16 - 1, | ||
561 | .flags = IORESOURCE_MEM, | ||
562 | } | ||
563 | }; | ||
564 | |||
565 | static struct platform_device at91sam9261_rtt_device = { | ||
566 | .name = "at91_rtt", | ||
567 | .id = -1, | ||
568 | .resource = rtt_resources, | ||
569 | .num_resources = ARRAY_SIZE(rtt_resources), | ||
570 | }; | ||
571 | |||
572 | static void __init at91_add_device_rtt(void) | ||
573 | { | ||
574 | platform_device_register(&at91sam9261_rtt_device); | ||
575 | } | ||
576 | |||
577 | |||
578 | /* -------------------------------------------------------------------- | ||
579 | * Watchdog | ||
580 | * -------------------------------------------------------------------- */ | ||
581 | |||
582 | #if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE) | ||
583 | static struct platform_device at91sam9261_wdt_device = { | ||
584 | .name = "at91_wdt", | ||
585 | .id = -1, | ||
586 | .num_resources = 0, | ||
587 | }; | ||
588 | |||
589 | static void __init at91_add_device_watchdog(void) | ||
590 | { | ||
591 | platform_device_register(&at91sam9261_wdt_device); | ||
592 | } | ||
593 | #else | ||
594 | static void __init at91_add_device_watchdog(void) {} | ||
595 | #endif | ||
596 | |||
597 | |||
598 | /* -------------------------------------------------------------------- | ||
554 | * LEDs | 599 | * LEDs |
555 | * -------------------------------------------------------------------- */ | 600 | * -------------------------------------------------------------------- */ |
556 | 601 | ||
@@ -786,6 +831,8 @@ void __init at91_add_device_serial(void) {} | |||
786 | */ | 831 | */ |
787 | static int __init at91_add_standard_devices(void) | 832 | static int __init at91_add_standard_devices(void) |
788 | { | 833 | { |
834 | at91_add_device_rtt(); | ||
835 | at91_add_device_watchdog(); | ||
789 | return 0; | 836 | return 0; |
790 | } | 837 | } |
791 | 838 | ||
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c index d50a8dfb916d..b4eb21769db9 100644 --- a/arch/arm/mach-at91/at91sam9263_devices.c +++ b/arch/arm/mach-at91/at91sam9263_devices.c | |||
@@ -782,6 +782,67 @@ void __init at91_add_device_isi(void) {} | |||
782 | 782 | ||
783 | 783 | ||
784 | /* -------------------------------------------------------------------- | 784 | /* -------------------------------------------------------------------- |
785 | * RTT | ||
786 | * -------------------------------------------------------------------- */ | ||
787 | |||
788 | static struct resource rtt0_resources[] = { | ||
789 | { | ||
790 | .start = AT91_BASE_SYS + AT91_RTT0, | ||
791 | .end = AT91_BASE_SYS + AT91_RTT0 + SZ_16 - 1, | ||
792 | .flags = IORESOURCE_MEM, | ||
793 | } | ||
794 | }; | ||
795 | |||
796 | static struct platform_device at91sam9263_rtt0_device = { | ||
797 | .name = "at91_rtt", | ||
798 | .id = 0, | ||
799 | .resource = rtt0_resources, | ||
800 | .num_resources = ARRAY_SIZE(rtt0_resources), | ||
801 | }; | ||
802 | |||
803 | static struct resource rtt1_resources[] = { | ||
804 | { | ||
805 | .start = AT91_BASE_SYS + AT91_RTT1, | ||
806 | .end = AT91_BASE_SYS + AT91_RTT1 + SZ_16 - 1, | ||
807 | .flags = IORESOURCE_MEM, | ||
808 | } | ||
809 | }; | ||
810 | |||
811 | static struct platform_device at91sam9263_rtt1_device = { | ||
812 | .name = "at91_rtt", | ||
813 | .id = 1, | ||
814 | .resource = rtt1_resources, | ||
815 | .num_resources = ARRAY_SIZE(rtt1_resources), | ||
816 | }; | ||
817 | |||
818 | static void __init at91_add_device_rtt(void) | ||
819 | { | ||
820 | platform_device_register(&at91sam9263_rtt0_device); | ||
821 | platform_device_register(&at91sam9263_rtt1_device); | ||
822 | } | ||
823 | |||
824 | |||
825 | /* -------------------------------------------------------------------- | ||
826 | * Watchdog | ||
827 | * -------------------------------------------------------------------- */ | ||
828 | |||
829 | #if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE) | ||
830 | static struct platform_device at91sam9263_wdt_device = { | ||
831 | .name = "at91_wdt", | ||
832 | .id = -1, | ||
833 | .num_resources = 0, | ||
834 | }; | ||
835 | |||
836 | static void __init at91_add_device_watchdog(void) | ||
837 | { | ||
838 | platform_device_register(&at91sam9263_wdt_device); | ||
839 | } | ||
840 | #else | ||
841 | static void __init at91_add_device_watchdog(void) {} | ||
842 | #endif | ||
843 | |||
844 | |||
845 | /* -------------------------------------------------------------------- | ||
785 | * LEDs | 846 | * LEDs |
786 | * -------------------------------------------------------------------- */ | 847 | * -------------------------------------------------------------------- */ |
787 | 848 | ||
@@ -1021,6 +1082,8 @@ void __init at91_add_device_serial(void) {} | |||
1021 | */ | 1082 | */ |
1022 | static int __init at91_add_standard_devices(void) | 1083 | static int __init at91_add_standard_devices(void) |
1023 | { | 1084 | { |
1085 | at91_add_device_rtt(); | ||
1086 | at91_add_device_watchdog(); | ||
1024 | return 0; | 1087 | return 0; |
1025 | } | 1088 | } |
1026 | 1089 | ||
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c index 2bd60a3dc623..19ca71d3faab 100644 --- a/arch/arm/mach-at91/at91sam9rl_devices.c +++ b/arch/arm/mach-at91/at91sam9rl_devices.c | |||
@@ -384,6 +384,71 @@ void __init at91_add_device_lcdc(struct atmel_lcdfb_info *data) {} | |||
384 | 384 | ||
385 | 385 | ||
386 | /* -------------------------------------------------------------------- | 386 | /* -------------------------------------------------------------------- |
387 | * RTC | ||
388 | * -------------------------------------------------------------------- */ | ||
389 | |||
390 | #if defined(CONFIG_RTC_DRV_AT91RM9200) || defined(CONFIG_RTC_DRV_AT91RM9200_MODULE) | ||
391 | static struct platform_device at91sam9rl_rtc_device = { | ||
392 | .name = "at91_rtc", | ||
393 | .id = -1, | ||
394 | .num_resources = 0, | ||
395 | }; | ||
396 | |||
397 | static void __init at91_add_device_rtc(void) | ||
398 | { | ||
399 | platform_device_register(&at91sam9rl_rtc_device); | ||
400 | } | ||
401 | #else | ||
402 | static void __init at91_add_device_rtc(void) {} | ||
403 | #endif | ||
404 | |||
405 | |||
406 | /* -------------------------------------------------------------------- | ||
407 | * RTT | ||
408 | * -------------------------------------------------------------------- */ | ||
409 | |||
410 | static struct resource rtt_resources[] = { | ||
411 | { | ||
412 | .start = AT91_BASE_SYS + AT91_RTT, | ||
413 | .end = AT91_BASE_SYS + AT91_RTT + SZ_16 - 1, | ||
414 | .flags = IORESOURCE_MEM, | ||
415 | } | ||
416 | }; | ||
417 | |||
418 | static struct platform_device at91sam9rl_rtt_device = { | ||
419 | .name = "at91_rtt", | ||
420 | .id = -1, | ||
421 | .resource = rtt_resources, | ||
422 | .num_resources = ARRAY_SIZE(rtt_resources), | ||
423 | }; | ||
424 | |||
425 | static void __init at91_add_device_rtt(void) | ||
426 | { | ||
427 | platform_device_register(&at91sam9rl_rtt_device); | ||
428 | } | ||
429 | |||
430 | |||
431 | /* -------------------------------------------------------------------- | ||
432 | * Watchdog | ||
433 | * -------------------------------------------------------------------- */ | ||
434 | |||
435 | #if defined(CONFIG_AT91SAM9_WATCHDOG) || defined(CONFIG_AT91SAM9_WATCHDOG_MODULE) | ||
436 | static struct platform_device at91sam9rl_wdt_device = { | ||
437 | .name = "at91_wdt", | ||
438 | .id = -1, | ||
439 | .num_resources = 0, | ||
440 | }; | ||
441 | |||
442 | static void __init at91_add_device_watchdog(void) | ||
443 | { | ||
444 | platform_device_register(&at91sam9rl_wdt_device); | ||
445 | } | ||
446 | #else | ||
447 | static void __init at91_add_device_watchdog(void) {} | ||
448 | #endif | ||
449 | |||
450 | |||
451 | /* -------------------------------------------------------------------- | ||
387 | * LEDs | 452 | * LEDs |
388 | * -------------------------------------------------------------------- */ | 453 | * -------------------------------------------------------------------- */ |
389 | 454 | ||
@@ -659,6 +724,9 @@ void __init at91_add_device_serial(void) {} | |||
659 | */ | 724 | */ |
660 | static int __init at91_add_standard_devices(void) | 725 | static int __init at91_add_standard_devices(void) |
661 | { | 726 | { |
727 | at91_add_device_rtc(); | ||
728 | at91_add_device_rtt(); | ||
729 | at91_add_device_watchdog(); | ||
662 | return 0; | 730 | return 0; |
663 | } | 731 | } |
664 | 732 | ||