drivers/dma/arm-dma350.c
Source file repositories/reference/linux-study-clean/drivers/dma/arm-dma350.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/dma/arm-dma350.c- Extension
.c- Size
- 18322 bytes
- Lines
- 661
- Domain
- Driver Families
- Bucket
- drivers/dma
- 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/bitfield.hlinux/dmaengine.hlinux/dma-mapping.hlinux/io.hlinux/of.hlinux/module.hlinux/platform_device.hdmaengine.hvirt-dma.h
Detected Declarations
struct d350_descstruct d350_chanstruct d350enum ch_ctrl_donetypeenum ch_ctrl_xtypeenum ch_cfg_shareattrenum ch_cfg_memattrfunction d350_desc_freefunction d350_pausefunction d350_resumefunction d350_get_residuefunction d350_terminate_allfunction d350_synchronizefunction d350_desc_bytesfunction d350_tx_statusfunction d350_start_nextfunction d350_issue_pendingfunction d350_irqfunction d350_alloc_chan_resourcesfunction d350_free_chan_resourcesfunction d350_probefunction d350_remove
Annotated Snippet
struct d350_desc {
struct virt_dma_desc vd;
u32 command[16];
u16 xsize;
u16 xsizehi;
u8 tsz;
};
struct d350_chan {
struct virt_dma_chan vc;
struct d350_desc *desc;
void __iomem *base;
int irq;
enum dma_status status;
dma_cookie_t cookie;
u32 residue;
u8 tsz;
bool has_trig;
bool has_wrap;
bool coherent;
};
struct d350 {
struct dma_device dma;
int nchan;
int nreq;
struct d350_chan channels[] __counted_by(nchan);
};
static inline struct d350_chan *to_d350_chan(struct dma_chan *chan)
{
return container_of(chan, struct d350_chan, vc.chan);
}
static inline struct d350_desc *to_d350_desc(struct virt_dma_desc *vd)
{
return container_of(vd, struct d350_desc, vd);
}
static void d350_desc_free(struct virt_dma_desc *vd)
{
kfree(to_d350_desc(vd));
}
static struct dma_async_tx_descriptor *d350_prep_memcpy(struct dma_chan *chan,
dma_addr_t dest, dma_addr_t src, size_t len, unsigned long flags)
{
struct d350_chan *dch = to_d350_chan(chan);
struct d350_desc *desc;
u32 *cmd;
desc = kzalloc_obj(*desc, GFP_NOWAIT);
if (!desc)
return NULL;
desc->tsz = __ffs(len | dest | src | (1 << dch->tsz));
desc->xsize = lower_16_bits(len >> desc->tsz);
desc->xsizehi = upper_16_bits(len >> desc->tsz);
cmd = desc->command;
cmd[0] = LINK_CTRL | LINK_SRCADDR | LINK_SRCADDRHI | LINK_DESADDR |
LINK_DESADDRHI | LINK_XSIZE | LINK_XSIZEHI | LINK_SRCTRANSCFG |
LINK_DESTRANSCFG | LINK_XADDRINC | LINK_LINKADDR;
cmd[1] = FIELD_PREP(CH_CTRL_TRANSIZE, desc->tsz) |
FIELD_PREP(CH_CTRL_XTYPE, CH_CTRL_XTYPE_CONTINUE) |
FIELD_PREP(CH_CTRL_DONETYPE, CH_CTRL_DONETYPE_CMD);
cmd[2] = lower_32_bits(src);
cmd[3] = upper_32_bits(src);
cmd[4] = lower_32_bits(dest);
cmd[5] = upper_32_bits(dest);
cmd[6] = FIELD_PREP(CH_XY_SRC, desc->xsize) | FIELD_PREP(CH_XY_DES, desc->xsize);
cmd[7] = FIELD_PREP(CH_XY_SRC, desc->xsizehi) | FIELD_PREP(CH_XY_DES, desc->xsizehi);
cmd[8] = dch->coherent ? TRANSCFG_WB : TRANSCFG_NC;
cmd[9] = dch->coherent ? TRANSCFG_WB : TRANSCFG_NC;
cmd[10] = FIELD_PREP(CH_XY_SRC, 1) | FIELD_PREP(CH_XY_DES, 1);
cmd[11] = 0;
return vchan_tx_prep(&dch->vc, &desc->vd, flags);
}
static struct dma_async_tx_descriptor *d350_prep_memset(struct dma_chan *chan,
dma_addr_t dest, int value, size_t len, unsigned long flags)
{
struct d350_chan *dch = to_d350_chan(chan);
struct d350_desc *desc;
u32 *cmd;
desc = kzalloc_obj(*desc, GFP_NOWAIT);
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/dmaengine.h`, `linux/dma-mapping.h`, `linux/io.h`, `linux/of.h`, `linux/module.h`, `linux/platform_device.h`, `dmaengine.h`.
- Detected declarations: `struct d350_desc`, `struct d350_chan`, `struct d350`, `enum ch_ctrl_donetype`, `enum ch_ctrl_xtype`, `enum ch_cfg_shareattr`, `enum ch_cfg_memattr`, `function d350_desc_free`, `function d350_pause`, `function d350_resume`.
- Atlas domain: Driver Families / drivers/dma.
- 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.