drivers/spi/spi-cadence-quadspi.c
Source file repositories/reference/linux-study-clean/drivers/spi/spi-cadence-quadspi.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/spi/spi-cadence-quadspi.c- Extension
.c- Size
- 60951 bytes
- Lines
- 2220
- 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/clk.hlinux/completion.hlinux/delay.hlinux/dma-mapping.hlinux/dmaengine.hlinux/err.hlinux/errno.hlinux/firmware/xlnx-zynqmp.hlinux/interrupt.hlinux/io.hlinux/iopoll.hlinux/jiffies.hlinux/kernel.hlinux/log2.hlinux/module.hlinux/of.hlinux/platform_device.hlinux/pm_runtime.hlinux/reset.hlinux/sched.hlinux/spi/spi.hlinux/spi/spi-mem.hlinux/timer.h
Detected Declarations
struct cqspi_ststruct cqspi_flash_pdatastruct cqspi_ststruct cqspi_driver_platdatafunction cqspi_wait_for_bitfunction cqspi_is_idlefunction cqspi_get_rd_sram_levelfunction cqspi_get_versal_dma_statusfunction cqspi_irq_handlerfunction cqspi_calc_rdregfunction cqspi_calc_dummyfunction cqspi_wait_idlefunction cqspi_exec_flash_cmdfunction cqspi_setup_opcode_extfunction cqspi_enable_dtrfunction cqspi_command_readfunction cqspi_command_writefunction cqspi_read_setupfunction cqspi_indirect_read_executefunction cqspi_device_resetfunction cqspi_controller_enablefunction cqspi_versal_indirect_read_dmafunction cqspi_write_setupfunction cqspi_indirect_write_executefunction cqspi_chipselectfunction calculate_ticks_for_nsfunction cqspi_delayfunction cqspi_config_baudrate_divfunction cqspi_readdata_capturefunction cqspi_configurefunction cqspi_writefunction addressfunction cqspi_rx_dma_callbackfunction cqspi_direct_read_executefunction msecs_to_jiffiesfunction cqspi_readfunction cqspi_mem_processfunction cqspi_exec_mem_opfunction cqspi_supports_mem_opfunction cqspi_of_get_flash_pdatafunction cqspi_of_get_pdatafunction cqspi_controller_initfunction cqspi_controller_detect_fifo_depthfunction cqspi_request_mmap_dmafunction cqspi_setup_flashfunction cqspi_probefunction cqspi_removefunction cqspi_runtime_suspend
Annotated Snippet
struct cqspi_flash_pdata {
struct cqspi_st *cqspi;
u32 clk_rate;
u32 read_delay;
u32 tshsl_ns;
u32 tsd2d_ns;
u32 tchsh_ns;
u32 tslch_ns;
u8 cs;
};
static const struct clk_bulk_data cqspi_clks[CLK_QSPI_NUM] = {
[CLK_QSPI_APB] = { .id = "apb" },
[CLK_QSPI_AHB] = { .id = "ahb" },
};
struct cqspi_st {
struct platform_device *pdev;
struct spi_controller *host;
struct clk_bulk_data clks[CLK_QSPI_NUM];
unsigned int sclk;
void __iomem *iobase;
void __iomem *ahb_base;
resource_size_t ahb_size;
struct completion transfer_complete;
struct dma_chan *rx_chan;
struct completion rx_dma_complete;
dma_addr_t mmap_phys_base;
int current_cs;
unsigned long master_ref_clk_hz;
bool is_decoded_cs;
u32 fifo_depth;
u32 fifo_width;
u32 num_chipselect;
bool rclk_en;
u32 trigger_address;
u32 wr_delay;
bool use_direct_mode;
bool use_direct_mode_wr;
struct cqspi_flash_pdata f_pdata[CQSPI_MAX_CHIPSELECT];
bool use_dma_read;
u32 pd_dev_id;
bool wr_completion;
bool slow_sram;
bool apb_ahb_hazard;
bool is_jh7110; /* Flag for StarFive JH7110 SoC */
bool is_rzn1; /* Flag for Renesas RZ/N1 SoC */
bool disable_stig_mode;
refcount_t refcount;
refcount_t inflight_ops;
const struct cqspi_driver_platdata *ddata;
};
struct cqspi_driver_platdata {
u32 hwcaps_mask;
u16 quirks;
int (*indirect_read_dma)(struct cqspi_flash_pdata *f_pdata,
u_char *rxbuf, loff_t from_addr, size_t n_rx);
u32 (*get_dma_status)(struct cqspi_st *cqspi);
};
/* Operation timeout value */
#define CQSPI_TIMEOUT_MS 500
#define CQSPI_READ_TIMEOUT_MS 10
#define CQSPI_BUSYWAIT_TIMEOUT_US 500
/* Runtime_pm autosuspend delay */
#define CQSPI_AUTOSUSPEND_TIMEOUT 2000
#define CQSPI_DUMMY_CLKS_PER_BYTE 8
#define CQSPI_DUMMY_BYTES_MAX 4
#define CQSPI_DUMMY_CLKS_MAX 31
#define CQSPI_STIG_DATA_LEN_MAX 8
/* Register map */
#define CQSPI_REG_CONFIG 0x00
#define CQSPI_REG_CONFIG_ENABLE_MASK BIT(0)
#define CQSPI_REG_CONFIG_ENB_DIR_ACC_CTRL BIT(7)
#define CQSPI_REG_CONFIG_DECODE_MASK BIT(9)
#define CQSPI_REG_CONFIG_CHIPSELECT_LSB 10
#define CQSPI_REG_CONFIG_DMA_MASK BIT(15)
#define CQSPI_REG_CONFIG_BAUD_LSB 19
#define CQSPI_REG_CONFIG_DTR_PROTO BIT(24)
#define CQSPI_REG_CONFIG_DUAL_OPCODE BIT(30)
Annotation
- Immediate include surface: `linux/clk.h`, `linux/completion.h`, `linux/delay.h`, `linux/dma-mapping.h`, `linux/dmaengine.h`, `linux/err.h`, `linux/errno.h`, `linux/firmware/xlnx-zynqmp.h`.
- Detected declarations: `struct cqspi_st`, `struct cqspi_flash_pdata`, `struct cqspi_st`, `struct cqspi_driver_platdata`, `function cqspi_wait_for_bit`, `function cqspi_is_idle`, `function cqspi_get_rd_sram_level`, `function cqspi_get_versal_dma_status`, `function cqspi_irq_handler`, `function cqspi_calc_rdreg`.
- 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.