// SPDX-License-Identifier: GPL-2.0+ /* * Watchdog driver for Broadcom BCM2835 * * "bcm2708_wdog" driver written by Luke Diamand that was obtained from * branch "rpi-3.6.y" of git://github.com/raspberrypi/linux.git was used * as a hardware reference for the Broadcom BCM2835 watchdog timer. * * Copyright (C) 2013 Lubomir Rintel <lkundrak@v3.sk> *
*/
/* * The Raspberry Pi firmware uses the RSTS register to know which partition * to boot from. The partition value is spread into bits 0, 2, 4, 6, 8, 10. * Partition 63 is a special partition used by the firmware to indicate halt.
*/ #define PM_RSTS_RASPBERRYPI_HALT 0x555
/* * We can't really power off, but if we do the normal reset scheme, and * indicate to bootcode.bin not to reboot, then most of the chip will be * powered off.
*/ staticvoid bcm2835_power_off(void)
{ struct bcm2835_wdt *wdt = bcm2835_power_off_wdt;
u32 val;
/* * We set the watchdog hard reset bit here to distinguish this reset * from the normal (full) reset. bootcode.bin will not reboot after a * hard reset.
*/
val = readl_relaxed(wdt->base + PM_RSTS);
val |= PM_PASSWORD | PM_RSTS_RASPBERRYPI_HALT;
writel_relaxed(val, wdt->base + PM_RSTS);
/* Continue with normal reset mechanism */
__bcm2835_restart(wdt);
}
wdt = devm_kzalloc(dev, sizeof(struct bcm2835_wdt), GFP_KERNEL); if (!wdt) return -ENOMEM;
spin_lock_init(&wdt->lock);
wdt->base = pm->base;
watchdog_set_drvdata(&bcm2835_wdt_wdd, wdt);
watchdog_init_timeout(&bcm2835_wdt_wdd, heartbeat, dev);
watchdog_set_nowayout(&bcm2835_wdt_wdd, nowayout);
bcm2835_wdt_wdd.parent = dev; if (bcm2835_wdt_is_running(wdt)) { /* * The currently active timeout value (set by the * bootloader) may be different from the module * heartbeat parameter or the value in device * tree. But we just need to set WDOG_HW_RUNNING, * because then the framework will "immediately" ping * the device, updating the timeout.
*/
set_bit(WDOG_HW_RUNNING, &bcm2835_wdt_wdd.status);
}
module_param(heartbeat, uint, 0);
MODULE_PARM_DESC(heartbeat, "Initial watchdog heartbeat in seconds");
module_param(nowayout, bool, 0);
MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default="
__MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
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.