drivers/dma/bcm2835-dma.c
Source file repositories/reference/linux-study-clean/drivers/dma/bcm2835-dma.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/dma/bcm2835-dma.c- Extension
.c- Size
- 29028 bytes
- Lines
- 1049
- 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/dmaengine.hlinux/dma-mapping.hlinux/dmapool.hlinux/err.hlinux/init.hlinux/interrupt.hlinux/list.hlinux/module.hlinux/platform_device.hlinux/slab.hlinux/io.hlinux/spinlock.hlinux/of.hlinux/of_dma.hvirt-dma.h
Detected Declarations
struct bcm2835_dmadevstruct bcm2835_dma_cbstruct bcm2835_cb_entrystruct bcm2835_chanstruct bcm2835_descfunction bcm2835_dma_max_frame_lengthfunction bcm2835_dma_frames_for_lengthfunction bcm2835_dma_free_cb_chainfunction bcm2835_dma_desc_freefunction bcm2835_dma_create_cb_set_lengthfunction bcm2835_dma_fill_cb_chain_with_sgfunction bcm2835_dma_abortfunction bcm2835_dma_start_descfunction bcm2835_dma_callbackfunction bcm2835_dma_alloc_chan_resourcesfunction bcm2835_dma_free_chan_resourcesfunction bcm2835_dma_desc_sizefunction bcm2835_dma_desc_size_posfunction bcm2835_dma_tx_statusfunction bcm2835_dma_issue_pendingfunction bcm2835_dma_slave_configfunction bcm2835_dma_terminate_allfunction bcm2835_dma_synchronizefunction bcm2835_dma_chan_initfunction bcm2835_dma_freefunction list_for_each_entry_safefunction bcm2835_dma_suspend_latefunction list_for_each_entry_safefunction bcm2835_dma_probefunction bcm2835_dma_remove
Annotated Snippet
struct bcm2835_dmadev {
struct dma_device ddev;
void __iomem *base;
dma_addr_t zero_page;
};
struct bcm2835_dma_cb {
uint32_t info;
uint32_t src;
uint32_t dst;
uint32_t length;
uint32_t stride;
uint32_t next;
uint32_t pad[2];
};
struct bcm2835_cb_entry {
struct bcm2835_dma_cb *cb;
dma_addr_t paddr;
};
struct bcm2835_chan {
struct virt_dma_chan vc;
struct dma_slave_config cfg;
unsigned int dreq;
int ch;
struct bcm2835_desc *desc;
struct dma_pool *cb_pool;
void __iomem *chan_base;
int irq_number;
unsigned int irq_flags;
bool is_lite_channel;
};
struct bcm2835_desc {
struct bcm2835_chan *c;
struct virt_dma_desc vd;
enum dma_transfer_direction dir;
unsigned int frames;
size_t size;
bool cyclic;
struct bcm2835_cb_entry cb_list[];
};
#define BCM2835_DMA_CS 0x00
#define BCM2835_DMA_ADDR 0x04
#define BCM2835_DMA_TI 0x08
#define BCM2835_DMA_SOURCE_AD 0x0c
#define BCM2835_DMA_DEST_AD 0x10
#define BCM2835_DMA_LEN 0x14
#define BCM2835_DMA_STRIDE 0x18
#define BCM2835_DMA_NEXTCB 0x1c
#define BCM2835_DMA_DEBUG 0x20
/* DMA CS Control and Status bits */
#define BCM2835_DMA_ACTIVE BIT(0) /* activate the DMA */
#define BCM2835_DMA_END BIT(1) /* current CB has ended */
#define BCM2835_DMA_INT BIT(2) /* interrupt status */
#define BCM2835_DMA_DREQ BIT(3) /* DREQ state */
#define BCM2835_DMA_ISPAUSED BIT(4) /* Pause requested or not active */
#define BCM2835_DMA_ISHELD BIT(5) /* Is held by DREQ flow control */
#define BCM2835_DMA_WAITING_FOR_WRITES BIT(6) /* waiting for last
* AXI-write to ack
*/
#define BCM2835_DMA_ERR BIT(8)
#define BCM2835_DMA_PRIORITY(x) ((x & 15) << 16) /* AXI priority */
#define BCM2835_DMA_PANIC_PRIORITY(x) ((x & 15) << 20) /* panic priority */
/* current value of TI.BCM2835_DMA_WAIT_RESP */
#define BCM2835_DMA_WAIT_FOR_WRITES BIT(28)
#define BCM2835_DMA_DIS_DEBUG BIT(29) /* disable debug pause signal */
#define BCM2835_DMA_ABORT BIT(30) /* Stop current CB, go to next, WO */
#define BCM2835_DMA_RESET BIT(31) /* WO, self clearing */
/* Transfer information bits - also bcm2835_cb.info field */
#define BCM2835_DMA_INT_EN BIT(0)
#define BCM2835_DMA_TDMODE BIT(1) /* 2D-Mode */
#define BCM2835_DMA_WAIT_RESP BIT(3) /* wait for AXI-write to be acked */
#define BCM2835_DMA_D_INC BIT(4)
#define BCM2835_DMA_D_WIDTH BIT(5) /* 128bit writes if set */
#define BCM2835_DMA_D_DREQ BIT(6) /* enable DREQ for destination */
#define BCM2835_DMA_D_IGNORE BIT(7) /* ignore destination writes */
#define BCM2835_DMA_S_INC BIT(8)
#define BCM2835_DMA_S_WIDTH BIT(9) /* 128bit writes if set */
Annotation
- Immediate include surface: `linux/dmaengine.h`, `linux/dma-mapping.h`, `linux/dmapool.h`, `linux/err.h`, `linux/init.h`, `linux/interrupt.h`, `linux/list.h`, `linux/module.h`.
- Detected declarations: `struct bcm2835_dmadev`, `struct bcm2835_dma_cb`, `struct bcm2835_cb_entry`, `struct bcm2835_chan`, `struct bcm2835_desc`, `function bcm2835_dma_max_frame_length`, `function bcm2835_dma_frames_for_length`, `function bcm2835_dma_free_cb_chain`, `function bcm2835_dma_desc_free`, `function bcm2835_dma_create_cb_set_length`.
- 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.