drivers/dma/ep93xx_dma.c
Source file repositories/reference/linux-study-clean/drivers/dma/ep93xx_dma.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/dma/ep93xx_dma.c- Extension
.c- Size
- 43889 bytes
- Lines
- 1609
- 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/clk.hlinux/init.hlinux/interrupt.hlinux/dma-mapping.hlinux/dmaengine.hlinux/module.hlinux/mod_devicetable.hlinux/of_dma.hlinux/overflow.hlinux/platform_device.hlinux/slab.hdmaengine.h
Detected Declarations
struct ep93xx_dma_enginestruct ep93xx_dma_descstruct ep93xx_dma_chan_cfgstruct ep93xx_dma_chanstruct ep93xx_dma_enginestruct ep93xx_edma_dataenum ep93xx_dma_typefunction ep93xx_dma_chan_is_m2pfunction ep93xx_dma_chan_directionfunction ep93xx_dma_set_activefunction ep93xx_dma_get_activefunction ep93xx_dma_advance_activefunction m2p_set_controlfunction m2p_hw_setupfunction m2p_channel_statefunction m2p_hw_synchronizefunction m2p_hw_shutdownfunction m2p_fill_descfunction m2p_hw_submitfunction m2p_hw_interruptfunction m2m_hw_setupfunction m2m_hw_shutdownfunction m2m_fill_descfunction m2m_hw_submitfunction runningfunction ep93xx_dma_desc_getfunction ep93xx_dma_desc_putfunction ep93xx_dma_advance_workfunction ep93xx_dma_taskletfunction ep93xx_dma_interruptfunction ep93xx_dma_tx_submitfunction ep93xx_dma_alloc_chan_resourcesfunction ep93xx_dma_free_chan_resourcesfunction ep93xx_dma_prep_dma_memcpyfunction ep93xx_dma_prep_slave_sgfunction dmaengine_terminate_allfunction ep93xx_dma_synchronizefunction ep93xx_dma_terminate_allfunction ep93xx_dma_slave_configfunction ep93xx_dma_slave_config_writefunction ep93xx_dma_tx_statusfunction ep93xx_dma_issue_pendingfunction ep93xx_m2p_dma_filterfunction ep93xx_m2m_dma_filterfunction ep93xx_dma_probe
Annotated Snippet
struct ep93xx_dma_desc {
u32 src_addr;
u32 dst_addr;
size_t size;
bool complete;
struct dma_async_tx_descriptor txd;
struct list_head tx_list;
struct list_head node;
};
struct ep93xx_dma_chan_cfg {
u8 port;
enum dma_transfer_direction dir;
};
/**
* struct ep93xx_dma_chan - an EP93xx DMA M2P/M2M channel
* @chan: dmaengine API channel
* @edma: pointer to the engine device
* @regs: memory mapped registers
* @dma_cfg: channel number, direction
* @irq: interrupt number of the channel
* @clk: clock used by this channel
* @tasklet: channel specific tasklet used for callbacks
* @lock: lock protecting the fields following
* @flags: flags for the channel
* @buffer: which buffer to use next (0/1)
* @active: flattened chain of descriptors currently being processed
* @queue: pending descriptors which are handled next
* @free_list: list of free descriptors which can be used
* @runtime_addr: physical address currently used as dest/src (M2M only). This
* is set via .device_config before slave operation is
* prepared
* @runtime_ctrl: M2M runtime values for the control register.
* @slave_config: slave configuration
*
* As EP93xx DMA controller doesn't support real chained DMA descriptors we
* will have slightly different scheme here: @active points to a head of
* flattened DMA descriptor chain.
*
* @queue holds pending transactions. These are linked through the first
* descriptor in the chain. When a descriptor is moved to the @active queue,
* the first and chained descriptors are flattened into a single list.
*
*/
struct ep93xx_dma_chan {
struct dma_chan chan;
const struct ep93xx_dma_engine *edma;
void __iomem *regs;
struct ep93xx_dma_chan_cfg dma_cfg;
int irq;
struct clk *clk;
struct tasklet_struct tasklet;
/* protects the fields following */
spinlock_t lock;
unsigned long flags;
/* Channel is configured for cyclic transfers */
#define EP93XX_DMA_IS_CYCLIC 0
int buffer;
struct list_head active;
struct list_head queue;
struct list_head free_list;
u32 runtime_addr;
u32 runtime_ctrl;
struct dma_slave_config slave_config;
};
/**
* struct ep93xx_dma_engine - the EP93xx DMA engine instance
* @dma_dev: holds the dmaengine device
* @m2m: is this an M2M or M2P device
* @hw_setup: method which sets the channel up for operation
* @hw_synchronize: synchronizes DMA channel termination to current context
* @hw_shutdown: shuts the channel down and flushes whatever is left
* @hw_submit: pushes active descriptor(s) to the hardware
* @hw_interrupt: handle the interrupt
* @num_channels: number of channels for this instance
* @channels: array of channels
*
* There is one instance of this struct for the M2P channels and one for the
* M2M channels. hw_xxx() methods are used to perform operations which are
* different on M2M and M2P channels. These methods are called with channel
* lock held and interrupts disabled so they cannot sleep.
*/
struct ep93xx_dma_engine {
struct dma_device dma_dev;
bool m2m;
int (*hw_setup)(struct ep93xx_dma_chan *);
void (*hw_synchronize)(struct ep93xx_dma_chan *);
Annotation
- Immediate include surface: `linux/clk.h`, `linux/init.h`, `linux/interrupt.h`, `linux/dma-mapping.h`, `linux/dmaengine.h`, `linux/module.h`, `linux/mod_devicetable.h`, `linux/of_dma.h`.
- Detected declarations: `struct ep93xx_dma_engine`, `struct ep93xx_dma_desc`, `struct ep93xx_dma_chan_cfg`, `struct ep93xx_dma_chan`, `struct ep93xx_dma_engine`, `struct ep93xx_edma_data`, `enum ep93xx_dma_type`, `function ep93xx_dma_chan_is_m2p`, `function ep93xx_dma_chan_direction`, `function ep93xx_dma_set_active`.
- 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.