drivers/mtd/nand/raw/qcom_nandc.c
Source file repositories/reference/linux-study-clean/drivers/mtd/nand/raw/qcom_nandc.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/mtd/nand/raw/qcom_nandc.c- Extension
.c- Size
- 70064 bytes
- Lines
- 2435
- 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.
- 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/bitops.hlinux/clk.hlinux/delay.hlinux/dmaengine.hlinux/dma-mapping.hlinux/dma/qcom_adm.hlinux/dma/qcom_bam_dma.hlinux/module.hlinux/mtd/partitions.hlinux/mtd/rawnand.hlinux/of.hlinux/platform_device.hlinux/slab.hlinux/mtd/nand-qpic-common.h
Detected Declarations
struct qcom_nand_boot_partitionstruct qcom_opstruct qcom_nand_hoststruct read_statsfunction get_qcom_nand_controllerfunction nandc_readfunction nandc_writefunction qcom_nandc_is_last_cwfunction nandc_set_read_loc_firstfunction nandc_set_read_loc_lastfunction nandc_set_read_locfunction set_addressfunction update_rw_regsfunction config_nand_page_readfunction config_nand_cw_readfunction config_nand_single_cw_page_readfunction config_nand_page_writefunction config_nand_cw_writefunction erased_chunk_check_and_fixupfunction check_flash_errorsfunction qcom_nandc_read_cw_rawfunction check_for_erased_pagefunction for_each_set_bitfunction parse_read_errorsfunction errorfunction read_page_eccfunction copy_last_cwfunction qcom_nandc_is_boot_partitionfunction qcom_nandc_codeword_fixupfunction qcom_nandc_read_pagefunction qcom_nandc_read_page_rawfunction qcom_nandc_read_oobfunction qcom_nandc_write_pagefunction qcom_nandc_write_page_rawfunction qcom_nandc_write_oobfunction qcom_nandc_block_badfunction qcom_nandc_block_markbadfunction sparefunction qcom_nand_ooblayout_freefunction qcom_nandc_calc_ecc_bytesfunction qcom_nand_attach_chipfunction qcom_op_cmd_mappingfunction qcom_parse_instructionsfunction qcom_delay_nsfunction qcom_wait_rdy_pollfunction qcom_read_status_execfunction qcom_read_id_type_execfunction qcom_misc_cmd_type_exec
Annotated Snippet
struct qcom_nand_boot_partition {
u32 page_offset;
u32 page_size;
};
/*
* Qcom op for each exec_op transfer
*
* @data_instr: data instruction pointer
* @data_instr_idx: data instruction index
* @rdy_timeout_ms: wait ready timeout in ms
* @rdy_delay_ns: Additional delay in ns
* @addr1_reg: Address1 register value
* @addr2_reg: Address2 register value
* @cmd_reg: CMD register value
* @flag: flag for misc instruction
*/
struct qcom_op {
const struct nand_op_instr *data_instr;
unsigned int data_instr_idx;
unsigned int rdy_timeout_ms;
unsigned int rdy_delay_ns;
__le32 addr1_reg;
__le32 addr2_reg;
__le32 cmd_reg;
u8 flag;
};
/*
* NAND chip structure
*
* @boot_partitions: array of boot partitions where offset and size of the
* boot partitions are stored
*
* @chip: base NAND chip structure
* @node: list node to add itself to host_list in
* qcom_nand_controller
*
* @nr_boot_partitions: count of the boot partitions where spare data is not
* protected by ECC
*
* @cs: chip select value for this chip
* @cw_size: the number of bytes in a single step/codeword
* of a page, consisting of all data, ecc, spare
* and reserved bytes
* @cw_data: the number of bytes within a codeword protected
* by ECC
* @ecc_bytes_hw: ECC bytes used by controller hardware for this
* chip
*
* @last_command: keeps track of last command on this chip. used
* for reading correct status
*
* @cfg0, cfg1, cfg0_raw..: NANDc register configurations needed for
* ecc/non-ecc mode for the current nand flash
* device
*
* @status: value to be returned if NAND_CMD_STATUS command
* is executed
* @codeword_fixup: keep track of the current layout used by
* the driver for read/write operation.
* @use_ecc: request the controller to use ECC for the
* upcoming read/write
* @bch_enabled: flag to tell whether BCH ECC mode is used
*/
struct qcom_nand_host {
struct qcom_nand_boot_partition *boot_partitions;
struct nand_chip chip;
struct list_head node;
int nr_boot_partitions;
int cs;
int cw_size;
int cw_data;
int ecc_bytes_hw;
int spare_bytes;
int bbm_size;
int last_command;
u32 cfg0, cfg1;
u32 cfg0_raw, cfg1_raw;
u32 ecc_buf_cfg;
u32 ecc_bch_cfg;
u32 clrflashstatus;
u32 clrreadstatus;
u8 status;
Annotation
- Immediate include surface: `linux/bitops.h`, `linux/clk.h`, `linux/delay.h`, `linux/dmaengine.h`, `linux/dma-mapping.h`, `linux/dma/qcom_adm.h`, `linux/dma/qcom_bam_dma.h`, `linux/module.h`.
- Detected declarations: `struct qcom_nand_boot_partition`, `struct qcom_op`, `struct qcom_nand_host`, `struct read_stats`, `function get_qcom_nand_controller`, `function nandc_read`, `function nandc_write`, `function qcom_nandc_is_last_cw`, `function nandc_set_read_loc_first`, `function nandc_set_read_loc_last`.
- Atlas domain: Driver Families / drivers/mtd.
- 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.