STRUCT SPI_NOR_FLASH_PARAMETER(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct spi_nor_flash_parameter(9) β€” Kernel API Manual ✨

okay bestie, welcome to the kernel API manual, this one's literally about SPI NOR flash parameters and settings, no cap 🫢


πŸŽ€ NAME πŸŽ€

struct spi_nor_flash_parameter β€” SPI NOR flash parameters and settings.

It's giving "everything you need to know about this flash chip in one struct." This thing includes all the legacy flash parameters and settings β€” the ones that can be overwritten by the spi_nor_fixups hooks, or overwritten dynamically when the kernel is parsing the JESD216 Serial Flash Discoverable Parameters (SFDP) tables. Two glow-up paths, pick your fighter πŸ’–


✨ SYNOPSIS ✨

struct spi_nor_flash_parameter {
    u64 bank_size;
    u64 size;
    u32 writesize;
    u32 page_size;
    u8 addr_nbytes;
    u8 addr_mode_nbytes;
    u8 rdsr_dummy;
    u8 rdsr_addr_nbytes;
    u8 n_banks;
    u8 n_dice;
    u8 die_erase_opcode;
    u32 *vreg_offset;
    struct spi_nor_hwcaps           hwcaps;
    struct spi_nor_read_command     reads[SNOR_CMD_READ_MAX];
    struct spi_nor_pp_command       page_programs[SNOR_CMD_PP_MAX];
    struct spi_nor_erase_map        erase_map;
    struct spi_nor_otp              otp;
    int (*set_octal_dtr)(struct spi_nor *nor, bool enable);
    int (*quad_enable)(struct spi_nor *nor);
    int (*set_4byte_addr_mode)(struct spi_nor *nor, bool enable);
    int (*ready)(struct spi_nor *nor);
    const struct spi_nor_locking_ops *locking_ops;
    void *priv;
 };

like, look at her. absolutely iconic field lineup πŸ‘‘


🌸 Members 🌸

tour time, bestie β€” every single field, and what it's actually doing:

  • bank_size β€” the flash memory bank density, in bytes. your bank's size, literally πŸ’Έ
  • size β€” the total flash memory density in bytes. the whole thing, the full meal.
  • writesize β€” the minimal writable flash unit size. it defaults to 1. for ECC-ed flashes, set this to the ECC unit size, periodt.
  • page_size β€” the page size of the SPI NOR flash memory πŸ“„
  • addr_nbytes β€” number of address bytes to send.
  • addr_mode_nbytes β€” number of address bytes of the current address mode. highkey useful when the flash operates with 4B opcodes but still needs the internal address mode for opcodes that don't have a 4B opcode correspondent. iykyk 🧚
  • rdsr_dummy β€” dummy cycles needed for the Read Status Register command in octal DTR mode.
  • rdsr_addr_nbytes β€” dummy address bytes needed for the Read Status Register command in octal DTR mode.
  • n_banks β€” number of banks.
  • n_dice β€” number of dice in the flash memory. yes, dice 🎲 (that's the plural of die here, not the thing you roll, don't come for me)
  • die_erase_opcode β€” die erase opcode. defaults to SPINOR_OP_CHIP_ERASE.
  • vreg_offset β€” volatile register offset for each die.
  • hwcaps β€” describes the read and page program hardware capabilities.
  • reads β€” read capabilities, ordered by priority: the higher the index in the array, the higher the priority. queue up, besties πŸ’…
  • page_programs β€” page program capabilities, ordered by priority: the higher the index in the array, the higher the priority. same energy, different array.
  • erase_map β€” the erase map parsed from the SFDP Sector Map Parameter Table.
  • otp β€” SPI NOR OTP info.
  • set_octal_dtr β€” enables or disables SPI NOR octal DTR mode.
  • quad_enable β€” enables SPI NOR quad mode.
  • set_4byte_addr_mode β€” puts the SPI NOR in 4 byte addressing mode.
  • ready β€” (optional) some flashes might use a different mechanism than reading the status register to indicate they are ready for a new command. not all heroes read the status register πŸ™ˆ
  • locking_ops β€” SPI NOR locking methods.
  • priv β€” the flash's private data. mind your business, it's private πŸ’€

πŸ¦‹ SEE ALSO πŸ¦‹

go read these next, bestie, they're all in the same friend group:

  • Kernel file ./drivers/mtd/spi-nor/core.h
  • struct spi_nor_erase_type(9)
  • struct spi_nor_erase_command(9)
  • struct spi_nor_erase_region(9)
  • struct spi_nor_erase_map(9)
  • struct spi_nor_locking_ops(9)
  • struct spi_nor_otp_organization(9)
  • struct spi_nor_otp_ops(9)
  • struct spi_nor_otp(9)
  • struct spi_nor_fixups(9)
  • struct spi_nor_id(9)
  • struct flash_info(9)
  • struct spi_nor_manufacturer(9)
  • struct sfdp(9)
  • spi_nor_needs_sfdp(9)

🌈 sign-off 🌈

this lil masterpiece lives in ./drivers/mtd/spi-nor, dated October 2026, and it's the struct spi_n...sh_parameter(9) page β€” go forth and flash responsibly, ily, bye πŸ«ΆπŸ’–βœ¨

πŸ“¦ where this page comes from