drivers/i3c/master/i3c-master-cdns.c
Source file repositories/reference/linux-study-clean/drivers/i3c/master/i3c-master-cdns.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/i3c/master/i3c-master-cdns.c- Extension
.c- Size
- 44902 bytes
- Lines
- 1636
- Domain
- Driver Families
- Bucket
- drivers/i3c
- 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.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- 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/bitops.hlinux/clk.hlinux/err.hlinux/errno.hlinux/i3c/master.hlinux/interrupt.hlinux/io.hlinux/iopoll.hlinux/ioport.hlinux/kernel.hlinux/list.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/slab.hlinux/spinlock.hlinux/workqueue.h../internals.h
Detected Declarations
struct cdns_i3c_master_capsstruct cdns_i3c_cmdstruct cdns_i3c_xferstruct cdns_i3c_datastruct cdns_i3c_masterstruct cdns_i3c_i2c_dev_datafunction to_cdns_i3c_masterfunction cdns_i3c_master_wr_to_tx_fifofunction cdns_i3c_master_rd_from_rx_fifofunction cdns_i3c_master_supports_ccc_cmdfunction cdns_i3c_master_disablefunction cdns_i3c_master_enablefunction cdns_i3c_master_alloc_xferfunction cdns_i3c_master_free_xferfunction cdns_i3c_master_start_xfer_lockedfunction cdns_i3c_master_end_xfer_lockedfunction cdns_i3c_master_queue_xferfunction cdns_i3c_master_unqueue_xferfunction cdns_i3c_cmd_get_errfunction cdns_i3c_master_send_ccc_cmdfunction cdns_i3c_master_i3c_xfersfunction cdns_i3c_master_i2c_xfersfunction prepare_rr0_dev_addressfunction cdns_i3c_master_upd_i3c_addrfunction cdns_i3c_master_get_rr_slotfunction for_each_set_bitfunction cdns_i3c_master_reattach_i3c_devfunction cdns_i3c_master_attach_i3c_devfunction cdns_i3c_master_detach_i3c_devfunction cdns_i3c_master_attach_i2c_devfunction cdns_i3c_master_detach_i2c_devfunction cdns_i3c_master_bus_cleanupfunction cdns_i3c_master_dev_rr_to_infofunction cdns_i3c_master_upd_i3c_scl_limfunction i3c_bus_for_each_i3cdevfunction cdns_i3c_master_do_daafunction cdns_i3c_master_calculate_thd_delayfunction cdns_i3c_master_bus_initfunction cdns_i3c_master_handle_ibifunction cnds_i3c_master_demux_ibisfunction cdns_i3c_master_interruptfunction cdns_i3c_master_disable_ibifunction cdns_i3c_master_enable_ibifunction cdns_i3c_master_request_ibifunction cdns_i3c_master_free_ibifunction cdns_i3c_master_recycle_ibi_slotfunction cdns_i3c_master_probefunction cdns_i3c_master_remove
Annotated Snippet
struct cdns_i3c_master_caps {
u32 cmdfifodepth;
u32 cmdrfifodepth;
u32 txfifodepth;
u32 rxfifodepth;
u32 ibirfifodepth;
};
struct cdns_i3c_cmd {
u32 cmd0;
u32 cmd1;
u32 tx_len;
const void *tx_buf;
u32 rx_len;
void *rx_buf;
u32 error;
};
struct cdns_i3c_xfer {
struct list_head node;
struct completion comp;
int ret;
unsigned int ncmds;
struct cdns_i3c_cmd cmds[] __counted_by(ncmds);
};
struct cdns_i3c_data {
u8 thd_delay_ns;
};
struct cdns_i3c_master {
struct i3c_master_controller base;
u32 free_rr_slots;
unsigned int maxdevs;
struct {
unsigned int num_slots;
struct i3c_dev_desc **slots;
spinlock_t lock;
} ibi;
struct {
struct list_head list;
struct cdns_i3c_xfer *cur;
spinlock_t lock;
} xferqueue;
void __iomem *regs;
struct clk *sysclk;
struct cdns_i3c_master_caps caps;
unsigned long i3c_scl_lim;
const struct cdns_i3c_data *devdata;
};
static inline struct cdns_i3c_master *
to_cdns_i3c_master(struct i3c_master_controller *master)
{
return container_of(master, struct cdns_i3c_master, base);
}
static void cdns_i3c_master_wr_to_tx_fifo(struct cdns_i3c_master *master,
const u8 *bytes, int nbytes)
{
i3c_writel_fifo(master->regs + TX_FIFO, bytes, nbytes);
}
static void cdns_i3c_master_rd_from_rx_fifo(struct cdns_i3c_master *master,
u8 *bytes, int nbytes)
{
i3c_readl_fifo(master->regs + RX_FIFO, bytes, nbytes);
}
static bool cdns_i3c_master_supports_ccc_cmd(struct i3c_master_controller *m,
const struct i3c_ccc_cmd *cmd)
{
if (cmd->ndests > 1)
return false;
switch (cmd->id) {
case I3C_CCC_ENEC(true):
case I3C_CCC_ENEC(false):
case I3C_CCC_DISEC(true):
case I3C_CCC_DISEC(false):
case I3C_CCC_ENTAS(0, true):
case I3C_CCC_ENTAS(0, false):
case I3C_CCC_RSTDAA(true):
case I3C_CCC_RSTDAA(false):
case I3C_CCC_ENTDAA:
case I3C_CCC_SETMWL(true):
case I3C_CCC_SETMWL(false):
case I3C_CCC_SETMRL(true):
case I3C_CCC_SETMRL(false):
case I3C_CCC_DEFSLVS:
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/clk.h`, `linux/err.h`, `linux/errno.h`, `linux/i3c/master.h`, `linux/interrupt.h`, `linux/io.h`, `linux/iopoll.h`.
- Detected declarations: `struct cdns_i3c_master_caps`, `struct cdns_i3c_cmd`, `struct cdns_i3c_xfer`, `struct cdns_i3c_data`, `struct cdns_i3c_master`, `struct cdns_i3c_i2c_dev_data`, `function to_cdns_i3c_master`, `function cdns_i3c_master_wr_to_tx_fifo`, `function cdns_i3c_master_rd_from_rx_fifo`, `function cdns_i3c_master_supports_ccc_cmd`.
- Atlas domain: Driver Families / drivers/i3c.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
- IRQ or DMA behavior appears here, which is relevant to the selected PCIe/NVMe device path.
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.