STRUCT SPI_NOR(9)
okay so bestie, this is struct spi_nor(9) from the Kernel API Manual β yes, the big one β and it's lowkey iconic. π
π NAME π
struct spi_nor β the structure for defining the SPI NOR layer. that's the whole assignment, and it ate, periodt. β¨
β¨ SYNOPSIS β¨
here's the entire struct, no cap β every field exactly as it appears:
struct spi_nor {
struct mtd_info mtd;
struct mutex lock;
struct spi_nor_rww {
wait_queue_head_t wait;
bool ongoing_io;
bool ongoing_rd;
bool ongoing_pe;
unsigned int used_banks;
} rww;
struct device *dev;
struct spi_mem *spimem;
u8 *bouncebuf;
size_t bouncebuf_size;
u8 *id;
const struct flash_info *info;
const struct spi_nor_manufacturer *manufacturer;
u8 addr_nbytes;
u8 erase_opcode;
u8 read_opcode;
u8 read_dummy;
u8 program_opcode;
enum spi_nor_protocol read_proto;
enum spi_nor_protocol write_proto;
enum spi_nor_protocol reg_proto;
bool sst_write_second;
u32 flags;
enum spi_nor_cmd_ext cmd_ext_type;
struct sfdp *sfdp;
struct dentry *debugfs_root;
u8 dfs_sr_cache[2];
const struct spi_nor_controller_ops *controller_ops;
struct spi_nor_flash_parameter *params;
struct {
struct spi_mem_dirmap_desc *rdesc;
struct spi_mem_dirmap_desc *wdesc;
} dirmap;
void *priv;
};
π§Έ Members π§Έ
vibe check on every single member β no skips, no crumbs left behind:
mtdβ anmtd_infostructurelockβ the lock for the read/write/erase/lock/unlock operationsrwwβ Read-While-Write (RWW) sync lockrww.waitβ wait queue for the RWW syncrww.ongoing_ioβ the bus is busyrww.ongoing_rdβ a read is ongoing on the chiprww.ongoing_peβ a program/erase is ongoing on the chiprww.used_banksβ bitmap of the banks in use
devβ pointer to an SPI device or an SPI NOR controller devicespimemβ pointer to the SPI memory devicebouncebufβ bounce buffer used when the buffer passed by the MTD layer is not DMA-ablebouncebuf_sizeβ size of the bounce bufferidβ The flash's ID bytes. Always containsSPI_NOR_MAX_ID_LENbytes.infoβ SPI NOR part JEDEC MFR ID and other infomanufacturerβ SPI NOR manufactureraddr_nbytesβ number of address byteserase_opcodeβ the opcode for erasing a sectorread_opcodeβ the read opcoderead_dummyβ the dummy needed by the read operationprogram_opcodeβ the program opcoderead_protoβ the SPI protocol for read operationswrite_protoβ the SPI protocol for write operationsreg_protoβ the SPI protocol for read_reg/write_reg/erase operationssst_write_secondβ used by the SST write operationflagsβ flag options for the current SPI NOR (SNOR_F_*)cmd_ext_typeβ the command opcode extension type for DTR mode.sfdpβ the SFDP data of the flashdebugfs_rootβ pointer to the debugfs directorydfs_sr_cacheβ Status Register cached value for debugfs use onlycontroller_opsβ SPI NOR controller driver specific operations.paramsβ[FLASH-SPECIFIC]SPI NOR flash parameters and settings. The structure includes legacy flash parameters and settings that can be overwritten by thespi_nor_fixupshooks, or dynamically when parsing the SFDP tables.dirmapβ pointers tostruct spi_mem_dirmap_descfor reads/writes.privβ pointer to the private data
π SEE ALSO π
go peek at the Kernel file ./include/linux/mtd/spi-nor.h, plus these besties: struct spi_nor_hwcaps(9), struct spi_nor_controller_ops(9), enum spi_nor_cmd_ext(9), and spi_nor_scan(9). iykyk π
that's the whole page, bestie π«Ά. footer energy: source/version ./include/linux/mtd, date October 2026, title struct spi_nor(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