drivers/reset/reset-brcmstb-rescal.c
Source file repositories/reference/linux-study-clean/drivers/reset/reset-brcmstb-rescal.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/reset/reset-brcmstb-rescal.c- Extension
.c- Size
- 2810 bytes
- Lines
- 106
- Domain
- Driver Families
- Bucket
- drivers/reset
- 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/device.hlinux/iopoll.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/reset-controller.h
Detected Declarations
struct brcm_rescal_resetfunction brcm_rescal_reset_setfunction brcm_rescal_reset_xlatefunction brcm_rescal_reset_probe
Annotated Snippet
struct brcm_rescal_reset {
void __iomem *base;
struct device *dev;
struct reset_controller_dev rcdev;
};
static int brcm_rescal_reset_set(struct reset_controller_dev *rcdev,
unsigned long id)
{
struct brcm_rescal_reset *data =
container_of(rcdev, struct brcm_rescal_reset, rcdev);
void __iomem *base = data->base;
u32 reg;
int ret;
reg = readl(base + BRCM_RESCAL_START);
writel(reg | BRCM_RESCAL_START_BIT, base + BRCM_RESCAL_START);
reg = readl(base + BRCM_RESCAL_START);
if (!(reg & BRCM_RESCAL_START_BIT)) {
dev_err(data->dev, "failed to start SATA/PCIe rescal\n");
return -EIO;
}
ret = readl_poll_timeout(base + BRCM_RESCAL_STATUS, reg,
(reg & BRCM_RESCAL_STATUS_BIT), 100, 1000);
if (ret) {
dev_err(data->dev, "time out on SATA/PCIe rescal\n");
return ret;
}
reg = readl(base + BRCM_RESCAL_START);
writel(reg & ~BRCM_RESCAL_START_BIT, base + BRCM_RESCAL_START);
dev_dbg(data->dev, "SATA/PCIe rescal success\n");
return 0;
}
static int brcm_rescal_reset_xlate(struct reset_controller_dev *rcdev,
const struct of_phandle_args *reset_spec)
{
/* This is needed if #reset-cells == 0. */
return 0;
}
static const struct reset_control_ops brcm_rescal_reset_ops = {
.reset = brcm_rescal_reset_set,
};
static int brcm_rescal_reset_probe(struct platform_device *pdev)
{
struct brcm_rescal_reset *data;
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
if (!data)
return -ENOMEM;
data->base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(data->base))
return PTR_ERR(data->base);
data->rcdev.owner = THIS_MODULE;
data->rcdev.nr_resets = 1;
data->rcdev.ops = &brcm_rescal_reset_ops;
data->rcdev.of_node = pdev->dev.of_node;
data->rcdev.of_xlate = brcm_rescal_reset_xlate;
data->dev = &pdev->dev;
return devm_reset_controller_register(&pdev->dev, &data->rcdev);
}
static const struct of_device_id brcm_rescal_reset_of_match[] = {
{ .compatible = "brcm,bcm7216-pcie-sata-rescal" },
{ },
};
MODULE_DEVICE_TABLE(of, brcm_rescal_reset_of_match);
static struct platform_driver brcm_rescal_reset_driver = {
.probe = brcm_rescal_reset_probe,
.driver = {
.name = "brcm-rescal-reset",
.of_match_table = brcm_rescal_reset_of_match,
}
};
module_platform_driver(brcm_rescal_reset_driver);
MODULE_AUTHOR("Broadcom");
MODULE_DESCRIPTION("Broadcom SATA/PCIe rescal reset controller");
MODULE_LICENSE("GPL v2");
Annotation
- Immediate include surface: `linux/device.h`, `linux/iopoll.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/reset-controller.h`.
- Detected declarations: `struct brcm_rescal_reset`, `function brcm_rescal_reset_set`, `function brcm_rescal_reset_xlate`, `function brcm_rescal_reset_probe`.
- Atlas domain: Driver Families / drivers/reset.
- 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.