mirror of
https://github.com/armbian/linux.git
synced 2026-01-06 10:13:00 -08:00
Merge git://www.linux-watchdog.org/linux-watchdog
Pull watchdog updates from Wim Van Sebroeck:
- lots of devm_ conversions and cleanup
- platform_set_drvdata cleanups
- s3c2410: dev_err/dev_info + dev_pm_ops
- watchdog_core: don't try to stop device if not running fix
- wdrtas: use print_hex_dump
- xilinx cleanups
- orion_wdt fixes
- softdog cleanup
- hpwdt: check on UEFI bits
- deletion of mpcore_wdt driver
- addition of broadcom BCM2835 watchdog timer driver
- addition of MEN A21 watcdog devices
* git://www.linux-watchdog.org/linux-watchdog: (38 commits)
watchdog: hpwdt: Add check for UEFI bits
watchdog: softdog: remove replaceable ping operation
watchdog: New watchdog driver for MEN A21 watchdogs
Watchdog: fix clearing of the watchdog interrupt
Watchdog: allow orion_wdt to be built for Dove
watchdog: Add Broadcom BCM2835 watchdog timer driver
watchdog: delete mpcore_wdt driver
watchdog: xilinx: Setup the origin compatible string
watchdog: xilinx: Fix driver header
watchdog: wdrtas: don't use custom version of print_hex_dump
watchdog: core: don't try to stop device if not running
watchdog: jz4740: Pass device to clk_get
watchdog: twl4030: Remove redundant platform_set_drvdata()
watchdog: mpcore: Remove redundant platform_set_drvdata()
watchdog: da9055: use platform_{get,set}_drvdata()
watchdog: da9052: use platform_{get,set}_drvdata()
watchdog: cpwd: use platform_{get,set}_drvdata()
watchdog: s3c2410_wdt: convert s3c2410wdt to dev_pm_ops
watchdog: s3c2410_wdt: use dev_err()/dev_info() instead of pr_err()/pr_info()
watchdog: wm831x: use platform_{get,set}_drvdata()
...
This commit is contained in:
25
Documentation/devicetree/bindings/gpio/men-a021-wdt.txt
Normal file
25
Documentation/devicetree/bindings/gpio/men-a021-wdt.txt
Normal file
@@ -0,0 +1,25 @@
|
||||
Bindings for MEN A21 Watchdog device connected to GPIO lines
|
||||
|
||||
Required properties:
|
||||
- compatible: "men,a021-wdt"
|
||||
- gpios: Specifies the pins that control the Watchdog, order:
|
||||
1: Watchdog enable
|
||||
2: Watchdog fast-mode
|
||||
3: Watchdog trigger
|
||||
4: Watchdog reset cause bit 0
|
||||
5: Watchdog reset cause bit 1
|
||||
6: Watchdog reset cause bit 2
|
||||
|
||||
Optional properties:
|
||||
- None
|
||||
|
||||
Example:
|
||||
watchdog {
|
||||
compatible ="men,a021-wdt";
|
||||
gpios = <&gpio3 9 1 /* WD_EN */
|
||||
&gpio3 10 1 /* WD_FAST */
|
||||
&gpio3 11 1 /* WD_TRIG */
|
||||
&gpio3 6 1 /* RST_CAUSE[0] */
|
||||
&gpio3 7 1 /* RST_CAUSE[1] */
|
||||
&gpio3 8 1>; /* RST_CAUSE[2] */
|
||||
};
|
||||
@@ -5,9 +5,14 @@ Required properties:
|
||||
- compatible : should be "brcm,bcm2835-pm-wdt"
|
||||
- reg : Specifies base physical address and size of the registers.
|
||||
|
||||
Optional properties:
|
||||
|
||||
- timeout-sec : Contains the watchdog timeout in seconds
|
||||
|
||||
Example:
|
||||
|
||||
watchdog {
|
||||
compatible = "brcm,bcm2835-pm-wdt";
|
||||
reg = <0x7e100000 0x28>;
|
||||
timeout-sec = <10>;
|
||||
};
|
||||
|
||||
@@ -194,14 +194,6 @@ reset: Watchdog Interrupt/Reset Mode. 0 = interrupt, 1 = reset
|
||||
nowayout: Watchdog cannot be stopped once started
|
||||
(default=kernel config parameter)
|
||||
-------------------------------------------------
|
||||
mpcore_wdt:
|
||||
mpcore_margin: MPcore timer margin in seconds.
|
||||
(0 < mpcore_margin < 65536, default=60)
|
||||
nowayout: Watchdog cannot be stopped once started
|
||||
(default=kernel config parameter)
|
||||
mpcore_noboot: MPcore watchdog action, set to 1 to ignore reboots,
|
||||
0 to reboot (default=0
|
||||
-------------------------------------------------
|
||||
mv64x60_wdt:
|
||||
nowayout: Watchdog cannot be stopped once started
|
||||
(default=kernel config parameter)
|
||||
|
||||
@@ -5387,6 +5387,12 @@ F: drivers/mtd/
|
||||
F: include/linux/mtd/
|
||||
F: include/uapi/mtd/
|
||||
|
||||
MEN A21 WATCHDOG DRIVER
|
||||
M: Johannes Thumshirn <johannes.thumshirn@men.de>
|
||||
L: linux-watchdog@vger.kernel.org
|
||||
S: Supported
|
||||
F: drivers/watchdog/mena21_wdt.c
|
||||
|
||||
METAG ARCHITECTURE
|
||||
M: James Hogan <james.hogan@imgtec.com>
|
||||
S: Supported
|
||||
|
||||
@@ -61,7 +61,6 @@ CONFIG_GPIO_SYSFS=y
|
||||
CONFIG_GPIO_PL061=y
|
||||
# CONFIG_HWMON is not set
|
||||
CONFIG_WATCHDOG=y
|
||||
CONFIG_MPCORE_WATCHDOG=y
|
||||
# CONFIG_HID_SUPPORT is not set
|
||||
CONFIG_USB=y
|
||||
# CONFIG_USB_DEVICE_CLASS is not set
|
||||
|
||||
@@ -26,6 +26,7 @@
|
||||
#define SYSTEM_SOFT_RESET (BRIDGE_VIRT_BASE + 0x010c)
|
||||
#define SOFT_RESET 0x00000001
|
||||
|
||||
#define BRIDGE_CAUSE (BRIDGE_VIRT_BASE + 0x0110)
|
||||
#define BRIDGE_INT_TIMER1_CLR (~0x0004)
|
||||
|
||||
#define IRQ_VIRT_BASE (BRIDGE_VIRT_BASE + 0x0200)
|
||||
|
||||
@@ -21,14 +21,12 @@
|
||||
#define CPU_RESET 0x00000002
|
||||
|
||||
#define RSTOUTn_MASK (BRIDGE_VIRT_BASE + 0x0108)
|
||||
#define WDT_RESET_OUT_EN 0x00000002
|
||||
#define SOFT_RESET_OUT_EN 0x00000004
|
||||
|
||||
#define SYSTEM_SOFT_RESET (BRIDGE_VIRT_BASE + 0x010c)
|
||||
#define SOFT_RESET 0x00000001
|
||||
|
||||
#define BRIDGE_CAUSE (BRIDGE_VIRT_BASE + 0x0110)
|
||||
#define WDT_INT_REQ 0x0008
|
||||
|
||||
#define BRIDGE_INT_TIMER1_CLR (~0x0004)
|
||||
|
||||
|
||||
@@ -18,7 +18,6 @@
|
||||
#define CPU_CTRL (ORION5X_BRIDGE_VIRT_BASE + 0x104)
|
||||
|
||||
#define RSTOUTn_MASK (ORION5X_BRIDGE_VIRT_BASE + 0x108)
|
||||
#define WDT_RESET_OUT_EN 0x0002
|
||||
|
||||
#define CPU_SOFT_RESET (ORION5X_BRIDGE_VIRT_BASE + 0x10c)
|
||||
|
||||
@@ -26,8 +25,6 @@
|
||||
|
||||
#define POWER_MNG_CTRL_REG (ORION5X_BRIDGE_VIRT_BASE + 0x11C)
|
||||
|
||||
#define WDT_INT_REQ 0x0008
|
||||
|
||||
#define BRIDGE_INT_TIMER1_CLR (~0x0004)
|
||||
|
||||
#define MAIN_IRQ_CAUSE (ORION5X_BRIDGE_VIRT_BASE + 0x200)
|
||||
|
||||
@@ -221,15 +221,6 @@ config DW_WATCHDOG
|
||||
To compile this driver as a module, choose M here: the
|
||||
module will be called dw_wdt.
|
||||
|
||||
config MPCORE_WATCHDOG
|
||||
tristate "MPcore watchdog"
|
||||
depends on HAVE_ARM_TWD
|
||||
help
|
||||
Watchdog timer embedded into the MPcore system.
|
||||
|
||||
To compile this driver as a module, choose M here: the
|
||||
module will be called mpcore_wdt.
|
||||
|
||||
config EP93XX_WATCHDOG
|
||||
tristate "EP93xx Watchdog"
|
||||
depends on ARCH_EP93XX
|
||||
@@ -291,7 +282,7 @@ config DAVINCI_WATCHDOG
|
||||
|
||||
config ORION_WATCHDOG
|
||||
tristate "Orion watchdog"
|
||||
depends on ARCH_ORION5X || ARCH_KIRKWOOD
|
||||
depends on ARCH_ORION5X || ARCH_KIRKWOOD || ARCH_DOVE
|
||||
select WATCHDOG_CORE
|
||||
help
|
||||
Say Y here if to include support for the watchdog timer
|
||||
@@ -1109,6 +1100,17 @@ config BCM63XX_WDT
|
||||
To compile this driver as a loadable module, choose M here.
|
||||
The module will be called bcm63xx_wdt.
|
||||
|
||||
config BCM2835_WDT
|
||||
tristate "Broadcom BCM2835 hardware watchdog"
|
||||
depends on ARCH_BCM2835
|
||||
select WATCHDOG_CORE
|
||||
help
|
||||
Watchdog driver for the built in watchdog hardware in Broadcom
|
||||
BCM2835 SoC.
|
||||
|
||||
To compile this driver as a loadable module, choose M here.
|
||||
The module will be called bcm2835_wdt.
|
||||
|
||||
config LANTIQ_WDT
|
||||
tristate "Lantiq SoC watchdog"
|
||||
depends on LANTIQ
|
||||
@@ -1183,6 +1185,18 @@ config BOOKE_WDT_DEFAULT_TIMEOUT
|
||||
|
||||
The value can be overridden by the wdt_period command-line parameter.
|
||||
|
||||
config MEN_A21_WDT
|
||||
tristate "MEN A21 VME CPU Carrier Board Watchdog Timer"
|
||||
select WATCHDOG_CORE
|
||||
depends on GPIOLIB
|
||||
help
|
||||
Watchdog driver for MEN A21 VMEbus CPU Carrier Boards.
|
||||
|
||||
The driver can also be built as a module. If so, the module will be
|
||||
called mena21_wdt.
|
||||
|
||||
If unsure select N here.
|
||||
|
||||
# PPC64 Architecture
|
||||
|
||||
config WATCHDOG_RTAS
|
||||
|
||||
@@ -41,7 +41,6 @@ obj-$(CONFIG_KS8695_WATCHDOG) += ks8695_wdt.o
|
||||
obj-$(CONFIG_S3C2410_WATCHDOG) += s3c2410_wdt.o
|
||||
obj-$(CONFIG_SA1100_WATCHDOG) += sa1100_wdt.o
|
||||
obj-$(CONFIG_DW_WATCHDOG) += dw_wdt.o
|
||||
obj-$(CONFIG_MPCORE_WATCHDOG) += mpcore_wdt.o
|
||||
obj-$(CONFIG_EP93XX_WATCHDOG) += ep93xx_wdt.o
|
||||
obj-$(CONFIG_PNX4008_WATCHDOG) += pnx4008_wdt.o
|
||||
obj-$(CONFIG_IOP_WATCHDOG) += iop_wdt.o
|
||||
@@ -54,6 +53,7 @@ obj-$(CONFIG_TS72XX_WATCHDOG) += ts72xx_wdt.o
|
||||
obj-$(CONFIG_IMX2_WDT) += imx2_wdt.o
|
||||
obj-$(CONFIG_UX500_WATCHDOG) += ux500_wdt.o
|
||||
obj-$(CONFIG_RETU_WATCHDOG) += retu_wdt.o
|
||||
obj-$(CONFIG_BCM2835_WDT) += bcm2835_wdt.o
|
||||
|
||||
# AVR32 Architecture
|
||||
obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o
|
||||
@@ -144,6 +144,7 @@ obj-$(CONFIG_8xxx_WDT) += mpc8xxx_wdt.o
|
||||
obj-$(CONFIG_MV64X60_WDT) += mv64x60_wdt.o
|
||||
obj-$(CONFIG_PIKA_WDT) += pika_wdt.o
|
||||
obj-$(CONFIG_BOOKE_WDT) += booke_wdt.o
|
||||
obj-$(CONFIG_MEN_A21_WDT) += mena21_wdt.o
|
||||
|
||||
# PPC64 Architecture
|
||||
obj-$(CONFIG_WATCHDOG_RTAS) += wdrtas.o
|
||||
|
||||
@@ -321,13 +321,14 @@ static int __init at32_wdt_probe(struct platform_device *pdev)
|
||||
return -ENXIO;
|
||||
}
|
||||
|
||||
wdt = kzalloc(sizeof(struct wdt_at32ap700x), GFP_KERNEL);
|
||||
wdt = devm_kzalloc(&pdev->dev, sizeof(struct wdt_at32ap700x),
|
||||
GFP_KERNEL);
|
||||
if (!wdt) {
|
||||
dev_dbg(&pdev->dev, "no memory for wdt structure\n");
|
||||
return -ENOMEM;
|
||||
}
|
||||
|
||||
wdt->regs = ioremap(regs->start, resource_size(regs));
|
||||
wdt->regs = devm_ioremap(&pdev->dev, regs->start, resource_size(regs));
|
||||
if (!wdt->regs) {
|
||||
ret = -ENOMEM;
|
||||
dev_dbg(&pdev->dev, "could not map I/O memory\n");
|
||||
@@ -342,7 +343,7 @@ static int __init at32_wdt_probe(struct platform_device *pdev)
|
||||
dev_info(&pdev->dev, "CPU must be reset with external "
|
||||
"reset or POR due to silicon errata.\n");
|
||||
ret = -EIO;
|
||||
goto err_iounmap;
|
||||
goto err_free;
|
||||
} else {
|
||||
wdt->users = 0;
|
||||
}
|
||||
@@ -364,7 +365,7 @@ static int __init at32_wdt_probe(struct platform_device *pdev)
|
||||
ret = misc_register(&wdt->miscdev);
|
||||
if (ret) {
|
||||
dev_dbg(&pdev->dev, "failed to register wdt miscdev\n");
|
||||
goto err_register;
|
||||
goto err_free;
|
||||
}
|
||||
|
||||
dev_info(&pdev->dev,
|
||||
@@ -373,12 +374,7 @@ static int __init at32_wdt_probe(struct platform_device *pdev)
|
||||
|
||||
return 0;
|
||||
|
||||
err_register:
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
err_iounmap:
|
||||
iounmap(wdt->regs);
|
||||
err_free:
|
||||
kfree(wdt);
|
||||
wdt = NULL;
|
||||
return ret;
|
||||
}
|
||||
@@ -391,10 +387,7 @@ static int __exit at32_wdt_remove(struct platform_device *pdev)
|
||||
at32_wdt_stop();
|
||||
|
||||
misc_deregister(&wdt->miscdev);
|
||||
iounmap(wdt->regs);
|
||||
kfree(wdt);
|
||||
wdt = NULL;
|
||||
platform_set_drvdata(pdev, NULL);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
189
drivers/watchdog/bcm2835_wdt.c
Normal file
189
drivers/watchdog/bcm2835_wdt.c
Normal file
@@ -0,0 +1,189 @@
|
||||
/*
|
||||
* 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>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#include <linux/types.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/watchdog.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/of_address.h>
|
||||
#include <linux/miscdevice.h>
|
||||
|
||||
#define PM_RSTC 0x1c
|
||||
#define PM_WDOG 0x24
|
||||
|
||||
#define PM_PASSWORD 0x5a000000
|
||||
|
||||
#define PM_WDOG_TIME_SET 0x000fffff
|
||||
#define PM_RSTC_WRCFG_CLR 0xffffffcf
|
||||
#define PM_RSTC_WRCFG_SET 0x00000030
|
||||
#define PM_RSTC_WRCFG_FULL_RESET 0x00000020
|
||||
#define PM_RSTC_RESET 0x00000102
|
||||
|
||||
#define SECS_TO_WDOG_TICKS(x) ((x) << 16)
|
||||
#define WDOG_TICKS_TO_SECS(x) ((x) >> 16)
|
||||
|
||||
struct bcm2835_wdt {
|
||||
void __iomem *base;
|
||||
spinlock_t lock;
|
||||
};
|
||||
|
||||
static unsigned int heartbeat;
|
||||
static bool nowayout = WATCHDOG_NOWAYOUT;
|
||||
|
||||
static int bcm2835_wdt_start(struct watchdog_device *wdog)
|
||||
{
|
||||
struct bcm2835_wdt *wdt = watchdog_get_drvdata(wdog);
|
||||
uint32_t cur;
|
||||
unsigned long flags;
|
||||
|
||||
spin_lock_irqsave(&wdt->lock, flags);
|
||||
|
||||
writel_relaxed(PM_PASSWORD | (SECS_TO_WDOG_TICKS(wdog->timeout) &
|
||||
PM_WDOG_TIME_SET), wdt->base + PM_WDOG);
|
||||
cur = readl_relaxed(wdt->base + PM_RSTC);
|
||||
writel_relaxed(PM_PASSWORD | (cur & PM_RSTC_WRCFG_CLR) |
|
||||
PM_RSTC_WRCFG_FULL_RESET, wdt->base + PM_RSTC);
|
||||
|
||||
spin_unlock_irqrestore(&wdt->lock, flags);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bcm2835_wdt_stop(struct watchdog_device *wdog)
|
||||
{
|
||||
struct bcm2835_wdt *wdt = watchdog_get_drvdata(wdog);
|
||||
|
||||
writel_relaxed(PM_PASSWORD | PM_RSTC_RESET, wdt->base + PM_RSTC);
|
||||
dev_info(wdog->dev, "Watchdog timer stopped");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bcm2835_wdt_set_timeout(struct watchdog_device *wdog, unsigned int t)
|
||||
{
|
||||
wdog->timeout = t;
|
||||
return 0;
|
||||
}
|
||||
|
||||
static unsigned int bcm2835_wdt_get_timeleft(struct watchdog_device *wdog)
|
||||
{
|
||||
struct bcm2835_wdt *wdt = watchdog_get_drvdata(wdog);
|
||||
|
||||
uint32_t ret = readl_relaxed(wdt->base + PM_WDOG);
|
||||
return WDOG_TICKS_TO_SECS(ret & PM_WDOG_TIME_SET);
|
||||
}
|
||||
|
||||
static struct watchdog_ops bcm2835_wdt_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
.start = bcm2835_wdt_start,
|
||||
.stop = bcm2835_wdt_stop,
|
||||
.set_timeout = bcm2835_wdt_set_timeout,
|
||||
.get_timeleft = bcm2835_wdt_get_timeleft,
|
||||
};
|
||||
|
||||
static struct watchdog_info bcm2835_wdt_info = {
|
||||
.options = WDIOF_SETTIMEOUT | WDIOF_MAGICCLOSE |
|
||||
WDIOF_KEEPALIVEPING,
|
||||
.identity = "Broadcom BCM2835 Watchdog timer",
|
||||
};
|
||||
|
||||
static struct watchdog_device bcm2835_wdt_wdd = {
|
||||
.info = &bcm2835_wdt_info,
|
||||
.ops = &bcm2835_wdt_ops,
|
||||
.min_timeout = 1,
|
||||
.max_timeout = WDOG_TICKS_TO_SECS(PM_WDOG_TIME_SET),
|
||||
.timeout = WDOG_TICKS_TO_SECS(PM_WDOG_TIME_SET),
|
||||
};
|
||||
|
||||
static int bcm2835_wdt_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct device *dev = &pdev->dev;
|
||||
struct device_node *np = dev->of_node;
|
||||
struct bcm2835_wdt *wdt;
|
||||
int err;
|
||||
|
||||
wdt = devm_kzalloc(dev, sizeof(struct bcm2835_wdt), GFP_KERNEL);
|
||||
if (!wdt) {
|
||||
dev_err(dev, "Failed to allocate memory for watchdog device");
|
||||
return -ENOMEM;
|
||||
}
|
||||
platform_set_drvdata(pdev, wdt);
|
||||
|
||||
spin_lock_init(&wdt->lock);
|
||||
|
||||
wdt->base = of_iomap(np, 0);
|
||||
if (!wdt->base) {
|
||||
dev_err(dev, "Failed to remap watchdog regs");
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
watchdog_set_drvdata(&bcm2835_wdt_wdd, wdt);
|
||||
watchdog_init_timeout(&bcm2835_wdt_wdd, heartbeat, dev);
|
||||
watchdog_set_nowayout(&bcm2835_wdt_wdd, nowayout);
|
||||
err = watchdog_register_device(&bcm2835_wdt_wdd);
|
||||
if (err) {
|
||||
dev_err(dev, "Failed to register watchdog device");
|
||||
iounmap(wdt->base);
|
||||
return err;
|
||||
}
|
||||
|
||||
dev_info(dev, "Broadcom BCM2835 watchdog timer");
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int bcm2835_wdt_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct bcm2835_wdt *wdt = platform_get_drvdata(pdev);
|
||||
|
||||
watchdog_unregister_device(&bcm2835_wdt_wdd);
|
||||
iounmap(wdt->base);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void bcm2835_wdt_shutdown(struct platform_device *pdev)
|
||||
{
|
||||
bcm2835_wdt_stop(&bcm2835_wdt_wdd);
|
||||
}
|
||||
|
||||
static const struct of_device_id bcm2835_wdt_of_match[] = {
|
||||
{ .compatible = "brcm,bcm2835-pm-wdt", },
|
||||
{},
|
||||
};
|
||||
MODULE_DEVICE_TABLE(of, bcm2835_wdt_of_match);
|
||||
|
||||
static struct platform_driver bcm2835_wdt_driver = {
|
||||
.probe = bcm2835_wdt_probe,
|
||||
.remove = bcm2835_wdt_remove,
|
||||
.shutdown = bcm2835_wdt_shutdown,
|
||||
.driver = {
|
||||
.name = "bcm2835-wdt",
|
||||
.owner = THIS_MODULE,
|
||||
.of_match_table = bcm2835_wdt_of_match,
|
||||
},
|
||||
};
|
||||
module_platform_driver(bcm2835_wdt_driver);
|
||||
|
||||
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) ")");
|
||||
|
||||
MODULE_AUTHOR("Lubomir Rintel <lkundrak@v3.sk>");
|
||||
MODULE_DESCRIPTION("Driver for Broadcom BCM2835 watchdog timer");
|
||||
MODULE_LICENSE("GPL");
|
||||
MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
|
||||
@@ -16,6 +16,7 @@
|
||||
#include <linux/errno.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/init.h>
|
||||
#include <linux/io.h>
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/module.h>
|
||||
@@ -249,7 +250,8 @@ static int bcm63xx_wdt_probe(struct platform_device *pdev)
|
||||
return -ENODEV;
|
||||
}
|
||||
|
||||
bcm63xx_wdt_device.regs = ioremap_nocache(r->start, resource_size(r));
|
||||
bcm63xx_wdt_device.regs = devm_ioremap_nocache(&pdev->dev, r->start,
|
||||
resource_size(r));
|
||||
if (!bcm63xx_wdt_device.regs) {
|
||||
dev_err(&pdev->dev, "failed to remap I/O resources\n");
|
||||
return -ENXIO;
|
||||
@@ -258,7 +260,7 @@ static int bcm63xx_wdt_probe(struct platform_device *pdev)
|
||||
ret = bcm63xx_timer_register(TIMER_WDT_ID, bcm63xx_wdt_isr, NULL);
|
||||
if (ret < 0) {
|
||||
dev_err(&pdev->dev, "failed to register wdt timer isr\n");
|
||||
goto unmap;
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (bcm63xx_wdt_settimeout(wdt_time)) {
|
||||
@@ -281,8 +283,6 @@ static int bcm63xx_wdt_probe(struct platform_device *pdev)
|
||||
|
||||
unregister_timer:
|
||||
bcm63xx_timer_unregister(TIMER_WDT_ID);
|
||||
unmap:
|
||||
iounmap(bcm63xx_wdt_device.regs);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -293,7 +293,6 @@ static int bcm63xx_wdt_remove(struct platform_device *pdev)
|
||||
|
||||
misc_deregister(&bcm63xx_wdt_miscdev);
|
||||
bcm63xx_timer_unregister(TIMER_WDT_ID);
|
||||
iounmap(bcm63xx_wdt_device.regs);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -621,7 +621,7 @@ static int cpwd_probe(struct platform_device *op)
|
||||
WD_BADMODEL);
|
||||
}
|
||||
|
||||
dev_set_drvdata(&op->dev, p);
|
||||
platform_set_drvdata(op, p);
|
||||
cpwd_device = p;
|
||||
err = 0;
|
||||
|
||||
@@ -642,7 +642,7 @@ out_free:
|
||||
|
||||
static int cpwd_remove(struct platform_device *op)
|
||||
{
|
||||
struct cpwd *p = dev_get_drvdata(&op->dev);
|
||||
struct cpwd *p = platform_get_drvdata(op);
|
||||
int i;
|
||||
|
||||
for (i = 0; i < WD_NUMDEVS; i++) {
|
||||
|
||||
@@ -215,14 +215,14 @@ static int da9052_wdt_probe(struct platform_device *pdev)
|
||||
goto err;
|
||||
}
|
||||
|
||||
dev_set_drvdata(&pdev->dev, driver_data);
|
||||
platform_set_drvdata(pdev, driver_data);
|
||||
err:
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int da9052_wdt_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct da9052_wdt_data *driver_data = dev_get_drvdata(&pdev->dev);
|
||||
struct da9052_wdt_data *driver_data = platform_get_drvdata(pdev);
|
||||
|
||||
watchdog_unregister_device(&driver_data->wdt);
|
||||
kref_put(&driver_data->kref, da9052_wdt_release_resources);
|
||||
|
||||
@@ -174,7 +174,7 @@ static int da9055_wdt_probe(struct platform_device *pdev)
|
||||
goto err;
|
||||
}
|
||||
|
||||
dev_set_drvdata(&pdev->dev, driver_data);
|
||||
platform_set_drvdata(pdev, driver_data);
|
||||
|
||||
ret = watchdog_register_device(&driver_data->wdt);
|
||||
if (ret != 0)
|
||||
@@ -187,7 +187,7 @@ err:
|
||||
|
||||
static int da9055_wdt_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct da9055_wdt_data *driver_data = dev_get_drvdata(&pdev->dev);
|
||||
struct da9055_wdt_data *driver_data = platform_get_drvdata(pdev);
|
||||
|
||||
watchdog_unregister_device(&driver_data->wdt);
|
||||
kref_put(&driver_data->kref, da9055_wdt_release_resources);
|
||||
|
||||
@@ -154,8 +154,8 @@ static int dw_wdt_open(struct inode *inode, struct file *filp)
|
||||
return nonseekable_open(inode, filp);
|
||||
}
|
||||
|
||||
ssize_t dw_wdt_write(struct file *filp, const char __user *buf, size_t len,
|
||||
loff_t *offset)
|
||||
static ssize_t dw_wdt_write(struct file *filp, const char __user *buf,
|
||||
size_t len, loff_t *offset)
|
||||
{
|
||||
if (!len)
|
||||
return 0;
|
||||
@@ -305,13 +305,13 @@ static int dw_wdt_drv_probe(struct platform_device *pdev)
|
||||
if (IS_ERR(dw_wdt.regs))
|
||||
return PTR_ERR(dw_wdt.regs);
|
||||
|
||||
dw_wdt.clk = clk_get(&pdev->dev, NULL);
|
||||
dw_wdt.clk = devm_clk_get(&pdev->dev, NULL);
|
||||
if (IS_ERR(dw_wdt.clk))
|
||||
return PTR_ERR(dw_wdt.clk);
|
||||
|
||||
ret = clk_enable(dw_wdt.clk);
|
||||
if (ret)
|
||||
goto out_put_clk;
|
||||
return ret;
|
||||
|
||||
spin_lock_init(&dw_wdt.lock);
|
||||
|
||||
@@ -327,8 +327,6 @@ static int dw_wdt_drv_probe(struct platform_device *pdev)
|
||||
|
||||
out_disable_clk:
|
||||
clk_disable(dw_wdt.clk);
|
||||
out_put_clk:
|
||||
clk_put(dw_wdt.clk);
|
||||
|
||||
return ret;
|
||||
}
|
||||
@@ -338,7 +336,6 @@ static int dw_wdt_drv_remove(struct platform_device *pdev)
|
||||
misc_deregister(&dw_wdt_miscdev);
|
||||
|
||||
clk_disable(dw_wdt.clk);
|
||||
clk_put(dw_wdt.clk);
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
#endif /* CONFIG_HPWDT_NMI_DECODING */
|
||||
#include <asm/nmi.h>
|
||||
|
||||
#define HPWDT_VERSION "1.3.1"
|
||||
#define HPWDT_VERSION "1.3.2"
|
||||
#define SECS_TO_TICKS(secs) ((secs) * 1000 / 128)
|
||||
#define TICKS_TO_SECS(ticks) ((ticks) * 128 / 1000)
|
||||
#define HPWDT_MAX_TIMER TICKS_TO_SECS(65535)
|
||||
@@ -148,6 +148,7 @@ struct cmn_registers {
|
||||
static unsigned int hpwdt_nmi_decoding;
|
||||
static unsigned int allow_kdump = 1;
|
||||
static unsigned int is_icru;
|
||||
static unsigned int is_uefi;
|
||||
static DEFINE_SPINLOCK(rom_lock);
|
||||
static void *cru_rom_addr;
|
||||
static struct cmn_registers cmn_regs;
|
||||
@@ -484,7 +485,7 @@ static int hpwdt_pretimeout(unsigned int ulReason, struct pt_regs *regs)
|
||||
goto out;
|
||||
|
||||
spin_lock_irqsave(&rom_lock, rom_pl);
|
||||
if (!die_nmi_called && !is_icru)
|
||||
if (!die_nmi_called && !is_icru && !is_uefi)
|
||||
asminline_call(&cmn_regs, cru_rom_addr);
|
||||
die_nmi_called = 1;
|
||||
spin_unlock_irqrestore(&rom_lock, rom_pl);
|
||||
@@ -492,7 +493,7 @@ static int hpwdt_pretimeout(unsigned int ulReason, struct pt_regs *regs)
|
||||
if (allow_kdump)
|
||||
hpwdt_stop();
|
||||
|
||||
if (!is_icru) {
|
||||
if (!is_icru && !is_uefi) {
|
||||
if (cmn_regs.u1.ral == 0) {
|
||||
panic("An NMI occurred, "
|
||||
"but unable to determine source.\n");
|
||||
@@ -679,6 +680,8 @@ static void dmi_find_icru(const struct dmi_header *dm, void *dummy)
|
||||
smbios_proliant_ptr = (struct smbios_proliant_info *) dm;
|
||||
if (smbios_proliant_ptr->misc_features & 0x01)
|
||||
is_icru = 1;
|
||||
if (smbios_proliant_ptr->misc_features & 0x408)
|
||||
is_uefi = 1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -697,7 +700,7 @@ static int hpwdt_init_nmi_decoding(struct pci_dev *dev)
|
||||
* the old cru detect code.
|
||||
*/
|
||||
dmi_walk(dmi_find_icru, NULL);
|
||||
if (!is_icru) {
|
||||
if (!is_icru && !is_uefi) {
|
||||
|
||||
/*
|
||||
* We need to map the ROM to get the CRU service.
|
||||
|
||||
@@ -261,7 +261,7 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
|
||||
if (IS_ERR(imx2_wdt.base))
|
||||
return PTR_ERR(imx2_wdt.base);
|
||||
|
||||
imx2_wdt.clk = clk_get(&pdev->dev, NULL);
|
||||
imx2_wdt.clk = devm_clk_get(&pdev->dev, NULL);
|
||||
if (IS_ERR(imx2_wdt.clk)) {
|
||||
dev_err(&pdev->dev, "can't get Watchdog clock\n");
|
||||
return PTR_ERR(imx2_wdt.clk);
|
||||
@@ -286,7 +286,6 @@ static int __init imx2_wdt_probe(struct platform_device *pdev)
|
||||
|
||||
fail:
|
||||
imx2_wdt_miscdev.parent = NULL;
|
||||
clk_put(imx2_wdt.clk);
|
||||
return ret;
|
||||
}
|
||||
|
||||
@@ -299,8 +298,7 @@ static int __exit imx2_wdt_remove(struct platform_device *pdev)
|
||||
|
||||
dev_crit(imx2_wdt_miscdev.parent,
|
||||
"Device removed: Expect reboot!\n");
|
||||
} else
|
||||
clk_put(imx2_wdt.clk);
|
||||
}
|
||||
|
||||
imx2_wdt_miscdev.parent = NULL;
|
||||
return 0;
|
||||
|
||||
@@ -177,7 +177,7 @@ static int jz4740_wdt_probe(struct platform_device *pdev)
|
||||
goto err_out;
|
||||
}
|
||||
|
||||
drvdata->rtc_clk = clk_get(NULL, "rtc");
|
||||
drvdata->rtc_clk = clk_get(&pdev->dev, "rtc");
|
||||
if (IS_ERR(drvdata->rtc_clk)) {
|
||||
dev_err(&pdev->dev, "cannot find RTC clock\n");
|
||||
ret = PTR_ERR(drvdata->rtc_clk);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user