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 | |
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>
-rw-r--r-- | arch/powerpc/boot/dts/prpmc2800.dts | 6 | ||||
-rw-r--r-- | arch/powerpc/sysdev/mv64x60_dev.c | 64 | ||||
-rw-r--r-- | drivers/char/watchdog/mv64x60_wdt.c | 2 | ||||
-rw-r--r-- | include/asm-ppc/mv64x60.h | 8 | ||||
-rw-r--r-- | include/linux/mv643xx.h | 8 |
5 files changed, 79 insertions, 9 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: |
diff --git a/drivers/char/watchdog/mv64x60_wdt.c b/drivers/char/watchdog/mv64x60_wdt.c index 1ad632dd03e6..064e18034395 100644 --- a/drivers/char/watchdog/mv64x60_wdt.c +++ b/drivers/char/watchdog/mv64x60_wdt.c | |||
@@ -23,7 +23,7 @@ | |||
23 | #include <linux/watchdog.h> | 23 | #include <linux/watchdog.h> |
24 | #include <linux/platform_device.h> | 24 | #include <linux/platform_device.h> |
25 | 25 | ||
26 | #include <asm/mv64x60.h> | 26 | #include <linux/mv643xx.h> |
27 | #include <asm/uaccess.h> | 27 | #include <asm/uaccess.h> |
28 | #include <asm/io.h> | 28 | #include <asm/io.h> |
29 | 29 | ||
diff --git a/include/asm-ppc/mv64x60.h b/include/asm-ppc/mv64x60.h index fa6230fb641a..2963d6aa3ea5 100644 --- a/include/asm-ppc/mv64x60.h +++ b/include/asm-ppc/mv64x60.h | |||
@@ -120,14 +120,6 @@ extern spinlock_t mv64x60_lock; | |||
120 | 120 | ||
121 | #define MV64x60_64BIT_WIN_COUNT 24 | 121 | #define MV64x60_64BIT_WIN_COUNT 24 |
122 | 122 | ||
123 | /* Watchdog Platform Device, Driver Data */ | ||
124 | #define MV64x60_WDT_NAME "mv64x60_wdt" | ||
125 | |||
126 | struct mv64x60_wdt_pdata { | ||
127 | int timeout; /* watchdog expiry in seconds, default 10 */ | ||
128 | int bus_clk; /* bus clock in MHz, default 133 */ | ||
129 | }; | ||
130 | |||
131 | /* | 123 | /* |
132 | * Define a structure that's used to pass in config information to the | 124 | * Define a structure that's used to pass in config information to the |
133 | * core routines. | 125 | * core routines. |
diff --git a/include/linux/mv643xx.h b/include/linux/mv643xx.h index b021b3a2b65a..9c8049005052 100644 --- a/include/linux/mv643xx.h +++ b/include/linux/mv643xx.h | |||
@@ -1302,4 +1302,12 @@ struct mv643xx_eth_platform_data { | |||
1302 | u8 mac_addr[6]; /* mac address if non-zero*/ | 1302 | u8 mac_addr[6]; /* mac address if non-zero*/ |
1303 | }; | 1303 | }; |
1304 | 1304 | ||
1305 | /* Watchdog Platform Device, Driver Data */ | ||
1306 | #define MV64x60_WDT_NAME "mv64x60_wdt" | ||
1307 | |||
1308 | struct mv64x60_wdt_pdata { | ||
1309 | int timeout; /* watchdog expiry in seconds, default 10 */ | ||
1310 | int bus_clk; /* bus clock in MHz, default 133 */ | ||
1311 | }; | ||
1312 | |||
1305 | #endif /* __ASM_MV643XX_H */ | 1313 | #endif /* __ASM_MV643XX_H */ |