aboutsummaryrefslogtreecommitdiffstats
path: root/arch/arm/mach-at91/at91sam9263_devices.c
diff options
context:
space:
mode:
authorJean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>2012-02-15 08:24:46 -0500
committerNicolas Ferre <nicolas.ferre@atmel.com>2012-02-23 08:57:58 -0500
commitb3af8b49befdcc53cb5d89e57662c359bc0b6989 (patch)
tree7c53b06733ae3f00a4971b0a3e7f4deee83169d1 /arch/arm/mach-at91/at91sam9263_devices.c
parent4e9267f1b42b4f7b66214161b55f1f73365692cd (diff)
ARM: at91/rtc-at91sam9: pass the GPBR to use via resources
The GPBR registers are used for storing RTC values. The GPBR registers to use are now provided using standard resource entry. The array is filled in SoC specific code. rtc-at91sam9 RTT as RTC driver is modified to retrieve this information. Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> [nicolas.ferre@atmel.com: rework resources assignment] Signed-off-by: Nicolas Ferre <nicolas.ferre@atmel.com> Reviewed-by: Ryan Mallon <rmallon@gmail.com>
Diffstat (limited to 'arch/arm/mach-at91/at91sam9263_devices.c')
-rw-r--r--arch/arm/mach-at91/at91sam9263_devices.c30
1 files changed, 25 insertions, 5 deletions
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
980static struct resource rtt1_resources[] = { 981static 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)
996static void __init at91_add_device_rtt_rtc(void) 998static 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
1016static void __init at91_add_device_rtt_rtc(void) {} 1031static 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
1019static void __init at91_add_device_rtt(void) 1039static void __init at91_add_device_rtt(void)