STRUCT SPI_NOR(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

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 β€” an mtd_info structure
  • lock β€” the lock for the read/write/erase/lock/unlock operations
  • rww β€” Read-While-Write (RWW) sync lock
    • rww.wait β€” wait queue for the RWW sync
    • rww.ongoing_io β€” the bus is busy
    • rww.ongoing_rd β€” a read is ongoing on the chip
    • rww.ongoing_pe β€” a program/erase is ongoing on the chip
    • rww.used_banks β€” bitmap of the banks in use
  • dev β€” pointer to an SPI device or an SPI NOR controller device
  • spimem β€” pointer to the SPI memory device
  • bouncebuf β€” bounce buffer used when the buffer passed by the MTD layer is not DMA-able
  • bouncebuf_size β€” size of the bounce buffer
  • id β€” The flash's ID bytes. Always contains SPI_NOR_MAX_ID_LEN bytes.
  • info β€” SPI NOR part JEDEC MFR ID and other info
  • manufacturer β€” SPI NOR manufacturer
  • addr_nbytes β€” number of address bytes
  • erase_opcode β€” the opcode for erasing a sector
  • read_opcode β€” the read opcode
  • read_dummy β€” the dummy needed by the read operation
  • program_opcode β€” the program opcode
  • read_proto β€” the SPI protocol for read operations
  • write_proto β€” the SPI protocol for write operations
  • reg_proto β€” the SPI protocol for read_reg/write_reg/erase operations
  • sst_write_second β€” used by the SST write operation
  • flags β€” 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 flash
  • debugfs_root β€” pointer to the debugfs directory
  • dfs_sr_cache β€” Status Register cached value for debugfs use only
  • controller_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 the spi_nor_fixups hooks, or dynamically when parsing the SFDP tables.
  • dirmap β€” pointers to struct spi_mem_dirmap_desc for 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