drivers/remoteproc/rcar_rproc.c
Source file repositories/reference/linux-study-clean/drivers/remoteproc/rcar_rproc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/remoteproc/rcar_rproc.c- Extension
.c- Size
- 4554 bytes
- Lines
- 219
- Domain
- Driver Families
- Bucket
- drivers/remoteproc
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/limits.hlinux/module.hlinux/of.hlinux/of_reserved_mem.hlinux/platform_device.hlinux/pm_runtime.hlinux/remoteproc.hlinux/reset.hlinux/soc/renesas/rcar-rst.hremoteproc_internal.h
Detected Declarations
struct rcar_rprocfunction rcar_rproc_mem_allocfunction rcar_rproc_mem_releasefunction rcar_rproc_preparefunction rcar_rproc_parse_fwfunction rcar_rproc_startfunction rcar_rproc_stopfunction rcar_rproc_probefunction rcar_rproc_remove
Annotated Snippet
struct rcar_rproc {
struct reset_control *rst;
};
static int rcar_rproc_mem_alloc(struct rproc *rproc,
struct rproc_mem_entry *mem)
{
struct device *dev = &rproc->dev;
void *va;
dev_dbg(dev, "map memory: %pa+%zx\n", &mem->dma, mem->len);
va = ioremap_wc(mem->dma, mem->len);
if (!va) {
dev_err(dev, "Unable to map memory region: %pa+%zx\n",
&mem->dma, mem->len);
return -ENOMEM;
}
/* Update memory entry va */
mem->va = va;
return 0;
}
static int rcar_rproc_mem_release(struct rproc *rproc,
struct rproc_mem_entry *mem)
{
dev_dbg(&rproc->dev, "unmap memory: %pa\n", &mem->dma);
iounmap(mem->va);
return 0;
}
static int rcar_rproc_prepare(struct rproc *rproc)
{
struct device *dev = rproc->dev.parent;
struct device_node *np = dev->of_node;
struct rproc_mem_entry *mem;
int i = 0;
u32 da;
/* Register associated reserved memory regions */
while (1) {
struct resource res;
int ret;
ret = of_reserved_mem_region_to_resource(np, i++, &res);
if (ret)
return 0;
if (res.start > U32_MAX)
return -EINVAL;
/* No need to translate pa to da, R-Car use same map */
da = res.start;
mem = rproc_mem_entry_init(dev, NULL,
res.start,
resource_size(&res), da,
rcar_rproc_mem_alloc,
rcar_rproc_mem_release,
res.name);
if (!mem)
return -ENOMEM;
rproc_add_carveout(rproc, mem);
}
}
static int rcar_rproc_parse_fw(struct rproc *rproc, const struct firmware *fw)
{
int ret;
ret = rproc_elf_load_rsc_table(rproc, fw);
if (ret)
dev_info(&rproc->dev, "No resource table in elf\n");
return 0;
}
static int rcar_rproc_start(struct rproc *rproc)
{
struct rcar_rproc *priv = rproc->priv;
int err;
if (!rproc->bootaddr)
return -EINVAL;
err = rcar_rst_set_rproc_boot_addr(rproc->bootaddr);
if (err) {
Annotation
- Immediate include surface: `linux/limits.h`, `linux/module.h`, `linux/of.h`, `linux/of_reserved_mem.h`, `linux/platform_device.h`, `linux/pm_runtime.h`, `linux/remoteproc.h`, `linux/reset.h`.
- Detected declarations: `struct rcar_rproc`, `function rcar_rproc_mem_alloc`, `function rcar_rproc_mem_release`, `function rcar_rproc_prepare`, `function rcar_rproc_parse_fw`, `function rcar_rproc_start`, `function rcar_rproc_stop`, `function rcar_rproc_probe`, `function rcar_rproc_remove`.
- Atlas domain: Driver Families / drivers/remoteproc.
- 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.