mpc83xx_wdt rework, support for mpc8610
Subsystems (3)
v2 cover mpc83xx_wdt rework, support for mpc8610
Hi all,
Thanks for the review, here is the new version.
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.
Signature · 3 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2
PATCH v2 1/6 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.
--- drivers/watchdog/mpc83xx_wdt.c | 64 ++++++++++++++++++---------------------- 1 files changed, 29 insertions(+), 35 deletions(-)
drivers/watchdog/mpc83xx_wdt.c +29 -35
@@ -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 <asm/io.h> #include <asm/uaccess.h> +#include <sysdev/fsl_soc.h> struct mpc83xx_wdt {__be32 res0;
@@ -147,53 +148,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);
@@ -201,23 +191,27 @@ 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 = { + .name ="mpc83xx_wdt" , + .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 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);
Signature · 1 line
1.5.5.1
Re: [PATCH 1/6] [WATCHDOG] mpc83xx_wdt: convert to the OF platform driver
Hi Anton,
drivers/watchdog/mpc83xx_wdt.c static int __devexit mpc83xx_wdt_remove(struct platform_device *dev) · line 210
Quoted 10 lines · On Tue, 13 May 2008 18:14:54 +0400 Anton Vorontsov <[email protected]>…
drivers/watchdog/mpc83xx_wdt.c +3
-4+static struct of_platform_driver mpc83xx_wdt_driver = { + .name ="mpc83xx_wdt" , + .match_table = mpc83xx_wdt_match, .probe = mpc83xx_wdt_probe, .remove =__devexit_p (mpc83xx_wdt_remove), - .driver = { - .name = "mpc83xx_wdt", - .owner = THIS_MODULE, - },
You should leave this as it was because the name and owner fields are being removed from struct of_platform_driver in favour of those embedded in the .driver.
Maybe I should add a comment to the structure definition. Or maybe it is time to actually remove them.
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
PATCH v2 2/6 mpc83xx_wdt: add support for MPC86xx CPUs
In reply to Anton VorontsovOn 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.
--- drivers/watchdog/Kconfig | 4 +- drivers/watchdog/mpc83xx_wdt.c | 63 +++++++++++++++++++++++++++++++++++---- 2 files changed, 58 insertions(+), 9 deletions(-)
drivers/watchdog/Kconfig +2 -2
@@ -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"
drivers/watchdog/mpc83xx_wdt.c +56 -7
148 lines not on this page · raw message
Signature · 1 line
1.5.5.1
PATCH v2 3/6 mpc83xx_wdt: rename to mpc8xxx_wdt
In reply to Anton VorontsovRename 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).
--- drivers/watchdog/Kconfig | 4 +- drivers/watchdog/Makefile | 2 +- drivers/watchdog/mpc83xx_wdt.c | 273 ---------------------------------------- drivers/watchdog/mpc8xxx_wdt.c | 273 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 276 insertions(+), 276 deletions(-) delete mode 100644 drivers/watchdog/mpc83xx_wdt.c create mode 100644 drivers/watchdog/mpc8xxx_wdt.c
drivers/watchdog/Kconfig +2 -2
@@ -682,8 +682,8 @@ config 8xx_WDT tristate "MPC8xx Watchdog Timer" depends on 8xx -config 83xx_WDT - tristate "MPC83xx/MPC86xx Watchdog Timer" +config 8xxx_WDT + tristate "MPC8xxx Watchdog Timer" depends on PPC_83xx || PPC_86xx config MV64X60_WDT
drivers/watchdog/Makefile +1 -1
@@ -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
drivers/watchdog/mpc83xx_wdt.c deleted +0 -273
273 lines not on this page · raw message
drivers/watchdog/mpc8xxx_wdt.c new file +273 -0
273 lines not on this page · raw message
Signature · 1 line
1.5.5.1
Re: [PATCH 3/6] [WATCHDOG] mpc83xx_wdt: rename to mpc8xxx_wdt
Quoted 8 lines · On Tue, 13 May 2008 18:14:59 +0400 Anton Vorontsov <[email protected]>…
Rename the driver because now we support some MPC86xx processors.
There are no changes to the
mpc83xx_wdt.cfile, 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]>
Quoted 8 lines
--- drivers/watchdog/Kconfig | 4 +- drivers/watchdog/Makefile | 2 +- drivers/watchdog/mpc83xx_wdt.c | 273 ---------------------------------------- drivers/watchdog/mpc8xxx_wdt.c | 273 ++++++++++++++++++++++++++++++++++++++++ 4 files changed, 276 insertions(+), 276 deletions(-) delete mode 100644 drivers/watchdog/mpc83xx_wdt.c create mode 100644 drivers/watchdog/mpc8xxx_wdt.c
Doing this status with "git diff -M --stat" would show us if the file was just renamed or if there were some changes as well ...
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
Re: [PATCH 3/6] [WATCHDOG] mpc83xx_wdt: rename to mpc8xxx_wdt
Hi Anton,
Quoted 3 lines · On Wed, 14 May 2008 11:45:23 +1000 Stephen Rothwell <[email protected]>…
Doing this status with "git diff -M --stat" would show us if the file was just renamed or if there were some changes as well ...
Not that I don't trust you, just for future reference.
Signature · 3 lines
Cheers, Stephen Rothwell [email protected] http://www.canb.auug.org.au/~sfr/
Re: [PATCH 3/6] [WATCHDOG] mpc83xx_wdt: rename to mpc8xxx_wdt
Quoted 8 lines · Stephen Rothwell
Hi Anton,
Quoted 3 lines · On Wed, 14 May 2008 11:45:23 +1000 Stephen Rothwell <[email protected]>…
Doing this status with "git diff -M --stat" would show us if the file was just renamed or if there were some changes as well ...
Not that I don't trust you, just for future reference.
I use git-format-patch. And -M option would generate the whole patch in the "git patch format", which you can not apply with patch(1) (I also recalling that there was someone protesting wrt sending the patches in the git patch format, since not everybody use git).
Though, you can still check me if you want to, git generates useful headers in the patch itself:
drivers/watchdog/mpc83xx_wdt.c deleted +0 -0
....
drivers/watchdog/mpc8xxx_wdt.c new file +0 -0
The index stuff are hashes. They match. ;-)
But sure, it would be great if git-format-patch could generate diffstat in the git format and leave the patch itself patch(1)-compatible.
Signature · 3 lines
Anton Vorontsov email: [email protected] irc://irc.freenode.net/bd2
RE: [PATCH 3/6] [WATCHDOG] mpc83xx_wdt: rename to mpc8xxx_wdt
In reply to Stephen Rothwell=20
Quoted 13 lines
-----Original Message-----
From: [email protected]=20 [mailto:[email protected]]=20 On Behalf Of Stephen Rothwell
Sent: 2008?5?14? 9:45
To: Anton Vorontsov
Cc: Wood Scott; [email protected]; Wim Van Sebroeck; Tabi Timur
Subject: Re: [PATCH 3/6] [WATCHDOG]mpc83xx_wdt: rename tompc8xxx_wdt=20Quoted 2 lines · On Tue, 13 May 2008 18:14:59 +0400 Anton Vorontsov=20…
Rename the driver because now we support some MPC86xx processors.
What I want to know is that what about watchdog for booke(85xx) ?
Quoted 27 lines
Quoted 2 lines
=20
There are no changes to thempc83xx_wdt.cfile, yet. When=20possible, we=20
Quoted 1 line
do file renames and changes separately (because Linus once=20
asked so,=20
Quoted 6 lines
because it helps git to track the renamed files).
=20Signed-off-by Anton Vorontsov <[email protected]>--- drivers/watchdog/Kconfig | 4 +- drivers/watchdog/Makefile | 2 +-Quoted 7 lines
drivers/watchdog/mpc83xx_wdt.c| 273=20
----------------------------------------
drivers/watchdog/mpc8xxx_wdt.c| 273=20
++++++++++++++++++++++++++++++++++++++++4 files changed, 276 insertions(+), 276 deletions(-) delete mode=20100644
drivers/watchdog/mpc83xx_wdt.ccreate mode 100644=20drivers/watchdog/mpc8xxx_wdt.c=20
Doing this status with "git diff -M --stat" would show us if=20 the file was just renamed or if there were some changes as well ... =20
--
Cheers,
Stephen Rothwell [email protected]
http://www.canb.auug.org.au/~sfr/
=20
Re: [PATCH 3/6] [WATCHDOG] mpc83xx_wdt: rename to mpc8xxx_wdt
Quoted 11 lines · Chen Gong
Quoted 11 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Stephen Rothwell
Sent: 2008?5?14? 9:45
To: Anton Vorontsov
Cc: Wood Scott; [email protected]; Wim Van Sebroeck; Tabi Timur
Subject: Re: [PATCH 3/6] [WATCHDOG]mpc83xx_wdt: rename tompc8xxx_wdt
Quoted 5 lines
Quoted 4 lines
Quoted 2 lines · On Tue, 13 May 2008 18:14:59 +0400 Anton Vorontsov <[email protected]>…
Rename the driver because now we support some MPC86xx processors.
What I want to know is that what about watchdog for booke(85xx) ?
what about it, its still there in the tree (booke_wdt.c). This driver is for a SoC level watchdog that exists on 8xx, 83xx and 8610.
- k
RE: [PATCH 3/6] [WATCHDOG] mpc83xx_wdt: rename to mpc8xxx_wdt
=20
Quoted 27 lines
-----Original Message-----
From: Kumar Gala [mailto:[email protected]]=20
Sent: 2008?5?14? 23:03
To: Chen Gong
Cc: Stephen Rothwell; Anton Vorontsov; Wood Scott;=20 [email protected]; Wim Van Sebroeck; Tabi Timur
Subject: Re: [PATCH 3/6] [WATCHDOG]mpc83xx_wdt: rename tompc8xxx_wdt=20
=20
On May 13, 2008, at 10:53 PM, Chen Gong wrote:
=20Quoted 9 lines
Quoted 9 lines
-----Original Message-----
From: [email protected] [mailto:[email protected]] On Behalf Of Stephen Rothwell
Sent: 2008?5?14? 9:45
To: Anton Vorontsov
Cc: Wood Scott; [email protected]; Wim Van Sebroeck;=20Tabi Timur
Quoted 6 lines
Quoted 6 lines
Subject: Re: [PATCH 3/6] [WATCHDOG]
mpc83xx_wdt: rename to=20mpc8xxx_wdtQuoted 1 line · On Tue, 13 May 2008 18:14:59 +0400 Anton Vorontsov=20…
Quoted 6 lines
Quoted 2 lines
Quoted 1 line
Quoted 1 line
Rename the driver because now we support some MPC86xx processors.
What I want to know is that what about watchdog for booke(85xx) ?
=20
what about it, its still there in the tree (booke_wdt.c). =20 This driver is for a SoC level watchdog that exists on 8xx,=20 83xx and 8610.
Yeah, I know it well, but I'm just afraid it will take confusion for user.
Quoted 3 lines
=20
- k
=20
PATCH v2 4/6 mpc8xxx_wdt: various renames, mostly s/mpc83xx/mpc8xxx/g
In reply to Anton Vorontsovmpc83xx_wdt.c renamed to mpc8xxx_wdt.c, now we can do various renames in the file itself.
--- drivers/watchdog/mpc8xxx_wdt.c | 100 ++++++++++++++++++++-------------------- 1 files changed, 50 insertions(+), 50 deletions(-)
drivers/watchdog/mpc8xxx_wdt.c +50 -50
@@ -1,5 +1,5 @@/* -* mpc83xx_wdt.c - MPC83xx/MPC86xx watchdog userspace interface +* mpc8xxx_wdt.c - MPC8xxx watchdog userspace interface * * Authors: Dave Updegraff <[email protected]> * Kumar Gala <[email protected]>
@@ -29,7 +29,7 @@#include <asm/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,7 +42,7 @@ struct mpc83xx_wdt {u8 res2[0xF0 ]; }; -static struct mpc83xx_wdt __iomem *wd_base; +static struct mpc8xxx_wdt __iomem *wd_base;static u16 timeout =0xffff ;module_param (timeout, ushort,0 );
@@ -67,7 +67,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);
@@ -76,31 +76,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))
@@ -125,17 +125,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;
@@ -143,7 +143,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) {
@@ -153,7 +153,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);
@@ -162,22 +162,22 @@ 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;
@@ -194,12 +194,12 @@ static int __devinit mpc83xx_wdt_probe(struct of_device *ofdev, enabled =in_be32 (&wd_base->swcrr) &SWCRR_SWEN ;if (!enabled &&of_device_is_compatible (np,"fsl,mpc8610-wdt" )) { -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);
@@ -212,62 +212,62 @@ 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" , }, { .compatible ="fsl,mpc8610-wdt" , }, {}, }; -MODULE_DEVICE_TABLE (of, mpc83xx_wdt_match); +MODULE_DEVICE_TABLE (of, mpc8xxx_wdt_match); -static struct of_platform_driver mpc83xx_wdt_driver = { - .name ="mpc83xx_wdt" , - .match_table = mpc83xx_wdt_match, - .probe = mpc83xx_wdt_probe, - .remove =__devexit_p (mpc83xx_wdt_remove), +static struct of_platform_driver mpc8xxx_wdt_driver = { + .name ="mpc8xxx_wdt" , + .match_table = mpc8xxx_wdt_match, + .probe = mpc8xxx_wdt_probe, + .remove =__devexit_p (mpc8xxx_wdt_remove), }; -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 uProcessor" ); +MODULE_DESCRIPTION ("Driver for watchdog timer in MPC8xxx uProcessor" );MODULE_LICENSE ("GPL" );MODULE_ALIAS_MISCDEV (WATCHDOG_MINOR ); -MODULE_ALIAS ("platform:mpc83xx_wdt" ); +MODULE_ALIAS ("platform:mpc8xxx_wdt" );
Signature · 1 line
1.5.5.1
PATCH v2 5/6 fsl_soc: remove mpc83xx_wdt code
In reply to Anton Vorontsovmpc83xx_wdt is the OF driver now, so we don't need fsl_soc constructor.
--- arch/powerpc/sysdev/fsl_soc.c | 46 ----------------------------------------- 1 files changed, 0 insertions(+), 46 deletions(-)
arch/powerpc/sysdev/fsl_soc.c +0 -46
@@ -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)
Signature · 1 line
1.5.5.1
PATCH v2 6/6 86xx: mpc8610_hpcd: add watchdog node
In reply to Anton Vorontsov--- arch/powerpc/boot/dts/mpc8610_hpcd.dts | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
arch/powerpc/boot/dts/mpc8610_hpcd.dts +6 -0
@@ -195,6 +195,12 @@ fsl,has-rstcr; }; + wdt@e4000 { + device_type = "watchdog"; + compatible = "fsl,mpc8610-wdt"; + reg = <0xe4000 0x100>; + }; + gpio@f000 { compatible = "fsl,mpc8610-gpio"; reg = <0xf000 0x100>;
Signature · 1 line
1.5.5.1
Re: [PATCH 6/6] [POWERPC] 86xx: mpc8610_hpcd: add watchdog node
Quoted 10 lines · Anton Vorontsov
Signed-off-by Anton Vorontsov <[email protected]>--- arch/powerpc/boot/dts/mpc8610_hpcd.dts | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)arch/powerpc/boot/dts/mpc8610_hpcd.dts +0
-0
arch/powerpc/boot/dts/mpc8610_hpcd.dts line 203
Quoted 9 lines
arch/powerpc/boot/dts/mpc8610_hpcd.dts +6
-0@@ -195,6 +195,12 @@ fsl,has-rstcr; }; + wdt@e4000 { + device_type = "watchdog"; + compatible = "fsl,mpc8610-wdt"; + reg = <0xe4000 0x100>; + }; +
We don't need the device_type anymore.
-Scott
Quoted 4 lines · Anton Vorontsov
Hi all,
Thanks for the review, here is the new version.
Quoted 8 lines
Changes since v1:
- Scott Wood asked for
mpc83xx_wdton multiplatform kernels. Done via OF platform driver;
- Kumar Gala asked formpc83xx_wdt->mpc8xxx_wdtrename. Done in two steps;
- Segher Boessenkool noticed a negligence in the wdt device tree node. Fixed by removingmpc83xx_wdtcompatible entry.
any possibility of making this work on 8xx per Jochen's comment? (see mpc8xx_wdt.c)
- k
PATCH 1/1 mpc8xxx_wdt: add support for MPC8xx watchdogs
Only build-tested.
---
Quoted 16 lines · Kumar Gala
Quoted 4 lines · Anton Vorontsov
Hi all,
Thanks for the review, here is the new version.
Quoted 8 lines
Changes since v1:
- Scott Wood asked for
mpc83xx_wdton multiplatform kernels. Done via OF platform driver;
- Kumar Gala asked formpc83xx_wdt->mpc8xxx_wdtrename. Done in two steps;
- Segher Boessenkool noticed a negligence in the wdt device tree node. Fixed by removingmpc83xx_wdtcompatible entry.
Quoted 2 lines
any possibility of making this work on 8xx per Jochen's comment? (see
mpc8xx_wdt.c)
[ Oops. Jochen, sorry I forgot to Cc you this time. ]
I think it should work with the patch inlined here, and this node in the device tree.
soc@ff000000 {
....
wdt@0 {
device_type = "watchdog";
compatible = "fsl,mpc885-wdt";
reg = <0 0x100>;
};
....
};Not tested though. And also no support for RTC-driven timer tweak (anybody willing are welcomed to implement this ;-).
drivers/watchdog/Kconfig | 2 +- drivers/watchdog/mpc8xxx_wdt.c | 31 +++++++++++++++++++++++++++---- 2 files changed, 28 insertions(+), 5 deletions(-)
drivers/watchdog/Kconfig +1 -1
@@ -684,7 +684,7 @@ config 8xx_WDT config 8xxx_WDT tristate "MPC8xxx Watchdog Timer" - depends on PPC_83xx || PPC_86xx + depends on FSL_SOC config MV64X60_WDT tristate "MV64X60 (Marvell Discovery) Watchdog Timer"
drivers/watchdog/mpc8xxx_wdt.c +27 -4
@@ -42,6 +42,11 @@ struct mpc8xxx_wdt {u8 res2[0xF0 ]; }; +struct mpc8xxx_wdt_type { +int prescaler; +bool hw_enabled; +}; +static struct mpc8xxx_wdt __iomem *wd_base;static u16 timeout =0xffff ;
@@ -182,6 +187,7 @@ static int __devinit mpc8xxx_wdt_probe(struct of_device *ofdev, {int ret;struct device_node *np = ofdev->node; +struct mpc8xxx_wdt_type *wdt_type = match->data;u32 freq =fsl_get_sys_freq ();bool enabled;
@@ -193,7 +199,7 @@ static int __devinit mpc8xxx_wdt_probe(struct of_device *ofdev,return -ENOMEM ; enabled =in_be32 (&wd_base->swcrr) &SWCRR_SWEN ; -if (!enabled &&of_device_is_compatible (np,"fsl,mpc8610-wdt" )) { +if (!enabled && wdt_type->hw_enabled) {pr_info ("mpc8xxx_wdt: could not be enabled in software\n" ); ret = -ENOSYS ; goto err_unmap;
@@ -208,7 +214,7 @@ static int __devinit mpc8xxx_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;
@@ -240,8 +246,25 @@ static int __devexit mpc8xxx_wdt_remove(struct of_device *ofdev) }static const struct of_device_id mpc8xxx_wdt_match[] = { - { .compatible ="mpc83xx_wdt" , }, - { .compatible ="fsl,mpc8610-wdt" , }, + { + .compatible ="mpc83xx_wdt" , + .data = &(struct mpc8xxx_wdt_type ) { + .prescaler =0x10000 , + }, + }, + { + .compatible ="fsl,mpc8610-wdt" , + .data = &(struct mpc8xxx_wdt_type ) { + .prescaler =0x10000 , + .hw_enabled = true, + }, + }, + { + .compatible ="fsl,mpc885-wdt" , + .data = &(struct mpc8xxx_wdt_type ) { + .prescaler =0x800 , + }, + }, {}, };MODULE_DEVICE_TABLE (of, mpc8xxx_wdt_match);
Signature · 1 line
1.5.5.1
Re: [PATCH] [WATCHDOG] mpc8xxx_wdt: add support for MPC8xx watchdogs
drivers/watchdog/Kconfig config 8xx_WDT · line 687
Quoted 4 lines · Anton Vorontsov
config 8xxx_WDT
drivers/watchdog/Kconfig +1
-1tristate "MPC8xxx Watchdog Timer" - depends on PPC_83xx || PPC_86xx + depends on FSL_SOC
We should probably change the description to "MPC8xxx Platform Watchdog Timer", and have help text indicating that it's not the Book-E core watchdog, and that it works on 8xx despite the discrepancy in the number of "x"s.
-Scott