Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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