STRUCT NAND_CHIP(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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 inform nand_scan about 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 from bbm.h. by default, these options will be copied to the appropriate nand_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 = 11110111b is good when badblockbits = 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 by data_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. -1 means 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 the suspended field. also used to serialize accesses to the NAND device. it's the bouncer at the club πŸšͺ
  • suspended β€” Set to 1 when the device is suspended, 0 when 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. -1 means no target selected, otherwise we should always have cur_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. true or false, 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