This generic GPIO watchdog is used on Huawei E970 (brcm47xx) Signed-off-by: Mathias Adam --- a/drivers/watchdog/Kconfig +++ b/drivers/watchdog/Kconfig @@ -1139,6 +1139,15 @@ config WDT_MTX1 Hardware driver for the MTX-1 boards. This is a watchdog timer that will reboot the machine after a 100 seconds timer expired. +config GPIO_WDT + tristate "GPIO Hardware Watchdog" + help + Hardware driver for GPIO-controlled watchdogs. GPIO pin and + toggle interval settings are platform-specific. The driver + will stop toggling the GPIO (i.e. machine reboots) after a + 100 second timer expired and no process has written to + /dev/watchdog during that time. + config PNX833X_WDT tristate "PNX833x Hardware Watchdog" depends on SOC_PNX8335 --- a/drivers/watchdog/Makefile +++ b/drivers/watchdog/Makefile @@ -134,6 +134,7 @@ obj-$(CONFIG_RC32434_WDT) += rc32434_wdt obj-$(CONFIG_INDYDOG) += indydog.o obj-$(CONFIG_JZ4740_WDT) += jz4740_wdt.o obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o +obj-$(CONFIG_GPIO_WDT) += old_gpio_wdt.o obj-$(CONFIG_PNX833X_WDT) += pnx833x_wdt.o obj-$(CONFIG_SIBYTE_WDOG) += sb_wdog.o obj-$(CONFIG_AR7_WDT) += ar7_wdt.o --- /dev/null +++ b/drivers/watchdog/old_gpio_wdt.c @@ -0,0 +1,301 @@ +/* + * Driver for GPIO-controlled Hardware Watchdogs. + * + * Copyright (C) 2013 Mathias Adam + * + * Replaces mtx1_wdt (driver for the MTX-1 Watchdog): + * + * (C) Copyright 2005 4G Systems , + * All Rights Reserved. + * http://www.4g-systems.biz + * + * (C) Copyright 2007 OpenWrt.org, Florian Fainelli + * + * 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. + * + * Neither Michael Stickel nor 4G Systems admit liability nor provide + * warranty for any of this software. This material is provided + * "AS-IS" and at no charge. + * + * (c) Copyright 2005 4G Systems + * + * Release 0.01. + * Author: Michael Stickel michael.stickel@4g-systems.biz + * + * Release 0.02. + * Author: Florian Fainelli florian@openwrt.org + * use the Linux watchdog/timer APIs + * + * Release 0.03. + * Author: Mathias Adam + * make it a generic gpio watchdog driver + * + * The Watchdog is configured to reset the MTX-1 + * if it is not triggered for 100 seconds. + * It should not be triggered more often than 1.6 seconds. + * + * A timer triggers the watchdog every 5 seconds, until + * it is opened for the first time. After the first open + * it MUST be triggered every 2..95 seconds. + */ + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include + +static int ticks = 100 * HZ; + +static struct { + struct completion stop; + spinlock_t lock; + int running; + struct timer_list timer; + int queue; + int default_ticks; + unsigned long inuse; + unsigned gpio; + unsigned int gstate; + int interval; + int first_interval; +} gpio_wdt_device; + +static void gpio_wdt_trigger(unsigned long unused) +{ + spin_lock(&gpio_wdt_device.lock); + if (gpio_wdt_device.running && ticks > 0) + ticks -= gpio_wdt_device.interval; + + /* toggle wdt gpio */ + gpio_wdt_device.gstate = !gpio_wdt_device.gstate; + gpio_set_value(gpio_wdt_device.gpio, gpio_wdt_device.gstate); + + if (gpio_wdt_device.queue && ticks > 0) + mod_timer(&gpio_wdt_device.timer, jiffies + gpio_wdt_device.interval); + else + complete(&gpio_wdt_device.stop); + spin_unlock(&gpio_wdt_device.lock); +} + +static void gpio_wdt_reset(void) +{ + ticks = gpio_wdt_device.default_ticks; +} + + +static void gpio_wdt_start(void) +{ + unsigned long flags; + + spin_lock_irqsave(&gpio_wdt_device.lock, flags); + if (!gpio_wdt_devic
# Copyright (C) 2006-2013 OpenWrt.org
#
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

mainmenu "OpenWrt Configuration"

config MODULES
	option modules
	bool
	default y

config HAVE_DOT_CONFIG
	bool
	default y

source "target/Config.in"

source "config/Config-images.in"

source "config/Config-build.in"

source "config/Config-devel.in"

source "toolchain/Config.in"

source "target/imagebuilder/Config.in"

source "target/sdk/Config.in"

source "target/toolchain/Config.in"

source "tmp/.config-package.in"