watchdog: update geodewdt for new MFGPT API

Update to the new cs5535_mfgpt* API. The geode-specific wording should
eventually be dropped from this driver...

Signed-off-by: Andres Salomon <dilinger@collabora.co.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>

authored by

Andres Salomon and committed by
Linus Torvalds
9b0fd114 55639353

+20 -22
+1 -1
drivers/watchdog/Kconfig
··· 368 368 369 369 config GEODE_WDT 370 370 tristate "AMD Geode CS5535/CS5536 Watchdog" 371 - depends on MGEODE_LX 371 + depends on CS5535_MFGPT 372 372 help 373 373 This driver enables a watchdog capability built into the 374 374 CS5535/CS5536 companion chips for the AMD Geode GX and LX
+19 -21
drivers/watchdog/geodewdt.c
··· 1 - /* Watchdog timer for the Geode GX/LX with the CS5535/CS5536 companion chip 1 + /* Watchdog timer for machines with the CS5535/CS5536 companion chip 2 2 * 3 3 * Copyright (C) 2006-2007, Advanced Micro Devices, Inc. 4 + * Copyright (C) 2009 Andres Salomon <dilinger@collabora.co.uk> 4 5 * 5 6 * This program is free software; you can redistribute it and/or 6 7 * modify it under the terms of the GNU General Public License ··· 20 19 #include <linux/reboot.h> 21 20 #include <linux/uaccess.h> 22 21 23 - #include <asm/geode.h> 22 + #include <linux/cs5535.h> 24 23 25 24 #define GEODEWDT_HZ 500 26 25 #define GEODEWDT_SCALE 6 ··· 47 46 48 47 static struct platform_device *geodewdt_platform_device; 49 48 static unsigned long wdt_flags; 50 - static int wdt_timer; 49 + static struct cs5535_mfgpt_timer *wdt_timer; 51 50 static int safe_close; 52 51 53 52 static void geodewdt_ping(void) 54 53 { 55 54 /* Stop the counter */ 56 - geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0); 55 + cs5535_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0); 57 56 58 57 /* Reset the counter */ 59 - geode_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0); 58 + cs5535_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0); 60 59 61 60 /* Enable the counter */ 62 - geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN); 61 + cs5535_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN); 63 62 } 64 63 65 64 static void geodewdt_disable(void) 66 65 { 67 - geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0); 68 - geode_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0); 66 + cs5535_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0); 67 + cs5535_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0); 69 68 } 70 69 71 70 static int geodewdt_set_heartbeat(int val) ··· 73 72 if (val < 1 || val > GEODEWDT_MAX_SECONDS) 74 73 return -EINVAL; 75 74 76 - geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0); 77 - geode_mfgpt_write(wdt_timer, MFGPT_REG_CMP2, val * GEODEWDT_HZ); 78 - geode_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0); 79 - geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN); 75 + cs5535_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 0); 76 + cs5535_mfgpt_write(wdt_timer, MFGPT_REG_CMP2, val * GEODEWDT_HZ); 77 + cs5535_mfgpt_write(wdt_timer, MFGPT_REG_COUNTER, 0); 78 + cs5535_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, MFGPT_SETUP_CNTEN); 80 79 81 80 timeout = val; 82 81 return 0; ··· 216 215 217 216 static int __devinit geodewdt_probe(struct platform_device *dev) 218 217 { 219 - int ret, timer; 218 + int ret; 220 219 221 - timer = geode_mfgpt_alloc_timer(MFGPT_TIMER_ANY, MFGPT_DOMAIN_WORKING); 222 - 223 - if (timer == -1) { 220 + wdt_timer = cs5535_mfgpt_alloc_timer(MFGPT_TIMER_ANY, MFGPT_DOMAIN_WORKING); 221 + if (!wdt_timer) { 224 222 printk(KERN_ERR "geodewdt: No timers were available\n"); 225 223 return -ENODEV; 226 224 } 227 225 228 - wdt_timer = timer; 229 - 230 226 /* Set up the timer */ 231 227 232 - geode_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 228 + cs5535_mfgpt_write(wdt_timer, MFGPT_REG_SETUP, 233 229 GEODEWDT_SCALE | (3 << 8)); 234 230 235 231 /* Set up comparator 2 to reset when the event fires */ 236 - geode_mfgpt_toggle_event(wdt_timer, MFGPT_CMP2, MFGPT_EVENT_RESET, 1); 232 + cs5535_mfgpt_toggle_event(wdt_timer, MFGPT_CMP2, MFGPT_EVENT_RESET, 1); 237 233 238 234 /* Set up the initial timeout */ 239 235 240 - geode_mfgpt_write(wdt_timer, MFGPT_REG_CMP2, 236 + cs5535_mfgpt_write(wdt_timer, MFGPT_REG_CMP2, 241 237 timeout * GEODEWDT_HZ); 242 238 243 239 ret = misc_register(&geodewdt_miscdev);