forked from torvalds/linux
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'linux-watchdog-4.19-rc1' of git://www.linux-watchdog.org/l…
…inux-watchdog Pull watchdog updates from Wim Van Sebroeck: - add MEN 16z069 IP-Core driver - renesas-wdt: add support for the R8A77990 wdt - stm32_iwdg: Add stm32mp1 support and pclk feature - sp805_wdt, orion_wdt, sprd_wdt: several improvements - imx2_wdt, stmp3xxx: switch to SPDX identifier * tag 'linux-watchdog-4.19-rc1' of git://www.linux-watchdog.org/linux-watchdog: watchdog: fix dependencies of menz69_wdt.o watchdog: sp805: Add clock-frequency property watchdog: add driver for the MEN 16z069 IP-Core watchdog: sprd_wdt: Remove redundant dev_err call in sprd_wdt_probe() watchdog: stmp3xxx: Switch to SPDX identifier watchdog: imx2_wdt: Switch to SPDX identifier watchdog: sp805: set WDOG_HW_RUNNING when appropriate watchdog: sp805: add 'timeout-sec' DT property support dt-bindings: watchdog: Add optional 'timeout-sec' property for sp805 dt-bindings: watchdog: Consolidate SP805 binding docs watchdog: orion_wdt: Mark watchdog as active when running at probe watchdog: stm32: add pclk feature for stm32mp1 dt-bindings: watchdog: add stm32mp1 support dt-bindings: watchdog: renesas-wdt: Add support for the R8A77990 wdt
- Loading branch information
Showing
14 changed files
with
351 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,32 @@ | ||
ARM AMBA Primecell SP805 Watchdog | ||
|
||
SP805 WDT is a ARM Primecell Peripheral and has a standard-id register that | ||
can be used to identify the peripheral type, vendor, and revision. | ||
This value can be used for driver matching. | ||
|
||
As SP805 WDT is a primecell IP, it follows the base bindings specified in | ||
'arm/primecell.txt' | ||
|
||
Required properties: | ||
- compatible: Should be "arm,sp805" & "arm,primecell" | ||
- reg: Should contain location and length for watchdog timer register. | ||
- interrupts: Should contain the list of watchdog timer interrupts. | ||
- clocks: clocks driving the watchdog timer hardware. This list should be 2 | ||
clocks. With 2 clocks, the order is wdogclk clock, apb_pclk. | ||
- compatible: Should be "arm,sp805" & "arm,primecell" | ||
- reg: Should contain location and length for watchdog timer register | ||
- clocks: Clocks driving the watchdog timer hardware. This list should be | ||
2 clocks. With 2 clocks, the order is wdog_clk, apb_pclk | ||
wdog_clk can be equal to or be a sub-multiple of the apb_pclk | ||
frequency | ||
- clock-names: Shall be "wdog_clk" for first clock and "apb_pclk" for the | ||
second one | ||
|
||
Optional properties: | ||
- interrupts: Should specify WDT interrupt number | ||
- timeout-sec: Should specify default WDT timeout in seconds. If unset, the | ||
default timeout is determined by the driver | ||
|
||
Example: | ||
watchdog@66090000 { | ||
compatible = "arm,sp805", "arm,primecell"; | ||
reg = <0x66090000 0x1000>; | ||
interrupts = <GIC_SPI 406 IRQ_TYPE_LEVEL_HIGH>; | ||
clocks = <&apb_pclk>,<&apb_pclk>; | ||
clock-names = "wdogclk", "apb_pclk"; | ||
clocks = <&wdt_clk>, <&apb_pclk>; | ||
clock-names = "wdog_clk", "apb_pclk"; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9427,6 +9427,12 @@ F: drivers/leds/leds-menf21bmc.c | |
F: drivers/hwmon/menf21bmc_hwmon.c | ||
F: Documentation/hwmon/menf21bmc | ||
|
||
MEN Z069 WATCHDOG DRIVER | ||
M: Johannes Thumshirn <[email protected]> | ||
L: [email protected] | ||
S: Maintained | ||
F: drivers/watchdog/menz069_wdt.c | ||
|
||
MESON AO CEC DRIVER FOR AMLOGIC SOCS | ||
M: Neil Armstrong <[email protected]> | ||
L: [email protected] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,170 @@ | ||
// SPDX-License-Identifier: GPL-2.0 | ||
/* | ||
* Watchdog driver for the MEN z069 IP-Core | ||
* | ||
* Copyright (C) 2018 Johannes Thumshirn <[email protected]> | ||
*/ | ||
#include <linux/io.h> | ||
#include <linux/kernel.h> | ||
#include <linux/mcb.h> | ||
#include <linux/module.h> | ||
#include <linux/watchdog.h> | ||
|
||
struct men_z069_drv { | ||
struct watchdog_device wdt; | ||
void __iomem *base; | ||
struct resource *mem; | ||
}; | ||
|
||
#define MEN_Z069_WTR 0x10 | ||
#define MEN_Z069_WTR_WDEN BIT(15) | ||
#define MEN_Z069_WTR_WDET_MASK 0x7fff | ||
#define MEN_Z069_WVR 0x14 | ||
|
||
#define MEN_Z069_TIMER_FREQ 500 /* 500 Hz */ | ||
#define MEN_Z069_WDT_COUNTER_MIN 1 | ||
#define MEN_Z069_WDT_COUNTER_MAX 0x7fff | ||
#define MEN_Z069_DEFAULT_TIMEOUT 30 | ||
|
||
static bool nowayout = WATCHDOG_NOWAYOUT; | ||
module_param(nowayout, bool, 0); | ||
MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" | ||
__MODULE_STRING(WATCHDOG_NOWAYOUT) ")"); | ||
|
||
static int men_z069_wdt_start(struct watchdog_device *wdt) | ||
{ | ||
struct men_z069_drv *drv = watchdog_get_drvdata(wdt); | ||
u16 val; | ||
|
||
val = readw(drv->base + MEN_Z069_WTR); | ||
val |= MEN_Z069_WTR_WDEN; | ||
writew(val, drv->base + MEN_Z069_WTR); | ||
|
||
return 0; | ||
} | ||
|
||
static int men_z069_wdt_stop(struct watchdog_device *wdt) | ||
{ | ||
struct men_z069_drv *drv = watchdog_get_drvdata(wdt); | ||
u16 val; | ||
|
||
val = readw(drv->base + MEN_Z069_WTR); | ||
val &= ~MEN_Z069_WTR_WDEN; | ||
writew(val, drv->base + MEN_Z069_WTR); | ||
|
||
return 0; | ||
} | ||
|
||
static int men_z069_wdt_ping(struct watchdog_device *wdt) | ||
{ | ||
struct men_z069_drv *drv = watchdog_get_drvdata(wdt); | ||
u16 val; | ||
|
||
/* The watchdog trigger value toggles between 0x5555 and 0xaaaa */ | ||
val = readw(drv->base + MEN_Z069_WVR); | ||
val ^= 0xffff; | ||
writew(val, drv->base + MEN_Z069_WVR); | ||
|
||
return 0; | ||
} | ||
|
||
static int men_z069_wdt_set_timeout(struct watchdog_device *wdt, | ||
unsigned int timeout) | ||
{ | ||
struct men_z069_drv *drv = watchdog_get_drvdata(wdt); | ||
u16 reg, val, ena; | ||
|
||
wdt->timeout = timeout; | ||
val = timeout * MEN_Z069_TIMER_FREQ; | ||
|
||
reg = readw(drv->base + MEN_Z069_WVR); | ||
ena = reg & MEN_Z069_WTR_WDEN; | ||
reg = ena | val; | ||
writew(reg, drv->base + MEN_Z069_WTR); | ||
|
||
return 0; | ||
} | ||
|
||
static const struct watchdog_info men_z069_info = { | ||
.options = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING | WDIOF_MAGICCLOSE, | ||
.identity = "MEN z069 Watchdog", | ||
}; | ||
|
||
static const struct watchdog_ops men_z069_ops = { | ||
.owner = THIS_MODULE, | ||
.start = men_z069_wdt_start, | ||
.stop = men_z069_wdt_stop, | ||
.ping = men_z069_wdt_ping, | ||
.set_timeout = men_z069_wdt_set_timeout, | ||
}; | ||
|
||
static struct watchdog_device men_z069_wdt = { | ||
.info = &men_z069_info, | ||
.ops = &men_z069_ops, | ||
.timeout = MEN_Z069_DEFAULT_TIMEOUT, | ||
.min_timeout = 1, | ||
.max_timeout = MEN_Z069_WDT_COUNTER_MAX / MEN_Z069_TIMER_FREQ, | ||
}; | ||
|
||
static int men_z069_probe(struct mcb_device *dev, | ||
const struct mcb_device_id *id) | ||
{ | ||
struct men_z069_drv *drv; | ||
struct resource *mem; | ||
|
||
drv = devm_kzalloc(&dev->dev, sizeof(struct men_z069_drv), GFP_KERNEL); | ||
if (!drv) | ||
return -ENOMEM; | ||
|
||
mem = mcb_request_mem(dev, "z069-wdt"); | ||
if (IS_ERR(mem)) | ||
return PTR_ERR(mem); | ||
|
||
drv->base = devm_ioremap(&dev->dev, mem->start, resource_size(mem)); | ||
if (drv->base == NULL) | ||
goto release_mem; | ||
|
||
drv->mem = mem; | ||
|
||
drv->wdt = men_z069_wdt; | ||
watchdog_init_timeout(&drv->wdt, 0, &dev->dev); | ||
watchdog_set_nowayout(&drv->wdt, nowayout); | ||
watchdog_set_drvdata(&drv->wdt, drv); | ||
drv->wdt.parent = &dev->dev; | ||
mcb_set_drvdata(dev, drv); | ||
|
||
return watchdog_register_device(&men_z069_wdt); | ||
|
||
release_mem: | ||
mcb_release_mem(mem); | ||
return -ENOMEM; | ||
} | ||
|
||
static void men_z069_remove(struct mcb_device *dev) | ||
{ | ||
struct men_z069_drv *drv = mcb_get_drvdata(dev); | ||
|
||
watchdog_unregister_device(&drv->wdt); | ||
mcb_release_mem(drv->mem); | ||
} | ||
|
||
static const struct mcb_device_id men_z069_ids[] = { | ||
{ .device = 0x45 }, | ||
{ } | ||
}; | ||
MODULE_DEVICE_TABLE(mcb, men_z069_ids); | ||
|
||
static struct mcb_driver men_z069_driver = { | ||
.driver = { | ||
.name = "z069-wdt", | ||
.owner = THIS_MODULE, | ||
}, | ||
.probe = men_z069_probe, | ||
.remove = men_z069_remove, | ||
.id_table = men_z069_ids, | ||
}; | ||
module_mcb_driver(men_z069_driver); | ||
|
||
MODULE_AUTHOR("Johannes Thumshirn <[email protected]>"); | ||
MODULE_LICENSE("GPL v2"); | ||
MODULE_ALIAS("mcb:16z069"); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.