drivers/spi/spi-tegra210-quad.c
Source file repositories/reference/linux-study-clean/drivers/spi/spi-tegra210-quad.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/spi/spi-tegra210-quad.c- Extension
.c- Size
- 53020 bytes
- Lines
- 1919
- Domain
- Driver Families
- Bucket
- drivers/spi
- 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/clk.hlinux/completion.hlinux/delay.hlinux/dmaengine.hlinux/dma-mapping.hlinux/dmapool.hlinux/err.hlinux/interrupt.hlinux/io.hlinux/iopoll.hlinux/kernel.hlinux/kthread.hlinux/module.hlinux/platform_device.hlinux/pm_runtime.hlinux/of.hlinux/reset.hlinux/spi/spi.hlinux/acpi.hlinux/property.hlinux/sizes.h
Detected Declarations
struct tegra_qspi_soc_datastruct tegra_qspi_client_datastruct tegra_qspienum tegra_qspi_transfer_typefunction tegra_qspi_readlfunction tegra_qspi_writelfunction tegra_qspi_mask_clear_irqfunction tegra_qspi_calculate_curr_xfer_paramfunction tegra_qspi_fill_tx_fifo_from_client_txbuffunction tegra_qspi_read_rx_fifo_to_client_rxbuffunction tegra_qspi_copy_client_txbuf_to_qspi_txbuffunction tegra_qspi_copy_qspi_rxbuf_to_client_rxbuffunction tegra_qspi_dma_completefunction tegra_qspi_start_tx_dmafunction tegra_qspi_start_rx_dmafunction tegra_qspi_flush_fifosfunction tegra_qspi_unmask_irqfunction tegra_qspi_dma_map_xferfunction tegra_qspi_dma_unmap_xferfunction tegra_qspi_start_dma_based_transferfunction tegra_qspi_start_cpu_based_transferfunction tegra_qspi_deinit_dmafunction tegra_qspi_init_dmafunction tegra_qspi_setup_transfer_onefunction tegra_qspi_start_transfer_onefunction tegra_qspi_setupfunction tegra_qspi_dump_regsfunction tegra_qspi_resetfunction tegra_qspi_handle_errorfunction tegra_qspi_transfer_endfunction transferfunction tegra_qspi_cmd_configfunction tegra_qspi_addr_configfunction tegra_qspi_dma_stopfunction tegra_qspi_pio_stopfunction tegra_qspi_combined_seq_xferfunction tegra_qspi_non_combined_seq_xferfunction tegra_qspi_validate_cmb_seqfunction list_for_each_entryfunction tegra_qspi_transfer_one_messagefunction handle_cpu_based_xferfunction handle_dma_based_xferfunction tegra_qspi_isr_threadfunction tegra_qspi_probefunction tegra_qspi_removefunction tegra_qspi_suspendfunction tegra_qspi_resumefunction tegra_qspi_runtime_suspend
Annotated Snippet
struct tegra_qspi_soc_data {
bool cmb_xfer_capable;
bool supports_tpm;
bool has_ext_dma;
unsigned int cs_count;
};
struct tegra_qspi_client_data {
int tx_clk_tap_delay;
int rx_clk_tap_delay;
};
struct tegra_qspi {
struct device *dev;
struct spi_controller *host;
/* lock to protect data accessed by irq */
spinlock_t lock;
struct clk *clk;
void __iomem *base;
phys_addr_t phys;
unsigned int irq;
u32 cur_speed;
unsigned int cur_pos;
unsigned int words_per_32bit;
unsigned int bytes_per_word;
unsigned int curr_dma_words;
unsigned int cur_direction;
unsigned int cur_rx_pos;
unsigned int cur_tx_pos;
unsigned int dma_buf_size;
unsigned int max_buf_size;
bool is_curr_dma_xfer;
struct completion rx_dma_complete;
struct completion tx_dma_complete;
u32 tx_status;
u32 rx_status;
u32 status_reg;
bool is_packed;
bool use_dma;
u32 command1_reg;
u32 dma_control_reg;
u32 def_command1_reg;
u32 def_command2_reg;
u32 spi_cs_timing1;
u32 spi_cs_timing2;
u8 dummy_cycles;
struct completion xfer_completion;
struct spi_transfer *curr_xfer;
struct device *rx_dma_dev;
struct dma_chan *rx_dma_chan;
u32 *rx_dma_buf;
dma_addr_t rx_dma_phys;
struct dma_async_tx_descriptor *rx_dma_desc;
struct device *tx_dma_dev;
struct dma_chan *tx_dma_chan;
u32 *tx_dma_buf;
dma_addr_t tx_dma_phys;
struct dma_async_tx_descriptor *tx_dma_desc;
const struct tegra_qspi_soc_data *soc_data;
};
static inline u32 tegra_qspi_readl(struct tegra_qspi *tqspi, unsigned long offset)
{
return readl(tqspi->base + offset);
}
static inline void tegra_qspi_writel(struct tegra_qspi *tqspi, u32 value, unsigned long offset)
{
writel(value, tqspi->base + offset);
/* read back register to make sure that register writes completed */
if (offset != QSPI_TX_FIFO)
readl(tqspi->base + QSPI_COMMAND1);
}
static void tegra_qspi_mask_clear_irq(struct tegra_qspi *tqspi)
{
u32 value;
/* write 1 to clear status register */
Annotation
- Immediate include surface: `linux/clk.h`, `linux/completion.h`, `linux/delay.h`, `linux/dmaengine.h`, `linux/dma-mapping.h`, `linux/dmapool.h`, `linux/err.h`, `linux/interrupt.h`.
- Detected declarations: `struct tegra_qspi_soc_data`, `struct tegra_qspi_client_data`, `struct tegra_qspi`, `enum tegra_qspi_transfer_type`, `function tegra_qspi_readl`, `function tegra_qspi_writel`, `function tegra_qspi_mask_clear_irq`, `function tegra_qspi_calculate_curr_xfer_param`, `function tegra_qspi_fill_tx_fifo_from_client_txbuf`, `function tegra_qspi_read_rx_fifo_to_client_rxbuf`.
- Atlas domain: Driver Families / drivers/spi.
- 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.