drivers/dma/tegra186-gpc-dma.c
Source file repositories/reference/linux-study-clean/drivers/dma/tegra186-gpc-dma.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/dma/tegra186-gpc-dma.c- Extension
.c- Size
- 44009 bytes
- Lines
- 1553
- 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/dmaengine.hlinux/dma-mapping.hlinux/interrupt.hlinux/iommu.hlinux/iopoll.hlinux/minmax.hlinux/module.hlinux/of.hlinux/of_dma.hlinux/platform_device.hlinux/reset.hlinux/slab.hdt-bindings/memory/tegra186-mc.hvirt-dma.h
Detected Declarations
struct tegra_dmastruct tegra_dma_channelstruct tegra_dma_chip_datastruct tegra_dma_channel_regsstruct tegra_dma_sg_reqstruct tegra_dma_descstruct tegra_dma_channelstruct tegra_dmafunction tdc_writefunction tdc_readfunction tegra_dma_dump_chan_regsfunction tegra_dma_sid_reservefunction tegra_dma_sid_freefunction tegra_dma_desc_freefunction tegra_dma_slave_configfunction tegra_dma_pausefunction tegra_dma_device_pausefunction tegra_dma_resumefunction tegra_dma_device_resumefunction tegra_dma_pause_noerrfunction tegra_dma_disablefunction tegra_dma_configure_next_sgfunction tegra_dma_startfunction tegra_dma_xfer_completefunction tegra_dma_chan_decode_errorfunction tegra_dma_isrfunction tegra_dma_issue_pendingfunction tegra_dma_stop_clientfunction tegra_dma_terminate_allfunction tegra_dma_get_residualfunction tegra_dma_tx_statusfunction get_bus_widthfunction get_burst_sizefunction get_transfer_paramfunction tegra_dma_prep_dma_memsetfunction tegra_dma_prep_dma_memcpyfunction tegra_dma_prep_slave_sgfunction tegra_dma_prep_dma_cyclicfunction tegra_dma_alloc_chan_resourcesfunction tegra_dma_chan_synchronizefunction tegra_dma_free_chan_resourcesfunction tegra_dma_program_sidfunction tegra_dma_probefunction tegra_dma_removefunction tegra_dma_pm_suspendfunction tegra_dma_pm_resume
Annotated Snippet
struct tegra_dma_chip_data {
bool hw_support_pause;
unsigned int nr_channels;
unsigned int channel_reg_size;
unsigned int max_dma_count;
int (*terminate)(struct tegra_dma_channel *tdc);
};
/* DMA channel registers */
struct tegra_dma_channel_regs {
u32 csr;
u32 src_ptr;
u32 dst_ptr;
u32 high_addr_ptr;
u32 mc_seq;
u32 mmio_seq;
u32 wcount;
u32 fixed_pattern;
};
/*
* tegra_dma_sg_req: DMA request details to configure hardware. This
* contains the details for one transfer to configure DMA hw.
* The client's request for data transfer can be broken into multiple
* sub-transfer as per requester details and hw support. This sub transfer
* get added as an array in Tegra DMA desc which manages the transfer details.
*/
struct tegra_dma_sg_req {
unsigned int len;
struct tegra_dma_channel_regs ch_regs;
};
/*
* tegra_dma_desc: Tegra DMA descriptors which uses virt_dma_desc to
* manage client request and keep track of transfer status, callbacks
* and request counts etc.
*/
struct tegra_dma_desc {
bool cyclic;
unsigned int bytes_req;
unsigned int bytes_xfer;
unsigned int sg_idx;
unsigned int sg_count;
struct virt_dma_desc vd;
struct tegra_dma_channel *tdc;
struct tegra_dma_sg_req sg_req[] __counted_by(sg_count);
};
/*
* tegra_dma_channel: Channel specific information
*/
struct tegra_dma_channel {
bool config_init;
char name[30];
enum dma_transfer_direction sid_dir;
enum dma_status status;
int id;
int irq;
int slave_id;
struct tegra_dma *tdma;
struct virt_dma_chan vc;
struct tegra_dma_desc *dma_desc;
struct dma_slave_config dma_sconfig;
unsigned int stream_id;
unsigned long chan_base_offset;
};
/*
* tegra_dma: Tegra DMA specific information
*/
struct tegra_dma {
const struct tegra_dma_chip_data *chip_data;
unsigned long sid_m2d_reserved;
unsigned long sid_d2m_reserved;
u32 chan_mask;
void __iomem *base_addr;
struct device *dev;
struct dma_device dma_dev;
struct reset_control *rst;
struct tegra_dma_channel channels[];
};
static inline void tdc_write(struct tegra_dma_channel *tdc,
u32 reg, u32 val)
{
writel_relaxed(val, tdc->tdma->base_addr + tdc->chan_base_offset + reg);
}
static inline u32 tdc_read(struct tegra_dma_channel *tdc, u32 reg)
{
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/dmaengine.h`, `linux/dma-mapping.h`, `linux/interrupt.h`, `linux/iommu.h`, `linux/iopoll.h`, `linux/minmax.h`, `linux/module.h`.
- Detected declarations: `struct tegra_dma`, `struct tegra_dma_channel`, `struct tegra_dma_chip_data`, `struct tegra_dma_channel_regs`, `struct tegra_dma_sg_req`, `struct tegra_dma_desc`, `struct tegra_dma_channel`, `struct tegra_dma`, `function tdc_write`, `function tdc_read`.
- 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.