* [PATCH 1/3] watchdog: Add support for the Freescale MXC watchdog
@ 2010-03-19 15:13 Vladimir Zapolskiy
2010-03-19 15:16 ` [PATCH 2/3] imx3: Add watchdog platform device support Vladimir Zapolskiy
` (3 more replies)
0 siblings, 4 replies; 11+ messages in thread
From: Vladimir Zapolskiy @ 2010-03-19 15:13 UTC (permalink / raw)
To: linux-arm-kernel
Add driver for the Freescale MXC SoCs built-in watchdog.
Signed-off-by: Vladimir Zapolskiy <vzapolskiy@gmail.com>
Cc: Wim Van Sebroeck <wim@iguana.be>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
---
drivers/watchdog/Kconfig | 10 ++
drivers/watchdog/Makefile | 1 +
drivers/watchdog/mxc_wdt.c | 385 ++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 396 insertions(+), 0 deletions(-)
create mode 100644 drivers/watchdog/mxc_wdt.c
diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 088f32f..985d067 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -289,6 +289,16 @@ config ADX_WATCHDOG
Say Y here if you want support for the watchdog timer on Avionic
Design Xanthos boards.
+config MXC_WATCHDOG
+ tristate "MXC watchdog"
+ depends on ARCH_MXC
+ select WATCHDOG_NOWAYOUT
+ help
+ Say Y here if to include support for the watchdog timer
+ in Freescale MXC SoCs.
+ To compile this driver as a module, choose M here: the
+ module will be called mxc_wdt.
+
# AVR32 Architecture
config AT32AP700X_WDT
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index 475c611..347c227 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -46,6 +46,7 @@ obj-$(CONFIG_COH901327_WATCHDOG) += coh901327_wdt.o
obj-$(CONFIG_STMP3XXX_WATCHDOG) += stmp3xxx_wdt.o
obj-$(CONFIG_NUC900_WATCHDOG) += nuc900_wdt.o
obj-$(CONFIG_ADX_WATCHDOG) += adx_wdt.o
+obj-$(CONFIG_MXC_WATCHDOG) += mxc_wdt.o
# AVR32 Architecture
obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o
diff --git a/drivers/watchdog/mxc_wdt.c b/drivers/watchdog/mxc_wdt.c
new file mode 100644
index 0000000..0daa37b
--- /dev/null
+++ b/drivers/watchdog/mxc_wdt.c
@@ -0,0 +1,385 @@
+/*
+ * linux/drivers/char/watchdog/mxc_wdt.c
+ *
+ * Watchdog driver for Freescale MXC SoCs. It is based on omap_wdt.c
+ *
+ * Copyright 2010 Vladimir Zapolskiy <vzapolskiy@gmail.com>
+ * Copyright 2004-2007 Freescale Semiconductor, Inc. All Rights Reserved.
+ * 2005 (c) MontaVista Software, Inc. All Rights Reserved.
+ *
+ * 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.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ */
+
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/fs.h>
+#include <linux/mm.h>
+#include <linux/miscdevice.h>
+#include <linux/watchdog.h>
+#include <linux/reboot.h>
+#include <linux/init.h>
+#include <linux/err.h>
+#include <linux/platform_device.h>
+#include <linux/moduleparam.h>
+#include <linux/clk.h>
+#include <linux/io.h>
+#include <linux/uaccess.h>
+
+#define MXC_WDT_WCR 0x00
+#define MXC_WDT_WSR 0x02
+#define MXC_WDT_WRSR 0x04
+#define WCR_WOE_BIT (1 << 6)
+#define WCR_WDA_BIT (1 << 5)
+#define WCR_SRS_BIT (1 << 4)
+#define WCR_WRE_BIT (1 << 3)
+#define WCR_WDE_BIT (1 << 2)
+#define WCR_WDBG_BIT (1 << 1)
+#define WCR_WDZST_BIT (1 << 0)
+#define WDT_MAGIC_1 0x5555
+#define WDT_MAGIC_2 0xAAAA
+
+#define TIMER_MARGIN_MAX 127
+#define TIMER_MARGIN_DEFAULT 60 /* 60 seconds */
+#define TIMER_MARGIN_MIN 1
+
+#define WDOG_SEC_TO_COUNT(s) ((s * 2) << 8)
+#define WDOG_COUNT_TO_SEC(c) ((c >> 8) / 2)
+
+static struct platform_device *mxc_wdt_dev;
+
+struct mxc_wdt {
+ void __iomem *base;
+ struct device *dev;
+ unsigned long status;
+ struct clk *clk;
+ struct resource *mem;
+};
+
+static spinlock_t wdt_lock;
+
+static unsigned int timer_margin = TIMER_MARGIN_DEFAULT;
+module_param(timer_margin, uint, 0);
+MODULE_PARM_DESC(timer_margin, "initial watchdog timeout in seconds (default="
+ __MODULE_STRING(TIMER_MARGIN_DEFAULT) ")");
+
+static u16 mxc_wdt_get_bootstatus(struct mxc_wdt *wdt)
+{
+ void __iomem *base = wdt->base;
+ u16 val;
+
+ val = __raw_readw(base + MXC_WDT_WRSR);
+ return val;
+}
+
+static void mxc_wdt_set_timeout(struct mxc_wdt *wdt)
+{
+ void __iomem *base = wdt->base;
+ u16 val;
+
+ val = __raw_readw(base + MXC_WDT_WCR);
+ val = (val & 0x00FF) | WDOG_SEC_TO_COUNT(timer_margin);
+ __raw_writew(val, base + MXC_WDT_WCR);
+}
+
+static void mxc_wdt_ping(struct mxc_wdt *wdt)
+{
+ void __iomem *base = wdt->base;
+
+ /* issue the service sequence instructions */
+ __raw_writew(WDT_MAGIC_1, base + MXC_WDT_WSR);
+ __raw_writew(WDT_MAGIC_2, base + MXC_WDT_WSR);
+}
+
+static void mxc_wdt_enable(struct mxc_wdt *wdt)
+{
+ void __iomem *base = wdt->base;
+ u16 val;
+
+ val = __raw_readw(base + MXC_WDT_WCR);
+ val &= 0xFF00; /* preserve timeout value */
+ val |= WCR_WOE_BIT | WCR_WDA_BIT | WCR_SRS_BIT |
+ WCR_WDZST_BIT | WCR_WDBG_BIT | WCR_WDE_BIT;
+
+ __raw_writew(val, base + MXC_WDT_WCR);
+
+ mxc_wdt_ping(wdt);
+}
+
+static void mxc_wdt_disable(struct mxc_wdt *wdt)
+{
+ /* This stub is remained to include disable support on IMX1 SoCs */
+}
+
+/* Allow only one task to hold watchdog node open */
+static int mxc_wdt_open(struct inode *inode, struct file *file)
+{
+ struct mxc_wdt *wdt = platform_get_drvdata(mxc_wdt_dev);
+
+ if (test_and_set_bit(0, &wdt->status))
+ return -EBUSY;
+
+ file->private_data = (void *)wdt;
+
+ clk_enable(wdt->clk);
+
+ spin_lock(&wdt_lock);
+ mxc_wdt_set_timeout(wdt);
+ mxc_wdt_enable(wdt);
+ spin_unlock(&wdt_lock);
+
+ return 0;
+}
+
+/* The watchdog found on MXC chips cannot be disabled. */
+static int mxc_wdt_release(struct inode *inode, struct file *file)
+{
+ struct mxc_wdt *wdt = file->private_data;
+
+ /* disable the watchdog timer unless NOWAYOUT is defined. */
+#ifndef CONFIG_WATCHDOG_NOWAYOUT
+ mxc_wdt_disable(wdt);
+#else
+ printk(KERN_CRIT "MXC watchdog: unexpected close, timer will not stop\n");
+#endif
+ clear_bit(0, &wdt->status);
+
+ clk_disable(wdt->clk);
+
+ return 0;
+}
+
+static ssize_t mxc_wdt_write(struct file *file, const char __user * data,
+ size_t len, loff_t * ppos)
+{
+ struct mxc_wdt *wdt = file->private_data;
+
+ /* Reload counter */
+ if (len) {
+ spin_lock(&wdt_lock);
+ mxc_wdt_ping(wdt);
+ spin_unlock(&wdt_lock);
+ }
+
+ return len;
+}
+
+static long mxc_wdt_ioctl(struct file *file, unsigned int cmd,
+ unsigned long arg)
+{
+ void __user *argp = (void __user *)arg;
+ int __user *p = argp;
+ int new_margin;
+ struct mxc_wdt *wdt = file->private_data;
+
+ static const struct watchdog_info mxc_wdt_ident = {
+ .identity = "MXC watchdog",
+ .options = WDIOF_SETTIMEOUT,
+ .firmware_version = 0,
+ };
+
+ switch (cmd) {
+ case WDIOC_GETSUPPORT:
+ return copy_to_user(argp, &mxc_wdt_ident,
+ sizeof(mxc_wdt_ident)) ? -EFAULT : 0;
+ case WDIOC_GETSTATUS:
+ return put_user(0, p);
+ case WDIOC_GETBOOTSTATUS:
+ return put_user(mxc_wdt_get_bootstatus(wdt), p);
+ case WDIOC_KEEPALIVE:
+ spin_lock(&wdt_lock);
+ mxc_wdt_ping(wdt);
+ spin_unlock(&wdt_lock);
+ return 0;
+ case WDIOC_SETTIMEOUT:
+ if (get_user(new_margin, p))
+ return -EFAULT;
+
+ if (new_margin < TIMER_MARGIN_MIN ||
+ new_margin > TIMER_MARGIN_MAX)
+ return -EINVAL;
+
+ spin_lock(&wdt_lock);
+ timer_margin = new_margin;
+ mxc_wdt_set_timeout(wdt);
+ mxc_wdt_ping(wdt);
+ spin_unlock(&wdt_lock);
+ /* Fall */
+ case WDIOC_GETTIMEOUT:
+ return put_user(timer_margin, p);
+ default:
+ return -ENOTTY;
+ }
+}
+
+static const struct file_operations mxc_wdt_fops = {
+ .owner = THIS_MODULE,
+ .llseek = no_llseek,
+ .write = mxc_wdt_write,
+ .unlocked_ioctl = mxc_wdt_ioctl,
+ .open = mxc_wdt_open,
+ .release = mxc_wdt_release,
+};
+
+static struct miscdevice mxc_wdt_miscdev = {
+ .minor = WATCHDOG_MINOR,
+ .name = "watchdog",
+ .fops = &mxc_wdt_fops,
+};
+
+static int __init mxc_wdt_probe(struct platform_device *pdev)
+{
+ struct resource *res;
+ struct mxc_wdt *wdt;
+ int ret;
+
+ /* reserve static register mappings */
+ res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ if (!res) {
+ ret = -ENOENT;
+ goto err_get_resource;
+ }
+
+ wdt = kzalloc(sizeof(struct mxc_wdt), GFP_KERNEL);
+ if (!wdt) {
+ ret = -ENOMEM;
+ goto err_kzalloc;
+ }
+
+ wdt->status = 0;
+ wdt->mem = request_mem_region(res->start, resource_size(res),
+ pdev->name);
+ if (!wdt->mem) {
+ ret = -EBUSY;
+ goto err_busy;
+ }
+
+ /* To determine watchdog clock state it is assumed
+ that the clock is disabled on probe */
+ wdt->clk = clk_get(&pdev->dev, NULL);
+ if (IS_ERR(wdt->clk)) {
+ ret = PTR_ERR(wdt->clk);
+ printk(KERN_ERR "MXC watchdog: no clock source found\n");
+ goto err_clk;
+ }
+
+ wdt->base = ioremap(res->start, resource_size(res));
+ if (!wdt->base) {
+ ret = -ENOMEM;
+ goto err_ioremap;
+ }
+
+ platform_set_drvdata(pdev, wdt);
+
+ mxc_wdt_miscdev.parent = &pdev->dev;
+
+ ret = misc_register(&mxc_wdt_miscdev);
+ if (ret)
+ goto err_misc;
+
+ pr_info("MXC watchdog: initial timeout %d sec\n", timer_margin);
+
+ mxc_wdt_dev = pdev;
+
+ return 0;
+
+ err_misc:
+ platform_set_drvdata(pdev, NULL);
+ iounmap(wdt->base);
+
+ err_ioremap:
+ clk_put(wdt->clk);
+
+ err_clk:
+ release_mem_region(res->start, resource_size(res));
+
+ err_busy:
+ kfree(wdt);
+
+ err_kzalloc:
+ err_get_resource:
+ return ret;
+}
+
+static void mxc_wdt_shutdown(struct platform_device *pdev)
+{
+ struct mxc_wdt *wdt = platform_get_drvdata(pdev);
+
+ if (wdt->status)
+ mxc_wdt_disable(wdt);
+}
+
+static int __devexit mxc_wdt_remove(struct platform_device *pdev)
+{
+ struct resource *res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+ struct mxc_wdt *wdt = platform_get_drvdata(pdev);
+
+ if (!res)
+ return -ENOENT;
+
+ misc_deregister(&mxc_wdt_miscdev);
+
+ platform_set_drvdata(pdev, NULL);
+ iounmap(wdt->base);
+
+ clk_put(wdt->clk);
+
+ release_mem_region(res->start, resource_size(res));
+
+ kfree(wdt);
+ mxc_wdt_dev = NULL;
+
+ return 0;
+}
+
+static struct platform_driver mxc_wdt_driver = {
+ .probe = mxc_wdt_probe,
+ .remove = __devexit_p(mxc_wdt_remove),
+ .shutdown = mxc_wdt_shutdown,
+ .driver = {
+ .owner = THIS_MODULE,
+ .name = "imx-wdt",
+ },
+};
+
+static int __init mxc_wdt_init(void)
+{
+ if ((timer_margin < TIMER_MARGIN_MIN) ||
+ (timer_margin > TIMER_MARGIN_MAX)) {
+ pr_info("MXC watchdog error: wrong timer_margin %d\n",
+ timer_margin);
+ pr_info(" Valid range: %d to %d seconds\n", TIMER_MARGIN_MIN,
+ TIMER_MARGIN_MAX);
+ return -EINVAL;
+ }
+
+ spin_lock_init(&wdt_lock);
+ return platform_driver_register(&mxc_wdt_driver);
+}
+
+static void __exit mxc_wdt_exit(void)
+{
+ platform_driver_unregister(&mxc_wdt_driver);
+}
+
+module_init(mxc_wdt_init);
+module_exit(mxc_wdt_exit);
+
+MODULE_AUTHOR("Vladimir Zapolskiy");
+MODULE_DESCRIPTION("MXC Watchdog");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS("platform:imx-wdt");
+MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
--
1.6.6.1
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 2/3] imx3: Add watchdog platform device support
2010-03-19 15:13 [PATCH 1/3] watchdog: Add support for the Freescale MXC watchdog Vladimir Zapolskiy
@ 2010-03-19 15:16 ` Vladimir Zapolskiy
2010-03-22 8:42 ` Sascha Hauer
2010-03-19 15:16 ` [PATCH 3/3] imx31: add watchdog device on litekit board Vladimir Zapolskiy
` (2 subsequent siblings)
3 siblings, 1 reply; 11+ messages in thread
From: Vladimir Zapolskiy @ 2010-03-19 15:16 UTC (permalink / raw)
To: linux-arm-kernel
This patch adds support for build-in watchdog device found on
Freescale imx31 and imx35 SoCs.
Signed-off-by: Vladimir Zapolskiy <vzapolskiy@gmail.com>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
---
arch/arm/mach-mx3/devices.c | 19 ++++++++++++++++++-
arch/arm/mach-mx3/devices.h | 3 ++-
2 files changed, 20 insertions(+), 2 deletions(-)
diff --git a/arch/arm/mach-mx3/devices.c b/arch/arm/mach-mx3/devices.c
index 6adb586..f891115 100644
--- a/arch/arm/mach-mx3/devices.c
+++ b/arch/arm/mach-mx3/devices.c
@@ -575,11 +575,26 @@ struct platform_device imx_ssi_device1 = {
.resource = imx_ssi_resources1,
};
-static int mx3_devices_init(void)
+static struct resource imx_wdt_resources[] = {
+ {
+ .flags = IORESOURCE_MEM,
+ },
+};
+
+struct platform_device imx_wdt_device0 = {
+ .name = "imx-wdt",
+ .id = 0,
+ .num_resources = ARRAY_SIZE(imx_wdt_resources),
+ .resource = imx_wdt_resources,
+};
+
+static int __init mx3_devices_init(void)
{
if (cpu_is_mx31()) {
mxc_nand_resources[0].start = MX31_NFC_BASE_ADDR;
mxc_nand_resources[0].end = MX31_NFC_BASE_ADDR + 0xfff;
+ imx_wdt_resources[0].start = MX31_WDOG_BASE_ADDR;
+ imx_wdt_resources[0].end = MX31_WDOG_BASE_ADDR + 0x3fff;
mxc_register_device(&mxc_rnga_device, NULL);
}
if (cpu_is_mx35()) {
@@ -597,6 +612,8 @@ static int mx3_devices_init(void)
imx_ssi_resources0[1].end = MX35_INT_SSI1;
imx_ssi_resources1[1].start = MX35_INT_SSI2;
imx_ssi_resources1[1].end = MX35_INT_SSI2;
+ imx_wdt_resources[0].start = MX35_WDOG_BASE_ADDR;
+ imx_wdt_resources[0].end = MX35_WDOG_BASE_ADDR + 0x3fff;
}
return 0;
diff --git a/arch/arm/mach-mx3/devices.h b/arch/arm/mach-mx3/devices.h
index 42cf175..4f77eb5 100644
--- a/arch/arm/mach-mx3/devices.h
+++ b/arch/arm/mach-mx3/devices.h
@@ -25,4 +25,5 @@ extern struct platform_device mxc_spi_device1;
extern struct platform_device mxc_spi_device2;
extern struct platform_device imx_ssi_device0;
extern struct platform_device imx_ssi_device1;
-
+extern struct platform_device imx_ssi_device1;
+extern struct platform_device imx_wdt_device0;
--
1.6.6.1
^ permalink raw reply related [flat|nested] 11+ messages in thread* [PATCH 2/3] imx3: Add watchdog platform device support
2010-03-19 15:16 ` [PATCH 2/3] imx3: Add watchdog platform device support Vladimir Zapolskiy
@ 2010-03-22 8:42 ` Sascha Hauer
0 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2010-03-22 8:42 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Mar 19, 2010 at 06:16:37PM +0300, Vladimir Zapolskiy wrote:
> This patch adds support for build-in watchdog device found on
> Freescale imx31 and imx35 SoCs.
Added to mxc-master.
Sascha
>
> Signed-off-by: Vladimir Zapolskiy <vzapolskiy@gmail.com>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
> ---
> arch/arm/mach-mx3/devices.c | 19 ++++++++++++++++++-
> arch/arm/mach-mx3/devices.h | 3 ++-
> 2 files changed, 20 insertions(+), 2 deletions(-)
>
> diff --git a/arch/arm/mach-mx3/devices.c b/arch/arm/mach-mx3/devices.c
> index 6adb586..f891115 100644
> --- a/arch/arm/mach-mx3/devices.c
> +++ b/arch/arm/mach-mx3/devices.c
> @@ -575,11 +575,26 @@ struct platform_device imx_ssi_device1 = {
> .resource = imx_ssi_resources1,
> };
>
> -static int mx3_devices_init(void)
> +static struct resource imx_wdt_resources[] = {
> + {
> + .flags = IORESOURCE_MEM,
> + },
> +};
> +
> +struct platform_device imx_wdt_device0 = {
> + .name = "imx-wdt",
> + .id = 0,
> + .num_resources = ARRAY_SIZE(imx_wdt_resources),
> + .resource = imx_wdt_resources,
> +};
> +
> +static int __init mx3_devices_init(void)
> {
> if (cpu_is_mx31()) {
> mxc_nand_resources[0].start = MX31_NFC_BASE_ADDR;
> mxc_nand_resources[0].end = MX31_NFC_BASE_ADDR + 0xfff;
> + imx_wdt_resources[0].start = MX31_WDOG_BASE_ADDR;
> + imx_wdt_resources[0].end = MX31_WDOG_BASE_ADDR + 0x3fff;
> mxc_register_device(&mxc_rnga_device, NULL);
> }
> if (cpu_is_mx35()) {
> @@ -597,6 +612,8 @@ static int mx3_devices_init(void)
> imx_ssi_resources0[1].end = MX35_INT_SSI1;
> imx_ssi_resources1[1].start = MX35_INT_SSI2;
> imx_ssi_resources1[1].end = MX35_INT_SSI2;
> + imx_wdt_resources[0].start = MX35_WDOG_BASE_ADDR;
> + imx_wdt_resources[0].end = MX35_WDOG_BASE_ADDR + 0x3fff;
> }
>
> return 0;
> diff --git a/arch/arm/mach-mx3/devices.h b/arch/arm/mach-mx3/devices.h
> index 42cf175..4f77eb5 100644
> --- a/arch/arm/mach-mx3/devices.h
> +++ b/arch/arm/mach-mx3/devices.h
> @@ -25,4 +25,5 @@ extern struct platform_device mxc_spi_device1;
> extern struct platform_device mxc_spi_device2;
> extern struct platform_device imx_ssi_device0;
> extern struct platform_device imx_ssi_device1;
> -
> +extern struct platform_device imx_ssi_device1;
> +extern struct platform_device imx_wdt_device0;
> --
> 1.6.6.1
>
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 3/3] imx31: add watchdog device on litekit board.
2010-03-19 15:13 [PATCH 1/3] watchdog: Add support for the Freescale MXC watchdog Vladimir Zapolskiy
2010-03-19 15:16 ` [PATCH 2/3] imx3: Add watchdog platform device support Vladimir Zapolskiy
@ 2010-03-19 15:16 ` Vladimir Zapolskiy
2010-03-22 8:43 ` Sascha Hauer
2010-03-20 12:09 ` [PATCH 1/3] watchdog: Add support for the Freescale MXC watchdog Wolfram Sang
2010-03-20 14:06 ` Russell King - ARM Linux
3 siblings, 1 reply; 11+ messages in thread
From: Vladimir Zapolskiy @ 2010-03-19 15:16 UTC (permalink / raw)
To: linux-arm-kernel
This patch adds support for SoC build-in watchdog device on litekit
board.
Signed-off-by: Vladimir Zapolskiy <vzapolskiy@gmail.com>
Cc: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
---
arch/arm/mach-mx3/mx31lite-db.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
diff --git a/arch/arm/mach-mx3/mx31lite-db.c b/arch/arm/mach-mx3/mx31lite-db.c
index ccd8742..0201683 100644
--- a/arch/arm/mach-mx3/mx31lite-db.c
+++ b/arch/arm/mach-mx3/mx31lite-db.c
@@ -206,5 +206,6 @@ void __init mx31lite_db_init(void)
mxc_register_device(&mxcsdhc_device0, &mmc_pdata);
mxc_register_device(&mxc_spi_device0, &spi0_pdata);
platform_device_register(&litekit_led_device);
+ mxc_register_device(&imx_wdt_device0, NULL);
}
--
1.6.6.1
^ permalink raw reply related [flat|nested] 11+ messages in thread
* [PATCH 3/3] imx31: add watchdog device on litekit board.
2010-03-19 15:16 ` [PATCH 3/3] imx31: add watchdog device on litekit board Vladimir Zapolskiy
@ 2010-03-22 8:43 ` Sascha Hauer
0 siblings, 0 replies; 11+ messages in thread
From: Sascha Hauer @ 2010-03-22 8:43 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Mar 19, 2010 at 06:16:59PM +0300, Vladimir Zapolskiy wrote:
> This patch adds support for SoC build-in watchdog device on litekit
> board.
Added to mxc-master.
Sascha
>
> Signed-off-by: Vladimir Zapolskiy <vzapolskiy@gmail.com>
> Cc: Uwe Kleine-K?nig <u.kleine-koenig@pengutronix.de>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> ---
> arch/arm/mach-mx3/mx31lite-db.c | 1 +
> 1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/arch/arm/mach-mx3/mx31lite-db.c b/arch/arm/mach-mx3/mx31lite-db.c
> index ccd8742..0201683 100644
> --- a/arch/arm/mach-mx3/mx31lite-db.c
> +++ b/arch/arm/mach-mx3/mx31lite-db.c
> @@ -206,5 +206,6 @@ void __init mx31lite_db_init(void)
> mxc_register_device(&mxcsdhc_device0, &mmc_pdata);
> mxc_register_device(&mxc_spi_device0, &spi0_pdata);
> platform_device_register(&litekit_led_device);
> + mxc_register_device(&imx_wdt_device0, NULL);
> }
>
> --
> 1.6.6.1
>
>
--
Pengutronix e.K. | |
Industrial Linux Solutions | http://www.pengutronix.de/ |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0 |
Amtsgericht Hildesheim, HRA 2686 | Fax: +49-5121-206917-5555 |
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/3] watchdog: Add support for the Freescale MXC watchdog
2010-03-19 15:13 [PATCH 1/3] watchdog: Add support for the Freescale MXC watchdog Vladimir Zapolskiy
2010-03-19 15:16 ` [PATCH 2/3] imx3: Add watchdog platform device support Vladimir Zapolskiy
2010-03-19 15:16 ` [PATCH 3/3] imx31: add watchdog device on litekit board Vladimir Zapolskiy
@ 2010-03-20 12:09 ` Wolfram Sang
2010-03-20 18:40 ` Vladimir Zapolskiy
2010-03-20 14:06 ` Russell King - ARM Linux
3 siblings, 1 reply; 11+ messages in thread
From: Wolfram Sang @ 2010-03-20 12:09 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Mar 19, 2010 at 06:13:27PM +0300, Vladimir Zapolskiy wrote:
> Add driver for the Freescale MXC SoCs built-in watchdog.
Any improvements over/differences to this one?
http://article.gmane.org/gmane.linux.ports.arm.kernel/70753
(Read the thread for the comments I received)
Coincidence, I wanted to pick up my version and finish it next week. We have to
agree how to continue. I like mine a tad better (there are some mixups of
MX1/2+ capabilities in yours, e.g. SETTIMEOUT) and it also got review already,
but of course I am biased ;) What do you suggest?
Regards,
Wolfram
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100320/dddf8ec8/attachment.sig>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/3] watchdog: Add support for the Freescale MXC watchdog
2010-03-20 12:09 ` [PATCH 1/3] watchdog: Add support for the Freescale MXC watchdog Wolfram Sang
@ 2010-03-20 18:40 ` Vladimir Zapolskiy
2010-03-21 10:36 ` Wolfram Sang
0 siblings, 1 reply; 11+ messages in thread
From: Vladimir Zapolskiy @ 2010-03-20 18:40 UTC (permalink / raw)
To: linux-arm-kernel
Wolfram Sang <w.sang@pengutronix.de> writes:
> On Fri, Mar 19, 2010 at 06:13:27PM +0300, Vladimir Zapolskiy wrote:
>> Add driver for the Freescale MXC SoCs built-in watchdog.
>
> Any improvements over/differences to this one?
>
> http://article.gmane.org/gmane.linux.ports.arm.kernel/70753
>
> (Read the thread for the comments I received)
>
> Coincidence, I wanted to pick up my version and finish it next week. We have to
> agree how to continue. I like mine a tad better (there are some mixups of
> MX1/2+ capabilities in yours, e.g. SETTIMEOUT) and it also got review already,
> but of course I am biased ;) What do you suggest?
>
> Regards,
>
> Wolfram
Hi Wolfram,
that's a surprise for me, haven't noticed your version of the driver in
the maillist, and wrote one more watchdog driver :)
The driver is extremely simple, so from my biased position only minor
benefits can be found in my version:
* introduced spinlock to protect concurrent write to registers
* SETTIMEOUT option is present and it works well on imx31
* correct zero byte write()
* clock enabled only when watchdog node is opened
* dynamic wdt structure, which potentially simplifies future support of
several watchdogs found on imx51 and imx37 IIRC
* no critical message on close with unset NOWAYOUT on non-imx1 SoCs
Your pretty good version supports imx1, and I cann't test my version on
imx1, because I don't have such hardware on hand.
Obviously better to update your reviewed one, and I hope some comments or even
updates from my side could be accepted by you :)
With best wishes,
Vladimir
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/3] watchdog: Add support for the Freescale MXC watchdog
2010-03-20 18:40 ` Vladimir Zapolskiy
@ 2010-03-21 10:36 ` Wolfram Sang
2010-03-21 18:27 ` Vladimir Zapolskiy
0 siblings, 1 reply; 11+ messages in thread
From: Wolfram Sang @ 2010-03-21 10:36 UTC (permalink / raw)
To: linux-arm-kernel
Hi Vladimir,
On Sat, Mar 20, 2010 at 09:40:07PM +0300, Vladimir Zapolskiy wrote:
> The driver is extremely simple, so from my biased position only minor
> benefits can be found in my version:
> * introduced spinlock to protect concurrent write to registers
> * SETTIMEOUT option is present and it works well on imx31
> * correct zero byte write()
> * clock enabled only when watchdog node is opened
> * dynamic wdt structure, which potentially simplifies future support of
> several watchdogs found on imx51 and imx37 IIRC
> * no critical message on close with unset NOWAYOUT on non-imx1 SoCs
>
> Your pretty good version supports imx1, and I cann't test my version on
> imx1, because I don't have such hardware on hand.
>
> Obviously better to update your reviewed one, and I hope some comments or even
> updates from my side could be accepted by you :)
Thanks for agreeing on the procedure and pointing out the benefits of your
driver. I will surely have a look at them and don't be surprised if you will
find this or that incorporated ;) I haven't really started yet, so I might be
missing something: What races do you want to protect against with the spinlock?
The ping?
Regards,
Wolfram
--
Pengutronix e.K. | Wolfram Sang |
Industrial Linux Solutions | http://www.pengutronix.de/ |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20100321/56fe7884/attachment.sig>
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/3] watchdog: Add support for the Freescale MXC watchdog
2010-03-21 10:36 ` Wolfram Sang
@ 2010-03-21 18:27 ` Vladimir Zapolskiy
0 siblings, 0 replies; 11+ messages in thread
From: Vladimir Zapolskiy @ 2010-03-21 18:27 UTC (permalink / raw)
To: linux-arm-kernel
Wolfram Sang <w.sang@pengutronix.de> writes:
Hi,
> Hi Vladimir,
>
> On Sat, Mar 20, 2010 at 09:40:07PM +0300, Vladimir Zapolskiy wrote:
>
>> The driver is extremely simple, so from my biased position only minor
>> benefits can be found in my version:
>> * introduced spinlock to protect concurrent write to registers
>> * SETTIMEOUT option is present and it works well on imx31
>> * correct zero byte write()
>> * clock enabled only when watchdog node is opened
>> * dynamic wdt structure, which potentially simplifies future support of
>> several watchdogs found on imx51 and imx37 IIRC
>> * no critical message on close with unset NOWAYOUT on non-imx1 SoCs
>>
>> Your pretty good version supports imx1, and I cann't test my version on
>> imx1, because I don't have such hardware on hand.
>>
>> Obviously better to update your reviewed one, and I hope some comments or even
>> updates from my side could be accepted by you :)
>
> Thanks for agreeing on the procedure and pointing out the benefits of your
> driver. I will surely have a look at them and don't be surprised if you will
> find this or that incorporated ;) I haven't really started yet, so I might be
> missing something: What races do you want to protect against with the spinlock?
> The ping?
>
locking was added in analogy with other watchdog drivers. Just checked
imx1, imx3 and imx5 reference manuals, for all chips "any number of
instructions can be executed between two writes" to WSR. I understand
this that only ping/ping races can influence the watchdog, and that kind
of race does not look harmful.
So the locking could be omitted.
With best wishes,
Vladimir
^ permalink raw reply [flat|nested] 11+ messages in thread
* [PATCH 1/3] watchdog: Add support for the Freescale MXC watchdog
2010-03-19 15:13 [PATCH 1/3] watchdog: Add support for the Freescale MXC watchdog Vladimir Zapolskiy
` (2 preceding siblings ...)
2010-03-20 12:09 ` [PATCH 1/3] watchdog: Add support for the Freescale MXC watchdog Wolfram Sang
@ 2010-03-20 14:06 ` Russell King - ARM Linux
2010-03-20 17:58 ` Vladimir Zapolskiy
3 siblings, 1 reply; 11+ messages in thread
From: Russell King - ARM Linux @ 2010-03-20 14:06 UTC (permalink / raw)
To: linux-arm-kernel
On Fri, Mar 19, 2010 at 06:13:27PM +0300, Vladimir Zapolskiy wrote:
> +/* The watchdog found on MXC chips cannot be disabled. */
> +static int mxc_wdt_release(struct inode *inode, struct file *file)
> +{
> + struct mxc_wdt *wdt = file->private_data;
> +
> + /* disable the watchdog timer unless NOWAYOUT is defined. */
> +#ifndef CONFIG_WATCHDOG_NOWAYOUT
> + mxc_wdt_disable(wdt);
> +#else
> + printk(KERN_CRIT "MXC watchdog: unexpected close, timer will not stop\n");
> +#endif
> + clear_bit(0, &wdt->status);
> +
> + clk_disable(wdt->clk);
You're sure that disabling the watchdog clock won't disable the watchdog
itself?
^ permalink raw reply [flat|nested] 11+ messages in thread
end of thread, other threads:[~2010-03-22 8:43 UTC | newest]
Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-03-19 15:13 [PATCH 1/3] watchdog: Add support for the Freescale MXC watchdog Vladimir Zapolskiy
2010-03-19 15:16 ` [PATCH 2/3] imx3: Add watchdog platform device support Vladimir Zapolskiy
2010-03-22 8:42 ` Sascha Hauer
2010-03-19 15:16 ` [PATCH 3/3] imx31: add watchdog device on litekit board Vladimir Zapolskiy
2010-03-22 8:43 ` Sascha Hauer
2010-03-20 12:09 ` [PATCH 1/3] watchdog: Add support for the Freescale MXC watchdog Wolfram Sang
2010-03-20 18:40 ` Vladimir Zapolskiy
2010-03-21 10:36 ` Wolfram Sang
2010-03-21 18:27 ` Vladimir Zapolskiy
2010-03-20 14:06 ` Russell King - ARM Linux
2010-03-20 17:58 ` Vladimir Zapolskiy
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).