drivers/remoteproc/pru_rproc.c
Source file repositories/reference/linux-study-clean/drivers/remoteproc/pru_rproc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/remoteproc/pru_rproc.c- Extension
.c- Size
- 31178 bytes
- Lines
- 1136
- Domain
- Driver Families
- Bucket
- drivers/remoteproc
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitops.hlinux/debugfs.hlinux/irqdomain.hlinux/module.hlinux/of.hlinux/of_irq.hlinux/platform_device.hlinux/remoteproc/pruss.hlinux/pruss_driver.hlinux/remoteproc.hremoteproc_internal.hremoteproc_elf_helpers.hpru_rproc.h
Detected Declarations
struct pru_private_datastruct pru_rprocenum pru_iomemfunction pru_control_read_regfunction pru_control_write_regfunction pru_control_set_regfunction pru_rproc_set_firmwarefunction pru_rproc_getfunction pru_rproc_putfunction pru_rproc_set_ctablefunction pru_debug_read_regfunction regs_showfunction pru_rproc_debug_ss_setfunction pru_rproc_debug_ss_getfunction pru_rproc_create_debug_entriesfunction pru_dispose_irq_mappingfunction pru_handle_intrmapfunction pru_rproc_startfunction pru_rproc_stopfunction addressfunction addressfunction integerfunction pru_rproc_load_elf_segmentsfunction pru_rproc_find_interrupt_mapfunction segmentfunction pru_rproc_set_idfunction pru_rproc_probeexport pru_rproc_getexport pru_rproc_putexport pru_rproc_set_ctable
Annotated Snippet
struct pru_private_data {
enum pru_type type;
unsigned int is_k3 : 1;
};
/**
* struct pru_rproc - PRU remoteproc structure
* @id: id of the PRU core within the PRUSS
* @dev: PRU core device pointer
* @pruss: back-reference to parent PRUSS structure
* @rproc: remoteproc pointer for this PRU core
* @data: PRU core specific data
* @mem_regions: data for each of the PRU memory regions
* @client_np: client device node
* @lock: mutex to protect client usage
* @fw_name: name of firmware image used during loading
* @mapped_irq: virtual interrupt numbers of created fw specific mapping
* @pru_interrupt_map: pointer to interrupt mapping description (firmware)
* @pru_interrupt_map_sz: pru_interrupt_map size
* @rmw_lock: lock for read, modify, write operations on registers
* @dbg_single_step: debug state variable to set PRU into single step mode
* @dbg_continuous: debug state variable to restore PRU execution mode
* @evt_count: number of mapped events
* @gpmux_save: saved value for gpmux config
*/
struct pru_rproc {
int id;
struct device *dev;
struct pruss *pruss;
struct rproc *rproc;
const struct pru_private_data *data;
struct pruss_mem_region mem_regions[PRU_IOMEM_MAX];
struct device_node *client_np;
struct mutex lock;
const char *fw_name;
unsigned int *mapped_irq;
struct pru_irq_rsc *pru_interrupt_map;
size_t pru_interrupt_map_sz;
spinlock_t rmw_lock;
u32 dbg_single_step;
u32 dbg_continuous;
u8 evt_count;
u8 gpmux_save;
};
static inline u32 pru_control_read_reg(struct pru_rproc *pru, unsigned int reg)
{
return readl_relaxed(pru->mem_regions[PRU_IOMEM_CTRL].va + reg);
}
static inline
void pru_control_write_reg(struct pru_rproc *pru, unsigned int reg, u32 val)
{
writel_relaxed(val, pru->mem_regions[PRU_IOMEM_CTRL].va + reg);
}
static inline
void pru_control_set_reg(struct pru_rproc *pru, unsigned int reg,
u32 mask, u32 set)
{
u32 val;
unsigned long flags;
spin_lock_irqsave(&pru->rmw_lock, flags);
val = pru_control_read_reg(pru, reg);
val &= ~mask;
val |= (set & mask);
pru_control_write_reg(pru, reg, val);
spin_unlock_irqrestore(&pru->rmw_lock, flags);
}
/**
* pru_rproc_set_firmware() - set firmware for a PRU core
* @rproc: the rproc instance of the PRU
* @fw_name: the new firmware name, or NULL if default is desired
*
* Return: 0 on success, or errno in error case.
*/
static int pru_rproc_set_firmware(struct rproc *rproc, const char *fw_name)
{
struct pru_rproc *pru = rproc->priv;
if (!fw_name)
fw_name = pru->fw_name;
return rproc_set_firmware(rproc, fw_name);
}
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/debugfs.h`, `linux/irqdomain.h`, `linux/module.h`, `linux/of.h`, `linux/of_irq.h`, `linux/platform_device.h`, `linux/remoteproc/pruss.h`.
- Detected declarations: `struct pru_private_data`, `struct pru_rproc`, `enum pru_iomem`, `function pru_control_read_reg`, `function pru_control_write_reg`, `function pru_control_set_reg`, `function pru_rproc_set_firmware`, `function pru_rproc_get`, `function pru_rproc_put`, `function pru_rproc_set_ctable`.
- Atlas domain: Driver Families / drivers/remoteproc.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.