drivers/bus/imx-aipstz.c
Source file repositories/reference/linux-study-clean/drivers/bus/imx-aipstz.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/bus/imx-aipstz.c- Extension
.c- Size
- 3321 bytes
- Lines
- 124
- Domain
- Driver Families
- Bucket
- drivers/bus
- 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/module.hlinux/of.hlinux/of_platform.hlinux/platform_device.hlinux/pm_runtime.hlinux/regmap.h
Detected Declarations
struct imx_aipstz_configstruct imx_aipstz_datafunction imx_aipstz_apply_defaultfunction imx_aipstz_probefunction imx_aipstz_removefunction imx_aipstz_runtime_resume
Annotated Snippet
struct imx_aipstz_config {
u32 mpr0;
u32 opacr0;
u32 opacr1;
u32 opacr2;
u32 opacr3;
u32 opacr4;
};
struct imx_aipstz_data {
void __iomem *base;
const struct imx_aipstz_config *default_cfg;
};
static void imx_aipstz_apply_default(struct imx_aipstz_data *data)
{
writel(data->default_cfg->mpr0, data->base + IMX_AIPSTZ_MPR0);
writel(data->default_cfg->opacr0, data->base + IMX_AIPSTZ_OPACR0);
writel(data->default_cfg->opacr1, data->base + IMX_AIPSTZ_OPACR1);
writel(data->default_cfg->opacr2, data->base + IMX_AIPSTZ_OPACR2);
writel(data->default_cfg->opacr3, data->base + IMX_AIPSTZ_OPACR3);
writel(data->default_cfg->opacr4, data->base + IMX_AIPSTZ_OPACR4);
}
static const struct of_device_id imx_aipstz_match_table[] = {
{ .compatible = "simple-bus", },
{ }
};
static int imx_aipstz_probe(struct platform_device *pdev)
{
struct imx_aipstz_data *data;
data = devm_kzalloc(&pdev->dev, sizeof(*data), GFP_KERNEL);
if (!data)
return dev_err_probe(&pdev->dev, -ENOMEM,
"failed to allocate data memory\n");
data->base = devm_platform_get_and_ioremap_resource(pdev, 0, NULL);
if (IS_ERR(data->base))
return dev_err_probe(&pdev->dev, -ENOMEM,
"failed to get/ioremap AC memory\n");
data->default_cfg = of_device_get_match_data(&pdev->dev);
imx_aipstz_apply_default(data);
dev_set_drvdata(&pdev->dev, data);
pm_runtime_set_active(&pdev->dev);
devm_pm_runtime_enable(&pdev->dev);
return of_platform_populate(pdev->dev.of_node, imx_aipstz_match_table,
NULL, &pdev->dev);
}
static void imx_aipstz_remove(struct platform_device *pdev)
{
of_platform_depopulate(&pdev->dev);
}
static int imx_aipstz_runtime_resume(struct device *dev)
{
struct imx_aipstz_data *data = dev_get_drvdata(dev);
/* restore potentially lost configuration during domain power-off */
imx_aipstz_apply_default(data);
return 0;
}
static const struct dev_pm_ops imx_aipstz_pm_ops = {
RUNTIME_PM_OPS(NULL, imx_aipstz_runtime_resume, NULL)
SYSTEM_SLEEP_PM_OPS(pm_runtime_force_suspend, pm_runtime_force_resume)
};
/*
* following configuration is equivalent to:
* masters 0-7 => trusted for R/W + use AHB's HPROT[1] to det. privilege
*/
static const struct imx_aipstz_config imx8mp_aipstz_default_cfg = {
.mpr0 = 0x77777777,
};
static const struct of_device_id imx_aipstz_of_ids[] = {
{ .compatible = "fsl,imx8mp-aipstz", .data = &imx8mp_aipstz_default_cfg },
{ }
};
MODULE_DEVICE_TABLE(of, imx_aipstz_of_ids);
Annotation
- Immediate include surface: `linux/module.h`, `linux/of.h`, `linux/of_platform.h`, `linux/platform_device.h`, `linux/pm_runtime.h`, `linux/regmap.h`.
- Detected declarations: `struct imx_aipstz_config`, `struct imx_aipstz_data`, `function imx_aipstz_apply_default`, `function imx_aipstz_probe`, `function imx_aipstz_remove`, `function imx_aipstz_runtime_resume`.
- Atlas domain: Driver Families / drivers/bus.
- 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.