STRUCT SPI_NOR_FLASH_PARAMETER(9)
π 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 to1. 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 toSPINOR_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
- 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