drivers/dma/mxs-dma.c
Source file repositories/reference/linux-study-clean/drivers/dma/mxs-dma.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/dma/mxs-dma.c- Extension
.c- Size
- 22842 bytes
- Lines
- 842
- 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.
- 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/init.hlinux/types.hlinux/mm.hlinux/interrupt.hlinux/clk.hlinux/wait.hlinux/sched.hlinux/semaphore.hlinux/device.hlinux/dma-mapping.hlinux/slab.hlinux/platform_device.hlinux/dmaengine.hlinux/delay.hlinux/module.hlinux/stmp_device.hlinux/of.hlinux/of_dma.hlinux/list.hlinux/dma/mxs-dma.hasm/irq.hdmaengine.h
Detected Declarations
struct mxs_dma_ccwstruct mxs_dma_chanstruct mxs_dma_enginestruct mxs_dma_typestruct mxs_dma_filter_paramenum mxs_dma_devtypeenum mxs_dma_idfunction mxs_dma_reset_chanfunction READ_FLUSHfunction mxs_dma_enable_chanfunction mxs_dma_disable_chanfunction mxs_dma_pause_chanfunction mxs_dma_resume_chanfunction mxs_dma_tx_submitfunction mxs_dma_taskletfunction mxs_dma_irq_to_chanfunction mxs_dma_int_handlerfunction mxs_dma_alloc_chan_resourcesfunction mxs_dma_free_chan_resourcesfunction for_each_sgfunction mxs_dma_terminate_allfunction mxs_dma_tx_statusfunction mxs_dma_initfunction mxs_dma_filter_fnfunction mxs_dma_probe
Annotated Snippet
struct mxs_dma_ccw {
u32 next;
u16 bits;
u16 xfer_bytes;
#define MAX_XFER_BYTES 0xff00
u32 bufaddr;
#define MXS_PIO_WORDS 16
u32 pio_words[MXS_PIO_WORDS];
};
#define CCW_BLOCK_SIZE (4 * PAGE_SIZE)
#define NUM_CCW (int)(CCW_BLOCK_SIZE / sizeof(struct mxs_dma_ccw))
struct mxs_dma_chan {
struct mxs_dma_engine *mxs_dma;
struct dma_chan chan;
struct dma_async_tx_descriptor desc;
struct tasklet_struct tasklet;
unsigned int chan_irq;
struct mxs_dma_ccw *ccw;
dma_addr_t ccw_phys;
int desc_count;
enum dma_status status;
unsigned int flags;
bool reset;
#define MXS_DMA_SG_LOOP (1 << 0)
#define MXS_DMA_USE_SEMAPHORE (1 << 1)
};
#define MXS_DMA_CHANNELS 16
#define MXS_DMA_CHANNELS_MASK 0xffff
enum mxs_dma_devtype {
MXS_DMA_APBH,
MXS_DMA_APBX,
};
enum mxs_dma_id {
IMX23_DMA,
IMX28_DMA,
};
struct mxs_dma_engine {
enum mxs_dma_id dev_id;
enum mxs_dma_devtype type;
void __iomem *base;
struct clk *clk;
struct dma_device dma_device;
struct mxs_dma_chan mxs_chans[MXS_DMA_CHANNELS];
struct platform_device *pdev;
unsigned int nr_channels;
};
struct mxs_dma_type {
enum mxs_dma_id id;
enum mxs_dma_devtype type;
};
static struct mxs_dma_type mxs_dma_types[] = {
{
.id = IMX23_DMA,
.type = MXS_DMA_APBH,
}, {
.id = IMX23_DMA,
.type = MXS_DMA_APBX,
}, {
.id = IMX28_DMA,
.type = MXS_DMA_APBH,
}, {
.id = IMX28_DMA,
.type = MXS_DMA_APBX,
}
};
static const struct of_device_id mxs_dma_dt_ids[] = {
{ .compatible = "fsl,imx23-dma-apbh", .data = &mxs_dma_types[0], },
{ .compatible = "fsl,imx23-dma-apbx", .data = &mxs_dma_types[1], },
{ .compatible = "fsl,imx28-dma-apbh", .data = &mxs_dma_types[2], },
{ .compatible = "fsl,imx28-dma-apbx", .data = &mxs_dma_types[3], },
{ /* sentinel */ }
};
MODULE_DEVICE_TABLE(of, mxs_dma_dt_ids);
static struct mxs_dma_chan *to_mxs_dma_chan(struct dma_chan *chan)
{
return container_of(chan, struct mxs_dma_chan, chan);
}
static void mxs_dma_reset_chan(struct dma_chan *chan)
{
Annotation
- Immediate include surface: `linux/init.h`, `linux/types.h`, `linux/mm.h`, `linux/interrupt.h`, `linux/clk.h`, `linux/wait.h`, `linux/sched.h`, `linux/semaphore.h`.
- Detected declarations: `struct mxs_dma_ccw`, `struct mxs_dma_chan`, `struct mxs_dma_engine`, `struct mxs_dma_type`, `struct mxs_dma_filter_param`, `enum mxs_dma_devtype`, `enum mxs_dma_id`, `function mxs_dma_reset_chan`, `function READ_FLUSH`, `function mxs_dma_enable_chan`.
- Atlas domain: Driver Families / drivers/dma.
- Implementation status: source implementation candidate.
- 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.