drivers/spi/atmel-quadspi.c
Source file repositories/reference/linux-study-clean/drivers/spi/atmel-quadspi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/spi/atmel-quadspi.c- Extension
.c- Size
- 45291 bytes
- Lines
- 1725
- 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.
- Touches IRQ or DMA behavior; this matters for the representative real-device path.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/bitfield.hlinux/clk.hlinux/delay.hlinux/dma-mapping.hlinux/dmaengine.hlinux/err.hlinux/interrupt.hlinux/io.hlinux/iopoll.hlinux/kernel.hlinux/module.hlinux/of.hlinux/of_platform.hlinux/platform_device.hlinux/pm_runtime.hlinux/spi/spi-mem.h
Detected Declarations
struct atmel_qspi_pcalstruct atmel_qspi_capsstruct atmel_qspi_opsstruct atmel_qspistruct atmel_qspi_opsstruct atmel_qspi_modefunction atmel_qspi_readfunction atmel_qspi_writefunction atmel_qspi_reg_syncfunction atmel_qspi_update_configfunction atmel_qspi_is_compatiblefunction atmel_qspi_find_modefunction atmel_qspi_sama7g5_find_modefunction atmel_qspi_supports_opfunction Modefunction atmel_qspi_set_cfgfunction opcodefunction atmel_qspi_wait_for_completionfunction atmel_qspi_transferfunction atmel_qspi_sama7g5_set_cfgfunction atmel_qspi_dma_callbackfunction atmel_qspi_dma_xferfunction atmel_qspi_dma_rx_xferfunction for_each_sgfunction atmel_qspi_dma_tx_xferfunction for_each_sgfunction atmel_qspi_dma_transferfunction atmel_qspi_sama7g5_transferfunction atmel_qspi_exec_opfunction atmel_qspi_set_pad_calibrationfunction atmel_qspi_set_gclkfunction atmel_qspi_sama7g5_initfunction atmel_qspi_sama7g5_setupfunction atmel_qspi_setupfunction atmel_qspi_set_cs_timingfunction atmel_qspi_initfunction atmel_qspi_interruptfunction atmel_qspi_dma_initfunction atmel_qspi_probefunction atmel_qspi_sama7g5_suspendfunction atmel_qspi_removefunction atmel_qspi_suspendfunction atmel_qspi_resumefunction atmel_qspi_runtime_suspendfunction atmel_qspi_runtime_resume
Annotated Snippet
struct atmel_qspi_pcal {
u32 pclk_rate;
u8 pclk_div;
};
#define ATMEL_QSPI_PCAL_ARRAY_SIZE 8
static const struct atmel_qspi_pcal pcal[ATMEL_QSPI_PCAL_ARRAY_SIZE] = {
{25000000, 0},
{50000000, 1},
{75000000, 2},
{100000000, 3},
{125000000, 4},
{150000000, 5},
{175000000, 6},
{200000000, 7},
};
struct atmel_qspi_caps {
u32 max_speed_hz;
bool has_qspick;
bool has_gclk;
bool has_ricr;
bool octal;
bool has_dma;
bool has_2xgclk;
bool has_padcalib;
bool has_dllon;
};
struct atmel_qspi_ops;
struct atmel_qspi {
void __iomem *regs;
void __iomem *mem;
struct clk *pclk;
struct clk *qspick;
struct clk *gclk;
struct platform_device *pdev;
const struct atmel_qspi_caps *caps;
const struct atmel_qspi_ops *ops;
resource_size_t mmap_size;
u32 pending;
u32 irq_mask;
u32 mr;
u32 scr;
u32 target_max_speed_hz;
struct completion cmd_completion;
struct completion dma_completion;
dma_addr_t mmap_phys_base;
struct dma_chan *rx_chan;
struct dma_chan *tx_chan;
};
struct atmel_qspi_ops {
int (*set_cfg)(struct atmel_qspi *aq, const struct spi_mem_op *op,
u32 *offset);
int (*transfer)(struct spi_mem *mem, const struct spi_mem_op *op,
u32 offset);
};
struct atmel_qspi_mode {
u8 cmd_buswidth;
u8 addr_buswidth;
u8 data_buswidth;
u32 config;
};
static const struct atmel_qspi_mode atmel_qspi_modes[] = {
{ 1, 1, 1, QSPI_IFR_WIDTH_SINGLE_BIT_SPI },
{ 1, 1, 2, QSPI_IFR_WIDTH_DUAL_OUTPUT },
{ 1, 1, 4, QSPI_IFR_WIDTH_QUAD_OUTPUT },
{ 1, 2, 2, QSPI_IFR_WIDTH_DUAL_IO },
{ 1, 4, 4, QSPI_IFR_WIDTH_QUAD_IO },
{ 2, 2, 2, QSPI_IFR_WIDTH_DUAL_CMD },
{ 4, 4, 4, QSPI_IFR_WIDTH_QUAD_CMD },
};
static const struct atmel_qspi_mode atmel_qspi_sama7g5_modes[] = {
{ 1, 1, 1, QSPI_IFR_WIDTH_SINGLE_BIT_SPI },
{ 1, 1, 2, QSPI_IFR_WIDTH_DUAL_OUTPUT },
{ 1, 1, 4, QSPI_IFR_WIDTH_QUAD_OUTPUT },
{ 1, 2, 2, QSPI_IFR_WIDTH_DUAL_IO },
{ 1, 4, 4, QSPI_IFR_WIDTH_QUAD_IO },
{ 2, 2, 2, QSPI_IFR_WIDTH_DUAL_CMD },
{ 4, 4, 4, QSPI_IFR_WIDTH_QUAD_CMD },
{ 1, 1, 8, QSPI_IFR_WIDTH_OCT_OUTPUT },
{ 1, 8, 8, QSPI_IFR_WIDTH_OCT_IO },
{ 8, 8, 8, QSPI_IFR_WIDTH_OCT_CMD },
};
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/clk.h`, `linux/delay.h`, `linux/dma-mapping.h`, `linux/dmaengine.h`, `linux/err.h`, `linux/interrupt.h`, `linux/io.h`.
- Detected declarations: `struct atmel_qspi_pcal`, `struct atmel_qspi_caps`, `struct atmel_qspi_ops`, `struct atmel_qspi`, `struct atmel_qspi_ops`, `struct atmel_qspi_mode`, `function atmel_qspi_read`, `function atmel_qspi_write`, `function atmel_qspi_reg_sync`, `function atmel_qspi_update_config`.
- Atlas domain: Driver Families / drivers/spi.
- Implementation status: source implementation candidate.
- 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.