2008-06-02 17:38:22

by Anton Vorontsov

[permalink] [raw]
Subject: [PATCH 0/8 v4] mpc83xx_wdt rework, support for mpc8610 and mpc8xx

Hi all,

No comments on the previous version for two weeks... resending once
again.

Changes since v3:

- None. Simply resending, plus adding Andrew Morton and linux-kernel
to Cc, since I'm constantly getting bounces from Wim Van Sebroeck's
email:

- - - -
<[email protected]>:
213.249.96.99 does not like recipient.
Remote host said: 450 Client host rejected: cannot find your hostname, [85.21.88.2]
Giving up on 213.249.96.99.
I'm not going to try again; this message has been in the queue too long.
- - - -

Not sure whose fault is it though.

Andrew, if Wim will not get this series and there will no objections,
could you please pick [WATCHDOG] ones?

Changes since v2:

- New patch to fix current driver's checkpatch issues;
- New patch supporting MPC8xx watchdogs;
- Removed MODULE_ALIAS("platform:mpc83xx_wdt"), since this driver is no
longer on the platform bus;
- When renaming the driver also mention what kind of CPUs we support.
Also give a pointer for BookE watchdog driver. Though BookE users will
not see the MPC8xxx driver at all, because we're explicitly listing the
CPU families in "depends on". But this tip might be useful for
developers.
- Scott Wood noticed that we don't need device_type anymore. I thought
that OpenFirmware defines this type, but google didn't prove that.
So I just removed the device_type.

Changes since v1:

- Scott Wood asked for mpc83xx_wdt on multiplatform kernels. Done via
OF platform driver;
- Kumar Gala asked for mpc83xx_wdt -> mpc8xxx_wdt rename. Done in two
steps;
- Segher Boessenkool noticed a negligence in the wdt device tree node.
Fixed by removing mpc83xx_wdt compatible entry.

--
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2


2008-06-02 17:38:52

by Anton Vorontsov

[permalink] [raw]
Subject: [PATCH 1/8] [WATCHDOG] mpc83xx_wdt: fix checkpatch issues

Quite tired of these warnings ;-), checkpatch spitting them when
seeing the rename patch.

WARNING: Use #include <linux/io.h> instead of <asm/io.h>
#25: FILE: watchdog/mpc83xx_wdt.c:25:
+#include <asm/io.h>

WARNING: Use #include <linux/uaccess.h> instead of <asm/uaccess.h>
#26: FILE: watchdog/mpc83xx_wdt.c:26:
+#include <asm/uaccess.h>

WARNING: line over 80 characters
#45: FILE: watchdog/mpc83xx_wdt.c:45:
+MODULE_PARM_DESC(timeout, "Watchdog timeout in ticks. (0<timeout<65536, default=65535");

WARNING: line over 80 characters
#49: FILE: watchdog/mpc83xx_wdt.c:49:
+MODULE_PARM_DESC(reset, "Watchdog Interrupt/Reset Mode. 0 = interrupt, 1 = reset");

WARNING: space prohibited between function name and open parenthesis '('
#164: FILE: watchdog/mpc83xx_wdt.c:164:
+ wd_base = ioremap(r->start, sizeof (struct mpc83xx_wdt));

total: 0 errors, 5 warnings, 230 lines checked

Signed-off-by: Anton Vorontsov <[email protected]>
---
drivers/watchdog/mpc83xx_wdt.c | 12 +++++++-----
1 files changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/watchdog/mpc83xx_wdt.c b/drivers/watchdog/mpc83xx_wdt.c
index b16c5cd..6905712 100644
--- a/drivers/watchdog/mpc83xx_wdt.c
+++ b/drivers/watchdog/mpc83xx_wdt.c
@@ -22,8 +22,8 @@
#include <linux/platform_device.h>
#include <linux/module.h>
#include <linux/watchdog.h>
-#include <asm/io.h>
-#include <asm/uaccess.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>

struct mpc83xx_wdt {
__be32 res0;
@@ -42,11 +42,13 @@ static struct mpc83xx_wdt __iomem *wd_base;

static u16 timeout = 0xffff;
module_param(timeout, ushort, 0);
-MODULE_PARM_DESC(timeout, "Watchdog timeout in ticks. (0<timeout<65536, default=65535");
+MODULE_PARM_DESC(timeout, "Watchdog timeout in ticks. "
+ "(0<timeout<65536, default=65535");

static int reset = 1;
module_param(reset, bool, 0);
-MODULE_PARM_DESC(reset, "Watchdog Interrupt/Reset Mode. 0 = interrupt, 1 = reset");
+MODULE_PARM_DESC(reset, "Watchdog Interrupt/Reset Mode. "
+ "0 = interrupt, 1 = reset");

/*
* We always prescale, but if someone really doesn't want to they can set this
@@ -161,7 +163,7 @@ static int __devinit mpc83xx_wdt_probe(struct platform_device *dev)
goto err_out;
}

- wd_base = ioremap(r->start, sizeof (struct mpc83xx_wdt));
+ wd_base = ioremap(r->start, sizeof(struct mpc83xx_wdt));

if (wd_base == NULL) {
ret = -ENOMEM;
--
1.5.5.1

2008-06-02 17:39:33

by Anton Vorontsov

[permalink] [raw]
Subject: [PATCH 3/8] [WATCHDOG] mpc83xx_wdt: add support for MPC86xx CPUs

On MPC86xx the watchdog could be enabled only at power-on-reset, and
could not be disabled afterwards. We must ping the watchdog from the
kernel until the userspace handles it.

MPC83xx CPUs are only differ in a way that watchdog could be disabled
once, but after it was enabled via software it becomes just the same
as MPC86xx.

Thus, to support MPC86xx I added the kernel timer which pings the
watchdog until the userspace opens it.

Since we implemented the timer, now we're able to implement proper
handling for the CONFIG_WATCHDOG_NOWAYOUT case, for MPC83xx and MPC86xx.

Also move the probe code into subsys_initcall, because we want start
pinging the watchdog ASAP, and misc devices are available in
subsys_initcall.

Signed-off-by: Anton Vorontsov <[email protected]>
---
drivers/watchdog/Kconfig | 4 +-
drivers/watchdog/mpc83xx_wdt.c | 80 ++++++++++++++++++++++++++++++++++++----
2 files changed, 74 insertions(+), 10 deletions(-)

diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 254d115..2929055 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -683,8 +683,8 @@ config 8xx_WDT
depends on 8xx

config 83xx_WDT
- tristate "MPC83xx Watchdog Timer"
- depends on PPC_83xx
+ tristate "MPC83xx/MPC86xx Watchdog Timer"
+ depends on PPC_83xx || PPC_86xx

config MV64X60_WDT
tristate "MV64X60 (Marvell Discovery) Watchdog Timer"
diff --git a/drivers/watchdog/mpc83xx_wdt.c b/drivers/watchdog/mpc83xx_wdt.c
index 127d85e..19e3082 100644
--- a/drivers/watchdog/mpc83xx_wdt.c
+++ b/drivers/watchdog/mpc83xx_wdt.c
@@ -1,10 +1,12 @@
/*
- * mpc83xx_wdt.c - MPC83xx watchdog userspace interface
+ * mpc83xx_wdt.c - MPC83xx/MPC86xx watchdog userspace interface
*
* Authors: Dave Updegraff <[email protected]>
* Kumar Gala <[email protected]>
* Attribution: from 83xx_wst: Florian Schirmer <[email protected]>
* ..and from sc520_wdt
+ * Copyright (c) 2008 MontaVista Software, Inc.
+ * Anton Vorontsov <[email protected]>
*
* Note: it appears that you can only actually ENABLE or DISABLE the thing
* once after POR. Once enabled, you cannot disable, and vice versa.
@@ -18,6 +20,7 @@
#include <linux/fs.h>
#include <linux/init.h>
#include <linux/kernel.h>
+#include <linux/timer.h>
#include <linux/miscdevice.h>
#include <linux/of_platform.h>
#include <linux/module.h>
@@ -39,6 +42,11 @@ struct mpc83xx_wdt {
u8 res2[0xF0];
};

+struct mpc83xx_wdt_type {
+ int prescaler;
+ bool hw_enabled;
+};
+
static struct mpc83xx_wdt __iomem *wd_base;

static u16 timeout = 0xffff;
@@ -51,6 +59,11 @@ module_param(reset, bool, 0);
MODULE_PARM_DESC(reset, "Watchdog Interrupt/Reset Mode. "
"0 = interrupt, 1 = reset");

+static int nowayout = WATCHDOG_NOWAYOUT;
+module_param(nowayout, int, 0);
+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started "
+ "(default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+
/*
* We always prescale, but if someone really doesn't want to they can set this
* to 0
@@ -70,6 +83,22 @@ static void mpc83xx_wdt_keepalive(void)
spin_unlock(&wdt_spinlock);
}

+static void mpc83xx_wdt_timer_ping(unsigned long arg);
+static DEFINE_TIMER(wdt_timer, mpc83xx_wdt_timer_ping, 0, 0);
+
+static void mpc83xx_wdt_timer_ping(unsigned long arg)
+{
+ mpc83xx_wdt_keepalive();
+ /* We're pinging it twice faster than needed, just to be sure. */
+ mod_timer(&wdt_timer, jiffies + HZ * timeout_sec / 2);
+}
+
+static void mpc83xx_wdt_pr_warn(const char *msg)
+{
+ pr_crit("mpc83xx_wdt: %s, expect the %s soon!\n", msg,
+ reset ? "reset" : "machine check exception");
+}
+
static ssize_t mpc83xx_wdt_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
@@ -85,7 +114,8 @@ static int mpc83xx_wdt_open(struct inode *inode, struct file *file)
return -EBUSY;

