drivers/remoteproc/imx_rproc.c

Source file repositories/reference/linux-study-clean/drivers/remoteproc/imx_rproc.c

File Facts

System
Linux kernel
Corpus path
drivers/remoteproc/imx_rproc.c
Extension
.c
Size
43642 bytes
Lines
1587
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.

Dependency Surface

Detected Declarations

Annotated Snippet

struct imx_rproc_mem {
	void __iomem *cpu_addr;
	phys_addr_t sys_addr;
	size_t size;
};

/* att flags: lower 16 bits specifying core, higher 16 bits for flags  */
/* M4 own area. Can be mapped at probe */
#define ATT_OWN         BIT(31)
#define ATT_IOMEM       BIT(30)

#define ATT_CORE_MASK   0xffff
#define ATT_CORE(I)     BIT((I))

/* Linux has permission to handle the Logical Machine of remote cores */
#define IMX_RPROC_FLAGS_SM_LMM_CTRL	BIT(0)

static int imx_rproc_xtr_mbox_init(struct rproc *rproc, bool tx_block);
static void imx_rproc_free_mbox(void *data);

/* Forward declarations for platform operations */
static const struct imx_rproc_plat_ops imx_rproc_ops_sm_lmm;
static const struct imx_rproc_plat_ops imx_rproc_ops_sm_cpu;

struct imx_rproc {
	struct device			*dev;
	struct regmap			*regmap;
	struct regmap			*gpr;
	struct rproc			*rproc;
	const struct imx_rproc_dcfg	*dcfg;
	struct imx_rproc_mem		mem[IMX_RPROC_MEM_MAX];
	struct clk			*clk;
	struct mbox_client		cl;
	struct mbox_chan		*tx_ch;
	struct mbox_chan		*rx_ch;
	struct work_struct		rproc_work;
	struct workqueue_struct		*workqueue;
	void __iomem			*rsc_table;
	struct imx_sc_ipc		*ipc_handle;
	struct notifier_block		rproc_nb;
	u32				rproc_pt;	/* partition id */
	u32				rsrc_id;	/* resource id */
	u32				entry;		/* cpu start address */
	u32				core_index;
	struct dev_pm_domain_list	*pd_list;
	const struct imx_rproc_plat_ops	*ops;
	/*
	 * For i.MX System Manager based systems
	 * BIT 0: IMX_RPROC_FLAGS_SM_LMM_CTRL(RPROC LM is under Linux control )
	 */
	u32				flags;
};

static const struct imx_rproc_att imx_rproc_att_imx95_m7[] = {
	/* dev addr , sys addr  , size	    , flags */
	/* TCM CODE NON-SECURE */
	{ 0x00000000, 0x203C0000, 0x00040000, ATT_OWN | ATT_IOMEM },

	/* TCM SYS NON-SECURE*/
	{ 0x20000000, 0x20400000, 0x00040000, ATT_OWN | ATT_IOMEM },

	/* DDR */
	{ 0x80000000, 0x80000000, 0x50000000, 0 },
};

static const struct imx_rproc_att imx_rproc_att_imx94_m70[] = {
	/* dev addr , sys addr  , size	    , flags */
	/* TCM CODE NON-SECURE */
	{ 0x00000000, 0x203C0000, 0x00040000, ATT_OWN | ATT_IOMEM },
	/* TCM SYS NON-SECURE*/
	{ 0x20000000, 0x20400000, 0x00040000, ATT_OWN | ATT_IOMEM },

	/* DDR */
	{ 0x80000000, 0x80000000, 0x10000000, 0 },
};

static const struct imx_rproc_att imx_rproc_att_imx94_m71[] = {
	/* dev addr , sys addr  , size	    , flags */
	/* TCM CODE NON-SECURE */
	{ 0x00000000, 0x202C0000, 0x00040000, ATT_OWN | ATT_IOMEM },
	/* TCM SYS NON-SECURE*/
	{ 0x20000000, 0x20300000, 0x00040000, ATT_OWN | ATT_IOMEM },

	/* DDR */
	{ 0x80000000, 0x80000000, 0x10000000, 0 },
};

static const struct imx_rproc_att imx_rproc_att_imx94_m33s[] = {
	/* dev addr , sys addr  , size	    , flags */
	/* TCM CODE NON-SECURE */

Annotation

Implementation Notes