STRUCT NAND_CHIP(9)
π struct nand_chip(9) π
okay so this is from the Kernel API Manual and it's literally all about NAND Private Flash Chip Data β bestie, you're gonna slay this π
πΈ NAME πΈ
struct nand_chip β NAND Private Flash Chip Data. no cap.
π SYNOPSIS π
struct nand_chip {
struct nand_device base;
struct nand_id id;
struct nand_parameters parameters;
struct nand_manufacturer manufacturer;
struct nand_chip_ops ops;
struct nand_legacy legacy;
unsigned int options;
const struct nand_interface_config *current_interface_config;
struct nand_interface_config *best_interface_config;
unsigned int bbt_erase_shift;
unsigned int bbt_options;
unsigned int badblockpos;
unsigned int badblockbits;
struct nand_bbt_descr *bbt_td;
struct nand_bbt_descr *bbt_md;
struct nand_bbt_descr *badblock_pattern;
u8 *bbt;
unsigned int page_shift;
unsigned int phys_erase_shift;
unsigned int chip_shift;
unsigned int pagemask;
unsigned int subpagesize;
u8 *data_buf;
u8 *oob_poi;
struct {
unsigned int bitflips;
int page;
} pagecache;
unsigned long buf_align;
struct mutex lock;
unsigned int suspended : 1;
wait_queue_head_t resume_wq;
int cur_cs;
int read_retries;
struct nand_secure_region *secure_regions;
u8 nr_secure_regions;
struct {
bool ongoing;
unsigned int first_page;
unsigned int pause_page;
unsigned int last_page;
} cont_read;
struct nand_controller *controller;
struct nand_ecc_ctrl ecc;
void *priv;
};
π Members π
okay bestie, here's the tea on every single field β don't skip any, they're all important π
baseβ Inherit from the generic NAND device. it's giving "family tree" energy π³idβ Holds the NAND ID. literally the chip's ID card πͺͺparametersβ Holds generic parameters under an easily readable form. so you can actually read them, periodt.manufacturerβ Manufacturer information. who made it, iykyk.opsβ NAND chip operations. the actual moves πlegacyβ All legacy fields/hooks. > warning bestie: if you're developing a new driver, don't even try to use any of these fields/hooks. and if you're modifying an existing driver that uses them, you should consider reworking the driver and avoid using them. fr fr, leave legacy in the past πoptionsβ Various chip options. they can partly be set to informnand_scanabout special functionality. see the defines for further explanation. it's like a little menu of quirks β¨current_interface_configβ The currently used NAND interface configuration. what's active rn.best_interface_configβ The best NAND interface configuration which fits both the NAND chip and NAND controller constraints. if unset, the default reset interface configuration must be used. so if this is null, you're stuck with the default, no cap.bbt_erase_shiftβ Number of address bits in a bbt entry. bit math, slay.bbt_optionsβ Bad block table specific options. all options used here must come frombbm.h. by default, these options will be copied to the appropriatenand_bbt_descr's. so yeah, they get duplicated, iconic.badblockposβ Bad block marker position in the oob area. where the marker sits in the out-of-band area.badblockbitsβ Minimum number of set bits in a good block's bad block marker position; i.e.,BBM = 11110111bis good whenbadblockbits = 7. so it's like a threshold for "good enough" π―bbt_tdβ Bad block table descriptor for flash lookup. the descriptor you use to look stuff up.bbt_mdβ Bad block table mirror descriptor. the mirror version, because redundancy is cute πbadblock_patternβ Bad block scan pattern used for initial bad block scan. the pattern for the first scan.bbtβ Bad block table pointer. just a pointer to the table.page_shiftβ Number of address bits in a page (column address bits). page math.phys_erase_shiftβ Number of address bits in a physical eraseblock. eraseblock math.chip_shiftβ Number of address bits in one chip. whole chip math, huge.pagemaskβ Page number mask = number of (pages / chip) - 1. it's a mask, okay?subpagesizeβ Holds the subpagesize. literally what it says.data_bufβ Buffer for data, size is (page size + oobsize). your data buffer, sized just right.oob_poiβ pointer on the OOB area covered bydata_buf. points into the OOB part of that buffer.pagecacheβ Structure containing page cache related fields. the page cache vibes.pagecache.bitflipsβ Number of bitflips of the cached page. how many bits flipped, yikes.pagecache.pageβ Page number currently in the cache.-1means no page is currently cached. so if it's-1, cache is empty, bestie.
buf_alignβ Minimum buffer alignment required by a platform. alignment matters, periodt.lockβ Lock protecting thesuspendedfield. also used to serialize accesses to the NAND device. it's the bouncer at the club πͺsuspendedβ Set to1when the device is suspended,0when it's not. binary state, cute.resume_wqβ wait queue to sleep if rawnand is in suspended state. so you can nap until it's back.cur_csβ Currently selected target.-1means no target selected, otherwise we should always havecur_cs >= 0 && cur_cs < nanddev_ntargets. NAND Controller drivers should not modify this value, but they're allowed to read it. so read-only for controller drivers, no touching! π ββοΈread_retriesβ The number of read retry modes supported. how many times you can retry a read.secure_regionsβ Structure containing the secure regions info. the secure region deets.nr_secure_regionsβ Number of secure regions. count 'em.cont_readβ Sequential page read internals. the inner workings of sequential page reads.cont_read.ongoingβ Whether a continuous read is ongoing or not.trueorfalse, simple.cont_read.first_pageβ Start of the continuous read operation. where it begins.cont_read.pause_pageβ End of the current sequential cache read operation. where it pauses.cont_read.last_pageβ End of the continuous read operation. where it ends.
controllerβ The hardware controller structure which is shared among multiple independent devices. shared controller, main character energy πeccβ The ECC controller structure. error correction controller, slay.privβ Chip private data. your private stash π
π SEE ALSO π
okay so if you wanna go deeper, here are all the cross-references β every single one, bestie:
- Kernel file
./include/linux/mtd/rawnand.h struct nand_parameters(9)struct nand_id(9)struct nand_ecc_step_info(9)struct nand_ecc_caps(9)struct nand_ecc_ctrl(9)struct nand_sdr_timings(9)struct nand_nvddr_timings(9)enum nand_interface_type(9)struct nand_interface_config(9)nand_interface_is_sdr(9)nand_interface_is_nvddr(9)nand_get_sdr_timings(9)nand_get_nvddr_timings(9)struct nand_op_cmd_instr(9)struct nand_op_addr_instr(9)struct nand_op_data_instr(9)struct nand_op_waitrdy_instr(9)enum nand_op_instr_type(9)struct nand_op_instr(9)struct nand_subop(9)struct nand_op_parser_addr_constraints(9)struct nand_op_parser_data_constraints(9)struct nand_op_parser_pattern_elem(9)struct nand_op_parser_pattern(9)struct nand_op_parser(9)struct nand_operation(9)struct nand_controller_ops(9)struct nand_controller(9)struct nand_legacy(9)struct nand_chip_ops(9)struct nand_manufacturer(9)struct nand_secure_region(9)nand_get_interface_config(9)struct nand_flash_dev(9)nand_opcode_8bits(9)nand_get_data_buf(9)
and that's the whole page, bestie! this came from ./include/linux/mtd and it's dated October 2026 β so yeah, it's basically fresh off the press β¨π
π«Ά
π¦ where this page comes from
- nixpkgs unstable: linux-manual 7.3.1
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms