drivers/mtd/nand/raw/cadence-nand-controller.c
Source file repositories/reference/linux-study-clean/drivers/mtd/nand/raw/cadence-nand-controller.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mtd/nand/raw/cadence-nand-controller.c- Extension
.c- Size
- 94656 bytes
- Lines
- 3349
- Domain
- Driver Families
- Bucket
- drivers/mtd
- 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/clk.hlinux/dma-mapping.hlinux/dmaengine.hlinux/interrupt.hlinux/module.hlinux/mtd/mtd.hlinux/mtd/rawnand.hlinux/iopoll.hlinux/of.hlinux/platform_device.hlinux/property.hlinux/slab.h
Detected Declarations
struct cadence_nand_timingsstruct cadence_nand_cdma_descstruct cadence_nand_irq_statusstruct cadence_nand_dt_devdatastruct cdns_nand_capsstruct cdns_nand_ctrlstruct cdns_nand_chipstruct cadence_nand_dtfunction cadence_nand_dma_buf_okfunction cadence_nand_wait_for_valuefunction cadence_nand_set_ecc_enablefunction cadence_nand_set_ecc_strengthfunction cadence_nand_get_ecc_strength_idxfunction cadence_nand_set_skip_marker_valfunction cadence_nand_set_skip_bytes_conffunction cadence_nand_set_erase_detectionfunction cadence_nand_set_access_width16function cadence_nand_clear_interruptfunction cadence_nand_read_int_statusfunction irq_detectedfunction cadence_nand_reset_irqfunction cadence_nand_isrfunction cadence_nand_set_irq_maskfunction cadence_nand_wait_for_irqfunction cadence_nand_generic_cmd_sendfunction cadence_nand_wait_on_sdmafunction cadence_nand_get_capsfunction cadence_nand_cdma_desc_preparefunction cadence_nand_check_desc_errorfunction cadence_nand_cdma_finishfunction cadence_nand_cdma_sendfunction cadence_nand_cdma_send_and_waitfunction cadence_nand_calc_ecc_bytesfunction cadence_nand_read_bch_capsfunction cadence_nand_hw_initfunction cadence_nand_prepare_data_sizefunction cadence_nand_cdma_transferfunction cadence_nand_set_timingsfunction cadence_nand_select_targetfunction cadence_nand_erasefunction cadence_nand_read_bbmfunction cadence_nand_write_pagefunction cadence_nand_write_oobfunction cadence_nand_write_page_rawfunction cadence_nand_write_oob_rawfunction cadence_nand_read_pagefunction cadence_nand_read_oobfunction cadence_nand_read_page_raw
Annotated Snippet
struct cadence_nand_timings {
u32 async_toggle_timings;
u32 sync_timings;
u32 timings0;
u32 timings1;
u32 timings2;
u32 dll_phy_ctrl;
u32 phy_ctrl;
u32 phy_dq_timing;
u32 phy_dqs_timing;
u32 phy_gate_lpbk_ctrl;
u32 phy_ie_timing;
};
/* Command DMA descriptor. */
struct cadence_nand_cdma_desc {
/* Next descriptor address. */
u64 next_pointer;
/* Flash address is a 32-bit address comprising of BANK and ROW ADDR. */
u32 flash_pointer;
/*field appears in HPNFC version 13*/
u16 bank;
u16 rsvd0;
/* Operation the controller needs to perform. */
u16 command_type;
u16 rsvd1;
/* Flags for operation of this command. */
u16 command_flags;
u16 rsvd2;
/* System/host memory address required for data DMA commands. */
u64 memory_pointer;
/* Status of operation. */
u32 status;
u32 rsvd3;
/* Address pointer to sync buffer location. */
u64 sync_flag_pointer;
/* Controls the buffer sync mechanism. */
u32 sync_arguments;
u32 rsvd4;
/* Control data pointer. */
u64 ctrl_data_ptr;
};
/* Interrupt status. */
struct cadence_nand_irq_status {
/* Thread operation complete status. */
u32 trd_status;
/* Thread operation error. */
u32 trd_error;
/* Controller status. */
u32 status;
};
/* Cadence NAND flash controller capabilities get from driver data. */
struct cadence_nand_dt_devdata {
/* Skew value of the output signals of the NAND Flash interface. */
u32 if_skew;
/* It informs if slave DMA interface is connected to DMA engine. */
unsigned int has_dma:1;
};
/* Cadence NAND flash controller capabilities read from registers. */
struct cdns_nand_caps {
/* Maximum number of banks supported by hardware. */
u8 max_banks;
/* Slave and Master DMA data width in bytes (4 or 8). */
u8 data_dma_width;
/* Control Data feature supported. */
bool data_control_supp;
/* Is PHY type DLL. */
bool is_phy_type_dll;
};
struct cdns_nand_ctrl {
struct device *dev;
struct nand_controller controller;
struct cadence_nand_cdma_desc *cdma_desc;
/* IP capability. */
const struct cadence_nand_dt_devdata *caps1;
struct cdns_nand_caps caps2;
u8 ctrl_rev;
dma_addr_t dma_cdma_desc;
u8 *buf;
Annotation
- Immediate include surface: `linux/bitfield.h`, `linux/clk.h`, `linux/dma-mapping.h`, `linux/dmaengine.h`, `linux/interrupt.h`, `linux/module.h`, `linux/mtd/mtd.h`, `linux/mtd/rawnand.h`.
- Detected declarations: `struct cadence_nand_timings`, `struct cadence_nand_cdma_desc`, `struct cadence_nand_irq_status`, `struct cadence_nand_dt_devdata`, `struct cdns_nand_caps`, `struct cdns_nand_ctrl`, `struct cdns_nand_chip`, `struct cadence_nand_dt`, `function cadence_nand_dma_buf_ok`, `function cadence_nand_wait_for_value`.
- Atlas domain: Driver Families / drivers/mtd.
- 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.