// SPDX-License-Identifier: GPL-2.0-or-later /* * GE watchdog userspace interface * * Author: Martyn Welch <martyn.welch@ge.com> * * Copyright 2008 GE Intelligent Platforms Embedded Systems, Inc. * * Based on: mv64x60_wdt.c (MV64X60 watchdog userspace interface) * Author: James Chapman <jchapman@katalix.com>
*/
/* TODO: * This driver does not provide support for the hardwares capability of sending * an interrupt at a programmable threshold. * * This driver currently can only support 1 watchdog - there are 2 in the * hardware that this driver supports. Thus one could be configured as a * process-based watchdog (via /dev/watchdog), the second (using the interrupt * capabilities) a kernel-based watchdog.
*/
/* * The watchdog configuration register contains a pair of 2-bit fields, * 1. a reload field, bits 27-26, which triggers a reload of * the countdown register, and * 2. an enable field, bits 25-24, which toggles between * enabling and disabling the watchdog timer. * Bit 31 is a read-only field which indicates whether the * watchdog timer is currently enabled. * * The low 24 bits contain the timer reload value.
*/ #define GEF_WDC_ENABLE_SHIFT 24 #define GEF_WDC_SERVICE_SHIFT 26 #define GEF_WDC_ENABLED_SHIFT 31
/* only toggle the requested field if enabled state matches predicate */ if ((enabled ^ enabled_predicate) == 0) { /* We write a 1, then a 2 -- to the appropriate field */
data = (1 << field_shift) | gef_wdt_count;
iowrite32be(data, gef_wdt_regs);
data = (2 << field_shift) | gef_wdt_count;
iowrite32be(data, gef_wdt_regs);
ret = 1;
}
spin_unlock(&gef_wdt_spinlock);
switch (cmd) { case WDIOC_GETSUPPORT: if (copy_to_user(argp, &info, sizeof(info))) return -EFAULT; break;
case WDIOC_GETSTATUS: case WDIOC_GETBOOTSTATUS: if (put_user(wdt_status, (int __user *)argp)) return -EFAULT;
wdt_status &= ~WDIOF_KEEPALIVEPING; break;
case WDIOC_SETOPTIONS: if (get_user(options, (int __user *)argp)) return -EFAULT;
if (options & WDIOS_DISABLECARD)
gef_wdt_handler_disable();
if (options & WDIOS_ENABLECARD)
gef_wdt_handler_enable(); break;
case WDIOC_KEEPALIVE:
gef_wdt_service();
wdt_status |= WDIOF_KEEPALIVEPING; break;
case WDIOC_SETTIMEOUT: if (get_user(timeout, (int __user *)argp)) return -EFAULT;
gef_wdt_set_timeout(timeout);
fallthrough;
case WDIOC_GETTIMEOUT: if (put_user(gef_wdt_timeout, (int __user *)argp)) return -EFAULT; break;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.