diff options
author | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2011-11-01 13:43:31 -0400 |
---|---|---|
committer | Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com> | 2011-11-28 09:50:39 -0500 |
commit | c1c30a29df7e47310caa979dc48f715ae478de5f (patch) | |
tree | bea09972cee59473033064e55a649105e86525a7 | |
parent | f22deee523e0ff49c3be01dd6f979d374230725a (diff) |
ARM: at91: make watchdog drivers soc independent
switch the watchdog drivers to resource and pass it via platform_device
Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Acked-by: Nicolas Ferre <nicolas.ferre@atmel.com>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
-rw-r--r-- | arch/arm/mach-at91/at91cap9_devices.c | 11 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam9260_devices.c | 11 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam9261_devices.c | 11 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam9263_devices.c | 11 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam9g45_devices.c | 11 | ||||
-rw-r--r-- | arch/arm/mach-at91/at91sam9rl_devices.c | 11 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/at91cap9.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/at91sam9260.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/at91sam9261.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/at91sam9263.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/at91sam9g45.h | 2 | ||||
-rw-r--r-- | arch/arm/mach-at91/include/mach/at91sam9rl.h | 2 | ||||
-rw-r--r-- | drivers/watchdog/at91sam9_wdt.c | 22 | ||||
-rw-r--r-- | drivers/watchdog/at91sam9_wdt.h | 6 |
14 files changed, 88 insertions, 18 deletions
diff --git a/arch/arm/mach-at91/at91cap9_devices.c b/arch/arm/mach-at91/at91cap9_devices.c index 3262a7edc9c7..019dac047b91 100644 --- a/arch/arm/mach-at91/at91cap9_devices.c +++ b/arch/arm/mach-at91/at91cap9_devices.c | |||
@@ -694,10 +694,19 @@ static void __init at91_add_device_rtt(void) | |||
694 | * -------------------------------------------------------------------- */ | 694 | * -------------------------------------------------------------------- */ |
695 | 695 | ||
696 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) | 696 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) |
697 | static struct resource wdt_resources[] = { | ||
698 | { | ||
699 | .start = AT91CAP9_BASE_WDT, | ||
700 | .end = AT91CAP9_BASE_WDT + SZ_16 - 1, | ||
701 | .flags = IORESOURCE_MEM, | ||
702 | } | ||
703 | }; | ||
704 | |||
697 | static struct platform_device at91cap9_wdt_device = { | 705 | static struct platform_device at91cap9_wdt_device = { |
698 | .name = "at91_wdt", | 706 | .name = "at91_wdt", |
699 | .id = -1, | 707 | .id = -1, |
700 | .num_resources = 0, | 708 | .resource = wdt_resources, |
709 | .num_resources = ARRAY_SIZE(wdt_resources), | ||
701 | }; | 710 | }; |
702 | 711 | ||
703 | static void __init at91_add_device_watchdog(void) | 712 | static void __init at91_add_device_watchdog(void) |
diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c index 63cbfb887fbf..9cdaffa0d6b1 100644 --- a/arch/arm/mach-at91/at91sam9260_devices.c +++ b/arch/arm/mach-at91/at91sam9260_devices.c | |||
@@ -738,10 +738,19 @@ static void __init at91_add_device_rtt(void) | |||
738 | * -------------------------------------------------------------------- */ | 738 | * -------------------------------------------------------------------- */ |
739 | 739 | ||
740 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) | 740 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) |
741 | static struct resource wdt_resources[] = { | ||
742 | { | ||
743 | .start = AT91SAM9260_BASE_WDT, | ||
744 | .end = AT91SAM9260_BASE_WDT + SZ_16 - 1, | ||
745 | .flags = IORESOURCE_MEM, | ||
746 | } | ||
747 | }; | ||
748 | |||
741 | static struct platform_device at91sam9260_wdt_device = { | 749 | static struct platform_device at91sam9260_wdt_device = { |
742 | .name = "at91_wdt", | 750 | .name = "at91_wdt", |
743 | .id = -1, | 751 | .id = -1, |
744 | .num_resources = 0, | 752 | .resource = wdt_resources, |
753 | .num_resources = ARRAY_SIZE(wdt_resources), | ||
745 | }; | 754 | }; |
746 | 755 | ||
747 | static void __init at91_add_device_watchdog(void) | 756 | static void __init at91_add_device_watchdog(void) |
diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c index d5bd1e704421..c59e1e9a4f5c 100644 --- a/arch/arm/mach-at91/at91sam9261_devices.c +++ b/arch/arm/mach-at91/at91sam9261_devices.c | |||
@@ -624,10 +624,19 @@ static void __init at91_add_device_rtt(void) | |||
624 | * -------------------------------------------------------------------- */ | 624 | * -------------------------------------------------------------------- */ |
625 | 625 | ||
626 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) | 626 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) |
627 | static struct resource wdt_resources[] = { | ||
628 | { | ||
629 | .start = AT91SAM9261_BASE_WDT, | ||
630 | .end = AT91SAM9261_BASE_WDT + SZ_16 - 1, | ||
631 | .flags = IORESOURCE_MEM, | ||
632 | } | ||
633 | }; | ||
634 | |||
627 | static struct platform_device at91sam9261_wdt_device = { | 635 | static struct platform_device at91sam9261_wdt_device = { |
628 | .name = "at91_wdt", | 636 | .name = "at91_wdt", |
629 | .id = -1, | 637 | .id = -1, |
630 | .num_resources = 0, | 638 | .resource = wdt_resources, |
639 | .num_resources = ARRAY_SIZE(wdt_resources), | ||
631 | }; | 640 | }; |
632 | 641 | ||
633 | static void __init at91_add_device_watchdog(void) | 642 | static void __init at91_add_device_watchdog(void) |
diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c index 5d2b061fcc64..b5f4e2532fdb 100644 --- a/arch/arm/mach-at91/at91sam9263_devices.c +++ b/arch/arm/mach-at91/at91sam9263_devices.c | |||
@@ -996,10 +996,19 @@ static void __init at91_add_device_rtt(void) | |||
996 | * -------------------------------------------------------------------- */ | 996 | * -------------------------------------------------------------------- */ |
997 | 997 | ||
998 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) | 998 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) |
999 | static struct resource wdt_resources[] = { | ||
1000 | { | ||
1001 | .start = AT91SAM9263_BASE_WDT, | ||
1002 | .end = AT91SAM9263_BASE_WDT + SZ_16 - 1, | ||
1003 | .flags = IORESOURCE_MEM, | ||
1004 | } | ||
1005 | }; | ||
1006 | |||
999 | static struct platform_device at91sam9263_wdt_device = { | 1007 | static struct platform_device at91sam9263_wdt_device = { |
1000 | .name = "at91_wdt", | 1008 | .name = "at91_wdt", |
1001 | .id = -1, | 1009 | .id = -1, |
1002 | .num_resources = 0, | 1010 | .resource = wdt_resources, |
1011 | .num_resources = ARRAY_SIZE(wdt_resources), | ||
1003 | }; | 1012 | }; |
1004 | 1013 | ||
1005 | static void __init at91_add_device_watchdog(void) | 1014 | static void __init at91_add_device_watchdog(void) |
diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c index bb2ba0c1d0ee..3b91706e4f7d 100644 --- a/arch/arm/mach-at91/at91sam9g45_devices.c +++ b/arch/arm/mach-at91/at91sam9g45_devices.c | |||
@@ -1133,10 +1133,19 @@ static void __init at91_add_device_trng(void) {} | |||
1133 | * -------------------------------------------------------------------- */ | 1133 | * -------------------------------------------------------------------- */ |
1134 | 1134 | ||
1135 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) | 1135 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) |
1136 | static struct resource wdt_resources[] = { | ||
1137 | { | ||
1138 | .start = AT91SAM9G45_BASE_WDT, | ||
1139 | .end = AT91SAM9G45_BASE_WDT + SZ_16 - 1, | ||
1140 | .flags = IORESOURCE_MEM, | ||
1141 | } | ||
1142 | }; | ||
1143 | |||
1136 | static struct platform_device at91sam9g45_wdt_device = { | 1144 | static struct platform_device at91sam9g45_wdt_device = { |
1137 | .name = "at91_wdt", | 1145 | .name = "at91_wdt", |
1138 | .id = -1, | 1146 | .id = -1, |
1139 | .num_resources = 0, | 1147 | .resource = wdt_resources, |
1148 | .num_resources = ARRAY_SIZE(wdt_resources), | ||
1140 | }; | 1149 | }; |
1141 | 1150 | ||
1142 | static void __init at91_add_device_watchdog(void) | 1151 | static void __init at91_add_device_watchdog(void) |
diff --git a/arch/arm/mach-at91/at91sam9rl_devices.c b/arch/arm/mach-at91/at91sam9rl_devices.c index f9b423b7d7ae..c7961b446dd8 100644 --- a/arch/arm/mach-at91/at91sam9rl_devices.c +++ b/arch/arm/mach-at91/at91sam9rl_devices.c | |||
@@ -709,10 +709,19 @@ static void __init at91_add_device_rtt(void) | |||
709 | * -------------------------------------------------------------------- */ | 709 | * -------------------------------------------------------------------- */ |
710 | 710 | ||
711 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) | 711 | #if defined(CONFIG_AT91SAM9X_WATCHDOG) || defined(CONFIG_AT91SAM9X_WATCHDOG_MODULE) |
712 | static struct resource wdt_resources[] = { | ||
713 | { | ||
714 | .start = AT91SAM9RL_BASE_WDT, | ||
715 | .end = AT91SAM9RL_BASE_WDT + SZ_16 - 1, | ||
716 | .flags = IORESOURCE_MEM, | ||
717 | } | ||
718 | }; | ||
719 | |||
712 | static struct platform_device at91sam9rl_wdt_device = { | 720 | static struct platform_device at91sam9rl_wdt_device = { |
713 | .name = "at91_wdt", | 721 | .name = "at91_wdt", |
714 | .id = -1, | 722 | .id = -1, |
715 | .num_resources = 0, | 723 | .resource = wdt_resources, |
724 | .num_resources = ARRAY_SIZE(wdt_resources), | ||
716 | }; | 725 | }; |
717 | 726 | ||
718 | static void __init at91_add_device_watchdog(void) | 727 | static void __init at91_add_device_watchdog(void) |
diff --git a/arch/arm/mach-at91/include/mach/at91cap9.h b/arch/arm/mach-at91/include/mach/at91cap9.h index 5ac468c219af..750ba85614ca 100644 --- a/arch/arm/mach-at91/include/mach/at91cap9.h +++ b/arch/arm/mach-at91/include/mach/at91cap9.h | |||
@@ -86,7 +86,6 @@ | |||
86 | #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) | 86 | #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) |
87 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) | 87 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) |
88 | #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) | 88 | #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) |
89 | #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) | ||
90 | #define AT91_GPBR (cpu_is_at91cap9_revB() ? \ | 89 | #define AT91_GPBR (cpu_is_at91cap9_revB() ? \ |
91 | (0xfffffd50 - AT91_BASE_SYS) : \ | 90 | (0xfffffd50 - AT91_BASE_SYS) : \ |
92 | (0xfffffd60 - AT91_BASE_SYS)) | 91 | (0xfffffd60 - AT91_BASE_SYS)) |
@@ -101,6 +100,7 @@ | |||
101 | #define AT91CAP9_BASE_SHDWC 0xfffffd10 | 100 | #define AT91CAP9_BASE_SHDWC 0xfffffd10 |
102 | #define AT91CAP9_BASE_RTT 0xfffffd20 | 101 | #define AT91CAP9_BASE_RTT 0xfffffd20 |
103 | #define AT91CAP9_BASE_PIT 0xfffffd30 | 102 | #define AT91CAP9_BASE_PIT 0xfffffd30 |
103 | #define AT91CAP9_BASE_WDT 0xfffffd40 | ||
104 | 104 | ||
105 | #define AT91_USART0 AT91CAP9_BASE_US0 | 105 | #define AT91_USART0 AT91CAP9_BASE_US0 |
106 | #define AT91_USART1 AT91CAP9_BASE_US1 | 106 | #define AT91_USART1 AT91CAP9_BASE_US1 |
diff --git a/arch/arm/mach-at91/include/mach/at91sam9260.h b/arch/arm/mach-at91/include/mach/at91sam9260.h index e3c819ab3435..05860c5eb548 100644 --- a/arch/arm/mach-at91/include/mach/at91sam9260.h +++ b/arch/arm/mach-at91/include/mach/at91sam9260.h | |||
@@ -86,7 +86,6 @@ | |||
86 | #define AT91_DBGU (0xfffff200 - AT91_BASE_SYS) | 86 | #define AT91_DBGU (0xfffff200 - AT91_BASE_SYS) |
87 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) | 87 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) |
88 | #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) | 88 | #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) |
89 | #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) | ||
90 | #define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) | 89 | #define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) |
91 | 90 | ||
92 | #define AT91SAM9260_BASE_ECC 0xffffe800 | 91 | #define AT91SAM9260_BASE_ECC 0xffffe800 |
@@ -97,6 +96,7 @@ | |||
97 | #define AT91SAM9260_BASE_SHDWC 0xfffffd10 | 96 | #define AT91SAM9260_BASE_SHDWC 0xfffffd10 |
98 | #define AT91SAM9260_BASE_RTT 0xfffffd20 | 97 | #define AT91SAM9260_BASE_RTT 0xfffffd20 |
99 | #define AT91SAM9260_BASE_PIT 0xfffffd30 | 98 | #define AT91SAM9260_BASE_PIT 0xfffffd30 |
99 | #define AT91SAM9260_BASE_WDT 0xfffffd40 | ||
100 | 100 | ||
101 | #define AT91_USART0 AT91SAM9260_BASE_US0 | 101 | #define AT91_USART0 AT91SAM9260_BASE_US0 |
102 | #define AT91_USART1 AT91SAM9260_BASE_US1 | 102 | #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 f9b516368f96..df2ddfd2d22e 100644 --- a/arch/arm/mach-at91/include/mach/at91sam9261.h +++ b/arch/arm/mach-at91/include/mach/at91sam9261.h | |||
@@ -71,7 +71,6 @@ | |||
71 | #define AT91_DBGU (0xfffff200 - AT91_BASE_SYS) | 71 | #define AT91_DBGU (0xfffff200 - AT91_BASE_SYS) |
72 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) | 72 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) |
73 | #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) | 73 | #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) |
74 | #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) | ||
75 | #define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) | 74 | #define AT91_GPBR (0xfffffd50 - AT91_BASE_SYS) |
76 | 75 | ||
77 | #define AT91SAM9261_BASE_SMC 0xffffec00 | 76 | #define AT91SAM9261_BASE_SMC 0xffffec00 |
@@ -81,6 +80,7 @@ | |||
81 | #define AT91SAM9261_BASE_SHDWC 0xfffffd10 | 80 | #define AT91SAM9261_BASE_SHDWC 0xfffffd10 |
82 | #define AT91SAM9261_BASE_RTT 0xfffffd20 | 81 | #define AT91SAM9261_BASE_RTT 0xfffffd20 |
83 | #define AT91SAM9261_BASE_PIT 0xfffffd30 | 82 | #define AT91SAM9261_BASE_PIT 0xfffffd30 |
83 | #define AT91SAM9261_BASE_WDT 0xfffffd40 | ||
84 | 84 | ||
85 | #define AT91_USART0 AT91SAM9261_BASE_US0 | 85 | #define AT91_USART0 AT91SAM9261_BASE_US0 |
86 | #define AT91_USART1 AT91SAM9261_BASE_US1 | 86 | #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 28d52d588e90..0eb614eb2fa6 100644 --- a/arch/arm/mach-at91/include/mach/at91sam9263.h +++ b/arch/arm/mach-at91/include/mach/at91sam9263.h | |||
@@ -81,7 +81,6 @@ | |||
81 | #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) | 81 | #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) |
82 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) | 82 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) |
83 | #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) | 83 | #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) |
84 | #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) | ||
85 | #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) | 84 | #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) |
86 | 85 | ||
87 | #define AT91SAM9263_BASE_ECC0 0xffffe000 | 86 | #define AT91SAM9263_BASE_ECC0 0xffffe000 |
@@ -96,6 +95,7 @@ | |||
96 | #define AT91SAM9263_BASE_SHDWC 0xfffffd10 | 95 | #define AT91SAM9263_BASE_SHDWC 0xfffffd10 |
97 | #define AT91SAM9263_BASE_RTT0 0xfffffd20 | 96 | #define AT91SAM9263_BASE_RTT0 0xfffffd20 |
98 | #define AT91SAM9263_BASE_PIT 0xfffffd30 | 97 | #define AT91SAM9263_BASE_PIT 0xfffffd30 |
98 | #define AT91SAM9263_BASE_WDT 0xfffffd40 | ||
99 | #define AT91SAM9263_BASE_RTT1 0xfffffd50 | 99 | #define AT91SAM9263_BASE_RTT1 0xfffffd50 |
100 | 100 | ||
101 | #define AT91_USART0 AT91SAM9263_BASE_US0 | 101 | #define AT91_USART0 AT91SAM9263_BASE_US0 |
diff --git a/arch/arm/mach-at91/include/mach/at91sam9g45.h b/arch/arm/mach-at91/include/mach/at91sam9g45.h index 5f3453ef5866..65098c323101 100644 --- a/arch/arm/mach-at91/include/mach/at91sam9g45.h +++ b/arch/arm/mach-at91/include/mach/at91sam9g45.h | |||
@@ -93,7 +93,6 @@ | |||
93 | #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) | 93 | #define AT91_AIC (0xfffff000 - AT91_BASE_SYS) |
94 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) | 94 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) |
95 | #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) | 95 | #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) |
96 | #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) | ||
97 | #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) | 96 | #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) |
98 | #define AT91_RTC (0xfffffdb0 - AT91_BASE_SYS) | 97 | #define AT91_RTC (0xfffffdb0 - AT91_BASE_SYS) |
99 | 98 | ||
@@ -108,6 +107,7 @@ | |||
108 | #define AT91SAM9G45_BASE_SHDWC 0xfffffd10 | 107 | #define AT91SAM9G45_BASE_SHDWC 0xfffffd10 |
109 | #define AT91SAM9G45_BASE_RTT 0xfffffd20 | 108 | #define AT91SAM9G45_BASE_RTT 0xfffffd20 |
110 | #define AT91SAM9G45_BASE_PIT 0xfffffd30 | 109 | #define AT91SAM9G45_BASE_PIT 0xfffffd30 |
110 | #define AT91SAM9G45_BASE_WDT 0xfffffd40 | ||
111 | 111 | ||
112 | #define AT91_USART0 AT91SAM9G45_BASE_US0 | 112 | #define AT91_USART0 AT91SAM9G45_BASE_US0 |
113 | #define AT91_USART1 AT91SAM9G45_BASE_US1 | 113 | #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 6f3a4eeb7394..46e136d3ef3f 100644 --- a/arch/arm/mach-at91/include/mach/at91sam9rl.h +++ b/arch/arm/mach-at91/include/mach/at91sam9rl.h | |||
@@ -75,7 +75,6 @@ | |||
75 | #define AT91_DBGU (0xfffff200 - AT91_BASE_SYS) | 75 | #define AT91_DBGU (0xfffff200 - AT91_BASE_SYS) |
76 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) | 76 | #define AT91_PMC (0xfffffc00 - AT91_BASE_SYS) |
77 | #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) | 77 | #define AT91_RSTC (0xfffffd00 - AT91_BASE_SYS) |
78 | #define AT91_WDT (0xfffffd40 - AT91_BASE_SYS) | ||
79 | #define AT91_SCKCR (0xfffffd50 - AT91_BASE_SYS) | 78 | #define AT91_SCKCR (0xfffffd50 - AT91_BASE_SYS) |
80 | #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) | 79 | #define AT91_GPBR (0xfffffd60 - AT91_BASE_SYS) |
81 | #define AT91_RTC (0xfffffe00 - AT91_BASE_SYS) | 80 | #define AT91_RTC (0xfffffe00 - AT91_BASE_SYS) |
@@ -90,6 +89,7 @@ | |||
90 | #define AT91SAM9RL_BASE_SHDWC 0xfffffd10 | 89 | #define AT91SAM9RL_BASE_SHDWC 0xfffffd10 |
91 | #define AT91SAM9RL_BASE_RTT 0xfffffd20 | 90 | #define AT91SAM9RL_BASE_RTT 0xfffffd20 |
92 | #define AT91SAM9RL_BASE_PIT 0xfffffd30 | 91 | #define AT91SAM9RL_BASE_PIT 0xfffffd30 |
92 | #define AT91SAM9RL_BASE_WDT 0xfffffd40 | ||
93 | 93 | ||
94 | #define AT91_USART0 AT91SAM9RL_BASE_US0 | 94 | #define AT91_USART0 AT91SAM9RL_BASE_US0 |
95 | #define AT91_USART1 AT91SAM9RL_BASE_US1 | 95 | #define AT91_USART1 AT91SAM9RL_BASE_US1 |
diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c index 87445b2d72a7..00562566ef5f 100644 --- a/drivers/watchdog/at91sam9_wdt.c +++ b/drivers/watchdog/at91sam9_wdt.c | |||
@@ -35,6 +35,11 @@ | |||
35 | 35 | ||
36 | #define DRV_NAME "AT91SAM9 Watchdog" | 36 | #define DRV_NAME "AT91SAM9 Watchdog" |
37 | 37 | ||
38 | #define wdt_read(field) \ | ||
39 | __raw_readl(at91wdt_private.base + field) | ||
40 | #define wdt_write(field, val) \ | ||
41 | __raw_writel((val), at91wdt_private.base + field) | ||
42 | |||
38 | /* AT91SAM9 watchdog runs a 12bit counter @ 256Hz, | 43 | /* AT91SAM9 watchdog runs a 12bit counter @ 256Hz, |
39 | * use this to convert a watchdog | 44 | * use this to convert a watchdog |
40 | * value from/to milliseconds. | 45 | * value from/to milliseconds. |
@@ -63,6 +68,7 @@ MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started " | |||
63 | static void at91_ping(unsigned long data); | 68 | static void at91_ping(unsigned long data); |
64 | 69 | ||
65 | static struct { | 70 | static struct { |
71 | void __iomem *base; | ||
66 | unsigned long next_heartbeat; /* the next_heartbeat for the timer */ | 72 | unsigned long next_heartbeat; /* the next_heartbeat for the timer */ |
67 | unsigned long open; | 73 | unsigned long open; |
68 | char expect_close; | 74 | char expect_close; |
@@ -77,7 +83,7 @@ static struct { | |||
77 | */ | 83 | */ |
78 | static inline void at91_wdt_reset(void) | 84 | static inline void at91_wdt_reset(void) |
79 | { | 85 | { |
80 | at91_sys_write(AT91_WDT_CR, AT91_WDT_KEY | AT91_WDT_WDRSTT); | 86 | wdt_write(AT91_WDT_CR, AT91_WDT_KEY | AT91_WDT_WDRSTT); |
81 | } | 87 | } |
82 | 88 | ||
83 | /* | 89 | /* |
@@ -132,7 +138,7 @@ static int at91_wdt_settimeout(unsigned int timeout) | |||
132 | unsigned int mr; | 138 | unsigned int mr; |
133 | 139 | ||
134 | /* Check if disabled */ | 140 | /* Check if disabled */ |
135 | mr = at91_sys_read(AT91_WDT_MR); | 141 | mr = wdt_read(AT91_WDT_MR); |
136 | if (mr & AT91_WDT_WDDIS) { | 142 | if (mr & AT91_WDT_WDDIS) { |
137 | printk(KERN_ERR DRV_NAME": sorry, watchdog is disabled\n"); | 143 | printk(KERN_ERR DRV_NAME": sorry, watchdog is disabled\n"); |
138 | return -EIO; | 144 | return -EIO; |
@@ -149,7 +155,7 @@ static int at91_wdt_settimeout(unsigned int timeout) | |||
149 | | AT91_WDT_WDDBGHLT /* disabled in debug mode */ | 155 | | AT91_WDT_WDDBGHLT /* disabled in debug mode */ |
150 | | AT91_WDT_WDD /* restart at any time */ | 156 | | AT91_WDT_WDD /* restart at any time */ |
151 | | (timeout & AT91_WDT_WDV); /* timer value */ | 157 | | (timeout & AT91_WDT_WDV); /* timer value */ |
152 | at91_sys_write(AT91_WDT_MR, reg); | 158 | wdt_write(AT91_WDT_MR, reg); |
153 | 159 | ||
154 | return 0; | 160 | return 0; |
155 | } | 161 | } |
@@ -248,12 +254,22 @@ static struct miscdevice at91wdt_miscdev = { | |||
248 | 254 | ||
249 | static int __init at91wdt_probe(struct platform_device *pdev) | 255 | static int __init at91wdt_probe(struct platform_device *pdev) |
250 | { | 256 | { |
257 | struct resource *r; | ||
251 | int res; | 258 | int res; |
252 | 259 | ||
253 | if (at91wdt_miscdev.parent) | 260 | if (at91wdt_miscdev.parent) |
254 | return -EBUSY; | 261 | return -EBUSY; |
255 | at91wdt_miscdev.parent = &pdev->dev; | 262 | at91wdt_miscdev.parent = &pdev->dev; |
256 | 263 | ||
264 | r = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
265 | if (!r) | ||
266 | return -ENODEV; | ||
267 | at91wdt_private.base = ioremap(r->start, resource_size(r)); | ||
268 | if (!at91wdt_private.base) { | ||
269 | dev_err(&pdev->dev, "failed to map registers, aborting.\n"); | ||
270 | return -ENOMEM; | ||
271 | } | ||
272 | |||
257 | /* Set watchdog */ | 273 | /* Set watchdog */ |
258 | res = at91_wdt_settimeout(ms_to_ticks(WDT_HW_TIMEOUT * 1000)); | 274 | res = at91_wdt_settimeout(ms_to_ticks(WDT_HW_TIMEOUT * 1000)); |
259 | if (res) | 275 | if (res) |
diff --git a/drivers/watchdog/at91sam9_wdt.h b/drivers/watchdog/at91sam9_wdt.h index 757f9cab5c82..c6fbb2e6c41b 100644 --- a/drivers/watchdog/at91sam9_wdt.h +++ b/drivers/watchdog/at91sam9_wdt.h | |||
@@ -16,11 +16,11 @@ | |||
16 | #ifndef AT91_WDT_H | 16 | #ifndef AT91_WDT_H |
17 | #define AT91_WDT_H | 17 | #define AT91_WDT_H |
18 | 18 | ||
19 | #define AT91_WDT_CR (AT91_WDT + 0x00) /* Watchdog Control Register */ | 19 | #define AT91_WDT_CR 0x00 /* Watchdog Control Register */ |
20 | #define AT91_WDT_WDRSTT (1 << 0) /* Restart */ | 20 | #define AT91_WDT_WDRSTT (1 << 0) /* Restart */ |
21 | #define AT91_WDT_KEY (0xa5 << 24) /* KEY Password */ | 21 | #define AT91_WDT_KEY (0xa5 << 24) /* KEY Password */ |
22 | 22 | ||
23 | #define AT91_WDT_MR (AT91_WDT + 0x04) /* Watchdog Mode Register */ | 23 | #define AT91_WDT_MR 0x04 /* Watchdog Mode Register */ |
24 | #define AT91_WDT_WDV (0xfff << 0) /* Counter Value */ | 24 | #define AT91_WDT_WDV (0xfff << 0) /* Counter Value */ |
25 | #define AT91_WDT_WDFIEN (1 << 12) /* Fault Interrupt Enable */ | 25 | #define AT91_WDT_WDFIEN (1 << 12) /* Fault Interrupt Enable */ |
26 | #define AT91_WDT_WDRSTEN (1 << 13) /* Reset Processor */ | 26 | #define AT91_WDT_WDRSTEN (1 << 13) /* Reset Processor */ |
@@ -30,7 +30,7 @@ | |||
30 | #define AT91_WDT_WDDBGHLT (1 << 28) /* Debug Halt */ | 30 | #define AT91_WDT_WDDBGHLT (1 << 28) /* Debug Halt */ |
31 | #define AT91_WDT_WDIDLEHLT (1 << 29) /* Idle Halt */ | 31 | #define AT91_WDT_WDIDLEHLT (1 << 29) /* Idle Halt */ |
32 | 32 | ||
33 | #define AT91_WDT_SR (AT91_WDT + 0x08) /* Watchdog Status Register */ | 33 | #define AT91_WDT_SR 0x08 /* Watchdog Status Register */ |
34 | #define AT91_WDT_WDUNF (1 << 0) /* Watchdog Underflow */ | 34 | #define AT91_WDT_WDUNF (1 << 0) /* Watchdog Underflow */ |
35 | #define AT91_WDT_WDERR (1 << 1) /* Watchdog Error */ | 35 | #define AT91_WDT_WDERR (1 << 1) /* Watchdog Error */ |
36 | 36 | ||