aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDale Farnsworth <dale@farnsworth.org>2007-07-24 14:07:38 -0400
committerWim Van Sebroeck <wim@iguana.be>2007-07-24 14:56:35 -0400
commit422db8d229affd429b5a7389600877aa7dea2704 (patch)
tree2cdd7aaf3519379036dafa930bcfe31488cc91db
parent28dd1b0b9191ac9cd0b96fa4d09d951498bfbadb (diff)
[WATCHDOG] mv64x60_wdt: set up platform_device in platform code
The driver previously registered its platform device data in its own init function--that's bogus. Move that code to platform-specific code in arch/ppc. This is being done so that the platform code can decide at runtime whether to initialize this driver or not. Signed-off-by: Dale Farnsworth <dale@farnsworth.org> Signed-off-by: Wim Van Sebroeck <wim@iguana.be>
-rw-r--r--arch/ppc/syslib/mv64x60.c29
-rw-r--r--drivers/char/watchdog/mv64x60_wdt.c26
-rw-r--r--include/asm-ppc/mv64x60.h2
3 files changed, 31 insertions, 26 deletions
diff --git a/arch/ppc/syslib/mv64x60.c b/arch/ppc/syslib/mv64x60.c
index d212b1c418a9..2744b8a6f66a 100644
--- a/arch/ppc/syslib/mv64x60.c
+++ b/arch/ppc/syslib/mv64x60.c
@@ -441,6 +441,32 @@ static struct platform_device i2c_device = {
441}; 441};
442#endif 442#endif
443 443
444#ifdef CONFIG_WATCHDOG
445static struct mv64x60_wdt_pdata mv64x60_wdt_pdata = {
446 .timeout = 10, /* default watchdog expiry in seconds */
447 .bus_clk = 133, /* default bus clock in MHz */
448};
449
450static struct resource mv64x60_wdt_resources[] = {
451 [0] = {
452 .name = "mv64x60 wdt base",
453 .start = MV64x60_WDT_WDC,
454 .end = MV64x60_WDT_WDC + 8 - 1, /* two 32-bit registers */
455 .flags = IORESOURCE_MEM,
456 },
457};
458
459static struct platform_device wdt_device = {
460 .name = MV64x60_WDT_NAME,
461 .id = 0,
462 .num_resources = ARRAY_SIZE(mv64x60_wdt_resources),
463 .resource = mv64x60_wdt_resources,
464 .dev = {
465 .platform_data = &mv64x60_wdt_pdata,
466 },
467};
468#endif
469
444#if defined(CONFIG_SYSFS) && !defined(CONFIG_GT64260) 470#if defined(CONFIG_SYSFS) && !defined(CONFIG_GT64260)
445static struct mv64xxx_pdata mv64xxx_pdata = { 471static struct mv64xxx_pdata mv64xxx_pdata = {
446 .hs_reg_valid = 0, 472 .hs_reg_valid = 0,
@@ -476,6 +502,9 @@ static struct platform_device *mv64x60_pd_devs[] __initdata = {
476#ifdef CONFIG_I2C_MV64XXX 502#ifdef CONFIG_I2C_MV64XXX
477 &i2c_device, 503 &i2c_device,
478#endif 504#endif
505#ifdef CONFIG_MV64X60_WDT
506 &wdt_device,
507#endif
479#if defined(CONFIG_SYSFS) && !defined(CONFIG_GT64260) 508#if defined(CONFIG_SYSFS) && !defined(CONFIG_GT64260)
480 &mv64xxx_device, 509 &mv64xxx_device,
481#endif 510#endif
diff --git a/drivers/char/watchdog/mv64x60_wdt.c b/drivers/char/watchdog/mv64x60_wdt.c
index b887cdb01334..038f76e39818 100644
--- a/drivers/char/watchdog/mv64x60_wdt.c
+++ b/drivers/char/watchdog/mv64x60_wdt.c
@@ -219,40 +219,16 @@ static struct platform_driver mv64x60_wdt_driver = {
219 }, 219 },
220}; 220};
221 221
222static struct platform_device *mv64x60_wdt_dev;
223
224static int __init mv64x60_wdt_init(void) 222static int __init mv64x60_wdt_init(void)
225{ 223{
226 int ret;
227
228 printk(KERN_INFO "MV64x60 watchdog driver\n"); 224 printk(KERN_INFO "MV64x60 watchdog driver\n");
229 225
230 mv64x60_wdt_dev = platform_device_alloc(MV64x60_WDT_NAME, -1); 226 return platform_driver_register(&mv64x60_wdt_driver);
231 if (!mv64x60_wdt_dev) {
232 ret = -ENOMEM;
233 goto out;
234 }
235
236 ret = platform_device_add(mv64x60_wdt_dev);
237 if (ret) {
238 platform_device_put(mv64x60_wdt_dev);
239 goto out;
240 }
241
242 ret = platform_driver_register(&mv64x60_wdt_driver);
243 if (ret) {
244 platform_device_unregister(mv64x60_wdt_dev);
245 goto out;
246 }
247
248 out:
249 return ret;
250} 227}
251 228
252static void __exit mv64x60_wdt_exit(void) 229static void __exit mv64x60_wdt_exit(void)
253{ 230{
254 platform_driver_unregister(&mv64x60_wdt_driver); 231 platform_driver_unregister(&mv64x60_wdt_driver);
255 platform_device_unregister(mv64x60_wdt_dev);
256} 232}
257 233
258module_init(mv64x60_wdt_init); 234module_init(mv64x60_wdt_init);
diff --git a/include/asm-ppc/mv64x60.h b/include/asm-ppc/mv64x60.h
index db3776f18198..fa6230fb641a 100644
--- a/include/asm-ppc/mv64x60.h
+++ b/include/asm-ppc/mv64x60.h
@@ -121,7 +121,7 @@ extern spinlock_t mv64x60_lock;
121#define MV64x60_64BIT_WIN_COUNT 24 121#define MV64x60_64BIT_WIN_COUNT 24
122 122
123/* Watchdog Platform Device, Driver Data */ 123/* Watchdog Platform Device, Driver Data */
124#define MV64x60_WDT_NAME "wdt" 124#define MV64x60_WDT_NAME "mv64x60_wdt"
125 125
126struct mv64x60_wdt_pdata { 126struct mv64x60_wdt_pdata {
127 int timeout; /* watchdog expiry in seconds, default 10 */ 127 int timeout; /* watchdog expiry in seconds, default 10 */