mail archive of the barebox mailing list
 help / color / mirror / Atom feed
* [PATCH 0/7 v2] at91sam9 add watchdog support with keep alive
@ 2012-11-16 17:53 Jean-Christophe PLAGNIOL-VILLARD
  2012-11-16 17:55 ` [PATCH 1/7] watchdog: add keep alive support Jean-Christophe PLAGNIOL-VILLARD
  2013-01-17  9:36 ` [PATCH 0/7 v2] at91sam9 add watchdog support with keep alive Fabio Porcedda
  0 siblings, 2 replies; 14+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-16 17:53 UTC (permalink / raw)
  To: barebox

HI,

	v2:

	 found a bug on MMU platform the watchdodog need to init before the
	 poll register on non-MMU it work fine

	 btw register the wdt drvier as coredevice asame as the device

	The following patch series add the at91sam9 watchdog present on 
	sam9260/9g20/9261/9g10/9g45/9x5

	and introdudce the kep a live support so we can reset the watchdog via
	poller

The following changes since commit 281b927f44ae94280648714e3587efa4419f6ce3:

  Release v2012.11.0 (2012-11-16 13:54:49 +0100)

are available in the git repository at:

  git://git.jcrosoft.org/barebox.git delivery/at91sam9_wdt

for you to fetch changes up to 4b4830060956d58f924fc14020609ba5c4fe44ca:

  at91sam9x5: add wathdog support (2012-11-15 04:20:49 +0800)

----------------------------------------------------------------
Jean-Christophe PLAGNIOL-VILLARD (7):
      watchdog: add keep alive support
      watchdog: add at91sam9 watchdog support
      at91sam9260/9g20: add wathdog support
      at91sam9261/9g10: add wathdog support
      at91sam9263: add wathdog support
      at91sam9g45: add wathdog support
      at91sam9x5: add wathdog support

 arch/arm/mach-at91/at91sam9260_devices.c |   12 ++++++++++++
 arch/arm/mach-at91/at91sam9261_devices.c |   12 ++++++++++++
 arch/arm/mach-at91/at91sam9263_devices.c |   11 +++++++++++
 arch/arm/mach-at91/at91sam9g45_devices.c |   12 ++++++++++++
 arch/arm/mach-at91/at91sam9x5_devices.c  |   12 ++++++++++++
 drivers/watchdog/Kconfig                 |    8 ++++++++
 drivers/watchdog/Makefile                |    1 +
 drivers/watchdog/at91sam9_wdt.c          |  131 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 drivers/watchdog/at91sam9_wdt.h          |   38 ++++++++++++++++++++++++++++++++++++++
 drivers/watchdog/wd_core.c               |   21 +++++++++++++++++++++
 include/watchdog.h                       |    2 ++
 11 files changed, 260 insertions(+)
 create mode 100644 drivers/watchdog/at91sam9_wdt.c
 create mode 100644 drivers/watchdog/at91sam9_wdt.h

Best Regards,
J.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 1/7] watchdog: add keep alive support
  2012-11-16 17:53 [PATCH 0/7 v2] at91sam9 add watchdog support with keep alive Jean-Christophe PLAGNIOL-VILLARD
@ 2012-11-16 17:55 ` Jean-Christophe PLAGNIOL-VILLARD
  2012-11-16 17:55   ` [PATCH 2/7] watchdog: add at91sam9 watchdog support Jean-Christophe PLAGNIOL-VILLARD
                     ` (6 more replies)
  2013-01-17  9:36 ` [PATCH 0/7 v2] at91sam9 add watchdog support with keep alive Fabio Porcedda
  1 sibling, 7 replies; 14+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-16 17:55 UTC (permalink / raw)
  To: barebox

this will allow to ping the watchdog via poller

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 drivers/watchdog/Kconfig   |    1 +
 drivers/watchdog/wd_core.c |   21 +++++++++++++++++++++
 include/watchdog.h         |    2 ++
 3 files changed, 24 insertions(+)

diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 8fdc7a5..21480a1 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -1,5 +1,6 @@
 menuconfig WATCHDOG
 	bool "Watchdog support              "
+	select GENERIC_POLLER
 	help
 	  Many platforms support a watchdog to keep track of a working machine.
 	  This framework provides routines to handle these watchdogs.
diff --git a/drivers/watchdog/wd_core.c b/drivers/watchdog/wd_core.c
index 3d0cfc6..a1b9e28 100644
--- a/drivers/watchdog/wd_core.c
+++ b/drivers/watchdog/wd_core.c
@@ -17,18 +17,39 @@
 #include <errno.h>
 #include <linux/ctype.h>
 #include <watchdog.h>
+#include <poller.h>
 
 /*
  * Note: this simple framework supports one watchdog only.
  */
 static struct watchdog *watchdog;
 
+static void watchdog_poller_func(struct poller_struct *poller)
+{
+	watchdog->keep_alive(watchdog);
+}
+
+static struct poller_struct watchdog_poller = {
+	.func = watchdog_poller_func,
+};
+
 int watchdog_register(struct watchdog *wd)
 {
 	if (watchdog != NULL)
 		return -EBUSY;
 
 	watchdog = wd;
+
+	if (watchdog->keep_alive) {
+		int ret;
+
+		ret = poller_register(&watchdog_poller);
+		if (ret) {
+			watchdog = NULL;
+			return ret;
+		}
+	}
+
 	return 0;
 }
 EXPORT_SYMBOL(watchdog_register);
diff --git a/include/watchdog.h b/include/watchdog.h
index 3e2d08e..d5ecf2f 100644
--- a/include/watchdog.h
+++ b/include/watchdog.h
@@ -13,8 +13,10 @@
 #ifndef INCLUDE_WATCHDOG_H
 # define INCLUDE_WATCHDOG_H
 
+
 struct watchdog {
 	int (*set_timeout)(struct watchdog *, unsigned);
+	void (*keep_alive)(struct watchdog *);
 };
 
 int watchdog_register(struct watchdog *);
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 2/7] watchdog: add at91sam9 watchdog support
  2012-11-16 17:55 ` [PATCH 1/7] watchdog: add keep alive support Jean-Christophe PLAGNIOL-VILLARD
@ 2012-11-16 17:55   ` Jean-Christophe PLAGNIOL-VILLARD
  2012-11-19  9:36     ` Sascha Hauer
  2012-11-16 17:55   ` [PATCH 3/7] at91sam9260/9g20: add wathdog support Jean-Christophe PLAGNIOL-VILLARD
                     ` (5 subsequent siblings)
  6 siblings, 1 reply; 14+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-16 17:55 UTC (permalink / raw)
  To: barebox

with keep alive support

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 drivers/watchdog/Kconfig        |    7 +++
 drivers/watchdog/Makefile       |    1 +
 drivers/watchdog/at91sam9_wdt.c |  131 +++++++++++++++++++++++++++++++++++++++
 drivers/watchdog/at91sam9_wdt.h |   38 ++++++++++++
 4 files changed, 177 insertions(+)
 create mode 100644 drivers/watchdog/at91sam9_wdt.c
 create mode 100644 drivers/watchdog/at91sam9_wdt.h

diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
index 21480a1..5bd1083 100644
--- a/drivers/watchdog/Kconfig
+++ b/drivers/watchdog/Kconfig
@@ -7,6 +7,13 @@ menuconfig WATCHDOG
 
 if WATCHDOG
 
+config WATCHDOG_AT91SAM9X
+	tristate "AT91SAM9X / AT91CAP9 watchdog"
+	depends on ARCH_AT91
+	help
+	  Watchdog timer embedded into AT91SAM9X and AT91CAP9 chips. This will
+	  reboot your system when the timeout is reached.
+
 config WATCHDOG_MXS28
 	bool "i.MX28"
 	depends on ARCH_IMX28
diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index b29103b..4e863a5 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -1,2 +1,3 @@
 obj-$(CONFIG_WATCHDOG) += wd_core.o
+obj-$(CONFIG_WATCHDOG_AT91SAM9X) += at91sam9_wdt.o
 obj-$(CONFIG_WATCHDOG_MXS28) += im28wd.o
diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c
new file mode 100644
index 0000000..203d83a
--- /dev/null
+++ b/drivers/watchdog/at91sam9_wdt.c
@@ -0,0 +1,131 @@
+/*
+ * (c) 2012 Juergen Beisert <kernel@pengutronix.de>
+ *
+ * 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.
+ *
+ * Note: this driver works for the i.MX28 SoC. It might work for the
+ * i.MX23 Soc as well, but is not tested yet.
+ */
+
+#include <common.h>
+#include <init.h>
+#include <io.h>
+#include <errno.h>
+#include <malloc.h>
+#include <watchdog.h>
+
+#include "at91sam9_wdt.h"
+
+struct at91sam9_wdt {
+	struct watchdog wdt;
+	void __iomem *base;
+};
+
+#define to_at91sam9_wdt(h) container_of(h, struct at91sam9_wdt, wdt)
+
+#define wdt_read(at91wdt, field) \
+	__raw_readl(at91wdt->base + field)
+#define wdt_write(at91wdt, field, val) \
+	__raw_writel((val), at91wdt->base + field)
+
+static void at91sam9_wdt_keep_alive(struct watchdog *wdt)
+{
+	struct at91sam9_wdt *at91wdt = to_at91sam9_wdt(wdt);
+
+	wdt_write(at91wdt, AT91_WDT_CR, AT91_WDT_KEY | AT91_WDT_WDRSTT);
+}
+
+static int at91sam9_wdt_settimeout(struct watchdog *wdt, unsigned int timeout)
+{
+	struct at91sam9_wdt *at91wdt = to_at91sam9_wdt(wdt);
+	unsigned int reg;
+	unsigned int mr;
+
+	/* Check if disabled */
+	mr = wdt_read(at91wdt, AT91_WDT_MR);
+	if (mr & AT91_WDT_WDDIS) {
+		pr_err("sorry, watchdog is disabled\n");
+		return -EIO;
+	}
+
+	if (!timeout) {
+		wdt_write(at91wdt, AT91_WDT_MR, AT91_WDT_WDDIS);
+		return 0;
+	}
+
+	/*
+	 * All counting occurs at SLOW_CLOCK / 128 = 256 Hz
+	 *
+	 * Since WDV is a 12-bit counter, the maximum period is
+	 * 4096 / 256 = 16 seconds.
+	 */
+	reg = AT91_WDT_WDRSTEN	/* causes watchdog reset */
+		/* | AT91_WDT_WDRPROC	causes processor reset only */
+		| AT91_WDT_WDDBGHLT	/* disabled in debug mode */
+		| AT91_WDT_WDD		/* restart at any time */
+		| (timeout & AT91_WDT_WDV);  /* timer value */
+	wdt_write(at91wdt, AT91_WDT_MR, reg);
+
+	return 0;
+}
+
+static int at91sam9_wdt_probe(struct device_d *dev)
+{
+	struct at91sam9_wdt *priv;
+	struct watchdog *wdt;
+	int ret;
+	unsigned int mr;
+
+	priv = xzalloc(sizeof(struct at91sam9_wdt));
+	priv->base = dev_request_mem_region(dev, 0);
+	wdt = &priv->wdt;
+
+	wdt->set_timeout = at91sam9_wdt_settimeout;
+	wdt->keep_alive = at91sam9_wdt_keep_alive;
+
+	/* Check if disabled */
+	mr = wdt_read(priv, AT91_WDT_MR);
+	if (mr & AT91_WDT_WDDIS) {
+		dev_err(dev, "sorry, watchdog is disabled\n");
+		ret = -EIO;
+		goto err;
+	}
+
+	ret = watchdog_register(wdt);
+	if (ret != 0)
+		goto err;
+
+	dev->priv = priv;
+	return 0;
+
+err:
+	free(priv);
+	return ret;
+}
+
+static void at91sam9_wdt_remove(struct device_d *dev)
+{
+	struct at91sam9_wdt *priv= dev->priv;
+	watchdog_deregister(&priv->wdt);
+	free(priv);
+}
+
+static struct driver_d at91sam9_wdt_driver = {
+	.name	= "at91sam9_wdt",
+	.probe	= at91sam9_wdt_probe,
+	.remove = at91sam9_wdt_remove,
+};
+
+static int at91sam9_wdt_init(void)
+{
+	return platform_driver_register(&at91sam9_wdt_driver);
+}
+coredevice_initcall(at91sam9_wdt_init);
diff --git a/drivers/watchdog/at91sam9_wdt.h b/drivers/watchdog/at91sam9_wdt.h
new file mode 100644
index 0000000..2b68c1a
--- /dev/null
+++ b/drivers/watchdog/at91sam9_wdt.h
@@ -0,0 +1,38 @@
+/*
+ * drivers/watchdog/at91sam9_wdt.h
+ *
+ * Copyright (C) 2007 Andrew Victor
+ * Copyright (C) 2007 Atmel Corporation.
+ *
+ * Watchdog Timer (WDT) - System peripherals regsters.
+ * Based on AT91SAM9261 datasheet revision D.
+ *
+ * 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.
+ */
+
+#ifndef AT91_WDT_H
+#define AT91_WDT_H
+
+#define AT91_WDT_CR		0x00			/* Watchdog Control Register */
+#define		AT91_WDT_WDRSTT		(1    << 0)		/* Restart */
+#define		AT91_WDT_KEY		(0xa5 << 24)		/* KEY Password */
+
+#define AT91_WDT_MR		0x04			/* Watchdog Mode Register */
+#define		AT91_WDT_WDV		(0xfff << 0)		/* Counter Value */
+#define		AT91_WDT_WDFIEN		(1     << 12)		/* Fault Interrupt Enable */
+#define		AT91_WDT_WDRSTEN	(1     << 13)		/* Reset Processor */
+#define		AT91_WDT_WDRPROC	(1     << 14)		/* Timer Restart */
+#define		AT91_WDT_WDDIS		(1     << 15)		/* Watchdog Disable */
+#define		AT91_WDT_WDD		(0xfff << 16)		/* Delta Value */
+#define		AT91_WDT_WDDBGHLT	(1     << 28)		/* Debug Halt */
+#define		AT91_WDT_WDIDLEHLT	(1     << 29)		/* Idle Halt */
+
+#define AT91_WDT_SR		0x08			/* Watchdog Status Register */
+#define		AT91_WDT_WDUNF		(1 << 0)		/* Watchdog Underflow */
+#define		AT91_WDT_WDERR		(1 << 1)		/* Watchdog Error */
+
+
+#endif
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 3/7] at91sam9260/9g20: add wathdog support
  2012-11-16 17:55 ` [PATCH 1/7] watchdog: add keep alive support Jean-Christophe PLAGNIOL-VILLARD
  2012-11-16 17:55   ` [PATCH 2/7] watchdog: add at91sam9 watchdog support Jean-Christophe PLAGNIOL-VILLARD
@ 2012-11-16 17:55   ` Jean-Christophe PLAGNIOL-VILLARD
  2012-11-16 17:55   ` [PATCH 4/7] at91sam9261/9g10: " Jean-Christophe PLAGNIOL-VILLARD
                     ` (4 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-16 17:55 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/mach-at91/at91sam9260_devices.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/mach-at91/at91sam9260_devices.c b/arch/arm/mach-at91/at91sam9260_devices.c
index 9c9534e..e781de0 100644
--- a/arch/arm/mach-at91/at91sam9260_devices.c
+++ b/arch/arm/mach-at91/at91sam9260_devices.c
@@ -10,6 +10,7 @@
  *
  */
 #include <common.h>
+#include <init.h>
 #include <sizes.h>
 #include <asm/armlinux.h>
 #include <asm/hardware.h>
@@ -356,3 +357,14 @@ void at91_add_device_mci(short mmc_id, struct atmel_mci_platform_data *data)
 #else
 void at91_add_device_mci(short mmc_id, struct atmel_mci_platform_data *data) {}
 #endif
+
+#ifdef CONFIG_WATCHDOG_AT91SAM9X
+static int at91_add_device_watchdog(void)
+{
+	add_generic_device("at91sam9_wdt", DEVICE_ID_SINGLE, NULL,
+		AT91_WDT + AT91_BASE_SYS, 16, IORESOURCE_MEM, NULL);
+
+	return 0;
+}
+coredevice_initcall(at91_add_device_watchdog);
+#endif
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 4/7] at91sam9261/9g10: add wathdog support
  2012-11-16 17:55 ` [PATCH 1/7] watchdog: add keep alive support Jean-Christophe PLAGNIOL-VILLARD
  2012-11-16 17:55   ` [PATCH 2/7] watchdog: add at91sam9 watchdog support Jean-Christophe PLAGNIOL-VILLARD
  2012-11-16 17:55   ` [PATCH 3/7] at91sam9260/9g20: add wathdog support Jean-Christophe PLAGNIOL-VILLARD
@ 2012-11-16 17:55   ` Jean-Christophe PLAGNIOL-VILLARD
  2012-11-16 17:55   ` [PATCH 5/7] at91sam9263: " Jean-Christophe PLAGNIOL-VILLARD
                     ` (3 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-16 17:55 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/mach-at91/at91sam9261_devices.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 0091e2d..5784e13 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -10,6 +10,7 @@
  *
  */
 #include <common.h>
+#include <init.h>
 #include <sizes.h>
 #include <asm/armlinux.h>
 #include <asm/hardware.h>
@@ -257,3 +258,14 @@ void at91_add_device_mci(short mmc_id, struct atmel_mci_platform_data *data)
 #else
 void at91_add_device_mci(short mmc_id, struct atmel_mci_platform_data *data) {}
 #endif
+
+#ifdef CONFIG_WATCHDOG_AT91SAM9X
+static int at91_add_device_watchdog(void)
+{
+	add_generic_device("at91sam9_wdt", DEVICE_ID_SINGLE, NULL,
+		AT91_WDT + AT91_BASE_SYS, 16, IORESOURCE_MEM, NULL);
+
+	return 0;
+}
+coredevice_initcall(at91_add_device_watchdog);
+#endif
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 5/7] at91sam9263: add wathdog support
  2012-11-16 17:55 ` [PATCH 1/7] watchdog: add keep alive support Jean-Christophe PLAGNIOL-VILLARD
                     ` (2 preceding siblings ...)
  2012-11-16 17:55   ` [PATCH 4/7] at91sam9261/9g10: " Jean-Christophe PLAGNIOL-VILLARD
@ 2012-11-16 17:55   ` Jean-Christophe PLAGNIOL-VILLARD
  2012-11-16 17:55   ` [PATCH 6/7] at91sam9g45: " Jean-Christophe PLAGNIOL-VILLARD
                     ` (2 subsequent siblings)
  6 siblings, 0 replies; 14+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-16 17:55 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/mach-at91/at91sam9263_devices.c |   11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/arch/arm/mach-at91/at91sam9263_devices.c b/arch/arm/mach-at91/at91sam9263_devices.c
index e686480..0386d79 100644
--- a/arch/arm/mach-at91/at91sam9263_devices.c
+++ b/arch/arm/mach-at91/at91sam9263_devices.c
@@ -10,6 +10,7 @@
  *
  */
 #include <common.h>
+#include <init.h>
 #include <sizes.h>
 #include <asm/armlinux.h>
 #include <asm/hardware.h>
@@ -351,3 +352,13 @@ void at91_add_device_mci(short mmc_id, struct atmel_mci_platform_data *data)
 void at91_add_device_mci(short mmc_id, struct atmel_mci_platform_data *data) {}
 #endif
 
+#ifdef CONFIG_WATCHDOG_AT91SAM9X
+static int at91_add_device_watchdog(void)
+{
+	add_generic_device("at91sam9_wdt", DEVICE_ID_SINGLE, NULL,
+		AT91_WDT + AT91_BASE_SYS, 16, IORESOURCE_MEM, NULL);
+
+	return 0;
+}
+coredevice_initcall(at91_add_device_watchdog);
+#endif
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 6/7] at91sam9g45: add wathdog support
  2012-11-16 17:55 ` [PATCH 1/7] watchdog: add keep alive support Jean-Christophe PLAGNIOL-VILLARD
                     ` (3 preceding siblings ...)
  2012-11-16 17:55   ` [PATCH 5/7] at91sam9263: " Jean-Christophe PLAGNIOL-VILLARD
@ 2012-11-16 17:55   ` Jean-Christophe PLAGNIOL-VILLARD
  2012-11-16 17:55   ` [PATCH 7/7] at91sam9x5: " Jean-Christophe PLAGNIOL-VILLARD
  2012-11-19  9:38   ` [PATCH 1/7] watchdog: add keep alive support Sascha Hauer
  6 siblings, 0 replies; 14+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-16 17:55 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/mach-at91/at91sam9g45_devices.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/mach-at91/at91sam9g45_devices.c b/arch/arm/mach-at91/at91sam9g45_devices.c
index 22b455e..38593fc 100644
--- a/arch/arm/mach-at91/at91sam9g45_devices.c
+++ b/arch/arm/mach-at91/at91sam9g45_devices.c
@@ -10,6 +10,7 @@
  *
  */
 #include <common.h>
+#include <init.h>
 #include <sizes.h>
 #include <asm/armlinux.h>
 #include <asm/hardware.h>
@@ -324,3 +325,14 @@ void at91_add_device_spi(int spi_id, struct at91_spi_platform_data *pdata)
 #else
 void at91_add_device_spi(int spi_id, struct at91_spi_platform_data *pdata) {}
 #endif
+
+#ifdef CONFIG_WATCHDOG_AT91SAM9X
+static int at91_add_device_watchdog(void)
+{
+	add_generic_device("at91sam9_wdt", DEVICE_ID_SINGLE, NULL,
+		AT91_WDT + AT91_BASE_SYS, 16, IORESOURCE_MEM, NULL);
+
+	return 0;
+}
+coredevice_initcall(at91_add_device_watchdog);
+#endif
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 7/7] at91sam9x5: add wathdog support
  2012-11-16 17:55 ` [PATCH 1/7] watchdog: add keep alive support Jean-Christophe PLAGNIOL-VILLARD
                     ` (4 preceding siblings ...)
  2012-11-16 17:55   ` [PATCH 6/7] at91sam9g45: " Jean-Christophe PLAGNIOL-VILLARD
@ 2012-11-16 17:55   ` Jean-Christophe PLAGNIOL-VILLARD
  2012-11-19  9:38   ` [PATCH 1/7] watchdog: add keep alive support Sascha Hauer
  6 siblings, 0 replies; 14+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-16 17:55 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/mach-at91/at91sam9x5_devices.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/mach-at91/at91sam9x5_devices.c b/arch/arm/mach-at91/at91sam9x5_devices.c
index 26a380d..27e9ec9 100644
--- a/arch/arm/mach-at91/at91sam9x5_devices.c
+++ b/arch/arm/mach-at91/at91sam9x5_devices.c
@@ -10,6 +10,7 @@
  *
  */
 #include <common.h>
+#include <init.h>
 #include <sizes.h>
 #include <asm/armlinux.h>
 #include <asm/hardware.h>
@@ -234,3 +235,14 @@ resource_size_t __init at91_configure_usart3(unsigned pins)
 	return AT91SAM9X5_BASE_USART3;
 }
 #endif
+
+#ifdef CONFIG_WATCHDOG_AT91SAM9X
+static int at91_add_device_watchdog(void)
+{
+	add_generic_device("at91sam9_wdt", DEVICE_ID_SINGLE, NULL,
+		AT91_WDT + AT91_BASE_SYS, 16, IORESOURCE_MEM, NULL);
+
+	return 0;
+}
+coredevice_initcall(at91_add_device_watchdog);
+#endif
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/7] watchdog: add at91sam9 watchdog support
  2012-11-16 17:55   ` [PATCH 2/7] watchdog: add at91sam9 watchdog support Jean-Christophe PLAGNIOL-VILLARD
@ 2012-11-19  9:36     ` Sascha Hauer
  2012-11-19  9:59       ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 1 reply; 14+ messages in thread
From: Sascha Hauer @ 2012-11-19  9:36 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Fri, Nov 16, 2012 at 06:55:40PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> with keep alive support
> 
> Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> ---
>  drivers/watchdog/Kconfig        |    7 +++
>  drivers/watchdog/Makefile       |    1 +
>  drivers/watchdog/at91sam9_wdt.c |  131 +++++++++++++++++++++++++++++++++++++++
>  drivers/watchdog/at91sam9_wdt.h |   38 ++++++++++++
>  4 files changed, 177 insertions(+)
>  create mode 100644 drivers/watchdog/at91sam9_wdt.c
>  create mode 100644 drivers/watchdog/at91sam9_wdt.h
> 
> diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
> index 21480a1..5bd1083 100644
> --- a/drivers/watchdog/Kconfig
> +++ b/drivers/watchdog/Kconfig
> @@ -7,6 +7,13 @@ menuconfig WATCHDOG
>  
>  if WATCHDOG
>  
> +config WATCHDOG_AT91SAM9X
> +	tristate "AT91SAM9X / AT91CAP9 watchdog"
> +	depends on ARCH_AT91
> +	help
> +	  Watchdog timer embedded into AT91SAM9X and AT91CAP9 chips. This will
> +	  reboot your system when the timeout is reached.
> +
>  config WATCHDOG_MXS28
>  	bool "i.MX28"
>  	depends on ARCH_IMX28
> diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
> index b29103b..4e863a5 100644
> --- a/drivers/watchdog/Makefile
> +++ b/drivers/watchdog/Makefile
> @@ -1,2 +1,3 @@
>  obj-$(CONFIG_WATCHDOG) += wd_core.o
> +obj-$(CONFIG_WATCHDOG_AT91SAM9X) += at91sam9_wdt.o
>  obj-$(CONFIG_WATCHDOG_MXS28) += im28wd.o
> diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c
> new file mode 100644
> index 0000000..203d83a
> --- /dev/null
> +++ b/drivers/watchdog/at91sam9_wdt.c
> @@ -0,0 +1,131 @@
> +/*
> + * (c) 2012 Juergen Beisert <kernel@pengutronix.de>

Juergen Beisert?

> + *
> + * 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.
> + *
> + * Note: this driver works for the i.MX28 SoC. It might work for the
> + * i.MX23 Soc as well, but is not tested yet.

This might work on i.MX23?

> +
> +static void at91sam9_wdt_keep_alive(struct watchdog *wdt)
> +{
> +	struct at91sam9_wdt *at91wdt = to_at91sam9_wdt(wdt);
> +
> +	wdt_write(at91wdt, AT91_WDT_CR, AT91_WDT_KEY | AT91_WDT_WDRSTT);
> +}
> +
> +static int at91sam9_wdt_settimeout(struct watchdog *wdt, unsigned int timeout)
> +{
> +	struct at91sam9_wdt *at91wdt = to_at91sam9_wdt(wdt);
> +	unsigned int reg;
> +	unsigned int mr;
> +
> +	/* Check if disabled */
> +	mr = wdt_read(at91wdt, AT91_WDT_MR);
> +	if (mr & AT91_WDT_WDDIS) {
> +		pr_err("sorry, watchdog is disabled\n");
> +		return -EIO;
> +	}
> +
> +	if (!timeout) {
> +		wdt_write(at91wdt, AT91_WDT_MR, AT91_WDT_WDDIS);
> +		return 0;
> +	}
> +
> +	/*
> +	 * All counting occurs at SLOW_CLOCK / 128 = 256 Hz
> +	 *
> +	 * Since WDV is a 12-bit counter, the maximum period is
> +	 * 4096 / 256 = 16 seconds.
> +	 */
> +	reg = AT91_WDT_WDRSTEN	/* causes watchdog reset */
> +		/* | AT91_WDT_WDRPROC	causes processor reset only */
> +		| AT91_WDT_WDDBGHLT	/* disabled in debug mode */
> +		| AT91_WDT_WDD		/* restart at any time */
> +		| (timeout & AT91_WDT_WDV);  /* timer value */
> +	wdt_write(at91wdt, AT91_WDT_MR, reg);

This driver does not work like the watchdog API is supposed to work. It
currently works in the way that the watchdog command calls the
settimeout callback to keep the watchdog alive, hence we do not need
an explicit keepalive callback. Whether this API is good is debatable,
but this patch violates it and renders the watchdog command useless.

Sascha

-- 
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 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/7] watchdog: add keep alive support
  2012-11-16 17:55 ` [PATCH 1/7] watchdog: add keep alive support Jean-Christophe PLAGNIOL-VILLARD
                     ` (5 preceding siblings ...)
  2012-11-16 17:55   ` [PATCH 7/7] at91sam9x5: " Jean-Christophe PLAGNIOL-VILLARD
@ 2012-11-19  9:38   ` Sascha Hauer
  2012-11-19 10:08     ` Jean-Christophe PLAGNIOL-VILLARD
  6 siblings, 1 reply; 14+ messages in thread
From: Sascha Hauer @ 2012-11-19  9:38 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

On Fri, Nov 16, 2012 at 06:55:39PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> this will allow to ping the watchdog via poller
> 
>  /*
>   * Note: this simple framework supports one watchdog only.
>   */
>  static struct watchdog *watchdog;
>  
> +static void watchdog_poller_func(struct poller_struct *poller)
> +{
> +	watchdog->keep_alive(watchdog);
> +}
> +
> +static struct poller_struct watchdog_poller = {
> +	.func = watchdog_poller_func,
> +};
> +
>  int watchdog_register(struct watchdog *wd)
>  {
>  	if (watchdog != NULL)
>  		return -EBUSY;
>  
>  	watchdog = wd;
> +
> +	if (watchdog->keep_alive) {
> +		int ret;
> +
> +		ret = poller_register(&watchdog_poller);
> +		if (ret) {
> +			watchdog = NULL;
> +			return ret;
> +		}
> +	}

Currently the watchdog is supposed to be kept alive with periodically
calling the watchdog (or wd) command. A user may decide to just
periodically ping the watchdog from C code, but this should be a users
decision (i.e. some enhancement to the wd command) and should be
available for i.MX aswell.

Sascha


-- 
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 |

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 2/7] watchdog: add at91sam9 watchdog support
  2012-11-19  9:36     ` Sascha Hauer
@ 2012-11-19  9:59       ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 14+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-19  9:59 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 10:36 Mon 19 Nov     , Sascha Hauer wrote:
> 
> On Fri, Nov 16, 2012 at 06:55:40PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > with keep alive support
> > 
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
> > ---
> >  drivers/watchdog/Kconfig        |    7 +++
> >  drivers/watchdog/Makefile       |    1 +
> >  drivers/watchdog/at91sam9_wdt.c |  131 +++++++++++++++++++++++++++++++++++++++
> >  drivers/watchdog/at91sam9_wdt.h |   38 ++++++++++++
> >  4 files changed, 177 insertions(+)
> >  create mode 100644 drivers/watchdog/at91sam9_wdt.c
> >  create mode 100644 drivers/watchdog/at91sam9_wdt.h
> > 
> > diff --git a/drivers/watchdog/Kconfig b/drivers/watchdog/Kconfig
> > index 21480a1..5bd1083 100644
> > --- a/drivers/watchdog/Kconfig
> > +++ b/drivers/watchdog/Kconfig
> > @@ -7,6 +7,13 @@ menuconfig WATCHDOG
> >  
> >  if WATCHDOG
> >  
> > +config WATCHDOG_AT91SAM9X
> > +	tristate "AT91SAM9X / AT91CAP9 watchdog"
> > +	depends on ARCH_AT91
> > +	help
> > +	  Watchdog timer embedded into AT91SAM9X and AT91CAP9 chips. This will
> > +	  reboot your system when the timeout is reached.
> > +
> >  config WATCHDOG_MXS28
> >  	bool "i.MX28"
> >  	depends on ARCH_IMX28
> > diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
> > index b29103b..4e863a5 100644
> > --- a/drivers/watchdog/Makefile
> > +++ b/drivers/watchdog/Makefile
> > @@ -1,2 +1,3 @@
> >  obj-$(CONFIG_WATCHDOG) += wd_core.o
> > +obj-$(CONFIG_WATCHDOG_AT91SAM9X) += at91sam9_wdt.o
> >  obj-$(CONFIG_WATCHDOG_MXS28) += im28wd.o
> > diff --git a/drivers/watchdog/at91sam9_wdt.c b/drivers/watchdog/at91sam9_wdt.c
> > new file mode 100644
> > index 0000000..203d83a
> > --- /dev/null
> > +++ b/drivers/watchdog/at91sam9_wdt.c
> > @@ -0,0 +1,131 @@
> > +/*
> > + * (c) 2012 Juergen Beisert <kernel@pengutronix.de>
> 
> Juergen Beisert?
> 
> > + *
> > + * 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.
> > + *
> > + * Note: this driver works for the i.MX28 SoC. It might work for the
> > + * i.MX23 Soc as well, but is not tested yet.
> 
> This might work on i.MX23?
> 
> > +
> > +static void at91sam9_wdt_keep_alive(struct watchdog *wdt)
> > +{
> > +	struct at91sam9_wdt *at91wdt = to_at91sam9_wdt(wdt);
> > +
> > +	wdt_write(at91wdt, AT91_WDT_CR, AT91_WDT_KEY | AT91_WDT_WDRSTT);
> > +}
> > +
> > +static int at91sam9_wdt_settimeout(struct watchdog *wdt, unsigned int timeout)
> > +{
> > +	struct at91sam9_wdt *at91wdt = to_at91sam9_wdt(wdt);
> > +	unsigned int reg;
> > +	unsigned int mr;
> > +
> > +	/* Check if disabled */
> > +	mr = wdt_read(at91wdt, AT91_WDT_MR);
> > +	if (mr & AT91_WDT_WDDIS) {
> > +		pr_err("sorry, watchdog is disabled\n");
> > +		return -EIO;
> > +	}
> > +
> > +	if (!timeout) {
> > +		wdt_write(at91wdt, AT91_WDT_MR, AT91_WDT_WDDIS);
> > +		return 0;
> > +	}
> > +
> > +	/*
> > +	 * All counting occurs at SLOW_CLOCK / 128 = 256 Hz
> > +	 *
> > +	 * Since WDV is a 12-bit counter, the maximum period is
> > +	 * 4096 / 256 = 16 seconds.
> > +	 */
> > +	reg = AT91_WDT_WDRSTEN	/* causes watchdog reset */
> > +		/* | AT91_WDT_WDRPROC	causes processor reset only */
> > +		| AT91_WDT_WDDBGHLT	/* disabled in debug mode */
> > +		| AT91_WDT_WDD		/* restart at any time */
> > +		| (timeout & AT91_WDT_WDV);  /* timer value */
> > +	wdt_write(at91wdt, AT91_WDT_MR, reg);
> 
> This driver does not work like the watchdog API is supposed to work. It
> currently works in the way that the watchdog command calls the
> settimeout callback to keep the watchdog alive, hence we do not need
> an explicit keepalive callback. Whether this API is good is debatable,
> but this patch violates it and renders the watchdog command useless.
The watchdod commad just need to enable the watchdog/change the timeout or
diabled 

the rest need to be automatic

so we need to fix the API

because I can not add wd command in long nfs or tftp transfert

Best Regards,
J.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 1/7] watchdog: add keep alive support
  2012-11-19  9:38   ` [PATCH 1/7] watchdog: add keep alive support Sascha Hauer
@ 2012-11-19 10:08     ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 14+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-19 10:08 UTC (permalink / raw)
  To: Sascha Hauer; +Cc: barebox

On 10:38 Mon 19 Nov     , Sascha Hauer wrote:
> 
> On Fri, Nov 16, 2012 at 06:55:39PM +0100, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > this will allow to ping the watchdog via poller
> > 
> >  /*
> >   * Note: this simple framework supports one watchdog only.
> >   */
> >  static struct watchdog *watchdog;
> >  
> > +static void watchdog_poller_func(struct poller_struct *poller)
> > +{
> > +	watchdog->keep_alive(watchdog);
> > +}
> > +
> > +static struct poller_struct watchdog_poller = {
> > +	.func = watchdog_poller_func,
> > +};
> > +
> >  int watchdog_register(struct watchdog *wd)
> >  {
> >  	if (watchdog != NULL)
> >  		return -EBUSY;
> >  
> >  	watchdog = wd;
> > +
> > +	if (watchdog->keep_alive) {
> > +		int ret;
> > +
> > +		ret = poller_register(&watchdog_poller);
> > +		if (ret) {
> > +			watchdog = NULL;
> > +			return ret;
> > +		}
> > +	}
> 
> Currently the watchdog is supposed to be kept alive with periodically
> calling the watchdog (or wd) command. A user may decide to just
> periodically ping the watchdog from C code, but this should be a users
> decision (i.e. some enhancement to the wd command) and should be
> available for i.MX aswell.

no this is broken

this should be completly automatic I agree that the user need to control it

we are not going to add 100s of call in barebox for this

like did U-Boot

Barebox need to ping the wtach automticly via poler
and manage soft timeout

as some watchdog have short timeout so this will make the soft tiemout (user
timeout) hw indepedant as in linux

Best Regards,
J.

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* Re: [PATCH 0/7 v2] at91sam9 add watchdog support with keep alive
  2012-11-16 17:53 [PATCH 0/7 v2] at91sam9 add watchdog support with keep alive Jean-Christophe PLAGNIOL-VILLARD
  2012-11-16 17:55 ` [PATCH 1/7] watchdog: add keep alive support Jean-Christophe PLAGNIOL-VILLARD
@ 2013-01-17  9:36 ` Fabio Porcedda
  1 sibling, 0 replies; 14+ messages in thread
From: Fabio Porcedda @ 2013-01-17  9:36 UTC (permalink / raw)
  To: Jean-Christophe PLAGNIOL-VILLARD; +Cc: barebox

Hi Jean-Christophe ,

On Fri, Nov 16, 2012 at 6:53 PM, Jean-Christophe PLAGNIOL-VILLARD
<plagnioj@jcrosoft.com> wrote:
> HI,
>
>         v2:
>
>          found a bug on MMU platform the watchdodog need to init before the
>          poll register on non-MMU it work fine
>
>          btw register the wdt drvier as coredevice asame as the device
>
>         The following patch series add the at91sam9 watchdog present on
>         sam9260/9g20/9261/9g10/9g45/9x5
>
>         and introdudce the kep a live support so we can reset the watchdog via
>         poller
>
> The following changes since commit 281b927f44ae94280648714e3587efa4419f6ce3:
>
>   Release v2012.11.0 (2012-11-16 13:54:49 +0100)
>
> are available in the git repository at:
>
>   git://git.jcrosoft.org/barebox.git delivery/at91sam9_wdt
>
> for you to fetch changes up to 4b4830060956d58f924fc14020609ba5c4fe44ca:
>
>   at91sam9x5: add wathdog support (2012-11-15 04:20:49 +0800)
>
> ----------------------------------------------------------------
> Jean-Christophe PLAGNIOL-VILLARD (7):
>       watchdog: add keep alive support
>       watchdog: add at91sam9 watchdog support
>       at91sam9260/9g20: add wathdog support
>       at91sam9261/9g10: add wathdog support
>       at91sam9263: add wathdog support
>       at91sam9g45: add wathdog support
>       at91sam9x5: add wathdog support
>
>  arch/arm/mach-at91/at91sam9260_devices.c |   12 ++++++++++++
>  arch/arm/mach-at91/at91sam9261_devices.c |   12 ++++++++++++
>  arch/arm/mach-at91/at91sam9263_devices.c |   11 +++++++++++
>  arch/arm/mach-at91/at91sam9g45_devices.c |   12 ++++++++++++
>  arch/arm/mach-at91/at91sam9x5_devices.c  |   12 ++++++++++++
>  drivers/watchdog/Kconfig                 |    8 ++++++++
>  drivers/watchdog/Makefile                |    1 +
>  drivers/watchdog/at91sam9_wdt.c          |  131 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  drivers/watchdog/at91sam9_wdt.h          |   38 ++++++++++++++++++++++++++++++++++++++
>  drivers/watchdog/wd_core.c               |   21 +++++++++++++++++++++
>  include/watchdog.h                       |    2 ++
>  11 files changed, 260 insertions(+)
>  create mode 100644 drivers/watchdog/at91sam9_wdt.c
>  create mode 100644 drivers/watchdog/at91sam9_wdt.h
>
> Best Regards,
> J.
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox

Thanks for the work.

I'd love to have the watchdog support for at91.

Are you still working on it?

Can I help?

Best regards
--
Fabio Porcedda

_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

* [PATCH 4/7] at91sam9261/9g10: add wathdog support
  2012-11-16 17:02 ` [PATCH 1/7] watchdog: add keep alive support Jean-Christophe PLAGNIOL-VILLARD
@ 2012-11-16 17:03   ` Jean-Christophe PLAGNIOL-VILLARD
  0 siblings, 0 replies; 14+ messages in thread
From: Jean-Christophe PLAGNIOL-VILLARD @ 2012-11-16 17:03 UTC (permalink / raw)
  To: barebox

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
---
 arch/arm/mach-at91/at91sam9261_devices.c |   12 ++++++++++++
 1 file changed, 12 insertions(+)

diff --git a/arch/arm/mach-at91/at91sam9261_devices.c b/arch/arm/mach-at91/at91sam9261_devices.c
index 0091e2d..5784e13 100644
--- a/arch/arm/mach-at91/at91sam9261_devices.c
+++ b/arch/arm/mach-at91/at91sam9261_devices.c
@@ -10,6 +10,7 @@
  *
  */
 #include <common.h>
+#include <init.h>
 #include <sizes.h>
 #include <asm/armlinux.h>
 #include <asm/hardware.h>
@@ -257,3 +258,14 @@ void at91_add_device_mci(short mmc_id, struct atmel_mci_platform_data *data)
 #else
 void at91_add_device_mci(short mmc_id, struct atmel_mci_platform_data *data) {}
 #endif
+
+#ifdef CONFIG_WATCHDOG_AT91SAM9X
+static int at91_add_device_watchdog(void)
+{
+	add_generic_device("at91sam9_wdt", DEVICE_ID_SINGLE, NULL,
+		AT91_WDT + AT91_BASE_SYS, 16, IORESOURCE_MEM, NULL);
+
+	return 0;
+}
+coredevice_initcall(at91_add_device_watchdog);
+#endif
-- 
1.7.10.4


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2013-01-17  9:36 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-11-16 17:53 [PATCH 0/7 v2] at91sam9 add watchdog support with keep alive Jean-Christophe PLAGNIOL-VILLARD
2012-11-16 17:55 ` [PATCH 1/7] watchdog: add keep alive support Jean-Christophe PLAGNIOL-VILLARD
2012-11-16 17:55   ` [PATCH 2/7] watchdog: add at91sam9 watchdog support Jean-Christophe PLAGNIOL-VILLARD
2012-11-19  9:36     ` Sascha Hauer
2012-11-19  9:59       ` Jean-Christophe PLAGNIOL-VILLARD
2012-11-16 17:55   ` [PATCH 3/7] at91sam9260/9g20: add wathdog support Jean-Christophe PLAGNIOL-VILLARD
2012-11-16 17:55   ` [PATCH 4/7] at91sam9261/9g10: " Jean-Christophe PLAGNIOL-VILLARD
2012-11-16 17:55   ` [PATCH 5/7] at91sam9263: " Jean-Christophe PLAGNIOL-VILLARD
2012-11-16 17:55   ` [PATCH 6/7] at91sam9g45: " Jean-Christophe PLAGNIOL-VILLARD
2012-11-16 17:55   ` [PATCH 7/7] at91sam9x5: " Jean-Christophe PLAGNIOL-VILLARD
2012-11-19  9:38   ` [PATCH 1/7] watchdog: add keep alive support Sascha Hauer
2012-11-19 10:08     ` Jean-Christophe PLAGNIOL-VILLARD
2013-01-17  9:36 ` [PATCH 0/7 v2] at91sam9 add watchdog support with keep alive Fabio Porcedda
  -- strict thread matches above, loose matches on Subject: below --
2012-11-16 16:57 [PATCH 0/7] " Jean-Christophe PLAGNIOL-VILLARD
2012-11-16 17:02 ` [PATCH 1/7] watchdog: add keep alive support Jean-Christophe PLAGNIOL-VILLARD
2012-11-16 17:03   ` [PATCH 4/7] at91sam9261/9g10: add wathdog support Jean-Christophe PLAGNIOL-VILLARD

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox