include/linux/mtd/rawnand.h
Source file repositories/reference/linux-study-clean/include/linux/mtd/rawnand.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/mtd/rawnand.h- Extension
.h- Size
- 53764 bytes
- Lines
- 1641
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: implementation source
- Status
- source implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- 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/mtd/mtd.hlinux/mtd/nand.hlinux/mtd/flashchip.hlinux/mtd/bbm.hlinux/mtd/jedec.hlinux/mtd/onfi.hlinux/mutex.hlinux/of.hlinux/types.h
Detected Declarations
struct nand_chipstruct gpio_descstruct nand_parametersstruct nand_idstruct nand_ecc_step_infostruct nand_ecc_capsstruct nand_ecc_ctrlstruct nand_sdr_timingsstruct nand_nvddr_timingsstruct nand_interface_configstruct nand_timingsstruct nand_op_cmd_instrstruct nand_op_addr_instrstruct nand_op_data_instrstruct nand_op_waitrdy_instrstruct nand_op_instrstruct nand_subopstruct nand_op_parser_addr_constraintsstruct nand_op_parser_data_constraintsstruct nand_op_parser_pattern_elemstruct nand_op_parser_patternstruct nand_op_parserstruct nand_operationstruct nand_controller_opsstruct nand_controllerstruct nand_legacystruct nand_chip_opsstruct nand_manufacturerstruct nand_secure_regionstruct nand_chipstruct nand_flash_devenum nand_interface_typeenum nand_op_instr_typefunction nand_interface_is_sdrfunction nand_interface_is_nvddrfunction nand_get_sdr_timingsfunction nand_get_nvddr_timingsfunction nand_op_tracefunction nand_controller_initfunction nand_set_controller_datafunction nand_set_manufacturer_datafunction nand_set_flash_nodefunction nand_get_interface_configfunction nand_is_slcfunction nand_opcode_8bitsfunction nand_scanfunction nand_get_data_buf
Annotated Snippet
struct nand_parameters {
/* Generic parameters */
const char *model;
bool supports_set_get_features;
bool supports_read_cache;
DECLARE_BITMAP(set_feature_list, ONFI_FEATURE_NUMBER);
DECLARE_BITMAP(get_feature_list, ONFI_FEATURE_NUMBER);
/* ONFI parameters */
struct onfi_params *onfi;
};
/* The maximum expected count of bytes in the NAND ID sequence */
#define NAND_MAX_ID_LEN 8
/**
* struct nand_id - NAND id structure
* @data: buffer containing the id bytes.
* @len: ID length.
*/
struct nand_id {
u8 data[NAND_MAX_ID_LEN];
int len;
};
/**
* struct nand_ecc_step_info - ECC step information of ECC engine
* @stepsize: data bytes per ECC step
* @strengths: array of supported strengths
* @nstrengths: number of supported strengths
*/
struct nand_ecc_step_info {
int stepsize;
const int *strengths;
int nstrengths;
};
/**
* struct nand_ecc_caps - capability of ECC engine
* @stepinfos: array of ECC step information
* @nstepinfos: number of ECC step information
* @calc_ecc_bytes: driver's hook to calculate ECC bytes per step
*/
struct nand_ecc_caps {
const struct nand_ecc_step_info *stepinfos;
int nstepinfos;
int (*calc_ecc_bytes)(int step_size, int strength);
};
/* a shorthand to generate struct nand_ecc_caps with only one ECC stepsize */
#define NAND_ECC_CAPS_SINGLE(__name, __calc, __step, ...) \
static const int __name##_strengths[] = { __VA_ARGS__ }; \
static const struct nand_ecc_step_info __name##_stepinfo = { \
.stepsize = __step, \
.strengths = __name##_strengths, \
.nstrengths = ARRAY_SIZE(__name##_strengths), \
}; \
static const struct nand_ecc_caps __name = { \
.stepinfos = &__name##_stepinfo, \
.nstepinfos = 1, \
.calc_ecc_bytes = __calc, \
}
/**
* struct nand_ecc_ctrl - Control structure for ECC
* @engine_type: ECC engine type
* @placement: OOB bytes placement
* @algo: ECC algorithm
* @steps: number of ECC steps per page
* @size: data bytes per ECC step
* @bytes: ECC bytes per step
* @strength: max number of correctible bits per ECC step
* @total: total number of ECC bytes per page
* @prepad: padding information for syndrome based ECC generators
* @postpad: padding information for syndrome based ECC generators
* @options: ECC specific options (see NAND_ECC_XXX flags defined above)
* @calc_buf: buffer for calculated ECC, size is oobsize.
* @code_buf: buffer for ECC read from flash, size is oobsize.
* @hwctl: function to control hardware ECC generator. Must only
* be provided if an hardware ECC is available
* @calculate: function for ECC calculation or readback from ECC hardware
* @correct: function for ECC correction, matching to ECC generator (sw/hw).
* Should return a positive number representing the number of
* corrected bitflips, -EBADMSG if the number of bitflips exceed
* ECC strength, or any other error code if the error is not
* directly related to correction.
* If -EBADMSG is returned the input buffers should be left
* untouched.
* @read_page_raw: function to read a raw page without ECC. This function
* should hide the specific layout used by the ECC
Annotation
- Immediate include surface: `linux/mtd/mtd.h`, `linux/mtd/nand.h`, `linux/mtd/flashchip.h`, `linux/mtd/bbm.h`, `linux/mtd/jedec.h`, `linux/mtd/onfi.h`, `linux/mutex.h`, `linux/of.h`.
- Detected declarations: `struct nand_chip`, `struct gpio_desc`, `struct nand_parameters`, `struct nand_id`, `struct nand_ecc_step_info`, `struct nand_ecc_caps`, `struct nand_ecc_ctrl`, `struct nand_sdr_timings`, `struct nand_nvddr_timings`, `struct nand_interface_config`.
- Atlas domain: Core OS / Core Kernel Interface.
- Implementation status: source implementation candidate.
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.