STRUCT SPINAND_DEVICE(9)
β¨ 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 byREAD_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 inspi_mem_opbe 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:dirmapsis in the struct asstruct 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
- 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