Commit 39cdc4bf authored by Kumar Gala's avatar Kumar Gala Committed by Linus Torvalds

[PATCH] ppc32: Cleaned up global namespace of Book-E watchdog variables

Renamed global variables used to convey if the watchdog is enabled and
periodicity of the timer and moved the declarations into a header for these
variables
Signed-off-by: default avatarMatt McClintock <msm@freescale.com>
Signed-off-by: default avatarKumar Gala <kumar.gala@freescale.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent b0531b9b
...@@ -623,10 +623,8 @@ machine_init(unsigned long r3, unsigned long r4, unsigned long r5, ...@@ -623,10 +623,8 @@ machine_init(unsigned long r3, unsigned long r4, unsigned long r5,
/* Checks wdt=x and wdt_period=xx command-line option */ /* Checks wdt=x and wdt_period=xx command-line option */
int __init early_parse_wdt(char *p) int __init early_parse_wdt(char *p)
{ {
extern u32 wdt_enable;
if (p && strncmp(p, "0", 1) != 0) if (p && strncmp(p, "0", 1) != 0)
wdt_enable = 1; booke_wdt_enabled = 1;
return 0; return 0;
} }
...@@ -634,10 +632,8 @@ early_param("wdt", early_parse_wdt); ...@@ -634,10 +632,8 @@ early_param("wdt", early_parse_wdt);
int __init early_parse_wdt_period (char *p) int __init early_parse_wdt_period (char *p)
{ {
extern u32 wdt_period;
if (p) if (p)
wdt_period = simple_strtoul(p, NULL, 0); booke_wdt_period = simple_strtoul(p, NULL, 0);
return 0; return 0;
} }
......
...@@ -349,6 +349,9 @@ config 8xx_WDT ...@@ -349,6 +349,9 @@ config 8xx_WDT
config BOOKE_WDT config BOOKE_WDT
tristate "PowerPC Book-E Watchdog Timer" tristate "PowerPC Book-E Watchdog Timer"
depends on WATCHDOG && (BOOKE || 4xx) depends on WATCHDOG && (BOOKE || 4xx)
---help---
Please see Documentation/watchdog/watchdog-api.txt for
more information.
# MIPS Architecture # MIPS Architecture
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <asm/reg_booke.h> #include <asm/reg_booke.h>
#include <asm/uaccess.h> #include <asm/uaccess.h>
#include <asm/system.h>
/* If the kernel parameter wdt_enable=1, the watchdog will be enabled at boot. /* If the kernel parameter wdt_enable=1, the watchdog will be enabled at boot.
* Also, the wdt_period sets the watchdog timer period timeout. * Also, the wdt_period sets the watchdog timer period timeout.
...@@ -38,8 +39,8 @@ ...@@ -38,8 +39,8 @@
#define WDT_PERIOD_DEFAULT 4 /* Refer to the PPC40x and PPC4xx manuals */ #define WDT_PERIOD_DEFAULT 4 /* Refer to the PPC40x and PPC4xx manuals */
#endif /* for timing information */ #endif /* for timing information */
u32 wdt_enable = 0; u32 booke_wdt_enabled = 0;
u32 wdt_period = WDT_PERIOD_DEFAULT; u32 booke_wdt_period = WDT_PERIOD_DEFAULT;
#ifdef CONFIG_FSL_BOOKE #ifdef CONFIG_FSL_BOOKE
#define WDTP(x) ((((63-x)&0x3)<<30)|(((63-x)&0x3c)<<15)) #define WDTP(x) ((((63-x)&0x3)<<30)|(((63-x)&0x3c)<<15))
...@@ -55,7 +56,7 @@ static __inline__ void booke_wdt_enable(void) ...@@ -55,7 +56,7 @@ static __inline__ void booke_wdt_enable(void)
u32 val; u32 val;
val = mfspr(SPRN_TCR); val = mfspr(SPRN_TCR);
val |= (TCR_WIE|TCR_WRC(WRC_CHIP)|WDTP(wdt_period)); val |= (TCR_WIE|TCR_WRC(WRC_CHIP)|WDTP(booke_wdt_period));
mtspr(SPRN_TCR, val); mtspr(SPRN_TCR, val);
} }
...@@ -108,12 +109,12 @@ static int booke_wdt_ioctl (struct inode *inode, struct file *file, ...@@ -108,12 +109,12 @@ static int booke_wdt_ioctl (struct inode *inode, struct file *file,
booke_wdt_ping(); booke_wdt_ping();
return 0; return 0;
case WDIOC_SETTIMEOUT: case WDIOC_SETTIMEOUT:
if (get_user(wdt_period, (u32 *) arg)) if (get_user(booke_wdt_period, (u32 *) arg))
return -EFAULT; return -EFAULT;
mtspr(SPRN_TCR, (mfspr(SPRN_TCR)&~WDTP(0))|WDTP(wdt_period)); mtspr(SPRN_TCR, (mfspr(SPRN_TCR)&~WDTP(0))|WDTP(booke_wdt_period));
return 0; return 0;
case WDIOC_GETTIMEOUT: case WDIOC_GETTIMEOUT:
return put_user(wdt_period, (u32 *) arg); return put_user(booke_wdt_period, (u32 *) arg);
case WDIOC_SETOPTIONS: case WDIOC_SETOPTIONS:
if (get_user(tmp, (u32 *) arg)) if (get_user(tmp, (u32 *) arg))
return -EINVAL; return -EINVAL;
...@@ -134,11 +135,11 @@ static int booke_wdt_ioctl (struct inode *inode, struct file *file, ...@@ -134,11 +135,11 @@ static int booke_wdt_ioctl (struct inode *inode, struct file *file,
*/ */
static int booke_wdt_open (struct inode *inode, struct file *file) static int booke_wdt_open (struct inode *inode, struct file *file)
{ {
if (wdt_enable == 0) { if (booke_wdt_enabled == 0) {
wdt_enable = 1; booke_wdt_enabled = 1;
booke_wdt_enable(); booke_wdt_enable();
printk (KERN_INFO "PowerPC Book-E Watchdog Timer Enabled (wdt_period=%d)\n", printk (KERN_INFO "PowerPC Book-E Watchdog Timer Enabled (wdt_period=%d)\n",
wdt_period); booke_wdt_period);
} }
return 0; return 0;
...@@ -180,9 +181,9 @@ static int __init booke_wdt_init(void) ...@@ -180,9 +181,9 @@ static int __init booke_wdt_init(void)
return ret; return ret;
} }
if (wdt_enable == 1) { if (booke_wdt_enabled == 1) {
printk (KERN_INFO "PowerPC Book-E Watchdog Timer Enabled (wdt_period=%d)\n", printk (KERN_INFO "PowerPC Book-E Watchdog Timer Enabled (wdt_period=%d)\n",
wdt_period); booke_wdt_period);
booke_wdt_enable(); booke_wdt_enable();
} }
......
...@@ -87,6 +87,10 @@ extern void cacheable_memzero(void *p, unsigned int nb); ...@@ -87,6 +87,10 @@ extern void cacheable_memzero(void *p, unsigned int nb);
extern int do_page_fault(struct pt_regs *, unsigned long, unsigned long); extern int do_page_fault(struct pt_regs *, unsigned long, unsigned long);
extern void bad_page_fault(struct pt_regs *, unsigned long, int); extern void bad_page_fault(struct pt_regs *, unsigned long, int);
extern void die(const char *, struct pt_regs *, long); extern void die(const char *, struct pt_regs *, long);
#ifdef CONFIG_BOOKE_WDT
extern u32 booke_wdt_enabled;
extern u32 booke_wdt_period;
#endif /* CONFIG_BOOKE_WDT */
struct device_node; struct device_node;
extern void note_scsi_host(struct device_node *, void *); extern void note_scsi_host(struct device_node *, void *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment