public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [PATCH] drivers: watchdog: add MAX6373 WDT support
@ 2015-07-23 21:33 rnd4 at dave-tech.it
  2015-08-12 15:46 ` Tom Rini
  0 siblings, 1 reply; 5+ messages in thread
From: rnd4 at dave-tech.it @ 2015-07-23 21:33 UTC (permalink / raw)
  To: u-boot

From: Andrea Scian <andrea.scian@dave.eu>

MAX6373 is a simple WDT which is programmed its configuration pins
and reset via another pin, which is usually connected to a GPIO

Signed-off-by: Andrea Scian <andrea.scian@dave.eu>
---
 drivers/watchdog/Makefile      |    1 +
 drivers/watchdog/max6373_wdt.c |   34 ++++++++++++++++++++++++++++++++++
 2 files changed, 35 insertions(+)
 create mode 100644 drivers/watchdog/max6373_wdt.c

diff --git a/drivers/watchdog/Makefile b/drivers/watchdog/Makefile
index 0276a10..6826100 100644
--- a/drivers/watchdog/Makefile
+++ b/drivers/watchdog/Makefile
@@ -16,3 +16,4 @@ obj-$(CONFIG_XILINX_TB_WATCHDOG) += xilinx_tb_wdt.o
 obj-$(CONFIG_BFIN_WATCHDOG)  += bfin_wdt.o
 obj-$(CONFIG_OMAP_WATCHDOG) += omap_wdt.o
 obj-$(CONFIG_DESIGNWARE_WATCHDOG) += designware_wdt.o
+obj-$(CONFIG_MAX6373_WATCHDOG) += max6373_wdt.o
diff --git a/drivers/watchdog/max6373_wdt.c b/drivers/watchdog/max6373_wdt.c
new file mode 100644
index 0000000..cda46af
--- /dev/null
+++ b/drivers/watchdog/max6373_wdt.c
@@ -0,0 +1,34 @@
+/*
+ * Copyright (c) 2015 DAVE Embedded Systems <devel@dave.eu>
+ *
+ * SPDX-License-Identifier:	GPL-2.0+
+ *
+ * MAX6373 is a WDT which uses a simple GPIO to reset its timeout
+ *
+ * Use CONFIG_MAX6373_WDT_GPIO to define the GPIO number to use
+ */
+
+#include <common.h>
+#include <asm/io.h>
+#include <asm/gpio.h>
+#include <watchdog.h>
+
+#ifndef CONFIG_MAX6373_WDT_GPIO
+#error "Please use CONFIG_MAX6373_WDT_GPIO to define which GPIO to use"
+#endif
+
+void hw_watchdog_reset(void)
+{
+	gpio_set_value(CONFIG_MAX6373_WDT_GPIO,
+		!gpio_get_value(CONFIG_MAX6373_WDT_GPIO));
+}
+
+void hw_watchdog_init(void)
+{
+	if (gpio_request(CONFIG_MAX6373_WDT_GPIO, "MAX6373 WDT")) {
+		printf("Cannot request GPIO %d for MAX6373 WDT\n",
+			CONFIG_MAX6373_WDT_GPIO);
+		return;
+	}
+	gpio_direction_output(CONFIG_MAX6373_WDT_GPIO, 1);
+}
-- 
1.7.9.5

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

end of thread, other threads:[~2015-08-18 20:41 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-07-23 21:33 [U-Boot] [PATCH] drivers: watchdog: add MAX6373 WDT support rnd4 at dave-tech.it
2015-08-12 15:46 ` Tom Rini
2015-08-18 13:22   ` [U-Boot] [PATCH v2] " rnd4 at dave-tech.it
2015-08-18 13:33     ` Michael Trimarchi
2015-08-18 20:41       ` Andrea Scian

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