drivers/watchdog/ep93xx_wdt.c
Source file repositories/reference/linux-study-clean/drivers/watchdog/ep93xx_wdt.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/watchdog/ep93xx_wdt.c- Extension
.c- Size
- 3547 bytes
- Lines
- 144
- Domain
- Driver Families
- Bucket
- drivers/watchdog
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/platform_device.hlinux/module.hlinux/watchdog.hlinux/io.h
Detected Declarations
struct ep93xx_wdt_privfunction ep93xx_wdt_startfunction ep93xx_wdt_stopfunction ep93xx_wdt_pingfunction ep93xx_wdt_probe
Annotated Snippet
struct ep93xx_wdt_priv {
void __iomem *mmio;
struct watchdog_device wdd;
};
static int ep93xx_wdt_start(struct watchdog_device *wdd)
{
struct ep93xx_wdt_priv *priv = watchdog_get_drvdata(wdd);
writel(0xaaaa, priv->mmio + EP93XX_WATCHDOG);
return 0;
}
static int ep93xx_wdt_stop(struct watchdog_device *wdd)
{
struct ep93xx_wdt_priv *priv = watchdog_get_drvdata(wdd);
writel(0xaa55, priv->mmio + EP93XX_WATCHDOG);
return 0;
}
static int ep93xx_wdt_ping(struct watchdog_device *wdd)
{
struct ep93xx_wdt_priv *priv = watchdog_get_drvdata(wdd);
writel(0x5555, priv->mmio + EP93XX_WATCHDOG);
return 0;
}
static const struct watchdog_info ep93xx_wdt_ident = {
.options = WDIOF_CARDRESET |
WDIOF_SETTIMEOUT |
WDIOF_MAGICCLOSE |
WDIOF_KEEPALIVEPING,
.identity = "EP93xx Watchdog",
};
static const struct watchdog_ops ep93xx_wdt_ops = {
.owner = THIS_MODULE,
.start = ep93xx_wdt_start,
.stop = ep93xx_wdt_stop,
.ping = ep93xx_wdt_ping,
};
static int ep93xx_wdt_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct ep93xx_wdt_priv *priv;
struct watchdog_device *wdd;
unsigned long val;
int ret;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
priv->mmio = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(priv->mmio))
return PTR_ERR(priv->mmio);
val = readl(priv->mmio + EP93XX_WATCHDOG);
wdd = &priv->wdd;
wdd->bootstatus = (val & 0x01) ? WDIOF_CARDRESET : 0;
wdd->info = &ep93xx_wdt_ident;
wdd->ops = &ep93xx_wdt_ops;
wdd->min_timeout = 1;
wdd->max_hw_heartbeat_ms = 200;
wdd->parent = dev;
watchdog_set_nowayout(wdd, nowayout);
wdd->timeout = WDT_TIMEOUT;
watchdog_init_timeout(wdd, timeout, dev);
watchdog_set_drvdata(wdd, priv);
ret = devm_watchdog_register_device(dev, wdd);
if (ret)
return ret;
dev_info(dev, "EP93XX watchdog driver %s\n",
(val & 0x08) ? " (nCS1 disable detected)" : "");
return 0;
}
Annotation
- Immediate include surface: `linux/platform_device.h`, `linux/module.h`, `linux/watchdog.h`, `linux/io.h`.
- Detected declarations: `struct ep93xx_wdt_priv`, `function ep93xx_wdt_start`, `function ep93xx_wdt_stop`, `function ep93xx_wdt_ping`, `function ep93xx_wdt_probe`.
- Atlas domain: Driver Families / drivers/watchdog.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.