drivers/dma/mmp_pdma.c
Source file repositories/reference/linux-study-clean/drivers/dma/mmp_pdma.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/dma/mmp_pdma.c- Extension
.c- Size
- 36897 bytes
- Lines
- 1369
- 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/err.hlinux/module.hlinux/init.hlinux/types.hlinux/interrupt.hlinux/dma-mapping.hlinux/slab.hlinux/dmaengine.hlinux/platform_device.hlinux/device.hlinux/platform_data/mmp_dma.hlinux/dmapool.hlinux/clk.hlinux/reset.hlinux/of_dma.hlinux/of.hdmaengine.h
Detected Declarations
struct mmp_pdma_desc_hwstruct mmp_pdma_desc_swstruct mmp_pdma_phystruct mmp_pdma_chanstruct mmp_pdma_phystruct mmp_pdma_opsstruct mmp_pdma_devicefunction write_next_addr_32function read_src_addr_32function read_dst_addr_32function set_desc_next_addr_32function set_desc_src_addr_32function set_desc_dst_addr_32function get_desc_src_addr_32function get_desc_dst_addr_32function write_next_addr_64function read_src_addr_64function read_dst_addr_64function set_desc_next_addr_64function set_desc_src_addr_64function set_desc_dst_addr_64function get_desc_src_addr_64function get_desc_dst_addr_64function enable_chanfunction disable_chanfunction clear_chan_irqfunction mmp_pdma_chan_handlerfunction mmp_pdma_int_handlerfunction mmp_pdma_free_phyfunction start_pending_queuefunction mmp_pdma_tx_submitfunction list_for_each_entryfunction mmp_pdma_alloc_descriptorfunction mmp_pdma_alloc_chan_resourcesfunction mmp_pdma_free_desc_listfunction list_for_each_entry_safefunction mmp_pdma_free_chan_resourcesfunction mmp_pdma_prep_memcpyfunction mmp_pdma_prep_slave_sgfunction for_each_sgfunction mmp_pdma_prep_dma_cyclicfunction mmp_pdma_config_writefunction mmp_pdma_configfunction mmp_pdma_terminate_allfunction mmp_pdma_residuefunction list_for_each_entryfunction mmp_pdma_tx_statusfunction mmp_pdma_issue_pending
Annotated Snippet
struct mmp_pdma_desc_hw {
u32 ddadr; /* Points to the next descriptor + flags */
u32 dsadr; /* DSADR value for the current transfer */
u32 dtadr; /* DTADR value for the current transfer */
u32 dcmd; /* DCMD value for the current transfer */
/*
* The following 32-bit words are only used in the 64-bit, ie.
* LPAE (Long Physical Address Extension) mode.
* They are used to specify the high 32 bits of the descriptor's
* addresses.
*/
u32 ddadrh; /* High 32-bit of DDADR */
u32 dsadrh; /* High 32-bit of DSADR */
u32 dtadrh; /* High 32-bit of DTADR */
u32 rsvd; /* reserved */
} __aligned(32);
struct mmp_pdma_desc_sw {
struct mmp_pdma_desc_hw desc;
struct list_head node;
struct list_head tx_list;
struct dma_async_tx_descriptor async_tx;
};
struct mmp_pdma_phy;
struct mmp_pdma_chan {
struct device *dev;
struct dma_chan chan;
struct dma_async_tx_descriptor desc;
struct mmp_pdma_phy *phy;
enum dma_transfer_direction dir;
struct dma_slave_config slave_config;
struct mmp_pdma_desc_sw *cyclic_first; /* first desc_sw if channel
* is in cyclic mode */
/* channel's basic info */
struct tasklet_struct tasklet;
u32 dcmd;
u32 drcmr;
u32 dev_addr;
/* list for desc */
spinlock_t desc_lock; /* Descriptor list lock */
struct list_head chain_pending; /* Link descriptors queue for pending */
struct list_head chain_running; /* Link descriptors queue for running */
bool idle; /* channel statue machine */
bool byte_align;
struct dma_pool *desc_pool; /* Descriptors pool */
};
struct mmp_pdma_phy {
int idx;
void __iomem *base;
struct mmp_pdma_chan *vchan;
};
/**
* struct mmp_pdma_ops - Operations for the MMP PDMA controller
*
* Hardware Register Operations (read/write hardware registers):
* @write_next_addr: Function to program address of next descriptor into
* DDADR/DDADRH
* @read_src_addr: Function to read the source address from DSADR/DSADRH
* @read_dst_addr: Function to read the destination address from DTADR/DTADRH
*
* Descriptor Memory Operations (manipulate descriptor structs in memory):
* @set_desc_next_addr: Function to set next descriptor address in descriptor
* @set_desc_src_addr: Function to set the source address in descriptor
* @set_desc_dst_addr: Function to set the destination address in descriptor
* @get_desc_src_addr: Function to get the source address from descriptor
* @get_desc_dst_addr: Function to get the destination address from descriptor
*
* Controller Configuration:
* @run_bits: Control bits in DCSR register for channel start/stop
* @dma_width: DMA addressing width in bits (32 or 64). Determines the
* DMA mask capability of the controller hardware.
*/
struct mmp_pdma_ops {
/* Hardware Register Operations */
void (*write_next_addr)(struct mmp_pdma_phy *phy, dma_addr_t addr);
u64 (*read_src_addr)(struct mmp_pdma_phy *phy);
u64 (*read_dst_addr)(struct mmp_pdma_phy *phy);
/* Descriptor Memory Operations */
void (*set_desc_next_addr)(struct mmp_pdma_desc_hw *desc,
dma_addr_t addr);
void (*set_desc_src_addr)(struct mmp_pdma_desc_hw *desc,
Annotation
- Immediate include surface: `linux/err.h`, `linux/module.h`, `linux/init.h`, `linux/types.h`, `linux/interrupt.h`, `linux/dma-mapping.h`, `linux/slab.h`, `linux/dmaengine.h`.
- Detected declarations: `struct mmp_pdma_desc_hw`, `struct mmp_pdma_desc_sw`, `struct mmp_pdma_phy`, `struct mmp_pdma_chan`, `struct mmp_pdma_phy`, `struct mmp_pdma_ops`, `struct mmp_pdma_device`, `function write_next_addr_32`, `function read_src_addr_32`, `function read_dst_addr_32`.
- 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.