drivers/soc/ti/knav_dma.c
Source file repositories/reference/linux-study-clean/drivers/soc/ti/knav_dma.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/soc/ti/knav_dma.c- Extension
.c- Size
- 20026 bytes
- Lines
- 785
- Domain
- Driver Families
- Bucket
- drivers/soc
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- 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/io.hlinux/sched.hlinux/module.hlinux/dma-direction.hlinux/interrupt.hlinux/pm_runtime.hlinux/of_dma.hlinux/of_address.hlinux/platform_device.hlinux/soc/ti/knav_dma.hlinux/debugfs.hlinux/seq_file.h
Detected Declarations
struct reg_globalstruct reg_chanstruct reg_tx_schedstruct reg_rx_flowstruct knav_dma_pool_devicestruct knav_dma_devicestruct knav_dma_chanfunction knav_dma_device_readyfunction check_configfunction chan_startfunction chan_teardownfunction chan_stopfunction dma_hw_enable_allfunction knav_dma_hw_initfunction knav_dma_hw_destroyfunction dma_debug_show_channelsfunction dma_debug_show_devicesfunction list_for_each_entryfunction knav_dma_debug_showfunction list_for_each_entryfunction of_channel_match_helperfunction knav_dma_open_channelfunction knav_dma_close_channelfunction pktdma_init_rx_chanfunction pktdma_init_tx_chanfunction pktdma_init_chanfunction dma_initfunction knav_dma_probefunction knav_dma_removefunction list_for_each_entryexport knav_dma_device_readyexport knav_dma_open_channelexport knav_dma_close_channel
Annotated Snippet
struct reg_global {
u32 revision;
u32 perf_control;
u32 emulation_control;
u32 priority_control;
u32 qm_base_address[DMA_MAX_QMS];
};
struct reg_chan {
u32 control;
u32 mode;
u32 __rsvd[6];
};
struct reg_tx_sched {
u32 prio;
};
struct reg_rx_flow {
u32 control;
u32 tags;
u32 tag_sel;
u32 fdq_sel[2];
u32 thresh[3];
};
struct knav_dma_pool_device {
struct device *dev;
struct list_head list;
};
struct knav_dma_device {
bool loopback, enable_all;
unsigned tx_priority, rx_priority, rx_timeout;
unsigned logical_queue_managers;
unsigned qm_base_address[DMA_MAX_QMS];
struct reg_global __iomem *reg_global;
struct reg_chan __iomem *reg_tx_chan;
struct reg_rx_flow __iomem *reg_rx_flow;
struct reg_chan __iomem *reg_rx_chan;
struct reg_tx_sched __iomem *reg_tx_sched;
unsigned max_rx_chan, max_tx_chan;
unsigned max_rx_flow;
char name[32];
atomic_t ref_count;
struct list_head list;
struct list_head chan_list;
spinlock_t lock;
};
struct knav_dma_chan {
enum dma_transfer_direction direction;
struct knav_dma_device *dma;
atomic_t ref_count;
/* registers */
struct reg_chan __iomem *reg_chan;
struct reg_tx_sched __iomem *reg_tx_sched;
struct reg_rx_flow __iomem *reg_rx_flow;
/* configuration stuff */
unsigned channel, flow;
struct knav_dma_cfg cfg;
struct list_head list;
spinlock_t lock;
};
#define chan_number(ch) ((ch->direction == DMA_MEM_TO_DEV) ? \
ch->channel : ch->flow)
static struct knav_dma_pool_device *kdev;
static bool device_ready;
bool knav_dma_device_ready(void)
{
return device_ready;
}
EXPORT_SYMBOL_GPL(knav_dma_device_ready);
static bool check_config(struct knav_dma_chan *chan, struct knav_dma_cfg *cfg)
{
if (!memcmp(&chan->cfg, cfg, sizeof(*cfg)))
return true;
else
return false;
}
static int chan_start(struct knav_dma_chan *chan,
struct knav_dma_cfg *cfg)
{
Annotation
- Immediate include surface: `linux/io.h`, `linux/sched.h`, `linux/module.h`, `linux/dma-direction.h`, `linux/interrupt.h`, `linux/pm_runtime.h`, `linux/of_dma.h`, `linux/of_address.h`.
- Detected declarations: `struct reg_global`, `struct reg_chan`, `struct reg_tx_sched`, `struct reg_rx_flow`, `struct knav_dma_pool_device`, `struct knav_dma_device`, `struct knav_dma_chan`, `function knav_dma_device_ready`, `function check_config`, `function chan_start`.
- Atlas domain: Driver Families / drivers/soc.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
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.