diff options
author | Kevin Hilman <khilman@deeprootsystems.com> | 2010-10-01 16:24:09 -0400 |
---|---|---|
committer | Kevin Hilman <khilman@deeprootsystems.com> | 2010-10-01 16:24:09 -0400 |
commit | 963bfb0939232e415c7bfb19b08dce300eb148d9 (patch) | |
tree | 2efd04dc2afbc46c97d1c3327e6f7830acafb250 | |
parent | 7ad0e386d46e9edff64705ab25337ad9130baf63 (diff) | |
parent | 7ec5ad0f3c1e28b693185c35f768953c5db32291 (diff) |
Merge branch 'pm-hwmod-wdog' into pm-hwmods
-rw-r--r-- | arch/arm/mach-omap1/devices.c | 27 | ||||
-rw-r--r-- | arch/arm/mach-omap2/devices.c | 39 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap_hwmod_2420_data.c | 64 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap_hwmod_2430_data.c | 64 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | 66 | ||||
-rw-r--r-- | arch/arm/mach-omap2/omap_hwmod_44xx_data.c | 133 | ||||
-rw-r--r-- | arch/arm/plat-omap/devices.c | 41 | ||||
-rw-r--r-- | drivers/watchdog/omap_wdt.c | 42 |
8 files changed, 400 insertions, 76 deletions
diff --git a/arch/arm/mach-omap1/devices.c b/arch/arm/mach-omap1/devices.c index aa0725608fb1..a919366a90dd 100644 --- a/arch/arm/mach-omap1/devices.c +++ b/arch/arm/mach-omap1/devices.c | |||
@@ -232,3 +232,30 @@ static int __init omap1_init_devices(void) | |||
232 | } | 232 | } |
233 | arch_initcall(omap1_init_devices); | 233 | arch_initcall(omap1_init_devices); |
234 | 234 | ||
235 | #if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE) | ||
236 | |||
237 | static struct resource wdt_resources[] = { | ||
238 | { | ||
239 | .start = 0xfffeb000, | ||
240 | .end = 0xfffeb07F, | ||
241 | .flags = IORESOURCE_MEM, | ||
242 | }, | ||
243 | }; | ||
244 | |||
245 | static struct platform_device omap_wdt_device = { | ||
246 | .name = "omap_wdt", | ||
247 | .id = -1, | ||
248 | .num_resources = ARRAY_SIZE(wdt_resources), | ||
249 | .resource = wdt_resources, | ||
250 | }; | ||
251 | |||
252 | static int __init omap_init_wdt(void) | ||
253 | { | ||
254 | if (!cpu_is_omap16xx()) | ||
255 | return; | ||
256 | |||
257 | platform_device_register(&omap_wdt_device); | ||
258 | return 0; | ||
259 | } | ||
260 | subsys_initcall(omap_init_wdt); | ||
261 | #endif | ||
diff --git a/arch/arm/mach-omap2/devices.c b/arch/arm/mach-omap2/devices.c index 9e5d51bee94a..8e2f0aa310b5 100644 --- a/arch/arm/mach-omap2/devices.c +++ b/arch/arm/mach-omap2/devices.c | |||
@@ -15,6 +15,7 @@ | |||
15 | #include <linux/platform_device.h> | 15 | #include <linux/platform_device.h> |
16 | #include <linux/io.h> | 16 | #include <linux/io.h> |
17 | #include <linux/clk.h> | 17 | #include <linux/clk.h> |
18 | #include <linux/err.h> | ||
18 | 19 | ||
19 | #include <mach/hardware.h> | 20 | #include <mach/hardware.h> |
20 | #include <mach/irqs.h> | 21 | #include <mach/irqs.h> |
@@ -28,6 +29,8 @@ | |||
28 | #include <mach/gpio.h> | 29 | #include <mach/gpio.h> |
29 | #include <plat/mmc.h> | 30 | #include <plat/mmc.h> |
30 | #include <plat/dma.h> | 31 | #include <plat/dma.h> |
32 | #include <plat/omap_hwmod.h> | ||
33 | #include <plat/omap_device.h> | ||
31 | 34 | ||
32 | #include "mux.h" | 35 | #include "mux.h" |
33 | 36 | ||
@@ -932,3 +935,39 @@ static int __init omap2_init_devices(void) | |||
932 | return 0; | 935 | return 0; |
933 | } | 936 | } |
934 | arch_initcall(omap2_init_devices); | 937 | arch_initcall(omap2_init_devices); |
938 | |||
939 | #if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE) | ||
940 | struct omap_device_pm_latency omap_wdt_latency[] = { | ||
941 | [0] = { | ||
942 | .deactivate_func = omap_device_idle_hwmods, | ||
943 | .activate_func = omap_device_enable_hwmods, | ||
944 | .flags = OMAP_DEVICE_LATENCY_AUTO_ADJUST, | ||
945 | }, | ||
946 | }; | ||
947 | |||
948 | static int __init omap_init_wdt(void) | ||
949 | { | ||
950 | int id = -1; | ||
951 | struct omap_device *od; | ||
952 | struct omap_hwmod *oh; | ||
953 | char *oh_name = "wd_timer2"; | ||
954 | char *dev_name = "omap_wdt"; | ||
955 | |||
956 | if (!cpu_class_is_omap2()) | ||
957 | return 0; | ||
958 | |||
959 | oh = omap_hwmod_lookup(oh_name); | ||
960 | if (!oh) { | ||
961 | pr_err("Could not look up wd_timer%d hwmod\n", id); | ||
962 | return -EINVAL; | ||
963 | } | ||
964 | |||
965 | od = omap_device_build(dev_name, id, oh, NULL, 0, | ||
966 | omap_wdt_latency, | ||
967 | ARRAY_SIZE(omap_wdt_latency), 0); | ||
968 | WARN(IS_ERR(od), "Cant build omap_device for %s:%s.\n", | ||
969 | dev_name, oh->name); | ||
970 | return 0; | ||
971 | } | ||
972 | subsys_initcall(omap_init_wdt); | ||
973 | #endif | ||
diff --git a/arch/arm/mach-omap2/omap_hwmod_2420_data.c b/arch/arm/mach-omap2/omap_hwmod_2420_data.c index 3cc768e8bc04..66678d98ad96 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2420_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2420_data.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include "omap_hwmod_common_data.h" | 19 | #include "omap_hwmod_common_data.h" |
20 | 20 | ||
21 | #include "prm-regbits-24xx.h" | 21 | #include "prm-regbits-24xx.h" |
22 | #include "cm-regbits-24xx.h" | ||
22 | 23 | ||
23 | /* | 24 | /* |
24 | * OMAP2420 hardware module integration data | 25 | * OMAP2420 hardware module integration data |
@@ -33,6 +34,7 @@ static struct omap_hwmod omap2420_mpu_hwmod; | |||
33 | static struct omap_hwmod omap2420_iva_hwmod; | 34 | static struct omap_hwmod omap2420_iva_hwmod; |
34 | static struct omap_hwmod omap2420_l3_main_hwmod; | 35 | static struct omap_hwmod omap2420_l3_main_hwmod; |
35 | static struct omap_hwmod omap2420_l4_core_hwmod; | 36 | static struct omap_hwmod omap2420_l4_core_hwmod; |
37 | static struct omap_hwmod omap2420_wd_timer2_hwmod; | ||
36 | 38 | ||
37 | /* L3 -> L4_CORE interface */ | 39 | /* L3 -> L4_CORE interface */ |
38 | static struct omap_hwmod_ocp_if omap2420_l3_main__l4_core = { | 40 | static struct omap_hwmod_ocp_if omap2420_l3_main__l4_core = { |
@@ -165,12 +167,74 @@ static struct omap_hwmod omap2420_iva_hwmod = { | |||
165 | .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420) | 167 | .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420) |
166 | }; | 168 | }; |
167 | 169 | ||
170 | /* l4_wkup -> wd_timer2 */ | ||
171 | static struct omap_hwmod_addr_space omap2420_wd_timer2_addrs[] = { | ||
172 | { | ||
173 | .pa_start = 0x48022000, | ||
174 | .pa_end = 0x4802207f, | ||
175 | .flags = ADDR_TYPE_RT | ||
176 | }, | ||
177 | }; | ||
178 | |||
179 | static struct omap_hwmod_ocp_if omap2420_l4_wkup__wd_timer2 = { | ||
180 | .master = &omap2420_l4_wkup_hwmod, | ||
181 | .slave = &omap2420_wd_timer2_hwmod, | ||
182 | .clk = "mpu_wdt_ick", | ||
183 | .addr = omap2420_wd_timer2_addrs, | ||
184 | .addr_cnt = ARRAY_SIZE(omap2420_wd_timer2_addrs), | ||
185 | .user = OCP_USER_MPU | OCP_USER_SDMA, | ||
186 | }; | ||
187 | |||
188 | /* | ||
189 | * 'wd_timer' class | ||
190 | * 32-bit watchdog upward counter that generates a pulse on the reset pin on | ||
191 | * overflow condition | ||
192 | */ | ||
193 | |||
194 | static struct omap_hwmod_class_sysconfig omap2420_wd_timer_sysc = { | ||
195 | .rev_offs = 0x0000, | ||
196 | .sysc_offs = 0x0010, | ||
197 | .syss_offs = 0x0014, | ||
198 | .sysc_flags = (SYSC_HAS_EMUFREE | SYSC_HAS_SOFTRESET | | ||
199 | SYSC_HAS_AUTOIDLE), | ||
200 | .sysc_fields = &omap_hwmod_sysc_type1, | ||
201 | }; | ||
202 | |||
203 | static struct omap_hwmod_class omap2420_wd_timer_hwmod_class = { | ||
204 | .name = "wd_timer", | ||
205 | .sysc = &omap2420_wd_timer_sysc, | ||
206 | }; | ||
207 | |||
208 | /* wd_timer2 */ | ||
209 | static struct omap_hwmod_ocp_if *omap2420_wd_timer2_slaves[] = { | ||
210 | &omap2420_l4_wkup__wd_timer2, | ||
211 | }; | ||
212 | |||
213 | static struct omap_hwmod omap2420_wd_timer2_hwmod = { | ||
214 | .name = "wd_timer2", | ||
215 | .class = &omap2420_wd_timer_hwmod_class, | ||
216 | .main_clk = "mpu_wdt_fck", | ||
217 | .prcm = { | ||
218 | .omap2 = { | ||
219 | .prcm_reg_id = 1, | ||
220 | .module_bit = OMAP24XX_EN_MPU_WDT_SHIFT, | ||
221 | .module_offs = WKUP_MOD, | ||
222 | .idlest_reg_id = 1, | ||
223 | .idlest_idle_bit = OMAP24XX_ST_MPU_WDT_SHIFT, | ||
224 | }, | ||
225 | }, | ||
226 | .slaves = omap2420_wd_timer2_slaves, | ||
227 | .slaves_cnt = ARRAY_SIZE(omap2420_wd_timer2_slaves), | ||
228 | .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2420), | ||
229 | }; | ||
230 | |||
168 | static __initdata struct omap_hwmod *omap2420_hwmods[] = { | 231 | static __initdata struct omap_hwmod *omap2420_hwmods[] = { |
169 | &omap2420_l3_main_hwmod, | 232 | &omap2420_l3_main_hwmod, |
170 | &omap2420_l4_core_hwmod, | 233 | &omap2420_l4_core_hwmod, |
171 | &omap2420_l4_wkup_hwmod, | 234 | &omap2420_l4_wkup_hwmod, |
172 | &omap2420_mpu_hwmod, | 235 | &omap2420_mpu_hwmod, |
173 | &omap2420_iva_hwmod, | 236 | &omap2420_iva_hwmod, |
237 | &omap2420_wd_timer2_hwmod, | ||
174 | NULL, | 238 | NULL, |
175 | }; | 239 | }; |
176 | 240 | ||
diff --git a/arch/arm/mach-omap2/omap_hwmod_2430_data.c b/arch/arm/mach-omap2/omap_hwmod_2430_data.c index 4526628ed287..7ec927aa23de 100644 --- a/arch/arm/mach-omap2/omap_hwmod_2430_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_2430_data.c | |||
@@ -19,6 +19,7 @@ | |||
19 | #include "omap_hwmod_common_data.h" | 19 | #include "omap_hwmod_common_data.h" |
20 | 20 | ||
21 | #include "prm-regbits-24xx.h" | 21 | #include "prm-regbits-24xx.h" |
22 | #include "cm-regbits-24xx.h" | ||
22 | 23 | ||
23 | /* | 24 | /* |
24 | * OMAP2430 hardware module integration data | 25 | * OMAP2430 hardware module integration data |
@@ -33,6 +34,7 @@ static struct omap_hwmod omap2430_mpu_hwmod; | |||
33 | static struct omap_hwmod omap2430_iva_hwmod; | 34 | static struct omap_hwmod omap2430_iva_hwmod; |
34 | static struct omap_hwmod omap2430_l3_main_hwmod; | 35 | static struct omap_hwmod omap2430_l3_main_hwmod; |
35 | static struct omap_hwmod omap2430_l4_core_hwmod; | 36 | static struct omap_hwmod omap2430_l4_core_hwmod; |
37 | static struct omap_hwmod omap2430_wd_timer2_hwmod; | ||
36 | 38 | ||
37 | /* L3 -> L4_CORE interface */ | 39 | /* L3 -> L4_CORE interface */ |
38 | static struct omap_hwmod_ocp_if omap2430_l3_main__l4_core = { | 40 | static struct omap_hwmod_ocp_if omap2430_l3_main__l4_core = { |
@@ -165,12 +167,74 @@ static struct omap_hwmod omap2430_iva_hwmod = { | |||
165 | .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430) | 167 | .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430) |
166 | }; | 168 | }; |
167 | 169 | ||
170 | /* l4_wkup -> wd_timer2 */ | ||
171 | static struct omap_hwmod_addr_space omap2430_wd_timer2_addrs[] = { | ||
172 | { | ||
173 | .pa_start = 0x49016000, | ||
174 | .pa_end = 0x4901607f, | ||
175 | .flags = ADDR_TYPE_RT | ||
176 | }, | ||
177 | }; | ||
178 | |||
179 | static struct omap_hwmod_ocp_if omap2430_l4_wkup__wd_timer2 = { | ||
180 | .master = &omap2430_l4_wkup_hwmod, | ||
181 | .slave = &omap2430_wd_timer2_hwmod, | ||
182 | .clk = "mpu_wdt_ick", | ||
183 | .addr = omap2430_wd_timer2_addrs, | ||
184 | .addr_cnt = ARRAY_SIZE(omap2430_wd_timer2_addrs), | ||
185 | .user = OCP_USER_MPU | OCP_USER_SDMA, | ||
186 | }; | ||
187 | |||
188 | /* | ||
189 | * 'wd_timer' class | ||
190 | * 32-bit watchdog upward counter that generates a pulse on the reset pin on | ||
191 | * overflow condition | ||
192 | */ | ||
193 | |||
194 | static struct omap_hwmod_class_sysconfig omap2430_wd_timer_sysc = { | ||
195 | .rev_offs = 0x0, | ||
196 | .sysc_offs = 0x0010, | ||
197 | .syss_offs = 0x0014, | ||
198 | .sysc_flags = (SYSC_HAS_EMUFREE | SYSC_HAS_SOFTRESET | | ||
199 | SYSC_HAS_AUTOIDLE), | ||
200 | .sysc_fields = &omap_hwmod_sysc_type1, | ||
201 | }; | ||
202 | |||
203 | static struct omap_hwmod_class omap2430_wd_timer_hwmod_class = { | ||
204 | .name = "wd_timer", | ||
205 | .sysc = &omap2430_wd_timer_sysc, | ||
206 | }; | ||
207 | |||
208 | /* wd_timer2 */ | ||
209 | static struct omap_hwmod_ocp_if *omap2430_wd_timer2_slaves[] = { | ||
210 | &omap2430_l4_wkup__wd_timer2, | ||
211 | }; | ||
212 | |||
213 | static struct omap_hwmod omap2430_wd_timer2_hwmod = { | ||
214 | .name = "wd_timer2", | ||
215 | .class = &omap2430_wd_timer_hwmod_class, | ||
216 | .main_clk = "mpu_wdt_fck", | ||
217 | .prcm = { | ||
218 | .omap2 = { | ||
219 | .prcm_reg_id = 1, | ||
220 | .module_bit = OMAP24XX_EN_MPU_WDT_SHIFT, | ||
221 | .module_offs = WKUP_MOD, | ||
222 | .idlest_reg_id = 1, | ||
223 | .idlest_idle_bit = OMAP24XX_ST_MPU_WDT_SHIFT, | ||
224 | }, | ||
225 | }, | ||
226 | .slaves = omap2430_wd_timer2_slaves, | ||
227 | .slaves_cnt = ARRAY_SIZE(omap2430_wd_timer2_slaves), | ||
228 | .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP2430), | ||
229 | }; | ||
230 | |||
168 | static __initdata struct omap_hwmod *omap2430_hwmods[] = { | 231 | static __initdata struct omap_hwmod *omap2430_hwmods[] = { |
169 | &omap2430_l3_main_hwmod, | 232 | &omap2430_l3_main_hwmod, |
170 | &omap2430_l4_core_hwmod, | 233 | &omap2430_l4_core_hwmod, |
171 | &omap2430_l4_wkup_hwmod, | 234 | &omap2430_l4_wkup_hwmod, |
172 | &omap2430_mpu_hwmod, | 235 | &omap2430_mpu_hwmod, |
173 | &omap2430_iva_hwmod, | 236 | &omap2430_iva_hwmod, |
237 | &omap2430_wd_timer2_hwmod, | ||
174 | NULL, | 238 | NULL, |
175 | }; | 239 | }; |
176 | 240 | ||
diff --git a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c index 5d8eb58ba5e3..5bfe9c933144 100644 --- a/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_3xxx_data.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include "omap_hwmod_common_data.h" | 21 | #include "omap_hwmod_common_data.h" |
22 | 22 | ||
23 | #include "prm-regbits-34xx.h" | 23 | #include "prm-regbits-34xx.h" |
24 | #include "cm-regbits-34xx.h" | ||
24 | 25 | ||
25 | /* | 26 | /* |
26 | * OMAP3xxx hardware module integration data | 27 | * OMAP3xxx hardware module integration data |
@@ -36,6 +37,7 @@ static struct omap_hwmod omap3xxx_iva_hwmod; | |||
36 | static struct omap_hwmod omap3xxx_l3_main_hwmod; | 37 | static struct omap_hwmod omap3xxx_l3_main_hwmod; |
37 | static struct omap_hwmod omap3xxx_l4_core_hwmod; | 38 | static struct omap_hwmod omap3xxx_l4_core_hwmod; |
38 | static struct omap_hwmod omap3xxx_l4_per_hwmod; | 39 | static struct omap_hwmod omap3xxx_l4_per_hwmod; |
40 | static struct omap_hwmod omap3xxx_wd_timer2_hwmod; | ||
39 | 41 | ||
40 | /* L3 -> L4_CORE interface */ | 42 | /* L3 -> L4_CORE interface */ |
41 | static struct omap_hwmod_ocp_if omap3xxx_l3_main__l4_core = { | 43 | static struct omap_hwmod_ocp_if omap3xxx_l3_main__l4_core = { |
@@ -197,6 +199,69 @@ static struct omap_hwmod omap3xxx_iva_hwmod = { | |||
197 | .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430) | 199 | .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430) |
198 | }; | 200 | }; |
199 | 201 | ||
202 | /* l4_wkup -> wd_timer2 */ | ||
203 | static struct omap_hwmod_addr_space omap3xxx_wd_timer2_addrs[] = { | ||
204 | { | ||
205 | .pa_start = 0x48314000, | ||
206 | .pa_end = 0x4831407f, | ||
207 | .flags = ADDR_TYPE_RT | ||
208 | }, | ||
209 | }; | ||
210 | |||
211 | static struct omap_hwmod_ocp_if omap3xxx_l4_wkup__wd_timer2 = { | ||
212 | .master = &omap3xxx_l4_wkup_hwmod, | ||
213 | .slave = &omap3xxx_wd_timer2_hwmod, | ||
214 | .clk = "wdt2_ick", | ||
215 | .addr = omap3xxx_wd_timer2_addrs, | ||
216 | .addr_cnt = ARRAY_SIZE(omap3xxx_wd_timer2_addrs), | ||
217 | .user = OCP_USER_MPU | OCP_USER_SDMA, | ||
218 | }; | ||
219 | |||
220 | /* | ||
221 | * 'wd_timer' class | ||
222 | * 32-bit watchdog upward counter that generates a pulse on the reset pin on | ||
223 | * overflow condition | ||
224 | */ | ||
225 | |||
226 | static struct omap_hwmod_class_sysconfig omap3xxx_wd_timer_sysc = { | ||
227 | .rev_offs = 0x0000, | ||
228 | .sysc_offs = 0x0010, | ||
229 | .syss_offs = 0x0014, | ||
230 | .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_EMUFREE | | ||
231 | SYSC_HAS_ENAWAKEUP | SYSC_HAS_SOFTRESET | | ||
232 | SYSC_HAS_AUTOIDLE | SYSC_HAS_CLOCKACTIVITY), | ||
233 | .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), | ||
234 | .sysc_fields = &omap_hwmod_sysc_type1, | ||
235 | }; | ||
236 | |||
237 | static struct omap_hwmod_class omap3xxx_wd_timer_hwmod_class = { | ||
238 | .name = "wd_timer", | ||
239 | .sysc = &omap3xxx_wd_timer_sysc, | ||
240 | }; | ||
241 | |||
242 | /* wd_timer2 */ | ||
243 | static struct omap_hwmod_ocp_if *omap3xxx_wd_timer2_slaves[] = { | ||
244 | &omap3xxx_l4_wkup__wd_timer2, | ||
245 | }; | ||
246 | |||
247 | static struct omap_hwmod omap3xxx_wd_timer2_hwmod = { | ||
248 | .name = "wd_timer2", | ||
249 | .class = &omap3xxx_wd_timer_hwmod_class, | ||
250 | .main_clk = "wdt2_fck", | ||
251 | .prcm = { | ||
252 | .omap2 = { | ||
253 | .prcm_reg_id = 1, | ||
254 | .module_bit = OMAP3430_EN_WDT2_SHIFT, | ||
255 | .module_offs = WKUP_MOD, | ||
256 | .idlest_reg_id = 1, | ||
257 | .idlest_idle_bit = OMAP3430_ST_WDT2_SHIFT, | ||
258 | }, | ||
259 | }, | ||
260 | .slaves = omap3xxx_wd_timer2_slaves, | ||
261 | .slaves_cnt = ARRAY_SIZE(omap3xxx_wd_timer2_slaves), | ||
262 | .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP3430), | ||
263 | }; | ||
264 | |||
200 | static __initdata struct omap_hwmod *omap3xxx_hwmods[] = { | 265 | static __initdata struct omap_hwmod *omap3xxx_hwmods[] = { |
201 | &omap3xxx_l3_main_hwmod, | 266 | &omap3xxx_l3_main_hwmod, |
202 | &omap3xxx_l4_core_hwmod, | 267 | &omap3xxx_l4_core_hwmod, |
@@ -204,6 +269,7 @@ static __initdata struct omap_hwmod *omap3xxx_hwmods[] = { | |||
204 | &omap3xxx_l4_wkup_hwmod, | 269 | &omap3xxx_l4_wkup_hwmod, |
205 | &omap3xxx_mpu_hwmod, | 270 | &omap3xxx_mpu_hwmod, |
206 | &omap3xxx_iva_hwmod, | 271 | &omap3xxx_iva_hwmod, |
272 | &omap3xxx_wd_timer2_hwmod, | ||
207 | NULL, | 273 | NULL, |
208 | }; | 274 | }; |
209 | 275 | ||
diff --git a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c index e20b0eebc6d9..9523b4c9537f 100644 --- a/arch/arm/mach-omap2/omap_hwmod_44xx_data.c +++ b/arch/arm/mach-omap2/omap_hwmod_44xx_data.c | |||
@@ -452,6 +452,136 @@ static struct omap_hwmod omap44xx_mpu_hwmod = { | |||
452 | .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), | 452 | .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), |
453 | }; | 453 | }; |
454 | 454 | ||
455 | /* | ||
456 | * 'wd_timer' class | ||
457 | * 32-bit watchdog upward counter that generates a pulse on the reset pin on | ||
458 | * overflow condition | ||
459 | */ | ||
460 | |||
461 | static struct omap_hwmod_class_sysconfig omap44xx_wd_timer_sysc = { | ||
462 | .rev_offs = 0x0000, | ||
463 | .sysc_offs = 0x0010, | ||
464 | .syss_offs = 0x0014, | ||
465 | .sysc_flags = (SYSC_HAS_SIDLEMODE | SYSC_HAS_EMUFREE | | ||
466 | SYSC_HAS_SOFTRESET), | ||
467 | .idlemodes = (SIDLE_FORCE | SIDLE_NO | SIDLE_SMART), | ||
468 | .sysc_fields = &omap_hwmod_sysc_type1, | ||
469 | }; | ||
470 | |||
471 | static struct omap_hwmod_class omap44xx_wd_timer_hwmod_class = { | ||
472 | .name = "wd_timer", | ||
473 | .sysc = &omap44xx_wd_timer_sysc, | ||
474 | }; | ||
475 | |||
476 | /* wd_timer2 */ | ||
477 | static struct omap_hwmod omap44xx_wd_timer2_hwmod; | ||
478 | static struct omap_hwmod_irq_info omap44xx_wd_timer2_irqs[] = { | ||
479 | { .irq = 80 + OMAP44XX_IRQ_GIC_START }, | ||
480 | }; | ||
481 | |||
482 | static struct omap_hwmod_addr_space omap44xx_wd_timer2_addrs[] = { | ||
483 | { | ||
484 | .pa_start = 0x4a314000, | ||
485 | .pa_end = 0x4a31407f, | ||
486 | .flags = ADDR_TYPE_RT | ||
487 | }, | ||
488 | }; | ||
489 | |||
490 | /* l4_wkup -> wd_timer2 */ | ||
491 | static struct omap_hwmod_ocp_if omap44xx_l4_wkup__wd_timer2 = { | ||
492 | .master = &omap44xx_l4_wkup_hwmod, | ||
493 | .slave = &omap44xx_wd_timer2_hwmod, | ||
494 | .clk = "l4_wkup_clk_mux_ck", | ||
495 | .addr = omap44xx_wd_timer2_addrs, | ||
496 | .addr_cnt = ARRAY_SIZE(omap44xx_wd_timer2_addrs), | ||
497 | .user = OCP_USER_MPU | OCP_USER_SDMA, | ||
498 | }; | ||
499 | |||
500 | /* wd_timer2 slave ports */ | ||
501 | static struct omap_hwmod_ocp_if *omap44xx_wd_timer2_slaves[] = { | ||
502 | &omap44xx_l4_wkup__wd_timer2, | ||
503 | }; | ||
504 | |||
505 | static struct omap_hwmod omap44xx_wd_timer2_hwmod = { | ||
506 | .name = "wd_timer2", | ||
507 | .class = &omap44xx_wd_timer_hwmod_class, | ||
508 | .mpu_irqs = omap44xx_wd_timer2_irqs, | ||
509 | .mpu_irqs_cnt = ARRAY_SIZE(omap44xx_wd_timer2_irqs), | ||
510 | .main_clk = "wd_timer2_fck", | ||
511 | .prcm = { | ||
512 | .omap4 = { | ||
513 | .clkctrl_reg = OMAP4430_CM_WKUP_WDT2_CLKCTRL, | ||
514 | }, | ||
515 | }, | ||
516 | .slaves = omap44xx_wd_timer2_slaves, | ||
517 | .slaves_cnt = ARRAY_SIZE(omap44xx_wd_timer2_slaves), | ||
518 | .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), | ||
519 | }; | ||
520 | |||
521 | /* wd_timer3 */ | ||
522 | static struct omap_hwmod omap44xx_wd_timer3_hwmod; | ||
523 | static struct omap_hwmod_irq_info omap44xx_wd_timer3_irqs[] = { | ||
524 | { .irq = 36 + OMAP44XX_IRQ_GIC_START }, | ||
525 | }; | ||
526 | |||
527 | static struct omap_hwmod_addr_space omap44xx_wd_timer3_addrs[] = { | ||
528 | { | ||
529 | .pa_start = 0x40130000, | ||
530 | .pa_end = 0x4013007f, | ||
531 | .flags = ADDR_TYPE_RT | ||
532 | }, | ||
533 | }; | ||
534 | |||
535 | /* l4_abe -> wd_timer3 */ | ||
536 | static struct omap_hwmod_ocp_if omap44xx_l4_abe__wd_timer3 = { | ||
537 | .master = &omap44xx_l4_abe_hwmod, | ||
538 | .slave = &omap44xx_wd_timer3_hwmod, | ||
539 | .clk = "ocp_abe_iclk", | ||
540 | .addr = omap44xx_wd_timer3_addrs, | ||
541 | .addr_cnt = ARRAY_SIZE(omap44xx_wd_timer3_addrs), | ||
542 | .user = OCP_USER_MPU, | ||
543 | }; | ||
544 | |||
545 | /* l4_abe -> wd_timer3 (dma) */ | ||
546 | static struct omap_hwmod_addr_space omap44xx_wd_timer3_dma_addrs[] = { | ||
547 | { | ||
548 | .pa_start = 0x49030000, | ||
549 | .pa_end = 0x4903007f, | ||
550 | .flags = ADDR_TYPE_RT | ||
551 | }, | ||
552 | }; | ||
553 | |||
554 | static struct omap_hwmod_ocp_if omap44xx_l4_abe__wd_timer3_dma = { | ||
555 | .master = &omap44xx_l4_abe_hwmod, | ||
556 | .slave = &omap44xx_wd_timer3_hwmod, | ||
557 | .clk = "ocp_abe_iclk", | ||
558 | .addr = omap44xx_wd_timer3_dma_addrs, | ||
559 | .addr_cnt = ARRAY_SIZE(omap44xx_wd_timer3_dma_addrs), | ||
560 | .user = OCP_USER_SDMA, | ||
561 | }; | ||
562 | |||
563 | /* wd_timer3 slave ports */ | ||
564 | static struct omap_hwmod_ocp_if *omap44xx_wd_timer3_slaves[] = { | ||
565 | &omap44xx_l4_abe__wd_timer3, | ||
566 | &omap44xx_l4_abe__wd_timer3_dma, | ||
567 | }; | ||
568 | |||
569 | static struct omap_hwmod omap44xx_wd_timer3_hwmod = { | ||
570 | .name = "wd_timer3", | ||
571 | .class = &omap44xx_wd_timer_hwmod_class, | ||
572 | .mpu_irqs = omap44xx_wd_timer3_irqs, | ||
573 | .mpu_irqs_cnt = ARRAY_SIZE(omap44xx_wd_timer3_irqs), | ||
574 | .main_clk = "wd_timer3_fck", | ||
575 | .prcm = { | ||
576 | .omap4 = { | ||
577 | .clkctrl_reg = OMAP4430_CM1_ABE_WDT3_CLKCTRL, | ||
578 | }, | ||
579 | }, | ||
580 | .slaves = omap44xx_wd_timer3_slaves, | ||
581 | .slaves_cnt = ARRAY_SIZE(omap44xx_wd_timer3_slaves), | ||
582 | .omap_chip = OMAP_CHIP_INIT(CHIP_IS_OMAP4430), | ||
583 | }; | ||
584 | |||
455 | static __initdata struct omap_hwmod *omap44xx_hwmods[] = { | 585 | static __initdata struct omap_hwmod *omap44xx_hwmods[] = { |
456 | /* dmm class */ | 586 | /* dmm class */ |
457 | &omap44xx_dmm_hwmod, | 587 | &omap44xx_dmm_hwmod, |
@@ -472,6 +602,9 @@ static __initdata struct omap_hwmod *omap44xx_hwmods[] = { | |||
472 | 602 | ||
473 | /* mpu class */ | 603 | /* mpu class */ |
474 | &omap44xx_mpu_hwmod, | 604 | &omap44xx_mpu_hwmod, |
605 | /* wd_timer class */ | ||
606 | &omap44xx_wd_timer2_hwmod, | ||
607 | &omap44xx_wd_timer3_hwmod, | ||
475 | NULL, | 608 | NULL, |
476 | }; | 609 | }; |
477 | 610 | ||
diff --git a/arch/arm/plat-omap/devices.c b/arch/arm/plat-omap/devices.c index d1920be7833b..8e88e0e5d524 100644 --- a/arch/arm/plat-omap/devices.c +++ b/arch/arm/plat-omap/devices.c | |||
@@ -232,46 +232,6 @@ static void omap_init_uwire(void) | |||
232 | static inline void omap_init_uwire(void) {} | 232 | static inline void omap_init_uwire(void) {} |
233 | #endif | 233 | #endif |
234 | 234 | ||
235 | /*-------------------------------------------------------------------------*/ | ||
236 | |||
237 | #if defined(CONFIG_OMAP_WATCHDOG) || defined(CONFIG_OMAP_WATCHDOG_MODULE) | ||
238 | |||
239 | static struct resource wdt_resources[] = { | ||
240 | { | ||
241 | .flags = IORESOURCE_MEM, | ||
242 | }, | ||
243 | }; | ||
244 | |||
245 | static struct platform_device omap_wdt_device = { | ||
246 | .name = "omap_wdt", | ||
247 | .id = -1, | ||
248 | .num_resources = ARRAY_SIZE(wdt_resources), | ||
249 | .resource = wdt_resources, | ||
250 | }; | ||
251 | |||
252 | static void omap_init_wdt(void) | ||
253 | { | ||
254 | if (cpu_is_omap16xx()) | ||
255 | wdt_resources[0].start = 0xfffeb000; | ||
256 | else if (cpu_is_omap2420()) | ||
257 | wdt_resources[0].start = 0x48022000; /* WDT2 */ | ||
258 | else if (cpu_is_omap2430()) | ||
259 | wdt_resources[0].start = 0x49016000; /* WDT2 */ | ||
260 | else if (cpu_is_omap343x()) | ||
261 | wdt_resources[0].start = 0x48314000; /* WDT2 */ | ||
262 | else if (cpu_is_omap44xx()) | ||
263 | wdt_resources[0].start = 0x4a314000; | ||
264 | else | ||
265 | return; | ||
266 | |||
267 | wdt_resources[0].end = wdt_resources[0].start + 0x4f; | ||
268 | |||
269 | (void) platform_device_register(&omap_wdt_device); | ||
270 | } | ||
271 | #else | ||
272 | static inline void omap_init_wdt(void) {} | ||
273 | #endif | ||
274 | |||
275 | /* | 235 | /* |
276 | * This gets called after board-specific INIT_MACHINE, and initializes most | 236 | * This gets called after board-specific INIT_MACHINE, and initializes most |
277 | * on-chip peripherals accessible on this board (except for few like USB): | 237 | * on-chip peripherals accessible on this board (except for few like USB): |
@@ -300,7 +260,6 @@ static int __init omap_init_devices(void) | |||
300 | omap_init_rng(); | 260 | omap_init_rng(); |
301 | omap_init_mcpdm(); | 261 | omap_init_mcpdm(); |
302 | omap_init_uwire(); | 262 | omap_init_uwire(); |
303 | omap_init_wdt(); | ||
304 | return 0; | 263 | return 0; |
305 | } | 264 | } |
306 | arch_initcall(omap_init_devices); | 265 | arch_initcall(omap_init_devices); |
diff --git a/drivers/watchdog/omap_wdt.c b/drivers/watchdog/omap_wdt.c index 76b58abf4451..dbbc5801a0c3 100644 --- a/drivers/watchdog/omap_wdt.c +++ b/drivers/watchdog/omap_wdt.c | |||
@@ -38,11 +38,11 @@ | |||
38 | #include <linux/err.h> | 38 | #include <linux/err.h> |
39 | #include <linux/platform_device.h> | 39 | #include <linux/platform_device.h> |
40 | #include <linux/moduleparam.h> | 40 | #include <linux/moduleparam.h> |
41 | #include <linux/clk.h> | ||
42 | #include <linux/bitops.h> | 41 | #include <linux/bitops.h> |
43 | #include <linux/io.h> | 42 | #include <linux/io.h> |
44 | #include <linux/uaccess.h> | 43 | #include <linux/uaccess.h> |
45 | #include <linux/slab.h> | 44 | #include <linux/slab.h> |
45 | #include <linux/pm_runtime.h> | ||
46 | #include <mach/hardware.h> | 46 | #include <mach/hardware.h> |
47 | #include <plat/prcm.h> | 47 | #include <plat/prcm.h> |
48 | 48 | ||
@@ -61,8 +61,6 @@ struct omap_wdt_dev { | |||
61 | void __iomem *base; /* physical */ | 61 | void __iomem *base; /* physical */ |
62 | struct device *dev; | 62 | struct device *dev; |
63 | int omap_wdt_users; | 63 | int omap_wdt_users; |
64 | struct clk *ick; | ||
65 | struct clk *fck; | ||
66 | struct resource *mem; | 64 | struct resource *mem; |
67 | struct miscdevice omap_wdt_miscdev; | 65 | struct miscdevice omap_wdt_miscdev; |
68 | }; | 66 | }; |
@@ -146,8 +144,7 @@ static int omap_wdt_open(struct inode *inode, struct file *file) | |||
146 | if (test_and_set_bit(1, (unsigned long *)&(wdev->omap_wdt_users))) | 144 | if (test_and_set_bit(1, (unsigned long *)&(wdev->omap_wdt_users))) |
147 | return -EBUSY; | 145 | return -EBUSY; |
148 | 146 | ||
149 | clk_enable(wdev->ick); /* Enable the interface clock */ | 147 | pm_runtime_get_sync(wdev->dev); |
150 | clk_enable(wdev->fck); /* Enable the functional clock */ | ||
151 | 148 | ||
152 | /* initialize prescaler */ | 149 | /* initialize prescaler */ |
153 | while (__raw_readl(base + OMAP_WATCHDOG_WPS) & 0x01) | 150 | while (__raw_readl(base + OMAP_WATCHDOG_WPS) & 0x01) |
@@ -177,8 +174,7 @@ static int omap_wdt_release(struct inode *inode, struct file *file) | |||
177 | 174 | ||
178 | omap_wdt_disable(wdev); | 175 | omap_wdt_disable(wdev); |
179 | 176 | ||
180 | clk_disable(wdev->ick); | 177 | pm_runtime_put_sync(wdev->dev); |
181 | clk_disable(wdev->fck); | ||
182 | #else | 178 | #else |
183 | printk(KERN_CRIT "omap_wdt: Unexpected close, not stopping!\n"); | 179 | printk(KERN_CRIT "omap_wdt: Unexpected close, not stopping!\n"); |
184 | #endif | 180 | #endif |
@@ -292,19 +288,7 @@ static int __devinit omap_wdt_probe(struct platform_device *pdev) | |||
292 | 288 | ||
293 | wdev->omap_wdt_users = 0; | 289 | wdev->omap_wdt_users = 0; |
294 | wdev->mem = mem; | 290 | wdev->mem = mem; |
295 | 291 | wdev->dev = &pdev->dev; | |
296 | wdev->ick = clk_get(&pdev->dev, "ick"); | ||
297 | if (IS_ERR(wdev->ick)) { | ||
298 | ret = PTR_ERR(wdev->ick); | ||
299 | wdev->ick = NULL; | ||
300 | goto err_clk; | ||
301 | } | ||
302 | wdev->fck = clk_get(&pdev->dev, "fck"); | ||
303 | if (IS_ERR(wdev->fck)) { | ||
304 | ret = PTR_ERR(wdev->fck); | ||
305 | wdev->fck = NULL; | ||
306 | goto err_clk; | ||
307 | } | ||
308 | 292 | ||
309 | wdev->base = ioremap(res->start, resource_size(res)); | 293 | wdev->base = ioremap(res->start, resource_size(res)); |
310 | if (!wdev->base) { | 294 | if (!wdev->base) { |
@@ -314,8 +298,8 @@ static int __devinit omap_wdt_probe(struct platform_device *pdev) | |||
314 | 298 | ||
315 | platform_set_drvdata(pdev, wdev); | 299 | platform_set_drvdata(pdev, wdev); |
316 | 300 | ||
317 | clk_enable(wdev->ick); | 301 | pm_runtime_enable(wdev->dev); |
318 | clk_enable(wdev->fck); | 302 | pm_runtime_get_sync(wdev->dev); |
319 | 303 | ||
320 | omap_wdt_disable(wdev); | 304 | omap_wdt_disable(wdev); |
321 | omap_wdt_adjust_timeout(timer_margin); | 305 | omap_wdt_adjust_timeout(timer_margin); |
@@ -333,11 +317,7 @@ static int __devinit omap_wdt_probe(struct platform_device *pdev) | |||
333 | __raw_readl(wdev->base + OMAP_WATCHDOG_REV) & 0xFF, | 317 | __raw_readl(wdev->base + OMAP_WATCHDOG_REV) & 0xFF, |
334 | timer_margin); | 318 | timer_margin); |
335 | 319 | ||
336 | /* autogate OCP interface clock */ | 320 | pm_runtime_put_sync(wdev->dev); |
337 | __raw_writel(0x01, wdev->base + OMAP_WATCHDOG_SYS_CONFIG); | ||
338 | |||
339 | clk_disable(wdev->ick); | ||
340 | clk_disable(wdev->fck); | ||
341 | 321 | ||
342 | omap_wdt_dev = pdev; | 322 | omap_wdt_dev = pdev; |
343 | 323 | ||
@@ -349,12 +329,6 @@ err_misc: | |||
349 | 329 | ||
350 | err_ioremap: | 330 | err_ioremap: |
351 | wdev->base = NULL; | 331 | wdev->base = NULL; |
352 | |||
353 | err_clk: | ||
354 | if (wdev->ick) | ||
355 | clk_put(wdev->ick); | ||
356 | if (wdev->fck) | ||
357 | clk_put(wdev->fck); | ||
358 | kfree(wdev); | 332 | kfree(wdev); |
359 | 333 | ||
360 | err_kzalloc: | 334 | err_kzalloc: |
@@ -386,8 +360,6 @@ static int __devexit omap_wdt_remove(struct platform_device *pdev) | |||
386 | release_mem_region(res->start, resource_size(res)); | 360 | release_mem_region(res->start, resource_size(res)); |
387 | platform_set_drvdata(pdev, NULL); | 361 | platform_set_drvdata(pdev, NULL); |
388 | 362 | ||
389 | clk_put(wdev->ick); | ||
390 | clk_put(wdev->fck); | ||
391 | iounmap(wdev->base); | 363 | iounmap(wdev->base); |
392 | 364 | ||
393 | kfree(wdev); | 365 | kfree(wdev); |