aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/watchdog
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2012-03-08 12:27:07 -0500
committerOlof Johansson <olof@lixom.net>2012-03-08 12:27:07 -0500
commita58f67e70a6cad021ceebd1c8919b898dd5d5de3 (patch)
tree78cb630cb31a8cbec17463f9acc0f766707c232f /drivers/watchdog
parent4c6c826b22da9f6408b6bc6939a92aa0be838488 (diff)
parent46e446db4fb2cdb2f1bc69d3981fa23738a42835 (diff)
Merge branch 'dt' of git://github.com/hzhuang1/linux into next/dt
* 'dt' of git://github.com/hzhuang1/linux: (6 commits) Document: devicetree: add OF documents for arch-mmp ARM: dts: append DTS file of pxa168 ARM: mmp: append OF support on pxa168 ARM: mmp: enable rtc clk in pxa168 i2c: pxa: add OF support serial: pxa: add OF support (plus update to v3.3-rc6)
Diffstat (limited to 'drivers/watchdog')
-rw-r--r--drivers/watchdog/Kconfig2
-rw-r--r--drivers/watchdog/booke_wdt.c6
-rw-r--r--drivers/watchdog/hpwdt.c5
-rw-r--r--drivers/watchdog/pnx4008_wdt.c2
-rw-r--r--drivers/watchdog/s3c2410_wdt.c57
5 files changed, 41 insertions, 31 deletions
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 877b107f77a7..df9e8f0e327d 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -1098,7 +1098,7 @@ config BOOKE_WDT_DEFAULT_TIMEOUT
1098 For Freescale Book-E processors, this is a number between 0 and 63. 1098 For Freescale Book-E processors, this is a number between 0 and 63.
1099 For other Book-E processors, this is a number between 0 and 3. 1099 For other Book-E processors, this is a number between 0 and 3.
1100 1100
1101 The value can be overidden by the wdt_period command-line parameter. 1101 The value can be overridden by the wdt_period command-line parameter.
1102 1102
1103# PPC64 Architecture 1103# PPC64 Architecture
1104 1104
diff --git a/drivers/watchdog/booke_wdt.c b/drivers/watchdog/booke_wdt.c
index 337265b47305..7c0fdfca2646 100644
--- a/drivers/watchdog/booke_wdt.c
+++ b/drivers/watchdog/booke_wdt.c
@@ -198,9 +198,13 @@ static long booke_wdt_ioctl(struct file *file,
198 booke_wdt_period = tmp; 198 booke_wdt_period = tmp;
199#endif 199#endif
200 booke_wdt_set(); 200 booke_wdt_set();
201 return 0; 201 /* Fall */
202 case WDIOC_GETTIMEOUT: 202 case WDIOC_GETTIMEOUT:
203#ifdef CONFIG_FSL_BOOKE
204 return put_user(period_to_sec(booke_wdt_period), p);
205#else
203 return put_user(booke_wdt_period, p); 206 return put_user(booke_wdt_period, p);
207#endif
204 default: 208 default:
205 return -ENOTTY; 209 return -ENOTTY;
206 } 210 }
diff --git a/drivers/watchdog/hpwdt.c b/drivers/watchdog/hpwdt.c
index 8464ea1c36a1..3c166d3f4e55 100644
--- a/drivers/watchdog/hpwdt.c
+++ b/drivers/watchdog/hpwdt.c
@@ -231,7 +231,7 @@ static int __devinit cru_detect(unsigned long map_entry,
231 231
232 cmn_regs.u1.reax = CRU_BIOS_SIGNATURE_VALUE; 232 cmn_regs.u1.reax = CRU_BIOS_SIGNATURE_VALUE;
233 233
234 set_memory_x((unsigned long)bios32_entrypoint, (2 * PAGE_SIZE)); 234 set_memory_x((unsigned long)bios32_map, 2);
235 asminline_call(&cmn_regs, bios32_entrypoint); 235 asminline_call(&cmn_regs, bios32_entrypoint);
236 236
237 if (cmn_regs.u1.ral != 0) { 237 if (cmn_regs.u1.ral != 0) {
@@ -250,7 +250,8 @@ static int __devinit cru_detect(unsigned long map_entry,
250 cru_rom_addr = 250 cru_rom_addr =
251 ioremap(cru_physical_address, cru_length); 251 ioremap(cru_physical_address, cru_length);
252 if (cru_rom_addr) { 252 if (cru_rom_addr) {
253 set_memory_x((unsigned long)cru_rom_addr, cru_length); 253 set_memory_x((unsigned long)cru_rom_addr & PAGE_MASK,
254 (cru_length + PAGE_SIZE - 1) >> PAGE_SHIFT);
254 retval = 0; 255 retval = 0;
255 } 256 }
256 } 257 }
diff --git a/drivers/watchdog/pnx4008_wdt.c b/drivers/watchdog/pnx4008_wdt.c
index 8e210aafdfd0..dfae030a7ef2 100644
--- a/drivers/watchdog/pnx4008_wdt.c
+++ b/drivers/watchdog/pnx4008_wdt.c
@@ -264,7 +264,7 @@ static int __devinit pnx4008_wdt_probe(struct platform_device *pdev)
264 wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 264 wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
265 if (wdt_mem == NULL) { 265 if (wdt_mem == NULL) {
266 printk(KERN_INFO MODULE_NAME 266 printk(KERN_INFO MODULE_NAME
267 "failed to get memory region resouce\n"); 267 "failed to get memory region resource\n");
268 return -ENOENT; 268 return -ENOENT;
269 } 269 }
270 270
diff --git a/drivers/watchdog/s3c2410_wdt.c b/drivers/watchdog/s3c2410_wdt.c
index 4bc3744e14e4..404172f02c9b 100644
--- a/drivers/watchdog/s3c2410_wdt.c
+++ b/drivers/watchdog/s3c2410_wdt.c
@@ -312,18 +312,26 @@ static int __devinit s3c2410wdt_probe(struct platform_device *pdev)
312 dev = &pdev->dev; 312 dev = &pdev->dev;
313 wdt_dev = &pdev->dev; 313 wdt_dev = &pdev->dev;
314 314
315 /* get the memory region for the watchdog timer */
316
317 wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); 315 wdt_mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
318 if (wdt_mem == NULL) { 316 if (wdt_mem == NULL) {
319 dev_err(dev, "no memory resource specified\n"); 317 dev_err(dev, "no memory resource specified\n");
320 return -ENOENT; 318 return -ENOENT;
321 } 319 }
322 320
321 wdt_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
322 if (wdt_irq == NULL) {
323 dev_err(dev, "no irq resource specified\n");
324 ret = -ENOENT;
325 goto err;
326 }
327
328 /* get the memory region for the watchdog timer */
329
323 size = resource_size(wdt_mem); 330 size = resource_size(wdt_mem);
324 if (!request_mem_region(wdt_mem->start, size, pdev->name)) { 331 if (!request_mem_region(wdt_mem->start, size, pdev->name)) {
325 dev_err(dev, "failed to get memory region\n"); 332 dev_err(dev, "failed to get memory region\n");
326 return -EBUSY; 333 ret = -EBUSY;
334 goto err;
327 } 335 }
328 336
329 wdt_base = ioremap(wdt_mem->start, size); 337 wdt_base = ioremap(wdt_mem->start, size);
@@ -335,29 +343,17 @@ static int __devinit s3c2410wdt_probe(struct platform_device *pdev)
335 343
336 DBG("probe: mapped wdt_base=%p\n", wdt_base); 344 DBG("probe: mapped wdt_base=%p\n", wdt_base);
337 345
338 wdt_irq = platform_get_resource(pdev, IORESOURCE_IRQ, 0);
339 if (wdt_irq == NULL) {
340 dev_err(dev, "no irq resource specified\n");
341 ret = -ENOENT;
342 goto err_map;
343 }
344
345 ret = request_irq(wdt_irq->start, s3c2410wdt_irq, 0, pdev->name, pdev);
346 if (ret != 0) {
347 dev_err(dev, "failed to install irq (%d)\n", ret);
348 goto err_map;
349 }
350
351 wdt_clock = clk_get(&pdev->dev, "watchdog"); 346 wdt_clock = clk_get(&pdev->dev, "watchdog");
352 if (IS_ERR(wdt_clock)) { 347 if (IS_ERR(wdt_clock)) {
353 dev_err(dev, "failed to find watchdog clock source\n"); 348 dev_err(dev, "failed to find watchdog clock source\n");
354 ret = PTR_ERR(wdt_clock); 349 ret = PTR_ERR(wdt_clock);
355 goto err_irq; 350 goto err_map;
356 } 351 }
357 352
358 clk_enable(wdt_clock); 353 clk_enable(wdt_clock);
359 354
360 if (s3c2410wdt_cpufreq_register() < 0) { 355 ret = s3c2410wdt_cpufreq_register();
356 if (ret < 0) {
361 printk(KERN_ERR PFX "failed to register cpufreq\n"); 357 printk(KERN_ERR PFX "failed to register cpufreq\n");
362 goto err_clk; 358 goto err_clk;
363 } 359 }
@@ -378,12 +374,18 @@ static int __devinit s3c2410wdt_probe(struct platform_device *pdev)
378 "cannot start\n"); 374 "cannot start\n");
379 } 375 }
380 376
377 ret = request_irq(wdt_irq->start, s3c2410wdt_irq, 0, pdev->name, pdev);
378 if (ret != 0) {
379 dev_err(dev, "failed to install irq (%d)\n", ret);
380 goto err_cpufreq;
381 }
382
381 watchdog_set_nowayout(&s3c2410_wdd, nowayout); 383 watchdog_set_nowayout(&s3c2410_wdd, nowayout);
382 384
383 ret = watchdog_register_device(&s3c2410_wdd); 385 ret = watchdog_register_device(&s3c2410_wdd);
384 if (ret) { 386 if (ret) {
385 dev_err(dev, "cannot register watchdog (%d)\n", ret); 387 dev_err(dev, "cannot register watchdog (%d)\n", ret);
386 goto err_cpufreq; 388 goto err_irq;
387 } 389 }
388 390
389 if (tmr_atboot && started == 0) { 391 if (tmr_atboot && started == 0) {
@@ -408,23 +410,26 @@ static int __devinit s3c2410wdt_probe(struct platform_device *pdev)
408 410
409 return 0; 411 return 0;
410 412
413 err_irq:
414 free_irq(wdt_irq->start, pdev);
415
411 err_cpufreq: 416 err_cpufreq:
412 s3c2410wdt_cpufreq_deregister(); 417 s3c2410wdt_cpufreq_deregister();
413 418
414 err_clk: 419 err_clk:
415 clk_disable(wdt_clock); 420 clk_disable(wdt_clock);
416 clk_put(wdt_clock); 421 clk_put(wdt_clock);
417 422 wdt_clock = NULL;
418 err_irq:
419 free_irq(wdt_irq->start, pdev);
420 423
421 err_map: 424 err_map:
422 iounmap(wdt_base); 425 iounmap(wdt_base);
423 426
424 err_req: 427 err_req:
425 release_mem_region(wdt_mem->start, size); 428 release_mem_region(wdt_mem->start, size);
426 wdt_mem = NULL;
427 429
430 err:
431 wdt_irq = NULL;
432 wdt_mem = NULL;
428 return ret; 433 return ret;
429} 434}
430 435
@@ -432,18 +437,18 @@ static int __devexit s3c2410wdt_remove(struct platform_device *dev)
432{ 437{
433 watchdog_unregister_device(&s3c2410_wdd); 438 watchdog_unregister_device(&s3c2410_wdd);
434 439
440 free_irq(wdt_irq->start, dev);
441
435 s3c2410wdt_cpufreq_deregister(); 442 s3c2410wdt_cpufreq_deregister();
436 443
437 clk_disable(wdt_clock); 444 clk_disable(wdt_clock);
438 clk_put(wdt_clock); 445 clk_put(wdt_clock);
439 wdt_clock = NULL; 446 wdt_clock = NULL;
440 447
441 free_irq(wdt_irq->start, dev);
442 wdt_irq = NULL;
443
444 iounmap(wdt_base); 448 iounmap(wdt_base);
445 449
446 release_mem_region(wdt_mem->start, resource_size(wdt_mem)); 450 release_mem_region(wdt_mem->start, resource_size(wdt_mem));
451 wdt_irq = NULL;
447 wdt_mem = NULL; 452 wdt_mem = NULL;
448 return 0; 453 return 0;
449} 454}