drivers/soc/litex/litex_soc_ctrl.c
Source file repositories/reference/linux-study-clean/drivers/soc/litex/litex_soc_ctrl.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/soc/litex/litex_soc_ctrl.c- Extension
.c- Size
- 3416 bytes
- Lines
- 128
- Domain
- Driver Families
- Bucket
- drivers/soc
- 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/litex.hlinux/device.hlinux/errno.hlinux/of.hlinux/platform_device.hlinux/printk.hlinux/module.hlinux/io.hlinux/reboot.h
Detected Declarations
struct litex_soc_ctrl_devicefunction Copyrightfunction litex_reset_handlerfunction litex_soc_ctrl_probe
Annotated Snippet
struct litex_soc_ctrl_device {
void __iomem *base;
};
static int litex_reset_handler(struct sys_off_data *data)
{
struct litex_soc_ctrl_device *soc_ctrl_dev = data->cb_data;
litex_write32(soc_ctrl_dev->base + RESET_REG_OFF, RESET_REG_VALUE);
return NOTIFY_DONE;
}
static const struct of_device_id litex_soc_ctrl_of_match[] = {
{.compatible = "litex,soc-controller"},
{},
};
MODULE_DEVICE_TABLE(of, litex_soc_ctrl_of_match);
static int litex_soc_ctrl_probe(struct platform_device *pdev)
{
struct litex_soc_ctrl_device *soc_ctrl_dev;
int error;
soc_ctrl_dev = devm_kzalloc(&pdev->dev, sizeof(*soc_ctrl_dev), GFP_KERNEL);
if (!soc_ctrl_dev)
return -ENOMEM;
soc_ctrl_dev->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(soc_ctrl_dev->base))
return PTR_ERR(soc_ctrl_dev->base);
error = litex_check_csr_access(soc_ctrl_dev->base);
if (error)
return error;
error = devm_register_restart_handler(&pdev->dev,
litex_reset_handler,
soc_ctrl_dev);
if (error) {
dev_warn(&pdev->dev, "cannot register restart handler: %d\n",
error);
}
return 0;
}
static struct platform_driver litex_soc_ctrl_driver = {
.driver = {
.name = "litex-soc-controller",
.of_match_table = litex_soc_ctrl_of_match,
},
.probe = litex_soc_ctrl_probe,
};
module_platform_driver(litex_soc_ctrl_driver);
MODULE_DESCRIPTION("LiteX SoC Controller driver");
MODULE_AUTHOR("Antmicro <www.antmicro.com>");
MODULE_LICENSE("GPL v2");
Annotation
- Immediate include surface: `linux/litex.h`, `linux/device.h`, `linux/errno.h`, `linux/of.h`, `linux/platform_device.h`, `linux/printk.h`, `linux/module.h`, `linux/io.h`.
- Detected declarations: `struct litex_soc_ctrl_device`, `function Copyright`, `function litex_reset_handler`, `function litex_soc_ctrl_probe`.
- Atlas domain: Driver Families / drivers/soc.
- 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.