drivers/dma/stm32/stm32-dma3.c
Source file repositories/reference/linux-study-clean/drivers/dma/stm32/stm32-dma3.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/dma/stm32/stm32-dma3.c- Extension
.c- Size
- 63148 bytes
- Lines
- 2034
- 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/clk.hlinux/dma-mapping.hlinux/dmaengine.hlinux/dmapool.hlinux/init.hlinux/iopoll.hlinux/list.hlinux/module.hlinux/of_dma.hlinux/platform_device.hlinux/pm_runtime.hlinux/reset.hlinux/slab.h../virt-dma.h
Detected Declarations
struct stm32_dma3_hwdescstruct stm32_dma3_llistruct stm32_dma3_swdescstruct stm32_dma3_dt_confstruct stm32_dma3_chanstruct stm32_dma3_pdatastruct stm32_dma3_ddataenum ccidcfgr_cidenum ccr_prioenum ctr1_dwenum ctr1_pamenum ctr2_tcemenum stm32_dma3_master_portsenum stm32_dma3_port_data_widthfunction stm32_dma3_chan_dump_regfunction stm32_dma3_chan_dump_hwdescfunction hwdescfunction stm32_dma3_chan_desc_freefunction stm32_dma3_chan_vdesc_freefunction stm32_dma3_check_user_settingfunction stm32_dma3_chan_prep_hwdescfunction stm32_dma3_get_max_dwfunction stm32_dma3_get_max_burstfunction stm32_dma3_chan_prep_hwfunction stm32_dma3_chan_startfunction stm32_dma3_chan_suspendfunction stm32_dma3_chan_resetfunction stm32_dma3_chan_get_curr_hwdescfunction stm32_dma3_chan_set_residuefunction stm32_dma3_chan_stopfunction stm32_dma3_chan_completefunction stm32_dma3_chan_irqfunction stm32_dma3_get_chan_semfunction stm32_dma3_put_chan_semfunction stm32_dma3_alloc_chan_resourcesfunction readl_relaxedfunction stm32_dma3_free_chan_resourcesfunction stm32_dma3_get_ll_countfunction stm32_dma3_init_chan_config_for_memcpyfunction stm32_dma3_capsfunction stm32_dma3_configfunction stm32_dma3_pausefunction stm32_dma3_resumefunction stm32_dma3_terminate_allfunction stm32_dma3_synchronizefunction stm32_dma3_tx_statusfunction stm32_dma3_issue_pendingfunction stm32_dma3_filter_fn
Annotated Snippet
struct stm32_dma3_hwdesc {
u32 ctr1;
u32 ctr2;
u32 cbr1;
u32 csar;
u32 cdar;
u32 cllr;
} __packed __aligned(32);
/*
* CLLR_LA / sizeof(struct stm32_dma3_hwdesc) represents the number of hdwdesc that can be addressed
* by the pointer to the next linked-list data structure. The __aligned forces the 32-byte
* alignment. So use hardcoded 32. Multiplied by the max block size of each item, it represents
* the sg size limitation.
*/
#define STM32_DMA3_MAX_SEG_SIZE ((CLLR_LA / 32) * STM32_DMA3_MAX_BLOCK_SIZE)
/*
* Linked-list items
*/
struct stm32_dma3_lli {
struct stm32_dma3_hwdesc *hwdesc;
dma_addr_t hwdesc_addr;
};
struct stm32_dma3_swdesc {
struct virt_dma_desc vdesc;
u32 ccr;
bool cyclic;
u32 lli_size;
struct stm32_dma3_lli lli[] __counted_by(lli_size);
};
struct stm32_dma3_dt_conf {
u32 ch_id;
u32 req_line;
u32 ch_conf;
u32 tr_conf;
};
struct stm32_dma3_chan {
struct virt_dma_chan vchan;
u32 id;
int irq;
u32 fifo_size;
u32 max_burst;
bool semaphore_mode;
bool semaphore_taken;
struct stm32_dma3_dt_conf dt_config;
struct dma_slave_config dma_config;
u8 config_set;
struct dma_pool *lli_pool;
struct stm32_dma3_swdesc *swdesc;
enum ctr2_tcem tcem;
u32 dma_status;
};
struct stm32_dma3_pdata {
u32 axi_max_burst_len;
};
struct stm32_dma3_ddata {
struct dma_device dma_dev;
void __iomem *base;
struct clk *clk;
struct stm32_dma3_chan *chans;
u32 dma_channels;
u32 dma_requests;
enum stm32_dma3_port_data_width ports_max_dw[2];
u32 axi_max_burst_len;
};
static inline struct stm32_dma3_ddata *to_stm32_dma3_ddata(struct stm32_dma3_chan *chan)
{
return container_of(chan->vchan.chan.device, struct stm32_dma3_ddata, dma_dev);
}
static inline struct stm32_dma3_chan *to_stm32_dma3_chan(struct dma_chan *c)
{
return container_of(c, struct stm32_dma3_chan, vchan.chan);
}
static inline struct stm32_dma3_swdesc *to_stm32_dma3_swdesc(struct virt_dma_desc *vdesc)
{
return container_of(vdesc, struct stm32_dma3_swdesc, vdesc);
}
static struct device *chan2dev(struct stm32_dma3_chan *chan)
{
return &chan->vchan.chan.dev->device;
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/clk.h`, `linux/dma-mapping.h`, `linux/dmaengine.h`, `linux/dmapool.h`, `linux/init.h`, `linux/iopoll.h`, `linux/list.h`.
- Detected declarations: `struct stm32_dma3_hwdesc`, `struct stm32_dma3_lli`, `struct stm32_dma3_swdesc`, `struct stm32_dma3_dt_conf`, `struct stm32_dma3_chan`, `struct stm32_dma3_pdata`, `struct stm32_dma3_ddata`, `enum ccidcfgr_cid`, `enum ccr_prio`, `enum ctr1_dw`.
- 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.