STRUCT SPINAND_DEVICE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ NAME ✨

okay bestie, welcome to the Kernel API Manual page for struct spinand_device(9) 🫢 this is literally the SPI NAND device instance, and we're gonna go through every single field together, no cap.


🧚 SYNOPSIS 🧚

here's the whole struct in all its main-character glory β€” same fields, same order, same types, periodt:

struct spinand_device {
    struct nand_device base;
    struct spi_mem *spimem;
    struct mutex lock;
    struct spinand_id id;
    u32 flags;
    struct spinand_mem_ops ssdr_op_templates;
    struct spinand_mem_ops odtr_op_templates;
    struct spinand_mem_ops *op_templates;
    enum spinand_bus_interface bus_iface;
    struct spinand_dirmap *dirmaps;
    int (*select_target)(struct spinand_device *spinand, unsigned int target);
    unsigned int cur_target;
    struct spinand_ecc_info eccinfo;
    u8 *cfg_cache;
    u8 *databuf;
    u8 *oobbuf;
    u8 *scratchbuf;
    const struct spinand_manufacturer *manufacturer;
    void *priv;
    int (*configure_chip)(struct spinand_device *spinand, enum spinand_bus_interface iface);
    bool cont_read_possible;
    int (*set_cont_read)(struct spinand_device *spinand, bool enable);
    int (*set_randomizer)(struct spinand_device *spinand, bool enable);
    const struct spinand_fact_otp *fact_otp;
    const struct spinand_user_otp *user_otp;
    unsigned int read_retries;
    int (*set_read_retry)(struct spinand_device *spinand, unsigned int retry_mode);
};

πŸ’… Members πŸ’…

  • base β€” NAND device instance. the literal foundation, slay πŸ’–
  • spimem β€” pointer to the SPI mem object.
  • lock β€” lock used to serialize accesses to the NAND.
  • id β€” NAND ID as returned by READ_ID.
  • flags β€” NAND flags.
  • ssdr_op_templates β€” templates for all single SDR SPI mem operations.
  • odtr_op_templates β€” templates for all octal DTR SPI mem operations.
  • op_templates β€” templates for all SPI mem operations.
  • bus_iface β€” current bus interface.
  • select_target β€” select a specific target/die. usually called before sending a command addressing a page or an eraseblock embedded in this die. only required if your chip exposes several dies πŸ‘‘
  • cur_target β€” currently selected target/die.
  • eccinfo β€” on-die ECC information.
  • cfg_cache β€” config register cache. one entry per die.
  • databuf β€” bounce buffer for data.
  • oobbuf β€” bounce buffer for OOB data.
  • scratchbuf β€” buffer used for everything but page accesses. this is needed because the spi-mem interface explicitly requests that buffers passed in spi_mem_op be DMA-able, so we can't based the bufs on the stack 😭
  • manufacturer β€” SPI NAND manufacturer information.
  • priv β€” manufacturer private data.
  • configure_chip β€” align the chip configuration with the core settings.
  • cont_read_possible β€” field filled by the core once the whole system configuration is known to tell whether continuous reads are suitable to use or not in general with this chip/configuration. a per-transfer check must of course be done to ensure it is actually relevant to enable this feature. yes bestie, it's a whole sentence, and it ate πŸ’…
  • set_cont_read β€” enable/disable the continuous read feature.
  • set_randomizer β€” enable/disable the randomizer feature.
  • fact_otp β€” SPI NAND factory OTP info.
  • user_otp β€” SPI NAND user OTP info.
  • read_retries β€” the number of read retry modes supported.
  • set_read_retry β€” enable/disable the read retry feature.
tiny note for the completionists: dirmaps is in the struct as struct spinand_dirmap *dirmaps; β€” the Members list above doesn't hand it a separate blurb, so I'm not gonna invent one πŸ™ˆ

πŸ”— SEE ALSO πŸ”—

kernel file: ./include/linux/mtd/spinand.h πŸ¦‹

  • struct spinand_id(9)
  • struct spinand_devid(9)
  • struct spinand_manufacturer(9)
  • struct spinand_op_variants(9)
  • struct spinand_ondie_ecc_conf(9)
  • struct spinand_otp_layout(9)
  • struct spinand_fact_otp_ops(9)
  • struct spinand_user_otp_ops(9)
  • struct spinand_fact_otp(9)
  • struct spinand_user_otp(9)
  • enum spinand_bus_interface(9)
  • struct spinand_info(9)
  • struct spinand_mem_ops(9)
  • mtd_to_spinand(9)
  • spinand_to_mtd(9)
  • nand_to_spinand(9)
  • spinand_to_nand(9)
  • spinand_set_of_node(9)

bye bestie, this page is signing off from ./include/linux/mtd, dated October 2026, and it's all about struct spinand_device(9) β€” mwah πŸ’‹βœ¨

πŸ“¦ where this page comes from