diff options
author | Dale Farnsworth <dale@farnsworth.org> | 2007-07-24 14:12:24 -0400 |
---|---|---|
committer | Wim Van Sebroeck <wim@iguana.be> | 2007-07-24 17:16:02 -0400 |
commit | 7e07a15913e2e1fd99fb77c4c848437bd99a8d5f (patch) | |
tree | b53e6f8c4e2ad9675fb2031a12e6b75f44d5b6f1 /arch/powerpc | |
parent | 8a5cfa648347ab04e63a7f5e3699768d1f9bf00d (diff) |
[WATCHDOG] mv64x60_wdt: Add arch/powerpc platform support
Add support for arch/powerpc, specifically for the prpmc2800 platform.
Signed-off-by: Dale Farnsworth <dale@farnsworth.org>
Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
Diffstat (limited to 'arch/powerpc')
-rw-r--r-- | arch/powerpc/boot/dts/prpmc2800.dts | 6 | ||||
-rw-r--r-- | arch/powerpc/sysdev/mv64x60_dev.c | 64 |
2 files changed, 70 insertions, 0 deletions
diff --git a/arch/powerpc/boot/dts/prpmc2800.dts b/arch/powerpc/boot/dts/prpmc2800.dts index 699d0df574d5..5300b50cdc2f 100644 --- a/arch/powerpc/boot/dts/prpmc2800.dts +++ b/arch/powerpc/boot/dts/prpmc2800.dts | |||
@@ -207,6 +207,12 @@ | |||
207 | interrupt-parent = <&/mv64x60/pic>; | 207 | interrupt-parent = <&/mv64x60/pic>; |
208 | }; | 208 | }; |
209 | 209 | ||
210 | wdt@b410 { /* watchdog timer */ | ||
211 | compatible = "marvell,mv64x60-wdt"; | ||
212 | reg = <b410 8>; | ||
213 | timeout = <a>; /* wdt timeout in seconds */ | ||
214 | }; | ||
215 | |||
210 | i2c@c000 { | 216 | i2c@c000 { |
211 | device_type = "i2c"; | 217 | device_type = "i2c"; |
212 | compatible = "marvell,mv64x60-i2c"; | 218 | compatible = "marvell,mv64x60-i2c"; |
diff --git a/arch/powerpc/sysdev/mv64x60_dev.c b/arch/powerpc/sysdev/mv64x60_dev.c index b618fa60aef3..548a32082e4a 100644 --- a/arch/powerpc/sysdev/mv64x60_dev.c +++ b/arch/powerpc/sysdev/mv64x60_dev.c | |||
@@ -390,6 +390,61 @@ error: | |||
390 | return err; | 390 | return err; |
391 | } | 391 | } |
392 | 392 | ||
393 | /* | ||
394 | * Create mv64x60_wdt platform devices | ||
395 | */ | ||
396 | static int __init mv64x60_wdt_device_setup(struct device_node *np, int id) | ||
397 | { | ||
398 | struct resource r; | ||
399 | struct platform_device *pdev; | ||
400 | struct mv64x60_wdt_pdata pdata; | ||
401 | const unsigned int *prop; | ||
402 | int err; | ||
403 | |||
404 | err = of_address_to_resource(np, 0, &r); | ||
405 | if (err) | ||
406 | return err; | ||
407 | |||
408 | memset(&pdata, 0, sizeof(pdata)); | ||
409 | |||
410 | prop = of_get_property(np, "timeout", NULL); | ||
411 | if (!prop) | ||
412 | return -ENODEV; | ||
413 | pdata.timeout = *prop; | ||
414 | |||
415 | np = of_get_parent(np); | ||
416 | if (!np) | ||
417 | return -ENODEV; | ||
418 | |||
419 | prop = of_get_property(np, "clock-frequency", NULL); | ||
420 | of_node_put(np); | ||
421 | if (!prop) | ||
422 | return -ENODEV; | ||
423 | pdata.bus_clk = *prop / 1000000; /* wdt driver wants freq in MHz */ | ||
424 | |||
425 | pdev = platform_device_alloc(MV64x60_WDT_NAME, id); | ||
426 | if (!pdev) | ||
427 | return -ENOMEM; | ||
428 | |||
429 | err = platform_device_add_resources(pdev, &r, 1); | ||
430 | if (err) | ||
431 | goto error; | ||
432 | |||
433 | err = platform_device_add_data(pdev, &pdata, sizeof(pdata)); | ||
434 | if (err) | ||
435 | goto error; | ||
436 | |||
437 | err = platform_device_add(pdev); | ||
438 | if (err) | ||
439 | goto error; | ||
440 | |||
441 | return 0; | ||
442 | |||
443 | error: | ||
444 | platform_device_put(pdev); | ||
445 | return err; | ||
446 | } | ||
447 | |||
393 | static int __init mv64x60_device_setup(void) | 448 | static int __init mv64x60_device_setup(void) |
394 | { | 449 | { |
395 | struct device_node *np = NULL; | 450 | struct device_node *np = NULL; |
@@ -414,6 +469,15 @@ static int __init mv64x60_device_setup(void) | |||
414 | if ((err = mv64x60_i2c_device_setup(np, id))) | 469 | if ((err = mv64x60_i2c_device_setup(np, id))) |
415 | goto error; | 470 | goto error; |
416 | 471 | ||
472 | /* support up to one watchdog timer */ | ||
473 | np = of_find_compatible_node(np, NULL, "marvell,mv64x60-wdt"); | ||
474 | if (np) { | ||
475 | if ((err = mv64x60_wdt_device_setup(np, id))) | ||
476 | goto error; | ||
477 | of_node_put(np); | ||
478 | } | ||
479 | |||
480 | |||
417 | return 0; | 481 | return 0; |
418 | 482 | ||
419 | error: | 483 | error: |