diff options
-rw-r--r-- | arch/arm/mach-at91/at91sam9260_devices.c | 19 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam9261_devices.c | 17 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam9263_devices.c | 30 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam9g45_devices.c | 17 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam9rl_devices.c | 17 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/at91sam9260.h | 5 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/at91sam9261.h | 5 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/at91sam9263.h | 5 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/at91sam9g45.h | 5 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/at91sam9rl.h | 2 | ||||
-rw-r--r-- | drivers/rtc/rtc-at91sam9.c | 24 |
11 files changed, 114 insertions, 32 deletions
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c index 2071017a475a..34d2f5a58b4b 100644 --- a/arch/arm/mach-at91/at91sam9260_devices.c +++ b/arch/arm/mach-at91/at91sam9260_devices.c | |||
@@ -718,14 +718,15 @@ static struct resource rtt_resources[] = { | |||
718 | .start = AT91SAM9260_BASE_RTT, | 718 | .start = AT91SAM9260_BASE_RTT, |
719 | .end = AT91SAM9260_BASE_RTT + SZ_16 - 1, | 719 | .end = AT91SAM9260_BASE_RTT + SZ_16 - 1, |
720 | .flags = IORESOURCE_MEM, | 720 | .flags = IORESOURCE_MEM, |
721 | } | 721 | }, { |
722 | .flags = IORESOURCE_MEM, | ||
723 | }, | ||
722 | }; | 724 | }; |
723 | 725 | ||
724 | static struct platform_device at91sam9260_rtt_device = { | 726 | static struct platform_device at91sam9260_rtt_device = { |
725 | .name = "at91_rtt", | 727 | .name = "at91_rtt", |
726 | .id = 0, | 728 | .id = 0, |
727 | .resource = rtt_resources, | 729 | .resource = rtt_resources, |
728 | .num_resources = ARRAY_SIZE(rtt_resources), | ||
729 | }; | 730 | }; |
730 | 731 | ||
731 | 732 | ||
@@ -733,9 +734,21 @@ static struct platform_device at91sam9260_rtt_device = { | |||
733 | static void __init at91_add_device_rtt_rtc(void) | 734 | static void __init at91_add_device_rtt_rtc(void) |
734 | { | 735 | { |
735 | at91sam9260_rtt_device.name = "rtc-at91sam9"; | 736 | at91sam9260_rtt_device.name = "rtc-at91sam9"; |
737 | /* | ||
738 | * The second resource is needed: | ||
739 | * GPBR will serve as the storage for RTC time offset | ||
740 | */ | ||
741 | at91sam9260_rtt_device.num_resources = 2; | ||
742 | rtt_resources[1].start = AT91SAM9260_BASE_GPBR + | ||
743 | 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR; | ||
744 | rtt_resources[1].end = rtt_resources[1].start + 3; | ||
736 | } | 745 | } |
737 | #else | 746 | #else |
738 | static void __init at91_add_device_rtt_rtc(void) {} | 747 | static void __init at91_add_device_rtt_rtc(void) |
748 | { | ||
749 | /* Only one resource is needed: RTT not used as RTC */ | ||
750 | at91sam9260_rtt_device.num_resources = 1; | ||
751 | } | ||
739 | #endif | 752 | #endif |
740 | 753 | ||
741 | static void __init at91_add_device_rtt(void) | 754 | static void __init at91_add_device_rtt(void) |
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c index b3ceb97d722d..b9c06c408aba 100644 --- a/arch/arm/mach-at91/at91sam9261_devices.c +++ b/arch/arm/mach-at91/at91sam9261_devices.c | |||
@@ -604,6 +604,8 @@ static struct resource rtt_resources[] = { | |||
604 | .start = AT91SAM9261_BASE_RTT, | 604 | .start = AT91SAM9261_BASE_RTT, |
605 | .end = AT91SAM9261_BASE_RTT + SZ_16 - 1, | 605 | .end = AT91SAM9261_BASE_RTT + SZ_16 - 1, |
606 | .flags = IORESOURCE_MEM, | 606 | .flags = IORESOURCE_MEM, |
607 | }, { | ||
608 | .flags = IORESOURCE_MEM, | ||
607 | } | 609 | } |
608 | }; | 610 | }; |
609 | 611 | ||
@@ -611,16 +613,27 @@ static struct platform_device at91sam9261_rtt_device = { | |||
611 | .name = "at91_rtt", | 613 | .name = "at91_rtt", |
612 | .id = 0, | 614 | .id = 0, |
613 | .resource = rtt_resources, | 615 | .resource = rtt_resources, |
614 | .num_resources = ARRAY_SIZE(rtt_resources), | ||
615 | }; | 616 | }; |
616 | 617 | ||
617 | #if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9) | 618 | #if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9) |
618 | static void __init at91_add_device_rtt_rtc(void) | 619 | static void __init at91_add_device_rtt_rtc(void) |
619 | { | 620 | { |
620 | at91sam9261_rtt_device.name = "rtc-at91sam9"; | 621 | at91sam9261_rtt_device.name = "rtc-at91sam9"; |
622 | /* | ||
623 | * The second resource is needed: | ||
624 | * GPBR will serve as the storage for RTC time offset | ||
625 | */ | ||
626 | at91sam9261_rtt_device.num_resources = 2; | ||
627 | rtt_resources[1].start = AT91SAM9261_BASE_GPBR + | ||
628 | 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR; | ||
629 | rtt_resources[1].end = rtt_resources[1].start + 3; | ||
621 | } | 630 | } |
622 | #else | 631 | #else |
623 | static void __init at91_add_device_rtt_rtc(void) {} | 632 | static void __init at91_add_device_rtt_rtc(void) |
633 | { | ||
634 | /* Only one resource is needed: RTT not used as RTC */ | ||
635 | at91sam9261_rtt_device.num_resources = 1; | ||
636 | } | ||
624 | #endif | 637 | #endif |
625 | 638 | ||
626 | static void __init at91_add_device_rtt(void) | 639 | static void __init at91_add_device_rtt(void) |
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c index b4a6adb39b22..a8ae6f507eed 100644 --- a/arch/arm/mach-at91/at91sam9263_devices.c +++ b/arch/arm/mach-at91/at91sam9263_devices.c | |||
@@ -967,6 +967,8 @@ static struct resource rtt0_resources[] = { | |||
967 | .start = AT91SAM9263_BASE_RTT0, | 967 | .start = AT91SAM9263_BASE_RTT0, |
968 | .end = AT91SAM9263_BASE_RTT0 + SZ_16 - 1, | 968 | .end = AT91SAM9263_BASE_RTT0 + SZ_16 - 1, |
969 | .flags = IORESOURCE_MEM, | 969 | .flags = IORESOURCE_MEM, |
970 | }, { | ||
971 | .flags = IORESOURCE_MEM, | ||
970 | } | 972 | } |
971 | }; | 973 | }; |
972 | 974 | ||
@@ -974,7 +976,6 @@ static struct platform_device at91sam9263_rtt0_device = { | |||
974 | .name = "at91_rtt", | 976 | .name = "at91_rtt", |
975 | .id = 0, | 977 | .id = 0, |
976 | .resource = rtt0_resources, | 978 | .resource = rtt0_resources, |
977 | .num_resources = ARRAY_SIZE(rtt0_resources), | ||
978 | }; | 979 | }; |
979 | 980 | ||
980 | static struct resource rtt1_resources[] = { | 981 | static struct resource rtt1_resources[] = { |
@@ -982,6 +983,8 @@ static struct resource rtt1_resources[] = { | |||
982 | .start = AT91SAM9263_BASE_RTT1, | 983 | .start = AT91SAM9263_BASE_RTT1, |
983 | .end = AT91SAM9263_BASE_RTT1 + SZ_16 - 1, | 984 | .end = AT91SAM9263_BASE_RTT1 + SZ_16 - 1, |
984 | .flags = IORESOURCE_MEM, | 985 | .flags = IORESOURCE_MEM, |
986 | }, { | ||
987 | .flags = IORESOURCE_MEM, | ||
985 | } | 988 | } |
986 | }; | 989 | }; |
987 | 990 | ||
@@ -989,31 +992,48 @@ static struct platform_device at91sam9263_rtt1_device = { | |||
989 | .name = "at91_rtt", | 992 | .name = "at91_rtt", |
990 | .id = 1, | 993 | .id = 1, |
991 | .resource = rtt1_resources, | 994 | .resource = rtt1_resources, |
992 | .num_resources = ARRAY_SIZE(rtt1_resources), | ||
993 | }; | 995 | }; |
994 | 996 | ||
995 | #if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9) | 997 | #if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9) |
996 | static void __init at91_add_device_rtt_rtc(void) | 998 | static void __init at91_add_device_rtt_rtc(void) |
997 | { | 999 | { |
998 | struct platform_device *pdev; | 1000 | struct platform_device *pdev; |
1001 | struct resource *r; | ||
999 | 1002 | ||
1000 | switch (CONFIG_RTC_DRV_AT91SAM9_RTT) { | 1003 | switch (CONFIG_RTC_DRV_AT91SAM9_RTT) { |
1001 | case 0: | 1004 | case 0: |
1005 | /* | ||
1006 | * The second resource is needed only for the chosen RTT: | ||
1007 | * GPBR will serve as the storage for RTC time offset | ||
1008 | */ | ||
1009 | at91sam9263_rtt0_device.num_resources = 2; | ||
1010 | at91sam9263_rtt1_device.num_resources = 1; | ||
1002 | pdev = &at91sam9263_rtt0_device; | 1011 | pdev = &at91sam9263_rtt0_device; |
1012 | r = rtt0_resources; | ||
1003 | break; | 1013 | break; |
1004 | case 1: | 1014 | case 1: |
1015 | at91sam9263_rtt0_device.num_resources = 1; | ||
1016 | at91sam9263_rtt1_device.num_resources = 2; | ||
1005 | pdev = &at91sam9263_rtt1_device; | 1017 | pdev = &at91sam9263_rtt1_device; |
1018 | r = rtt1_resources; | ||
1006 | break; | 1019 | break; |
1007 | default: | 1020 | default: |
1008 | pr_err("at91sam9263: support only 2 RTT (%d)\n", | 1021 | pr_err("at91sam9263: only supports 2 RTT (%d)\n", |
1009 | CONFIG_RTC_DRV_AT91SAM9_RTT); | 1022 | CONFIG_RTC_DRV_AT91SAM9_RTT); |
1010 | return; | 1023 | return; |
1011 | } | 1024 | } |
1012 | 1025 | ||
1013 | pdev->name = "rtc-at91sam9"; | 1026 | pdev->name = "rtc-at91sam9"; |
1027 | r[1].start = AT91SAM9263_BASE_GPBR + 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR; | ||
1028 | r[1].end = r[1].start + 3; | ||
1014 | } | 1029 | } |
1015 | #else | 1030 | #else |
1016 | static void __init at91_add_device_rtt_rtc(void) {} | 1031 | static void __init at91_add_device_rtt_rtc(void) |
1032 | { | ||
1033 | /* Only one resource is needed: RTT not used as RTC */ | ||
1034 | at91sam9263_rtt0_device.num_resources = 1; | ||
1035 | at91sam9263_rtt1_device.num_resources = 1; | ||
1036 | } | ||
1017 | #endif | 1037 | #endif |
1018 | 1038 | ||
1019 | static void __init at91_add_device_rtt(void) | 1039 | static void __init at91_add_device_rtt(void) |
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c index 81d1adf1d978..98e40418fda1 100644 --- a/arch/arm/mach-at91/at91sam9g45_devices.c +++ b/arch/arm/mach-at91/at91sam9g45_devices.c | |||
@@ -1194,6 +1194,8 @@ static struct resource rtt_resources[] = { | |||
1194 | .start = AT91SAM9G45_BASE_RTT, | 1194 | .start = AT91SAM9G45_BASE_RTT, |
1195 | .end = AT91SAM9G45_BASE_RTT + SZ_16 - 1, | 1195 | .end = AT91SAM9G45_BASE_RTT + SZ_16 - 1, |
1196 | .flags = IORESOURCE_MEM, | 1196 | .flags = IORESOURCE_MEM, |
1197 | }, { | ||
1198 | .flags = IORESOURCE_MEM, | ||
1197 | } | 1199 | } |
1198 | }; | 1200 | }; |
1199 | 1201 | ||
@@ -1201,16 +1203,27 @@ static struct platform_device at91sam9g45_rtt_device = { | |||
1201 | .name = "at91_rtt", | 1203 | .name = "at91_rtt", |
1202 | .id = 0, | 1204 | .id = 0, |
1203 | .resource = rtt_resources, | 1205 | .resource = rtt_resources, |
1204 | .num_resources = ARRAY_SIZE(rtt_resources), | ||
1205 | }; | 1206 | }; |
1206 | 1207 | ||
1207 | #if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9) | 1208 | #if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9) |
1208 | static void __init at91_add_device_rtt_rtc(void) | 1209 | static void __init at91_add_device_rtt_rtc(void) |
1209 | { | 1210 | { |
1210 | at91sam9g45_rtt_device.name = "rtc-at91sam9"; | 1211 | at91sam9g45_rtt_device.name = "rtc-at91sam9"; |
1212 | /* | ||
1213 | * The second resource is needed: | ||
1214 | * GPBR will serve as the storage for RTC time offset | ||
1215 | */ | ||
1216 | at91sam9g45_rtt_device.num_resources = 2; | ||
1217 | rtt_resources[1].start = AT91SAM9G45_BASE_GPBR + | ||
1218 | 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR; | ||
1219 | rtt_resources[1].end = rtt_resources[1].start + 3; | ||
1211 | } | 1220 | } |
1212 | #else | 1221 | #else |
1213 | static void __init at91_add_device_rtt_rtc(void) {} | 1222 | static void __init at91_add_device_rtt_rtc(void) |
1223 | { | ||
1224 | /* Only one resource is needed: RTT not used as RTC */ | ||
1225 | at91sam9g45_rtt_device.num_resources = 1; | ||
1226 | } | ||
1214 | #endif | 1227 | #endif |
1215 | 1228 | ||
1216 | static void __init at91_add_device_rtt(void) | 1229 | static void __init at91_add_device_rtt(void) |
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c index dd248c837a77..342a6c51ed3b 100644 --- a/arch/arm/mach-at91/at91sam9rl_devices.c +++ b/arch/arm/mach-at91/at91sam9rl_devices.c | |||
@@ -683,6 +683,8 @@ static struct resource rtt_resources[] = { | |||
683 | .start = AT91SAM9RL_BASE_RTT, | 683 | .start = AT91SAM9RL_BASE_RTT, |
684 | .end = AT91SAM9RL_BASE_RTT + SZ_16 - 1, | 684 | .end = AT91SAM9RL_BASE_RTT + SZ_16 - 1, |
685 | .flags = IORESOURCE_MEM, | 685 | .flags = IORESOURCE_MEM, |
686 | }, { | ||
687 | .flags = IORESOURCE_MEM, | ||
686 | } | 688 | } |
687 | }; | 689 | }; |
688 | 690 | ||
@@ -690,16 +692,27 @@ static struct platform_device at91sam9rl_rtt_device = { | |||
690 | .name = "at91_rtt", | 692 | .name = "at91_rtt", |
691 | .id = 0, | 693 | .id = 0, |
692 | .resource = rtt_resources, | 694 | .resource = rtt_resources, |
693 | .num_resources = ARRAY_SIZE(rtt_resources), | ||
694 | }; | 695 | }; |
695 | 696 | ||
696 | #if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9) | 697 | #if IS_ENABLED(CONFIG_RTC_DRV_AT91SAM9) |
697 | static void __init at91_add_device_rtt_rtc(void) | 698 | static void __init at91_add_device_rtt_rtc(void) |
698 | { | 699 | { |
699 | at91sam9rl_rtt_device.name = "rtc-at91sam9"; | 700 | at91sam9rl_rtt_device.name = "rtc-at91sam9"; |
701 | /* | ||
702 | * The second resource is needed: | ||
703 | * GPBR will serve as the storage for RTC time offset | ||
704 | */ | ||
705 | at91sam9rl_rtt_device.num_resources = 2; | ||
706 | rtt_resources[1].start = AT91SAM9RL_BASE_GPBR + | ||
707 | 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR; | ||
708 | rtt_resources[1].end = rtt_resources[1].start + 3; | ||
700 | } | 709 | } |
701 | #else | 710 | #else |
702 | static void __init at91_add_device_rtt_rtc(void) {} | 711 | static void __init at91_add_device_rtt_rtc(void) |
712 | { | ||
713 | /* Only one resource is needed: RTT not used as RTC */ | ||
714 | at91sam9rl_rtt_device.num_resources = 1; | ||
715 | } | ||
703 | #endif | 716 | #endif |
704 | 717 | ||
705 | static void __init at91_add_device_rtt(void) | 718 | static void __init at91_add_device_rtt(void) |
diff --git a/arch/arm/mach-at91/include/mach/at91sam9260.h b/arch/arm/mach-at91/include/mach/at91sam9260.h index 1524e87c0043..2e47b6d19ab9 100644 --- a/arch/arm/mach-at91/include/mach/at91sam9260.h +++ b/arch/arm/mach-at91/include/mach/at91sam9260.h | |||
@@ -78,10 +78,8 @@ | |||
78 | #define AT91SAM9260_BASE_ADC 0xfffe0000 | 78 | #define AT91SAM9260_BASE_ADC 0xfffe0000 |
79 | 79 | ||
80 | /* | 80 | /* |
81 | * System Peripherals (offset from AT91_BASE_SYS) | 81 | * System Peripherals |
82 | */ | 82 | */ |
83 | #define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) | ||
84 | |||
85 | #define AT91SAM9260_BASE_ECC 0xffffe800 | 83 | #define AT91SAM9260_BASE_ECC 0xffffe800 |
86 | #define AT91SAM9260_BASE_SDRAMC 0xffffea00 | 84 | #define AT91SAM9260_BASE_SDRAMC 0xffffea00 |
87 | #define AT91SAM9260_BASE_SMC 0xffffec00 | 85 | #define AT91SAM9260_BASE_SMC 0xffffec00 |
@@ -95,6 +93,7 @@ | |||
95 | #define AT91SAM9260_BASE_RTT 0xfffffd20 | 93 | #define AT91SAM9260_BASE_RTT 0xfffffd20 |
96 | #define AT91SAM9260_BASE_PIT 0xfffffd30 | 94 | #define AT91SAM9260_BASE_PIT 0xfffffd30 |
97 | #define AT91SAM9260_BASE_WDT 0xfffffd40 | 95 | #define AT91SAM9260_BASE_WDT 0xfffffd40 |
96 | #define AT91SAM9260_BASE_GPBR 0xfffffd50 | ||
98 | 97 | ||
99 | #define AT91_USART0 AT91SAM9260_BASE_US0 | 98 | #define AT91_USART0 AT91SAM9260_BASE_US0 |
100 | #define AT91_USART1 AT91SAM9260_BASE_US1 | 99 | #define AT91_USART1 AT91SAM9260_BASE_US1 |
diff --git a/arch/arm/mach-at91/include/mach/at91sam9261.h b/arch/arm/mach-at91/include/mach/at91sam9261.h index a6a3c1d4bc7f..44fbdc12ee62 100644 --- a/arch/arm/mach-at91/include/mach/at91sam9261.h +++ b/arch/arm/mach-at91/include/mach/at91sam9261.h | |||
@@ -63,10 +63,8 @@ | |||
63 | 63 | ||
64 | 64 | ||
65 | /* | 65 | /* |
66 | * System Peripherals (offset from AT91_BASE_SYS) | 66 | * System Peripherals |
67 | */ | 67 | */ |
68 | #define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) | ||
69 | |||
70 | #define AT91SAM9261_BASE_SMC 0xffffec00 | 68 | #define AT91SAM9261_BASE_SMC 0xffffec00 |
71 | #define AT91SAM9261_BASE_MATRIX 0xffffee00 | 69 | #define AT91SAM9261_BASE_MATRIX 0xffffee00 |
72 | #define AT91SAM9261_BASE_SDRAMC 0xffffea00 | 70 | #define AT91SAM9261_BASE_SDRAMC 0xffffea00 |
@@ -79,6 +77,7 @@ | |||
79 | #define AT91SAM9261_BASE_RTT 0xfffffd20 | 77 | #define AT91SAM9261_BASE_RTT 0xfffffd20 |
80 | #define AT91SAM9261_BASE_PIT 0xfffffd30 | 78 | #define AT91SAM9261_BASE_PIT 0xfffffd30 |
81 | #define AT91SAM9261_BASE_WDT 0xfffffd40 | 79 | #define AT91SAM9261_BASE_WDT 0xfffffd40 |
80 | #define AT91SAM9261_BASE_GPBR 0xfffffd50 | ||
82 | 81 | ||
83 | #define AT91_USART0 AT91SAM9261_BASE_US0 | 82 | #define AT91_USART0 AT91SAM9261_BASE_US0 |
84 | #define AT91_USART1 AT91SAM9261_BASE_US1 | 83 | #define AT91_USART1 AT91SAM9261_BASE_US1 |
diff --git a/arch/arm/mach-at91/include/mach/at91sam9263.h b/arch/arm/mach-at91/include/mach/at91sam9263.h index dda083d1a66b..d96cbb2e03c4 100644 --- a/arch/arm/mach-at91/include/mach/at91sam9263.h +++ b/arch/arm/mach-at91/include/mach/at91sam9263.h | |||
@@ -72,10 +72,8 @@ | |||
72 | #define AT91SAM9263_BASE_2DGE 0xfffc8000 | 72 | #define AT91SAM9263_BASE_2DGE 0xfffc8000 |
73 | 73 | ||
74 | /* | 74 | /* |
75 | * System Peripherals (offset from AT91_BASE_SYS) | 75 | * System Peripherals |
76 | */ | 76 | */ |
77 | #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) | ||
78 | |||
79 | #define AT91SAM9263_BASE_ECC0 0xffffe000 | 77 | #define AT91SAM9263_BASE_ECC0 0xffffe000 |
80 | #define AT91SAM9263_BASE_SDRAMC0 0xffffe200 | 78 | #define AT91SAM9263_BASE_SDRAMC0 0xffffe200 |
81 | #define AT91SAM9263_BASE_SMC0 0xffffe400 | 79 | #define AT91SAM9263_BASE_SMC0 0xffffe400 |
@@ -95,6 +93,7 @@ | |||
95 | #define AT91SAM9263_BASE_PIT 0xfffffd30 | 93 | #define AT91SAM9263_BASE_PIT 0xfffffd30 |
96 | #define AT91SAM9263_BASE_WDT 0xfffffd40 | 94 | #define AT91SAM9263_BASE_WDT 0xfffffd40 |
97 | #define AT91SAM9263_BASE_RTT1 0xfffffd50 | 95 | #define AT91SAM9263_BASE_RTT1 0xfffffd50 |
96 | #define AT91SAM9263_BASE_GPBR 0xfffffd60 | ||
98 | 97 | ||
99 | #define AT91_USART0 AT91SAM9263_BASE_US0 | 98 | #define AT91_USART0 AT91SAM9263_BASE_US0 |
100 | #define AT91_USART1 AT91SAM9263_BASE_US1 | 99 | #define AT91_USART1 AT91SAM9263_BASE_US1 |
diff --git a/arch/arm/mach-at91/include/mach/at91sam9g45.h b/arch/arm/mach-at91/include/mach/at91sam9g45.h index a824e15bf00d..d052abcff852 100644 --- a/arch/arm/mach-at91/include/mach/at91sam9g45.h +++ b/arch/arm/mach-at91/include/mach/at91sam9g45.h | |||
@@ -84,10 +84,8 @@ | |||
84 | #define AT91SAM9G45_BASE_TC5 0xfffd4080 | 84 | #define AT91SAM9G45_BASE_TC5 0xfffd4080 |
85 | 85 | ||
86 | /* | 86 | /* |
87 | * System Peripherals (offset from AT91_BASE_SYS) | 87 | * System Peripherals |
88 | */ | 88 | */ |
89 | #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) | ||
90 | |||
91 | #define AT91SAM9G45_BASE_ECC 0xffffe200 | 89 | #define AT91SAM9G45_BASE_ECC 0xffffe200 |
92 | #define AT91SAM9G45_BASE_DDRSDRC1 0xffffe400 | 90 | #define AT91SAM9G45_BASE_DDRSDRC1 0xffffe400 |
93 | #define AT91SAM9G45_BASE_DDRSDRC0 0xffffe600 | 91 | #define AT91SAM9G45_BASE_DDRSDRC0 0xffffe600 |
@@ -106,6 +104,7 @@ | |||
106 | #define AT91SAM9G45_BASE_PIT 0xfffffd30 | 104 | #define AT91SAM9G45_BASE_PIT 0xfffffd30 |
107 | #define AT91SAM9G45_BASE_WDT 0xfffffd40 | 105 | #define AT91SAM9G45_BASE_WDT 0xfffffd40 |
108 | #define AT91SAM9G45_BASE_RTC 0xfffffdb0 | 106 | #define AT91SAM9G45_BASE_RTC 0xfffffdb0 |
107 | #define AT91SAM9G45_BASE_GPBR 0xfffffd60 | ||
109 | 108 | ||
110 | #define AT91_USART0 AT91SAM9G45_BASE_US0 | 109 | #define AT91_USART0 AT91SAM9G45_BASE_US0 |
111 | #define AT91_USART1 AT91SAM9G45_BASE_US1 | 110 | #define AT91_USART1 AT91SAM9G45_BASE_US1 |
diff --git a/arch/arm/mach-at91/include/mach/at91sam9rl.h b/arch/arm/mach-at91/include/mach/at91sam9rl.h index 2d7176ac9002..e0073eb10144 100644 --- a/arch/arm/mach-at91/include/mach/at91sam9rl.h +++ b/arch/arm/mach-at91/include/mach/at91sam9rl.h | |||
@@ -70,7 +70,6 @@ | |||
70 | * System Peripherals (offset from AT91_BASE_SYS) | 70 | * System Peripherals (offset from AT91_BASE_SYS) |
71 | */ | 71 | */ |
72 | #define AT91_SCKCR (0xfffffd50 - AT91_BASE_SYS) | 72 | #define AT91_SCKCR (0xfffffd50 - AT91_BASE_SYS) |
73 | #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) | ||
74 | 73 | ||
75 | #define AT91SAM9RL_BASE_DMA 0xffffe600 | 74 | #define AT91SAM9RL_BASE_DMA 0xffffe600 |
76 | #define AT91SAM9RL_BASE_ECC 0xffffe800 | 75 | #define AT91SAM9RL_BASE_ECC 0xffffe800 |
@@ -87,6 +86,7 @@ | |||
87 | #define AT91SAM9RL_BASE_RTT 0xfffffd20 | 86 | #define AT91SAM9RL_BASE_RTT 0xfffffd20 |
88 | #define AT91SAM9RL_BASE_PIT 0xfffffd30 | 87 | #define AT91SAM9RL_BASE_PIT 0xfffffd30 |
89 | #define AT91SAM9RL_BASE_WDT 0xfffffd40 | 88 | #define AT91SAM9RL_BASE_WDT 0xfffffd40 |
89 | #define AT91SAM9RL_BASE_GPBR 0xfffffd60 | ||
90 | #define AT91SAM9RL_BASE_RTC 0xfffffe00 | 90 | #define AT91SAM9RL_BASE_RTC 0xfffffe00 |
91 | 91 | ||
92 | #define AT91_USART0 AT91SAM9RL_BASE_US0 | 92 | #define AT91_USART0 AT91SAM9RL_BASE_US0 |
diff --git a/drivers/rtc/rtc-at91sam9.c b/drivers/rtc/rtc-at91sam9.c index 08b69fdf2a7e..729fb843a2fc 100644 --- a/drivers/rtc/rtc-at91sam9.c +++ b/drivers/rtc/rtc-at91sam9.c | |||
@@ -57,6 +57,7 @@ struct sam9_rtc { | |||
57 | void __iomem *rtt; | 57 | void __iomem *rtt; |
58 | struct rtc_device *rtcdev; | 58 | struct rtc_device *rtcdev; |
59 | u32 imr; | 59 | u32 imr; |
60 | void __iomem *gpbr; | ||
60 | }; | 61 | }; |
61 | 62 | ||
62 | #define rtt_readl(rtc, field) \ | 63 | #define rtt_readl(rtc, field) \ |
@@ -65,9 +66,9 @@ struct sam9_rtc { | |||
65 | __raw_writel((val), (rtc)->rtt + AT91_RTT_ ## field) | 66 | __raw_writel((val), (rtc)->rtt + AT91_RTT_ ## field) |
66 | 67 | ||
67 | #define gpbr_readl(rtc) \ | 68 | #define gpbr_readl(rtc) \ |
68 | at91_sys_read(AT91_GPBR + 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR) | 69 | __raw_readl((rtc)->gpbr) |
69 | #define gpbr_writel(rtc, val) \ | 70 | #define gpbr_writel(rtc, val) \ |
70 | at91_sys_write(AT91_GPBR + 4 * CONFIG_RTC_DRV_AT91SAM9_GPBR, (val)) | 71 | __raw_writel((val), (rtc)->gpbr) |
71 | 72 | ||
72 | /* | 73 | /* |
73 | * Read current time and date in RTC | 74 | * Read current time and date in RTC |
@@ -289,14 +290,17 @@ static const struct rtc_class_ops at91_rtc_ops = { | |||
289 | */ | 290 | */ |
290 | static int __devinit at91_rtc_probe(struct platform_device *pdev) | 291 | static int __devinit at91_rtc_probe(struct platform_device *pdev) |
291 | { | 292 | { |
292 | struct resource *r; | 293 | struct resource *r, *r_gpbr; |
293 | struct sam9_rtc *rtc; | 294 | struct sam9_rtc *rtc; |
294 | int ret; | 295 | int ret; |
295 | u32 mr; | 296 | u32 mr; |
296 | 297 | ||
297 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | 298 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); |
298 | if (!r) | 299 | r_gpbr = platform_get_resource(pdev, IORESOURCE_MEM, 1); |
300 | if (!r || !r_gpbr) { | ||
301 | dev_err(&pdev->dev, "need 2 ressources\n"); | ||
299 | return -ENODEV; | 302 | return -ENODEV; |
303 | } | ||
300 | 304 | ||
301 | rtc = kzalloc(sizeof *rtc, GFP_KERNEL); | 305 | rtc = kzalloc(sizeof *rtc, GFP_KERNEL); |
302 | if (!rtc) | 306 | if (!rtc) |
@@ -314,6 +318,13 @@ static int __devinit at91_rtc_probe(struct platform_device *pdev) | |||
314 | goto fail; | 318 | goto fail; |
315 | } | 319 | } |
316 | 320 | ||
321 | rtc->gpbr = ioremap(r_gpbr->start, resource_size(r_gpbr)); | ||
322 | if (!rtc->gpbr) { | ||
323 | dev_err(&pdev->dev, "failed to map gpbr registers, aborting.\n"); | ||
324 | ret = -ENOMEM; | ||
325 | goto fail_gpbr; | ||
326 | } | ||
327 | |||
317 | mr = rtt_readl(rtc, MR); | 328 | mr = rtt_readl(rtc, MR); |
318 | 329 | ||
319 | /* unless RTT is counting at 1 Hz, re-initialize it */ | 330 | /* unless RTT is counting at 1 Hz, re-initialize it */ |
@@ -340,7 +351,7 @@ static int __devinit at91_rtc_probe(struct platform_device *pdev) | |||
340 | if (ret) { | 351 | if (ret) { |
341 | dev_dbg(&pdev->dev, "can't share IRQ %d?\n", AT91_ID_SYS); | 352 | dev_dbg(&pdev->dev, "can't share IRQ %d?\n", AT91_ID_SYS); |
342 | rtc_device_unregister(rtc->rtcdev); | 353 | rtc_device_unregister(rtc->rtcdev); |
343 | goto fail; | 354 | goto fail_register; |
344 | } | 355 | } |
345 | 356 | ||
346 | /* NOTE: sam9260 rev A silicon has a ROM bug which resets the | 357 | /* NOTE: sam9260 rev A silicon has a ROM bug which resets the |
@@ -356,6 +367,8 @@ static int __devinit at91_rtc_probe(struct platform_device *pdev) | |||
356 | return 0; | 367 | return 0; |
357 | 368 | ||
358 | fail_register: | 369 | fail_register: |
370 | iounmap(rtc->gpbr); | ||
371 | fail_gpbr: | ||
359 | iounmap(rtc->rtt); | 372 | iounmap(rtc->rtt); |
360 | fail: | 373 | fail: |
361 | platform_set_drvdata(pdev, NULL); | 374 | platform_set_drvdata(pdev, NULL); |
@@ -377,6 +390,7 @@ static int __devexit at91_rtc_remove(struct platform_device *pdev) | |||
377 | 390 | ||
378 | rtc_device_unregister(rtc->rtcdev); | 391 | rtc_device_unregister(rtc->rtcdev); |
379 | 392 | ||
393 | iounmap(rtc->gpbr); | ||
380 | iounmap(rtc->rtt); | 394 | iounmap(rtc->rtt); |
381 | platform_set_drvdata(pdev, NULL); | 395 | platform_set_drvdata(pdev, NULL); |
382 | kfree(rtc); | 396 | kfree(rtc); |