/* Once we start the watchdog we can't stop it */
- __module_get(THIS_MODULE);
+ if (nowayout)
+ __module_get(THIS_MODULE);

/* Good, fire up the show */
if (prescale)
@@ -97,13 +127,17 @@ static int mpc83xx_wdt_open(struct inode *inode, struct file *file)

out_be32(&wd_base->swcrr, tmp);

+ del_timer_sync(&wdt_timer);
+
return nonseekable_open(inode, file);
}

static int mpc83xx_wdt_release(struct inode *inode, struct file *file)
{
- printk(KERN_CRIT "Unexpected close, not stopping watchdog!\n");
- mpc83xx_wdt_keepalive();
+ if (!nowayout)
+ mpc83xx_wdt_timer_ping(0);
+ else
+ mpc83xx_wdt_pr_warn("watchdog closed");
clear_bit(0, &wdt_is_open);
return 0;
}
@@ -154,15 +188,25 @@ static int __devinit mpc83xx_wdt_probe(struct of_device *ofdev,
const struct of_device_id *match)
{
int ret;
+ struct device_node *np = ofdev->node;
+ struct mpc83xx_wdt_type *wdt_type = match->data;
u32 freq = fsl_get_sys_freq();
+ bool enabled;

if (!freq || freq == -1)
return -EINVAL;

- wd_base = of_iomap(ofdev->node, 0);
+ wd_base = of_iomap(np, 0);
if (!wd_base)
return -ENOMEM;

+ enabled = in_be32(&wd_base->swcrr) & SWCRR_SWEN;
+ if (!enabled && wdt_type->hw_enabled) {
+ pr_info("mpc83xx_wdt: could not be enabled in software\n");
+ ret = -ENOSYS;
+ goto err_unmap;
+ }
+
ret = misc_register(&mpc83xx_wdt_miscdev);
if (ret) {
pr_err("cannot register miscdev on minor=%d (err=%d)\n",
@@ -172,13 +216,21 @@ static int __devinit mpc83xx_wdt_probe(struct of_device *ofdev,

/* Calculate the timeout in seconds */
if (prescale)
- timeout_sec = (timeout * 0x10000) / freq;
+ timeout_sec = (timeout * wdt_type->prescaler) / freq;
else
timeout_sec = timeout / freq;

pr_info("WDT driver for MPC83xx initialized. mode:%s timeout=%d "
"(%d seconds)\n", reset ? "reset" : "interrupt", timeout,
timeout_sec);
+
+ /*
+ * If the watchdog was previously enabled or we're running on
+ * MPC86xx, we should ping the wdt from the kernel until the
+ * userspace handles it.
+ */
+ if (enabled)
+ mpc83xx_wdt_timer_ping(0);
return 0;
err_unmap:
iounmap(wd_base);
@@ -187,6 +239,8 @@ err_unmap:

static int __devexit mpc83xx_wdt_remove(struct of_device *ofdev)
{
+ mpc83xx_wdt_pr_warn("watchdog removed");
+ del_timer_sync(&wdt_timer);
misc_deregister(&mpc83xx_wdt_miscdev);
iounmap(wd_base);

@@ -196,6 +250,16 @@ static int __devexit mpc83xx_wdt_remove(struct of_device *ofdev)
static const struct of_device_id mpc83xx_wdt_match[] = {
{
.compatible = "mpc83xx_wdt",
+ .data = &(struct mpc83xx_wdt_type) {
+ .prescaler = 0x10000,
+ },
+ },
+ {
+ .compatible = "fsl,mpc8610-wdt",
+ .data = &(struct mpc83xx_wdt_type) {
+ .prescaler = 0x10000,
+ .hw_enabled = true,
+ },
},
{},
};
@@ -221,10 +285,10 @@ static void __exit mpc83xx_wdt_exit(void)
of_unregister_platform_driver(&mpc83xx_wdt_driver);
}

-module_init(mpc83xx_wdt_init);
+subsys_initcall(mpc83xx_wdt_init);
module_exit(mpc83xx_wdt_exit);

MODULE_AUTHOR("Dave Updegraff, Kumar Gala");
-MODULE_DESCRIPTION("Driver for watchdog timer in MPC83xx uProcessor");
+MODULE_DESCRIPTION("Driver for watchdog timer in MPC83xx/MPC86xx uProcessors");
MODULE_LICENSE("GPL");
MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
--
1.5.5.1

2008-06-02 17:39:14

by Anton Vorontsov

[permalink] [raw]
Subject: [PATCH 2/8] [WATCHDOG] mpc83xx_wdt: convert to the OF platform driver

This patch simply converts mpc83xx_wdt to the OF platform driver so we
can directly work with the device tree without passing various stuff
through platform data.

Signed-off-by: Anton Vorontsov <[email protected]>
Acked-by: Stephen Rothwell <[email protected]>
---
drivers/watchdog/mpc83xx_wdt.c | 62 +++++++++++++++++++--------------------
1 files changed, 30 insertions(+), 32 deletions(-)

diff --git a/drivers/watchdog/mpc83xx_wdt.c b/drivers/watchdog/mpc83xx_wdt.c
index 6905712..127d85e 100644
--- a/drivers/watchdog/mpc83xx_wdt.c
+++ b/drivers/watchdog/mpc83xx_wdt.c
@@ -19,11 +19,12 @@
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/miscdevice.h>
-#include <linux/platform_device.h>
+#include <linux/of_platform.h>
#include <linux/module.h>
#include <linux/watchdog.h>
#include <linux/io.h>
#include <linux/uaccess.h>
+#include <sysdev/fsl_soc.h>

struct mpc83xx_wdt {
__be32 res0;
@@ -149,53 +150,42 @@ static struct miscdevice mpc83xx_wdt_miscdev = {
.fops = &mpc83xx_wdt_fops,
};

-static int __devinit mpc83xx_wdt_probe(struct platform_device *dev)
+static int __devinit mpc83xx_wdt_probe(struct of_device *ofdev,
+ const struct of_device_id *match)
{
- struct resource *r;
int ret;
- unsigned int *freq = dev->dev.platform_data;
+ u32 freq = fsl_get_sys_freq();

- /* get a pointer to the register memory */
- r = platform_get_resource(dev, IORESOURCE_MEM, 0);
+ if (!freq || freq == -1)
+ return -EINVAL;

- if (!r) {
- ret = -ENODEV;
- goto err_out;
- }
-
- wd_base = ioremap(r->start, sizeof(struct mpc83xx_wdt));
-
- if (wd_base == NULL) {
- ret = -ENOMEM;
- goto err_out;
- }
+ wd_base = of_iomap(ofdev->node, 0);
+ if (!wd_base)
+ return -ENOMEM;

ret = misc_register(&mpc83xx_wdt_miscdev);
if (ret) {
- printk(KERN_ERR "cannot register miscdev on minor=%d "
- "(err=%d)\n",
- WATCHDOG_MINOR, ret);
+ pr_err("cannot register miscdev on minor=%d (err=%d)\n",
+ WATCHDOG_MINOR, ret);
goto err_unmap;
}

/* Calculate the timeout in seconds */
if (prescale)
- timeout_sec = (timeout * 0x10000) / (*freq);
+ timeout_sec = (timeout * 0x10000) / freq;
else
- timeout_sec = timeout / (*freq);
+ timeout_sec = timeout / freq;

- printk(KERN_INFO "WDT driver for MPC83xx initialized. "
- "mode:%s timeout=%d (%d seconds)\n",
- reset ? "reset":"interrupt", timeout, timeout_sec);
+ pr_info("WDT driver for MPC83xx initialized. mode:%s timeout=%d "
+ "(%d seconds)\n", reset ? "reset" : "interrupt", timeout,
+ timeout_sec);
return 0;
-
err_unmap:
iounmap(wd_base);
-err_out:
return ret;
}

-static int __devexit mpc83xx_wdt_remove(struct platform_device *dev)
+static int __devexit mpc83xx_wdt_remove(struct of_device *ofdev)
{
misc_deregister(&mpc83xx_wdt_miscdev);
iounmap(wd_base);
@@ -203,7 +193,16 @@ static int __devexit mpc83xx_wdt_remove(struct platform_device *dev)
return 0;
}

-static struct platform_driver mpc83xx_wdt_driver = {
+static const struct of_device_id mpc83xx_wdt_match[] = {
+ {
+ .compatible = "mpc83xx_wdt",
+ },
+ {},
+};
+MODULE_DEVICE_TABLE(of, mpc83xx_wdt_match);
+
+static struct of_platform_driver mpc83xx_wdt_driver = {
+ .match_table = mpc83xx_wdt_match,
.probe = mpc83xx_wdt_probe,
.remove = __devexit_p(mpc83xx_wdt_remove),
.driver = {
@@ -214,12 +213,12 @@ static struct platform_driver mpc83xx_wdt_driver = {

static int __init mpc83xx_wdt_init(void)
{
- return platform_driver_register(&mpc83xx_wdt_driver);
+ return of_register_platform_driver(&mpc83xx_wdt_driver);
}

static void __exit mpc83xx_wdt_exit(void)
{
- platform_driver_unregister(&mpc83xx_wdt_driver);
+ of_unregister_platform_driver(&mpc83xx_wdt_driver);
}

module_init(mpc83xx_wdt_init);
@@ -229,4 +228,3 @@ MODULE_AUTHOR("Dave Updegraff, Kumar Gala");
MODULE_DESCRIPTION("Driver for watchdog timer in MPC83xx uProcessor");
MODULE_LICENSE("GPL");
MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
-MODULE_ALIAS("platform:mpc83xx_wdt");
--
1.5.5.1

2008-06-02 17:40:14

by Anton Vorontsov

[permalink] [raw]
Subject: [PATCH 5/8] [WATCHDOG] mpc8xxx_wdt: various renames, mostly s/mpc83xx/mpc8xxx/g

mpc83xx_wdt.c renamed to mpc8xxx_wdt.c, now we can do various renames
in the file itself.

Signed-off-by: Anton Vorontsov <[email protected]>
---
drivers/watchdog/mpc8xxx_wdt.c | 104 ++++++++++++++++++++--------------------
1 files changed, 52 insertions(+), 52 deletions(-)

diff --git a/drivers/watchdog/mpc8xxx_wdt.c b/drivers/watchdog/mpc8xxx_wdt.c
index 19e3082..2f0681f 100644
--- a/drivers/watchdog/mpc8xxx_wdt.c
+++ b/drivers/watchdog/mpc8xxx_wdt.c
@@ -1,5 +1,5 @@
/*
- * mpc83xx_wdt.c - MPC83xx/MPC86xx watchdog userspace interface
+ * mpc8xxx_wdt.c - MPC83xx/MPC86xx watchdog userspace interface
*
* Authors: Dave Updegraff <[email protected]>
* Kumar Gala <[email protected]>
@@ -29,7 +29,7 @@
#include <linux/uaccess.h>
#include <sysdev/fsl_soc.h>

-struct mpc83xx_wdt {
+struct mpc8xxx_wdt {
__be32 res0;
__be32 swcrr; /* System watchdog control register */
#define SWCRR_SWTC 0xFFFF0000 /* Software Watchdog Time Count. */
@@ -42,12 +42,12 @@ struct mpc83xx_wdt {
u8 res2[0xF0];
};

-struct mpc83xx_wdt_type {
+struct mpc8xxx_wdt_type {
int prescaler;
bool hw_enabled;
};

-static struct mpc83xx_wdt __iomem *wd_base;
+static struct mpc8xxx_wdt __iomem *wd_base;

static u16 timeout = 0xffff;
module_param(timeout, ushort, 0);
@@ -74,7 +74,7 @@ static unsigned int timeout_sec;
static unsigned long wdt_is_open;
static DEFINE_SPINLOCK(wdt_spinlock);

-static void mpc83xx_wdt_keepalive(void)
+static void mpc8xxx_wdt_keepalive(void)
{
/* Ping the WDT */
spin_lock(&wdt_spinlock);
@@ -83,31 +83,31 @@ static void mpc83xx_wdt_keepalive(void)
spin_unlock(&wdt_spinlock);
}

-static void mpc83xx_wdt_timer_ping(unsigned long arg);
-static DEFINE_TIMER(wdt_timer, mpc83xx_wdt_timer_ping, 0, 0);
+static void mpc8xxx_wdt_timer_ping(unsigned long arg);
+static DEFINE_TIMER(wdt_timer, mpc8xxx_wdt_timer_ping, 0, 0);

-static void mpc83xx_wdt_timer_ping(unsigned long arg)
+static void mpc8xxx_wdt_timer_ping(unsigned long arg)
{
- mpc83xx_wdt_keepalive();
+ mpc8xxx_wdt_keepalive();
/* We're pinging it twice faster than needed, just to be sure. */
mod_timer(&wdt_timer, jiffies + HZ * timeout_sec / 2);
}

-static void mpc83xx_wdt_pr_warn(const char *msg)
+static void mpc8xxx_wdt_pr_warn(const char *msg)
{
- pr_crit("mpc83xx_wdt: %s, expect the %s soon!\n", msg,
+ pr_crit("mpc8xxx_wdt: %s, expect the %s soon!\n", msg,
reset ? "reset" : "machine check exception");
}

-static ssize_t mpc83xx_wdt_write(struct file *file, const char __user *buf,
+static ssize_t mpc8xxx_wdt_write(struct file *file, const char __user *buf,
size_t count, loff_t *ppos)
{
if (count)
- mpc83xx_wdt_keepalive();
+ mpc8xxx_wdt_keepalive();
return count;
}

-static int mpc83xx_wdt_open(struct inode *inode, struct file *file)
+static int mpc8xxx_wdt_open(struct inode *inode, struct file *file)
{
u32 tmp = SWCRR_SWEN;
if (test_and_set_bit(0, &wdt_is_open))
@@ -132,17 +132,17 @@ static int mpc83xx_wdt_open(struct inode *inode, struct file *file)
return nonseekable_open(inode, file);
}

-static int mpc83xx_wdt_release(struct inode *inode, struct file *file)
+static int mpc8xxx_wdt_release(struct inode *inode, struct file *file)
{
if (!nowayout)
- mpc83xx_wdt_timer_ping(0);
+ mpc8xxx_wdt_timer_ping(0);
else
- mpc83xx_wdt_pr_warn("watchdog closed");
+ mpc8xxx_wdt_pr_warn("watchdog closed");
clear_bit(0, &wdt_is_open);
return 0;
}

-static int mpc83xx_wdt_ioctl(struct inode *inode, struct file *file,
+static int mpc8xxx_wdt_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg)
{
void __user *argp = (void __user *)arg;
@@ -150,7 +150,7 @@ static int mpc83xx_wdt_ioctl(struct inode *inode, struct file *file,
static struct watchdog_info ident = {
.options = WDIOF_KEEPALIVEPING,
.firmware_version = 1,
- .identity = "MPC83xx",
+ .identity = "MPC8xxx",
};

switch (cmd) {
@@ -160,7 +160,7 @@ static int mpc83xx_wdt_ioctl(struct inode *inode, struct file *file,
case WDIOC_GETBOOTSTATUS:
return put_user(0, p);
case WDIOC_KEEPALIVE:
- mpc83xx_wdt_keepalive();
+ mpc8xxx_wdt_keepalive();
return 0;
case WDIOC_GETTIMEOUT:
return put_user(timeout_sec, p);
@@ -169,27 +169,27 @@ static int mpc83xx_wdt_ioctl(struct inode *inode, struct file *file,
}
}

-static const struct file_operations mpc83xx_wdt_fops = {
+static const struct file_operations mpc8xxx_wdt_fops = {
.owner = THIS_MODULE,
.llseek = no_llseek,
- .write = mpc83xx_wdt_write,
- .ioctl = mpc83xx_wdt_ioctl,
- .open = mpc83xx_wdt_open,
- .release = mpc83xx_wdt_release,
+ .write = mpc8xxx_wdt_write,
+ .ioctl = mpc8xxx_wdt_ioctl,
+ .open = mpc8xxx_wdt_open,
+ .release = mpc8xxx_wdt_release,
};

-static struct miscdevice mpc83xx_wdt_miscdev = {
+static struct miscdevice mpc8xxx_wdt_miscdev = {
.minor = WATCHDOG_MINOR,
.name = "watchdog",
- .fops = &mpc83xx_wdt_fops,
+ .fops = &mpc8xxx_wdt_fops,
};

-static int __devinit mpc83xx_wdt_probe(struct of_device *ofdev,
+static int __devinit mpc8xxx_wdt_probe(struct of_device *ofdev,
const struct of_device_id *match)
{
int ret;
struct device_node *np = ofdev->node;
- struct mpc83xx_wdt_type *wdt_type = match->data;
+ struct mpc8xxx_wdt_type *wdt_type = match->data;
u32 freq = fsl_get_sys_freq();
bool enabled;

@@ -202,12 +202,12 @@ static int __devinit mpc83xx_wdt_probe(struct of_device *ofdev,

enabled = in_be32(&wd_base->swcrr) & SWCRR_SWEN;
if (!enabled && wdt_type->hw_enabled) {
- pr_info("mpc83xx_wdt: could not be enabled in software\n");
+ pr_info("mpc8xxx_wdt: could not be enabled in software\n");
ret = -ENOSYS;
goto err_unmap;
}

- ret = misc_register(&mpc83xx_wdt_miscdev);
+ ret = misc_register(&mpc8xxx_wdt_miscdev);
if (ret) {
pr_err("cannot register miscdev on minor=%d (err=%d)\n",
WATCHDOG_MINOR, ret);
@@ -220,73 +220,73 @@ static int __devinit mpc83xx_wdt_probe(struct of_device *ofdev,
else
timeout_sec = timeout / freq;

- pr_info("WDT driver for MPC83xx initialized. mode:%s timeout=%d "
+ pr_info("WDT driver for MPC8xxx initialized. mode:%s timeout=%d "
"(%d seconds)\n", reset ? "reset" : "interrupt", timeout,
timeout_sec);

/*
* If the watchdog was previously enabled or we're running on
- * MPC86xx, we should ping the wdt from the kernel until the
+ * MPC8xxx, we should ping the wdt from the kernel until the
* userspace handles it.
*/
if (enabled)
- mpc83xx_wdt_timer_ping(0);
+ mpc8xxx_wdt_timer_ping(0);
return 0;
err_unmap:
iounmap(wd_base);
return ret;
}

-static int __devexit mpc83xx_wdt_remove(struct of_device *ofdev)
+static int __devexit mpc8xxx_wdt_remove(struct of_device *ofdev)
{
- mpc83xx_wdt_pr_warn("watchdog removed");
+ mpc8xxx_wdt_pr_warn("watchdog removed");
del_timer_sync(&wdt_timer);
- misc_deregister(&mpc83xx_wdt_miscdev);
+ misc_deregister(&mpc8xxx_wdt_miscdev);
iounmap(wd_base);

return 0;
}

-static const struct of_device_id mpc83xx_wdt_match[] = {
+static const struct of_device_id mpc8xxx_wdt_match[] = {
{
.compatible = "mpc83xx_wdt",
- .data = &(struct mpc83xx_wdt_type) {
+ .data = &(struct mpc8xxx_wdt_type) {
.prescaler = 0x10000,
},
},
{
.compatible = "fsl,mpc8610-wdt",
- .data = &(struct mpc83xx_wdt_type) {
+ .data = &(struct mpc8xxx_wdt_type) {
.prescaler = 0x10000,
.hw_enabled = true,
},
},
{},
};
-MODULE_DEVICE_TABLE(of, mpc83xx_wdt_match);
+MODULE_DEVICE_TABLE(of, mpc8xxx_wdt_match);

-static struct of_platform_driver mpc83xx_wdt_driver = {
- .match_table = mpc83xx_wdt_match,
- .probe = mpc83xx_wdt_probe,
- .remove = __devexit_p(mpc83xx_wdt_remove),
+static struct of_platform_driver mpc8xxx_wdt_driver = {
+ .match_table = mpc8xxx_wdt_match,
+ .probe = mpc8xxx_wdt_probe,
+ .remove = __devexit_p(mpc8xxx_wdt_remove),
.driver = {
- .name = "mpc83xx_wdt",
+ .name = "mpc8xxx_wdt",
.owner = THIS_MODULE,
},
};

-static int __init mpc83xx_wdt_init(void)
+static int __init mpc8xxx_wdt_init(void)
{
- return of_register_platform_driver(&mpc83xx_wdt_driver);
+ return of_register_platform_driver(&mpc8xxx_wdt_driver);
}

-static void __exit mpc83xx_wdt_exit(void)
+static void __exit mpc8xxx_wdt_exit(void)
{
- of_unregister_platform_driver(&mpc83xx_wdt_driver);
+ of_unregister_platform_driver(&mpc8xxx_wdt_driver);
}

-subsys_initcall(mpc83xx_wdt_init);
-module_exit(mpc83xx_wdt_exit);
+subsys_initcall(mpc8xxx_wdt_init);
+module_exit(mpc8xxx_wdt_exit);

MODULE_AUTHOR("Dave Updegraff, Kumar Gala");
MODULE_DESCRIPTION("Driver for watchdog timer in MPC83xx/MPC86xx uProcessors");
--
1.5.5.1

2008-06-02 17:39:49

by Anton Vorontsov

[permalink] [raw]
Subject: [PATCH 4/8] [WATCHDOG] mpc83xx_wdt: rename to mpc8xxx_wdt

Rename the driver because now we support some MPC86xx processors.

There are no changes to the mpc83xx_wdt.c file, yet. When possible, we do
file renames and changes separately (because Linus once asked so, because
it helps git to track the renamed files).

Signed-off-by: Anton Vorontsov <[email protected]>
---
drivers/watchdog/Kconfig | 11 ++-
drivers/watchdog/Makefile | 2 +-
drivers/watchdog/mpc83xx_wdt.c | 294 ----------------------------------------
drivers/watchdog/mpc8xxx_wdt.c | 294 ++++++++++++++++++++++++++++++++++++++++
4 files changed, 304 insertions(+), 297 deletions(-)
delete mode 100644 drivers/watchdog/mpc83xx_wdt.c
create mode 100644 drivers/watchdog/mpc8xxx_wdt.c

diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 2929055..008eaa6 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -682,9 +682,16 @@ config 8xx_WDT
tristate "MPC8xx Watchdog Timer"
depends on 8xx

-config 83xx_WDT
- tristate "MPC83xx/MPC86xx Watchdog Timer"
+config 8xxx_WDT
+ tristate "MPC8xxx Platform Watchdog Timer"
depends on PPC_83xx || PPC_86xx
+ help
+ This driver is for a SoC level watchdog that exists on some
+ Freescale PowerPC processors. So far this driver supports:
+ - MPC83xx watchdogs
+ - MPC86xx watchdogs
+
+ For BookE processors (MPC85xx) use the BOOKE_WDT driver instead.

config MV64X60_WDT
tristate "MV64X60 (Marvell Discovery) Watchdog Timer"
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index f3fb170..d5782f9 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -102,7 +102,7 @@ obj-$(CONFIG_TXX9_WDT) += txx9wdt.o
# POWERPC Architecture
obj-$(CONFIG_8xx_WDT) += mpc8xx_wdt.o
obj-$(CONFIG_MPC5200_WDT) += mpc5200_wdt.o
-obj-$(CONFIG_83xx_WDT) += mpc83xx_wdt.o
+obj-$(CONFIG_8xxx_WDT) += mpc8xxx_wdt.o
obj-$(CONFIG_MV64X60_WDT) += mv64x60_wdt.o
obj-$(CONFIG_BOOKE_WDT) += booke_wdt.o

diff --git a/drivers/watchdog/mpc83xx_wdt.c b/drivers/watchdog/mpc83xx_wdt.c
deleted file mode 100644
index 19e3082..0000000
--- a/drivers/watchdog/mpc83xx_wdt.c
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * mpc83xx_wdt.c - MPC83xx/MPC86xx watchdog userspace interface
- *
- * Authors: Dave Updegraff <[email protected]>
- * Kumar Gala <[email protected]>
- * Attribution: from 83xx_wst: Florian Schirmer <[email protected]>
- * ..and from sc520_wdt
- * Copyright (c) 2008 MontaVista Software, Inc.
- * Anton Vorontsov <[email protected]>
- *
- * Note: it appears that you can only actually ENABLE or DISABLE the thing
- * once after POR. Once enabled, you cannot disable, and vice versa.
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of the GNU General Public License as published by the
- * Free Software Foundation; either version 2 of the License, or (at your
- * option) any later version.
- */
-
-#include <linux/fs.h>
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/timer.h>
-#include <linux/miscdevice.h>
-#include <linux/of_platform.h>
-#include <linux/module.h>
-#include <linux/watchdog.h>
-#include <linux/io.h>
-#include <linux/uaccess.h>
-#include <sysdev/fsl_soc.h>
-
-struct mpc83xx_wdt {
- __be32 res0;
- __be32 swcrr; /* System watchdog control register */
-#define SWCRR_SWTC 0xFFFF0000 /* Software Watchdog Time Count. */
-#define SWCRR_SWEN 0x00000004 /* Watchdog Enable bit. */
-#define SWCRR_SWRI 0x00000002 /* Software Watchdog Reset/Interrupt Select bit.*/
-#define SWCRR_SWPR 0x00000001 /* Software Watchdog Counter Prescale bit. */
- __be32 swcnr; /* System watchdog count register */
- u8 res1[2];
- __be16 swsrr; /* System watchdog service register */
- u8 res2[0xF0];
-};
-
-struct mpc83xx_wdt_type {
- int prescaler;
- bool hw_enabled;
-};
-
-static struct mpc83xx_wdt __iomem *wd_base;
-
-static u16 timeout = 0xffff;
-module_param(timeout, ushort, 0);
-MODULE_PARM_DESC(timeout, "Watchdog timeout in ticks. "
- "(0<timeout<65536, default=65535");
-
-static int reset = 1;
-module_param(reset, bool, 0);
-MODULE_PARM_DESC(reset, "Watchdog Interrupt/Reset Mode. "
- "0 = interrupt, 1 = reset");
-
-static int nowayout = WATCHDOG_NOWAYOUT;
-module_param(nowayout, int, 0);
-MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started "
- "(default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
-
-/*
- * We always prescale, but if someone really doesn't want to they can set this
- * to 0
- */
-static int prescale = 1;
-static unsigned int timeout_sec;
-
-static unsigned long wdt_is_open;
-static DEFINE_SPINLOCK(wdt_spinlock);
-
-static void mpc83xx_wdt_keepalive(void)
-{
- /* Ping the WDT */
- spin_lock(&wdt_spinlock);
- out_be16(&wd_base->swsrr, 0x556c);
- out_be16(&wd_base->swsrr, 0xaa39);
- spin_unlock(&wdt_spinlock);
-}
-
-static void mpc83xx_wdt_timer_ping(unsigned long arg);
-static DEFINE_TIMER(wdt_timer, mpc83xx_wdt_timer_ping, 0, 0);
-
-static void mpc83xx_wdt_timer_ping(unsigned long arg)
-{
- mpc83xx_wdt_keepalive();
- /* We're pinging it twice faster than needed, just to be sure. */
- mod_timer(&wdt_timer, jiffies + HZ * timeout_sec / 2);
-}
-
-static void mpc83xx_wdt_pr_warn(const char *msg)
-{
- pr_crit("mpc83xx_wdt: %s, expect the %s soon!\n", msg,
- reset ? "reset" : "machine check exception");
-}
-
-static ssize_t mpc83xx_wdt_write(struct file *file, const char __user *buf,
- size_t count, loff_t *ppos)
-{
- if (count)
- mpc83xx_wdt_keepalive();
- return count;
-}
-
-static int mpc83xx_wdt_open(struct inode *inode, struct file *file)
-{
- u32 tmp = SWCRR_SWEN;
- if (test_and_set_bit(0, &wdt_is_open))
- return -EBUSY;
-
- /* Once we start the watchdog we can't stop it */
- if (nowayout)
- __module_get(THIS_MODULE);
-
- /* Good, fire up the show */
- if (prescale)
- tmp |= SWCRR_SWPR;
- if (reset)
- tmp |= SWCRR_SWRI;
-
- tmp |= timeout << 16;
-
- out_be32(&wd_base->swcrr, tmp);
-
- del_timer_sync(&wdt_timer);
-
- return nonseekable_open(inode, file);
-}
-
-static int mpc83xx_wdt_release(struct inode *inode, struct file *file)
-{
- if (!nowayout)
- mpc83xx_wdt_timer_ping(0);
- else
- mpc83xx_wdt_pr_warn("watchdog closed");
- clear_bit(0, &wdt_is_open);
- return 0;
-}
-
-static int mpc83xx_wdt_ioctl(struct inode *inode, struct file *file,
- unsigned int cmd, unsigned long arg)
-{
- void __user *argp = (void __user *)arg;
- int __user *p = argp;
- static struct watchdog_info ident = {
- .options = WDIOF_KEEPALIVEPING,
- .firmware_version = 1,
- .identity = "MPC83xx",
- };
-
- switch (cmd) {
- case WDIOC_GETSUPPORT:
- return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
- case WDIOC_GETSTATUS:
- case WDIOC_GETBOOTSTATUS:
- return put_user(0, p);
- case WDIOC_KEEPALIVE:
- mpc83xx_wdt_keepalive();
- return 0;
- case WDIOC_GETTIMEOUT:
- return put_user(timeout_sec, p);
- default:
- return -ENOTTY;
- }
-}
-
-static const struct file_operations mpc83xx_wdt_fops = {
- .owner = THIS_MODULE,
- .llseek = no_llseek,
- .write = mpc83xx_wdt_write,
- .ioctl = mpc83xx_wdt_ioctl,
- .open = mpc83xx_wdt_open,
- .release = mpc83xx_wdt_release,
-};
-
-static struct miscdevice mpc83xx_wdt_miscdev = {
- .minor = WATCHDOG_MINOR,
- .name = "watchdog",
- .fops = &mpc83xx_wdt_fops,
-};
-
-static int __devinit mpc83xx_wdt_probe(struct of_device *ofdev,
- const struct of_device_id *match)
-{
- int ret;
- struct device_node *np = ofdev->node;
- struct mpc83xx_wdt_type *wdt_type = match->data;
- u32 freq = fsl_get_sys_freq();
- bool enabled;
-
- if (!freq || freq == -1)
- return -EINVAL;
-
- wd_base = of_iomap(np, 0);
- if (!wd_base)
- return -ENOMEM;
-
- enabled = in_be32(&wd_base->swcrr) & SWCRR_SWEN;
- if (!enabled && wdt_type->hw_enabled) {
- pr_info("mpc83xx_wdt: could not be enabled in software\n");
- ret = -ENOSYS;
- goto err_unmap;
- }
-
- ret = misc_register(&mpc83xx_wdt_miscdev);
- if (ret) {
- pr_err("cannot register miscdev on minor=%d (err=%d)\n",
- WATCHDOG_MINOR, ret);
- goto err_unmap;
- }
-
- /* Calculate the timeout in seconds */
- if (prescale)
- timeout_sec = (timeout * wdt_type->prescaler) / freq;
- else
- timeout_sec = timeout / freq;
-
- pr_info("WDT driver for MPC83xx initialized. mode:%s timeout=%d "
- "(%d seconds)\n", reset ? "reset" : "interrupt", timeout,
- timeout_sec);
-
- /*
- * If the watchdog was previously enabled or we're running on
- * MPC86xx, we should ping the wdt from the kernel until the
- * userspace handles it.
- */
- if (enabled)
- mpc83xx_wdt_timer_ping(0);
- return 0;
-err_unmap:
- iounmap(wd_base);
- return ret;
-}
-
-static int __devexit mpc83xx_wdt_remove(struct of_device *ofdev)
-{
- mpc83xx_wdt_pr_warn("watchdog removed");
- del_timer_sync(&wdt_timer);
- misc_deregister(&mpc83xx_wdt_miscdev);
- iounmap(wd_base);
-
- return 0;
-}
-
-static const struct of_device_id mpc83xx_wdt_match[] = {
- {
- .compatible = "mpc83xx_wdt",
- .data = &(struct mpc83xx_wdt_type) {
- .prescaler = 0x10000,
- },
- },
- {
- .compatible = "fsl,mpc8610-wdt",
- .data = &(struct mpc83xx_wdt_type) {
- .prescaler = 0x10000,
- .hw_enabled = true,
- },
- },
- {},
-};
-MODULE_DEVICE_TABLE(of, mpc83xx_wdt_match);
-
-static struct of_platform_driver mpc83xx_wdt_driver = {
- .match_table = mpc83xx_wdt_match,
- .probe = mpc83xx_wdt_probe,
- .remove = __devexit_p(mpc83xx_wdt_remove),
- .driver = {
- .name = "mpc83xx_wdt",
- .owner = THIS_MODULE,
- },
-};
-
-static int __init mpc83xx_wdt_init(void)
-{
- return of_register_platform_driver(&mpc83xx_wdt_driver);
-}
-
-static void __exit mpc83xx_wdt_exit(void)
-{
- of_unregister_platform_driver(&mpc83xx_wdt_driver);
-}
-
-subsys_initcall(mpc83xx_wdt_init);
-module_exit(mpc83xx_wdt_exit);
-
-MODULE_AUTHOR("Dave Updegraff, Kumar Gala");
-MODULE_DESCRIPTION("Driver for watchdog timer in MPC83xx/MPC86xx uProcessors");
-MODULE_LICENSE("GPL");
-MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
diff --git a/drivers/watchdog/mpc8xxx_wdt.c b/drivers/watchdog/mpc8xxx_wdt.c
new file mode 100644
index 0000000..19e3082
--- /dev/null
+++ b/drivers/watchdog/mpc8xxx_wdt.c
@@ -0,0 +1,294 @@
+/*
+ * mpc83xx_wdt.c - MPC83xx/MPC86xx watchdog userspace interface
+ *
+ * Authors: Dave Updegraff <[email protected]>
+ * Kumar Gala <[email protected]>
+ * Attribution: from 83xx_wst: Florian Schirmer <[email protected]>
+ * ..and from sc520_wdt
+ * Copyright (c) 2008 MontaVista Software, Inc.
+ * Anton Vorontsov <[email protected]>
+ *
+ * Note: it appears that you can only actually ENABLE or DISABLE the thing
+ * once after POR. Once enabled, you cannot disable, and vice versa.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/fs.h>
+#include <linux/init.h>
+#include <linux/kernel.h>
+#include <linux/timer.h>
+#include <linux/miscdevice.h>
+#include <linux/of_platform.h>
+#include <linux/module.h>
+#include <linux/watchdog.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
+#include <sysdev/fsl_soc.h>
+
+struct mpc83xx_wdt {
+ __be32 res0;
+ __be32 swcrr; /* System watchdog control register */
+#define SWCRR_SWTC 0xFFFF0000 /* Software Watchdog Time Count. */
+#define SWCRR_SWEN 0x00000004 /* Watchdog Enable bit. */
+#define SWCRR_SWRI 0x00000002 /* Software Watchdog Reset/Interrupt Select bit.*/
+#define SWCRR_SWPR 0x00000001 /* Software Watchdog Counter Prescale bit. */
+ __be32 swcnr; /* System watchdog count register */
+ u8 res1[2];
+ __be16 swsrr; /* System watchdog service register */
+ u8 res2[0xF0];
+};
+
+struct mpc83xx_wdt_type {
+ int prescaler;
+ bool hw_enabled;
+};
+
+static struct mpc83xx_wdt __iomem *wd_base;
+
+static u16 timeout = 0xffff;
+module_param(timeout, ushort, 0);
+MODULE_PARM_DESC(timeout, "Watchdog timeout in ticks. "
+ "(0<timeout<65536, default=65535");
+
+static int reset = 1;
+module_param(reset, bool, 0);
+MODULE_PARM_DESC(reset, "Watchdog Interrupt/Reset Mode. "
+ "0 = interrupt, 1 = reset");
+
+static int nowayout = WATCHDOG_NOWAYOUT;
+module_param(nowayout, int, 0);
+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started "
+ "(default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
+
+/*
+ * We always prescale, but if someone really doesn't want to they can set this
+ * to 0
+ */
+static int prescale = 1;
+static unsigned int timeout_sec;
+
+static unsigned long wdt_is_open;
+static DEFINE_SPINLOCK(wdt_spinlock);
+
+static void mpc83xx_wdt_keepalive(void)
+{
+ /* Ping the WDT */
+ spin_lock(&wdt_spinlock);
+ out_be16(&wd_base->swsrr, 0x556c);
+ out_be16(&wd_base->swsrr, 0xaa39);
+ spin_unlock(&wdt_spinlock);
+}
+
+static void mpc83xx_wdt_timer_ping(unsigned long arg);
+static DEFINE_TIMER(wdt_timer, mpc83xx_wdt_timer_ping, 0, 0);
+
+static void mpc83xx_wdt_timer_ping(unsigned long arg)
+{
+ mpc83xx_wdt_keepalive();
+ /* We're pinging it twice faster than needed, just to be sure. */
+ mod_timer(&wdt_timer, jiffies + HZ * timeout_sec / 2);
+}
+
+static void mpc83xx_wdt_pr_warn(const char *msg)
+{
+ pr_crit("mpc83xx_wdt: %s, expect the %s soon!\n", msg,
+ reset ? "reset" : "machine check exception");
+}
+
+static ssize_t mpc83xx_wdt_write(struct file *file, const char __user *buf,
+ size_t count, loff_t *ppos)
+{
+ if (count)
+ mpc83xx_wdt_keepalive();
+ return count;
+}
+
+static int mpc83xx_wdt_open(struct inode *inode, struct file *file)
+{
+ u32 tmp = SWCRR_SWEN;
+ if (test_and_set_bit(0, &wdt_is_open))
+ return -EBUSY;
+
+ /* Once we start the watchdog we can't stop it */
+ if (nowayout)
+ __module_get(THIS_MODULE);
+
+ /* Good, fire up the show */
+ if (prescale)
+ tmp |= SWCRR_SWPR;
+ if (reset)
+ tmp |= SWCRR_SWRI;
+
+ tmp |= timeout << 16;
+
+ out_be32(&wd_base->swcrr, tmp);
+
+ del_timer_sync(&wdt_timer);
+
+ return nonseekable_open(inode, file);
+}
+
+static int mpc83xx_wdt_release(struct inode *inode, struct file *file)
+{
+ if (!nowayout)
+ mpc83xx_wdt_timer_ping(0);
+ else
+ mpc83xx_wdt_pr_warn("watchdog closed");
+ clear_bit(0, &wdt_is_open);
+ return 0;
+}
+
+static int mpc83xx_wdt_ioctl(struct inode *inode, struct file *file,
+ unsigned int cmd, unsigned long arg)
+{
+ void __user *argp = (void __user *)arg;
+ int __user *p = argp;
+ static struct watchdog_info ident = {
+ .options = WDIOF_KEEPALIVEPING,
+ .firmware_version = 1,
+ .identity = "MPC83xx",
+ };
+
+ switch (cmd) {
+ case WDIOC_GETSUPPORT:
+ return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
+ case WDIOC_GETSTATUS:
+ case WDIOC_GETBOOTSTATUS:
+ return put_user(0, p);
+ case WDIOC_KEEPALIVE:
+ mpc83xx_wdt_keepalive();
+ return 0;
+ case WDIOC_GETTIMEOUT:
+ return put_user(timeout_sec, p);
+ default:
+ return -ENOTTY;
+ }
+}
+
+static const struct file_operations mpc83xx_wdt_fops = {
+ .owner = THIS_MODULE,
+ .llseek = no_llseek,
+ .write = mpc83xx_wdt_write,
+ .ioctl = mpc83xx_wdt_ioctl,
+ .open = mpc83xx_wdt_open,
+ .release = mpc83xx_wdt_release,
+};
+
+static struct miscdevice mpc83xx_wdt_miscdev = {
+ .minor = WATCHDOG_MINOR,
+ .name = "watchdog",
+ .fops = &mpc83xx_wdt_fops,
+};
+
+static int __devinit mpc83xx_wdt_probe(struct of_device *ofdev,
+ const struct of_device_id *match)
+{
+ int ret;
+ struct device_node *np = ofdev->node;
+ struct mpc83xx_wdt_type *wdt_type = match->data;
+ u32 freq = fsl_get_sys_freq();
+ bool enabled;
+
+ if (!freq || freq == -1)
+ return -EINVAL;
+
+ wd_base = of_iomap(np, 0);
+ if (!wd_base)
+ return -ENOMEM;
+
+ enabled = in_be32(&wd_base->swcrr) & SWCRR_SWEN;
+ if (!enabled && wdt_type->hw_enabled) {
+ pr_info("mpc83xx_wdt: could not be enabled in software\n");
+ ret = -ENOSYS;
+ goto err_unmap;
+ }
+
+ ret = misc_register(&mpc83xx_wdt_miscdev);
+ if (ret) {
+ pr_err("cannot register miscdev on minor=%d (err=%d)\n",
+ WATCHDOG_MINOR, ret);
+ goto err_unmap;
+ }
+
+ /* Calculate the timeout in seconds */
+ if (prescale)
+ timeout_sec = (timeout * wdt_type->prescaler) / freq;
+ else
+ timeout_sec = timeout / freq;
+
+ pr_info("WDT driver for MPC83xx initialized. mode:%s timeout=%d "
+ "(%d seconds)\n", reset ? "reset" : "interrupt", timeout,
+ timeout_sec);
+
+ /*
+ * If the watchdog was previously enabled or we're running on
+ * MPC86xx, we should ping the wdt from the kernel until the
+ * userspace handles it.
+ */
+ if (enabled)
+ mpc83xx_wdt_timer_ping(0);
+ return 0;
+err_unmap:
+ iounmap(wd_base);
+ return ret;
+}
+
+static int __devexit mpc83xx_wdt_remove(struct of_device *ofdev)
+{
+ mpc83xx_wdt_pr_warn("watchdog removed");
+ del_timer_sync(&wdt_timer);
+ misc_deregister(&mpc83xx_wdt_miscdev);
+ iounmap(wd_base);
+
+ return 0;
+}
+
+static const struct of_device_id mpc83xx_wdt_match[] = {
+ {
+ .compatible = "mpc83xx_wdt",
+ .data = &(struct mpc83xx_wdt_type) {
+ .prescaler = 0x10000,
+ },
+ },
+ {
+ .compatible = "fsl,mpc8610-wdt",
+ .data = &(struct mpc83xx_wdt_type) {
+ .prescaler = 0x10000,
+ .hw_enabled = true,
+ },
+ },
+ {},
+};
+MODULE_DEVICE_TABLE(of, mpc83xx_wdt_match);
+
+static struct of_platform_driver mpc83xx_wdt_driver = {
+ .match_table = mpc83xx_wdt_match,
+ .probe = mpc83xx_wdt_probe,
+ .remove = __devexit_p(mpc83xx_wdt_remove),
+ .driver = {
+ .name = "mpc83xx_wdt",
+ .owner = THIS_MODULE,
+ },
+};
+
+static int __init mpc83xx_wdt_init(void)
+{
+ return of_register_platform_driver(&mpc83xx_wdt_driver);
+}
+
+static void __exit mpc83xx_wdt_exit(void)
+{
+ of_unregister_platform_driver(&mpc83xx_wdt_driver);
+}
+
+subsys_initcall(mpc83xx_wdt_init);
+module_exit(mpc83xx_wdt_exit);
+
+MODULE_AUTHOR("Dave Updegraff, Kumar Gala");
+MODULE_DESCRIPTION("Driver for watchdog timer in MPC83xx/MPC86xx uProcessors");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
--
1.5.5.1

2008-06-02 17:40:39

by Anton Vorontsov

[permalink] [raw]
Subject: [PATCH 6/8] [WATCHDOG] mpc8xxx_wdt: add support for MPC8xx watchdogs

The mpc8xxx_wdt driver is using two registers: SWSRR to push magic
numbers, and SWCRR to control the watchdog. Both registers are available
on the MPC8xx, and seem to have the same offsets and semantics as in
MPC83xx/MPC86xx watchdogs. The only difference is prescale value. So this
driver simply works on the MPC8xx CPUs.

One quirk is needed for the MPC8xx, though. It has small prescale value
and slow CPU, so the watchdog resets board prior to the driver has time
to load. To solve this we should split initialization in two steps: start
ping the watchdog early, and register the watchdog userspace interface
later.

MPC823 seem to be the first CPU in MPC8xx line, so we use fsl,mpc823-wdt
compatible matching.

Signed-off-by: Anton Vorontsov <[email protected]>
Tested-by: Jochen Friedrich <[email protected]>
---
drivers/watchdog/Kconfig | 3 +-
drivers/watchdog/mpc8xxx_wdt.c | 44 ++++++++++++++++++++++++++++++----------
2 files changed, 35 insertions(+), 12 deletions(-)

diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 008eaa6..f9e617b 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -684,10 +684,11 @@ config 8xx_WDT

config 8xxx_WDT
tristate "MPC8xxx Platform Watchdog Timer"
- depends on PPC_83xx || PPC_86xx
+ depends on PPC_8xx || PPC_83xx || PPC_86xx
help
This driver is for a SoC level watchdog that exists on some
Freescale PowerPC processors. So far this driver supports:
+ - MPC8xx watchdogs
- MPC83xx watchdogs
- MPC86xx watchdogs

diff --git a/drivers/watchdog/mpc8xxx_wdt.c b/drivers/watchdog/mpc8xxx_wdt.c
index 2f0681f..0f7e165 100644
--- a/drivers/watchdog/mpc8xxx_wdt.c
+++ b/drivers/watchdog/mpc8xxx_wdt.c
@@ -1,5 +1,5 @@
/*
- * mpc8xxx_wdt.c - MPC83xx/MPC86xx watchdog userspace interface
+ * mpc8xxx_wdt.c - MPC8xx/MPC83xx/MPC86xx watchdog userspace interface
*
* Authors: Dave Updegraff <[email protected]>
* Kumar Gala <[email protected]>
@@ -207,13 +207,6 @@ static int __devinit mpc8xxx_wdt_probe(struct of_device *ofdev,
goto err_unmap;
}

- ret = misc_register(&mpc8xxx_wdt_miscdev);
- if (ret) {
- pr_err("cannot register miscdev on minor=%d (err=%d)\n",
- WATCHDOG_MINOR, ret);
- goto err_unmap;
- }
-
/* Calculate the timeout in seconds */
if (prescale)
timeout_sec = (timeout * wdt_type->prescaler) / freq;
@@ -234,6 +227,7 @@ static int __devinit mpc8xxx_wdt_probe(struct of_device *ofdev,
return 0;
err_unmap:
iounmap(wd_base);
+ wd_base = NULL;
return ret;
}

@@ -261,6 +255,12 @@ static const struct of_device_id mpc8xxx_wdt_match[] = {
.hw_enabled = true,
},
},
+ {
+ .compatible = "fsl,mpc823-wdt",
+ .data = &(struct mpc8xxx_wdt_type) {
+ .prescaler = 0x800,
+ },
+ },
{},
};
MODULE_DEVICE_TABLE(of, mpc8xxx_wdt_match);
@@ -275,20 +275,42 @@ static struct of_platform_driver mpc8xxx_wdt_driver = {
},
};

+/*
+ * We do wdt initialization in two steps: arch_initcall probes the wdt
+ * very early to start pinging the watchdog (misc devices are not yet
+ * available), and later module_init() just registers the misc device.
+ */
+static int __init mpc8xxx_wdt_init_late(void)
+{
+ int ret;
+
+ if (!wd_base)
+ return -ENODEV;
+
+ ret = misc_register(&mpc8xxx_wdt_miscdev);
+ if (ret) {
+ pr_err("cannot register miscdev on minor=%d (err=%d)\n",
+ WATCHDOG_MINOR, ret);
+ return ret;
+ }
+ return 0;
+}
+module_init(mpc8xxx_wdt_init_late);
+
static int __init mpc8xxx_wdt_init(void)
{
return of_register_platform_driver(&mpc8xxx_wdt_driver);
}
+arch_initcall(mpc8xxx_wdt_init);

static void __exit mpc8xxx_wdt_exit(void)
{
of_unregister_platform_driver(&mpc8xxx_wdt_driver);
}
-
-subsys_initcall(mpc8xxx_wdt_init);
module_exit(mpc8xxx_wdt_exit);

MODULE_AUTHOR("Dave Updegraff, Kumar Gala");
-MODULE_DESCRIPTION("Driver for watchdog timer in MPC83xx/MPC86xx uProcessors");
+MODULE_DESCRIPTION("Driver for watchdog timer in MPC8xx/MPC83xx/MPC86xx "
+ "uProcessors");
MODULE_LICENSE("GPL");
MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
--
1.5.5.1

2008-06-02 17:40:55

by Anton Vorontsov

[permalink] [raw]
Subject: [PATCH 7/8] [POWERPC] fsl_soc: remove mpc83xx_wdt code

mpc83xx_wdt is the OF driver now, so we don't need fsl_soc constructor.

Signed-off-by: Anton Vorontsov <[email protected]>
---
arch/powerpc/sysdev/fsl_soc.c | 46 -----------------------------------------
1 files changed, 0 insertions(+), 46 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index a5ceeef..32a3ac8 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -545,52 +545,6 @@ err:
arch_initcall(fsl_i2c_of_init);
#endif

-#ifdef CONFIG_PPC_83xx
-static int __init mpc83xx_wdt_init(void)
-{
- struct resource r;
- struct device_node *np;
- struct platform_device *dev;
- u32 freq = fsl_get_sys_freq();
- int ret;
-
- np = of_find_compatible_node(NULL, "watchdog", "mpc83xx_wdt");
-
- if (!np) {
- ret = -ENODEV;
- goto nodev;
- }
-
- memset(&r, 0, sizeof(r));
-
- ret = of_address_to_resource(np, 0, &r);
- if (ret)
- goto err;
-
- dev = platform_device_register_simple("mpc83xx_wdt", 0, &r, 1);
- if (IS_ERR(dev)) {
- ret = PTR_ERR(dev);
- goto err;
- }
-
- ret = platform_device_add_data(dev, &freq, sizeof(freq));
- if (ret)
- goto unreg;
-
- of_node_put(np);
- return 0;
-
-unreg:
- platform_device_unregister(dev);
-err:
- of_node_put(np);
-nodev:
- return ret;
-}
-
-arch_initcall(mpc83xx_wdt_init);
-#endif
-
static enum fsl_usb2_phy_modes determine_usb_phy(const char *phy_type)
{
if (!phy_type)
--
1.5.5.1

2008-06-02 17:41:18

by Anton Vorontsov

[permalink] [raw]
Subject: [PATCH 8/8] [POWERPC] 86xx: mpc8610_hpcd: add watchdog node


Signed-off-by: Anton Vorontsov <[email protected]>
---
arch/powerpc/boot/dts/mpc8610_hpcd.dts | 5 +++++
1 files changed, 5 insertions(+), 0 deletions(-)

diff --git a/arch/powerpc/boot/dts/mpc8610_hpcd.dts b/arch/powerpc/boot/dts/mpc8610_hpcd.dts
index fa9c297..bb0395b 100644
--- a/arch/powerpc/boot/dts/mpc8610_hpcd.dts
+++ b/arch/powerpc/boot/dts/mpc8610_hpcd.dts
@@ -204,6 +204,11 @@
fsl,has-rstcr;
};

+ wdt@e4000 {
+ compatible = "fsl,mpc8610-wdt";
+ reg = <0xe4000 0x100>;
+ };
+
i2s@16000 {
compatible = "fsl,mpc8610-ssi";
cell-index = <0>;
--
1.5.5.1

2008-06-02 20:06:33

by Alan

[permalink] [raw]
Subject: Re: [PATCH 1/8] [WATCHDOG] mpc83xx_wdt: fix checkpatch issues

On Mon, 2 Jun 2008 21:38:36 +0400
Anton Vorontsov <[email protected]> wrote:

> Quite tired of these warnings ;-), checkpatch spitting them when
> seeing the rename patch.

I've already sent the maintainer a complete overhaul of watchdog via
checkpatch.

Alan

2008-06-02 20:50:02

by Anton Vorontsov

[permalink] [raw]
Subject: Re: [PATCH 1/8] [WATCHDOG] mpc83xx_wdt: fix checkpatch issues

On Mon, Jun 02, 2008 at 08:43:18PM +0100, Alan Cox wrote:
> On Mon, 2 Jun 2008 21:38:36 +0400
> Anton Vorontsov <[email protected]> wrote:
>
> > Quite tired of these warnings ;-), checkpatch spitting them when
> > seeing the rename patch.
>
> I've already sent the maintainer a complete overhaul of watchdog via
> checkpatch.

Oh, I see it now, thanks. I've just read Wim's comments there, and I
think I'll have to wait for git-watchdog update and then will rebase my
work on top.

Thanks,

--
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2

2008-06-03 23:51:17

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH 0/8 v4] mpc83xx_wdt rework, support for mpc8610 and mpc8xx

On Mon, 2 Jun 2008 21:37:26 +0400
Anton Vorontsov <[email protected]> wrote:

> No comments on the previous version for two weeks... resending once
> again.

I did all the rework to make the patches apply on top of all the
pending watchdog work in Wim's tree and in -mm. I haven't build tested
it yet.


I'll assume that

[PATCH 7/8] [POWERPC] fsl_soc: remove mpc83xx_wdt code

and

[PATCH 8/8] [POWERPC] 86xx: mpc8610_hpcd: add watchdog node

are dependent upon the preceding six patches. This might be wrong.


Please put the subsystem identifier (eg, "watchdog" and "powerpc")
outside the [], for reasons which should be in
Documentation/SubmittingPatches, which used to be there but which got
lost. Bascially the text inside [] is for temporary not-for-committing
information such as "rfc", "2.6.24-rc4", "resend", etc and should be stripped
by the email recipient before merging.

2008-06-04 00:17:54

by Anton Vorontsov

[permalink] [raw]
Subject: Re: [PATCH 0/8 v4] mpc83xx_wdt rework, support for mpc8610 and mpc8xx

On Tue, Jun 03, 2008 at 04:48:30PM -0700, Andrew Morton wrote:
> On Mon, 2 Jun 2008 21:37:26 +0400
> Anton Vorontsov <[email protected]> wrote:
>
> > No comments on the previous version for two weeks... resending once
> > again.
>
> I did all the rework to make the patches apply on top of all the
> pending watchdog work in Wim's tree and in -mm. I haven't build tested
> it yet.

Thanks, I'll test it in run-time also.

> I'll assume that
>
> [PATCH 7/8] [POWERPC] fsl_soc: remove mpc83xx_wdt code
>
> and
>
> [PATCH 8/8] [POWERPC] 86xx: mpc8610_hpcd: add watchdog node
>
> are dependent upon the preceding six patches. This might be wrong.

This is correct.

> Please put the subsystem identifier (eg, "watchdog" and "powerpc")
> outside the [], for reasons which should be in
> Documentation/SubmittingPatches, which used to be there but which got
> lost. Bascially the text inside [] is for temporary not-for-committing
> information such as "rfc", "2.6.24-rc4", "resend", etc and should be stripped
> by the email recipient before merging.

Yeah, I know. It is just hard to remember all the preferences.

For example, PowerPC maintainers asking to do patches with "[POWERPC]"
identifier, this identifier purposely keeps intact for git-log.

--
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2

2008-06-04 00:32:47

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH 0/8 v4] mpc83xx_wdt rework, support for mpc8610 and mpc8xx

On Wed, 4 Jun 2008 04:17:39 +0400
Anton Vorontsov <[email protected]> wrote:

> > Please put the subsystem identifier (eg, "watchdog" and "powerpc")
> > outside the [], for reasons which should be in
> > Documentation/SubmittingPatches, which used to be there but which got
> > lost. Bascially the text inside [] is for temporary not-for-committing
> > information such as "rfc", "2.6.24-rc4", "resend", etc and should be stripped
> > by the email recipient before merging.
>
> Yeah, I know. It is just hard to remember all the preferences.
>
> For example, PowerPC maintainers asking to do patches with "[POWERPC]"
> identifier, this identifier purposely keeps intact for git-log.

Addition of "[powerpc]" if it was absent can be scripted.

However, the retaining of "[powerpc]" (etc) while not retaining "[rfc]"
(etc) is not practical.

Plus putting things into git with "[powerpc]" in the title is wrong.
The chances are good that anyone who is taking such a patch off the
git-commits list (say, for a backport) will lose that part of the
title. It should be "powerpc: "

(http://userweb.kernel.org/~akpm/dh.gif)

2008-06-04 04:07:44

by Paul Mackerras

[permalink] [raw]
Subject: Re: [PATCH 0/8 v4] mpc83xx_wdt rework, support for mpc8610 and mpc8xx

Andrew Morton writes:

> On Wed, 4 Jun 2008 04:17:39 +0400
> Anton Vorontsov <[email protected]> wrote:
>
> > > Please put the subsystem identifier (eg, "watchdog" and "powerpc")
> > > outside the [], for reasons which should be in
> > > Documentation/SubmittingPatches, which used to be there but which got
> > > lost. Bascially the text inside [] is for temporary not-for-committing
> > > information such as "rfc", "2.6.24-rc4", "resend", etc and should be stripped
> > > by the email recipient before merging.
> >
> > Yeah, I know. It is just hard to remember all the preferences.
> >
> > For example, PowerPC maintainers asking to do patches with "[POWERPC]"
> > identifier, this identifier purposely keeps intact for git-log.
>
> Addition of "[powerpc]" if it was absent can be scripted.
>
> However, the retaining of "[powerpc]" (etc) while not retaining "[rfc]"
> (etc) is not practical.
>
> Plus putting things into git with "[powerpc]" in the title is wrong.
> The chances are good that anyone who is taking such a patch off the
> git-commits list (say, for a backport) will lose that part of the
> title. It should be "powerpc: "

I think Anton is confusing two things: (a) what should be in the
subject line of a patch posted to a mailing list, and (b) what should
be in the headline of a commit put into a git tree that I pull from.
As for (a), people can put whatever they like in [], and if people put
"powerpc:" in the subject, I edit it out since my scripts put
[POWERPC] in the git commit headline. For (b), I ask git tree
maintainers that I'm going to pull from to put [POWERPC] at the start
of the headline for consistency with what I do.

Looking at Linus' git tree, it's evident that some subsystems use the
the "[SUBSYSTEM]" notation and some use "subsystem:". If there is now
an edict from on high that only "subsystem:" is acceptable, then I
must have missed that memo.

Paul.

2008-06-04 04:16:02

by Andrew Morton

[permalink] [raw]
Subject: Re: [PATCH 0/8 v4] mpc83xx_wdt rework, support for mpc8610 and mpc8xx

On Wed, 4 Jun 2008 14:07:20 +1000 Paul Mackerras <[email protected]> wrote:

> Looking at Linus' git tree, it's evident that some subsystems use the
> the "[SUBSYSTEM]" notation and some use "subsystem:". If there is now
> an edict from on high that only "subsystem:" is acceptable, then I
> must have missed that memo.

I'm all edicted out. Sometimes one just puts forth the reasoning and
lets others decide whether it's worth bothering about. I could understand
that decision being "no" :)

2008-06-04 12:27:39

by Anton Vorontsov

[permalink] [raw]
Subject: Re: [PATCH 0/8 v4] mpc83xx_wdt rework, support for mpc8610 and mpc8xx

On Wed, Jun 04, 2008 at 02:07:20PM +1000, Paul Mackerras wrote:
> Andrew Morton writes:
>
> > On Wed, 4 Jun 2008 04:17:39 +0400
> > Anton Vorontsov <[email protected]> wrote:
> >
> > > > Please put the subsystem identifier (eg, "watchdog" and "powerpc")
> > > > outside the [], for reasons which should be in
> > > > Documentation/SubmittingPatches, which used to be there but which got
> > > > lost. Bascially the text inside [] is for temporary not-for-committing
> > > > information such as "rfc", "2.6.24-rc4", "resend", etc and should be stripped
> > > > by the email recipient before merging.
> > >
> > > Yeah, I know. It is just hard to remember all the preferences.
> > >
> > > For example, PowerPC maintainers asking to do patches with "[POWERPC]"
> > > identifier, this identifier purposely keeps intact for git-log.
> >
> > Addition of "[powerpc]" if it was absent can be scripted.
> >
> > However, the retaining of "[powerpc]" (etc) while not retaining "[rfc]"
> > (etc) is not practical.
> >
> > Plus putting things into git with "[powerpc]" in the title is wrong.
> > The chances are good that anyone who is taking such a patch off the
> > git-commits list (say, for a backport) will lose that part of the
> > title. It should be "powerpc: "
>
> I think Anton is confusing two things:

I found original email.. yes, you indeed ask for [POWERPC] in git
trees.

But. I believe anyone who send patches, tries to mimic existing practice,
and thus please the maintainer. Personally, I'm doing git log subsystem/
and looking for the preferred format for the commit message. And I'm not
alone: linuxppc-dev is full of [POWERPC] in the patch subjects, despite
the fact that you didn't explicitly ask for it.

Asking to send patches with "subsystem: " and then seeing them as
"[SUBSYSTEM] " in git-log is more confusing. Since new authors will
personalize this thinking: "Oh, maintainer fixed my negligence.
Next time I should send a patch with [SUBSYSTEM]".

--
Anton Vorontsov
email: [email protected]
irc://irc.freenode.net/bd2

2008-06-04 17:32:17

by Randy Dunlap

[permalink] [raw]
Subject: Re: [PATCH 0/8 v4] mpc83xx_wdt rework, support for mpc8610 and mpc8xx

On Tue, 3 Jun 2008 21:15:30 -0700 Andrew Morton wrote:

> On Wed, 4 Jun 2008 14:07:20 +1000 Paul Mackerras <[email protected]> wrote:
>
> > Looking at Linus' git tree, it's evident that some subsystems use the
> > the "[SUBSYSTEM]" notation and some use "subsystem:". If there is now
> > an edict from on high that only "subsystem:" is acceptable, then I
> > must have missed that memo.
>
> I'm all edicted out. Sometimes one just puts forth the reasoning and
> lets others decide whether it's worth bothering about. I could understand
> that decision being "no" :)

Well, it would be a Good Thing if all subsystem/arch maintainers would do it
in the same format, whatever that format is.

---
~Randy
<quote:>
"It's the Government of the United States." ... The largest, and yet
the least efficient, producer of computer software in the world.

2008-06-07 17:57:26

by Anton Vorontsov

[permalink] [raw]
Subject: [PATCH -mm] watchdog: mpc8xxx_wdt: fix build

CC drivers/watchdog/mpc8xxx_wdt.o
drivers/watchdog/mpc8xxx_wdt.c: In function 'mpc8xxx_wdt_ioctl':
drivers/watchdog/mpc8xxx_wdt.c:156: error: 'cmd' undeclared (first use in this function)
drivers/watchdog/mpc8xxx_wdt.c:156: error: (Each undeclared identifier is reported only once
drivers/watchdog/mpc8xxx_wdt.c:156: error: for each function it appears in.)
drivers/watchdog/mpc8xxx_wdt.c: At top level:
drivers/watchdog/mpc8xxx_wdt.c:176: warning: initialization from incompatible pointer type

This patch ought to be folded into
mpc8xxx_wdt-various-renames-mostly-s-mpc83xx-mpc8xxx-g.patch

Signed-off-by: Anton Vorontsov <[email protected]>
---

On Tue, Jun 03, 2008 at 04:48:30PM -0700, Andrew Morton wrote:
> On Mon, 2 Jun 2008 21:37:26 +0400
> Anton Vorontsov <[email protected]> wrote:
>
> > No comments on the previous version for two weeks... resending once
> > again.
>
> I did all the rework to make the patches apply on top of all the
> pending watchdog work in Wim's tree and in -mm. I haven't build tested
> it yet.

Well, only one hunk is mis-merged, in
mpc8xxx_wdt-various-renames-mostly-s-mpc83xx-mpc8xxx-g.patch.

Here is the patch to fix it.

I also run-time tested it, everything seem to work great.

p.s. Would be very handy if linux-trees.git would track mmotm snapshots.

drivers/watchdog/mpc8xxx_wdt.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/watchdog/mpc8xxx_wdt.c b/drivers/watchdog/mpc8xxx_wdt.c
index 8b82b91..3c5ed9e 100644
--- a/drivers/watchdog/mpc8xxx_wdt.c
+++ b/drivers/watchdog/mpc8xxx_wdt.c
@@ -142,7 +142,7 @@ static int mpc8xxx_wdt_release(struct inode *inode, struct file *file)
return 0;
}

-static long mpc8xxx_wdt_ioctl(struct inode *inode, struct file *file,
+static long mpc8xxx_wdt_ioctl(struct file *file, unsigned int cmd,
unsigned long arg)
{
void __user *argp = (void __user *)arg;
--
1.5.5.1