drivers/reset/reset-imx-scu.c
Source file repositories/reference/linux-study-clean/drivers/reset/reset-imx-scu.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/reset/reset-imx-scu.c- Extension
.c- Size
- 2524 bytes
- Lines
- 102
- 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/firmware/imx/svc/misc.hlinux/kernel.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/reset-controller.hdt-bindings/firmware/imx/rsrc.h
Detected Declarations
struct imx_scu_resetstruct imx_scu_id_mapfunction imx_scu_reset_assertfunction imx_scu_xlatefunction imx_scu_reset_probe
Annotated Snippet
struct imx_scu_reset {
struct reset_controller_dev rc;
struct imx_sc_ipc *ipc_handle;
};
static struct imx_scu_reset *to_imx_scu(struct reset_controller_dev *rc)
{
return container_of(rc, struct imx_scu_reset, rc);
}
struct imx_scu_id_map {
u32 resource_id;
u32 command_id;
};
static const struct imx_scu_id_map imx_scu_id_map[] = {
{ IMX_SC_R_CSI_0, IMX_SC_C_MIPI_RESET },
{ IMX_SC_R_CSI_1, IMX_SC_C_MIPI_RESET },
};
static int imx_scu_reset_assert(struct reset_controller_dev *rc, unsigned long id)
{
struct imx_scu_reset *priv = to_imx_scu(rc);
return imx_sc_misc_set_control(priv->ipc_handle, imx_scu_id_map[id].resource_id,
imx_scu_id_map[id].command_id, true);
}
static const struct reset_control_ops imx_scu_reset_ops = {
.assert = imx_scu_reset_assert,
};
static int imx_scu_xlate(struct reset_controller_dev *rc, const struct of_phandle_args *reset_spec)
{
int i;
for (i = 0; i < rc->nr_resets; i++)
if (reset_spec->args[0] == imx_scu_id_map[i].resource_id)
return i;
return -EINVAL;
}
static int imx_scu_reset_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
struct imx_scu_reset *priv;
int ret;
priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL);
if (!priv)
return -ENOMEM;
platform_set_drvdata(pdev, &priv->rc);
ret = imx_scu_get_handle(&priv->ipc_handle);
if (ret)
return dev_err_probe(dev, ret, "sc_misc_MIPI get ipc handle failed!\n");
priv->rc.ops = &imx_scu_reset_ops;
priv->rc.owner = THIS_MODULE;
priv->rc.of_node = dev->of_node;
priv->rc.of_reset_n_cells = 1;
priv->rc.of_xlate = imx_scu_xlate;
priv->rc.nr_resets = ARRAY_SIZE(imx_scu_id_map);
return devm_reset_controller_register(dev, &priv->rc);
}
static const struct of_device_id imx_scu_reset_ids[] = {
{ .compatible = "fsl,imx-scu-reset", },
{}
};
MODULE_DEVICE_TABLE(of, imx_scu_reset_ids);
static struct platform_driver imx_scu_reset_driver = {
.probe = imx_scu_reset_probe,
.driver = {
.name = "scu-reset",
.of_match_table = imx_scu_reset_ids,
},
};
module_platform_driver(imx_scu_reset_driver);
MODULE_AUTHOR("Frank Li <Frank.Li@nxp.com>");
MODULE_DESCRIPTION("i.MX scu reset driver");
MODULE_LICENSE("GPL");
Annotation
- Immediate include surface: `linux/firmware/imx/svc/misc.h`, `linux/kernel.h`, `linux/module.h`, `linux/of.h`, `linux/platform_device.h`, `linux/reset-controller.h`, `dt-bindings/firmware/imx/rsrc.h`.
- Detected declarations: `struct imx_scu_reset`, `struct imx_scu_id_map`, `function imx_scu_reset_assert`, `function imx_scu_xlate`, `function imx_scu_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.