drivers/watchdog/aspeed_wdt.c
Source file repositories/reference/linux-study-clean/drivers/watchdog/aspeed_wdt.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/watchdog/aspeed_wdt.c- Extension
.c- Size
- 16266 bytes
- Lines
- 590
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/bits.hlinux/delay.hlinux/interrupt.hlinux/io.hlinux/kernel.hlinux/kstrtox.hlinux/mfd/syscon.hlinux/module.hlinux/of.hlinux/of_irq.hlinux/platform_device.hlinux/regmap.hlinux/watchdog.h
Detected Declarations
struct aspeed_wdt_scustruct aspeed_wdt_configstruct aspeed_wdtfunction pulsefunction aspeed_wdt_enablefunction aspeed_wdt_startfunction aspeed_wdt_stopfunction aspeed_wdt_pingfunction aspeed_wdt_set_timeoutfunction aspeed_wdt_set_pretimeoutfunction aspeed_wdt_restartfunction aspeed_wdt_update_bootstatusfunction of_device_is_compatiblefunction access_cs0_showfunction access_cs0_storefunction aspeed_wdt_irqfunction aspeed_wdt_probefunction aspeed_wdt_initfunction aspeed_wdt_exit
Annotated Snippet
struct aspeed_wdt_scu {
const char *compatible;
u32 reset_status_reg;
u32 wdt_reset_mask;
u32 wdt_reset_mask_shift;
};
struct aspeed_wdt_config {
u32 ext_pulse_width_mask;
u32 irq_shift;
u32 irq_mask;
struct aspeed_wdt_scu scu;
u32 num_reset_masks;
};
struct aspeed_wdt {
struct watchdog_device wdd;
void __iomem *base;
u32 ctrl;
const struct aspeed_wdt_config *cfg;
};
static const struct aspeed_wdt_config ast2400_config = {
.ext_pulse_width_mask = 0xff,
.irq_shift = 0,
.irq_mask = 0,
.scu = {
.compatible = "aspeed,ast2400-scu",
.reset_status_reg = 0x3c,
.wdt_reset_mask = 0x1,
.wdt_reset_mask_shift = 1,
},
};
static const struct aspeed_wdt_config ast2500_config = {
.ext_pulse_width_mask = 0xfffff,
.irq_shift = 12,
.irq_mask = GENMASK(31, 12),
.scu = {
.compatible = "aspeed,ast2500-scu",
.reset_status_reg = 0x3c,
.wdt_reset_mask = 0x1,
.wdt_reset_mask_shift = 2,
},
.num_reset_masks = 1,
};
static const struct aspeed_wdt_config ast2600_config = {
.ext_pulse_width_mask = 0xfffff,
.irq_shift = 0,
.irq_mask = GENMASK(31, 10),
.scu = {
.compatible = "aspeed,ast2600-scu",
.reset_status_reg = 0x74,
.wdt_reset_mask = 0xf,
.wdt_reset_mask_shift = 16,
},
.num_reset_masks = 2,
};
static const struct aspeed_wdt_config ast2700_config = {
.ext_pulse_width_mask = 0xfffff,
.irq_shift = 0,
.irq_mask = GENMASK(31, 10),
.scu = {
.compatible = "aspeed,ast2700-scu0",
.reset_status_reg = 0x70,
.wdt_reset_mask = 0xf,
.wdt_reset_mask_shift = 0,
},
.num_reset_masks = 5,
};
static const struct of_device_id aspeed_wdt_of_table[] = {
{ .compatible = "aspeed,ast2400-wdt", .data = &ast2400_config },
{ .compatible = "aspeed,ast2500-wdt", .data = &ast2500_config },
{ .compatible = "aspeed,ast2600-wdt", .data = &ast2600_config },
{ .compatible = "aspeed,ast2700-wdt", .data = &ast2700_config },
{ },
};
MODULE_DEVICE_TABLE(of, aspeed_wdt_of_table);
#define WDT_STATUS 0x00
#define WDT_RELOAD_VALUE 0x04
#define WDT_RESTART 0x08
#define WDT_CTRL 0x0C
#define WDT_CTRL_BOOT_SECONDARY BIT(7)
#define WDT_CTRL_RESET_MODE_SOC (0x00 << 5)
#define WDT_CTRL_RESET_MODE_FULL_CHIP (0x01 << 5)
#define WDT_CTRL_RESET_MODE_ARM_CPU (0x10 << 5)
Annotation
- Immediate include surface: `linux/bits.h`, `linux/delay.h`, `linux/interrupt.h`, `linux/io.h`, `linux/kernel.h`, `linux/kstrtox.h`, `linux/mfd/syscon.h`, `linux/module.h`.
- Detected declarations: `struct aspeed_wdt_scu`, `struct aspeed_wdt_config`, `struct aspeed_wdt`, `function pulse`, `function aspeed_wdt_enable`, `function aspeed_wdt_start`, `function aspeed_wdt_stop`, `function aspeed_wdt_ping`, `function aspeed_wdt_set_timeout`, `function aspeed_wdt_set_pretimeout`.
- Atlas domain: Driver Families / drivers/watchdog.
- Implementation status: source implementation candidate.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.