STRUCT FLASH_INFO(9)
π struct flash_info(9)
okay bestie, welcome to struct flash_info(9) from the Kernel API Manual β¨ β this is the little glow-up card that tells the kernel everything it needs to know about one SPI NOR flash chip. Think of it as the flash's profile pic and bio combined π
β¨ NAME β¨
struct flash_info β SPI NOR flash_info entry. literally the whole personality of a flash chip in one struct π
πΈ SYNOPSIS πΈ
struct flash_info {
char *name;
const struct spi_nor_id *id;
size_t size;
unsigned sector_size;
u16 page_size;
u8 n_banks;
u8 addr_nbytes;
u16 flags;
#define SPI_NOR_HAS_LOCK BIT(0);
#define SPI_NOR_HAS_TB BIT(1);
#define SPI_NOR_TB_SR_BIT6 BIT(2);
#define SPI_NOR_4BIT_BP BIT(3);
#define SPI_NOR_BP3_SR_BIT6 BIT(4);
#define SPI_NOR_SWP_IS_VOLATILE BIT(5);
#define SPI_NOR_NO_ERASE BIT(6);
#define SPI_NOR_QUAD_PP BIT(8);
#define SPI_NOR_RWW BIT(9);
#define SPI_NOR_HAS_CMP BIT(10);
u8 no_sfdp_flags;
#define SPI_NOR_SKIP_SFDP BIT(0);
#define SECT_4K BIT(1);
#define SPI_NOR_DUAL_READ BIT(3);
#define SPI_NOR_QUAD_READ BIT(4);
#define SPI_NOR_OCTAL_READ BIT(5);
#define SPI_NOR_OCTAL_DTR_READ BIT(6);
#define SPI_NOR_OCTAL_DTR_PP BIT(7);
u8 fixup_flags;
#define SPI_NOR_4B_OPCODES BIT(0);
#define SPI_NOR_IO_MODE_EN_VOLATILE BIT(1);
u8 mfr_flags;
const struct spi_nor_otp_organization *otp;
const struct spi_nor_fixups *fixups;
};
no cap, that's the whole thing π
π¦ Members π¦
nameβ (obsolete) the name of the flash. Do not set it for new additions, bestie, it's giving legacy energy πidβ pointer tostruct spi_nor_idorNULL, which means "no ID" (mostly older chips). so if a chip has no ID, it just shows up with no ID, iconic πsizeβ the size of the flash in bytes. The flash size is one property parsed by the SFDP. We use it as an indicator whether we need SFDP parsing for a particular flash. I.e. non-legacy flash entries inflash_infowill have a size of zero iff SFDP should be used. sosize == 0is the "pls parse my SFDP" bat signal π₯sector_sizeβ (optional) the size listed here is what works withSPINOR_OP_SE, which isn't necessarily called a "sector" by the vendor. Defaults to64k. vendors really be naming things however they want πpage_sizeβ (optional) the flash's page size. Defaults to256.n_banksβ (optional) the number of banks. Defaults to1.addr_nbytesβ number of address bytes to send.flagsβ flags that indicate support that is not defined by the JESD216 standard in its SFDP tables. Flag meanings:SPI_NOR_HAS_LOCKβ flash supports lock/unlock via SR.SPI_NOR_HAS_TBβ flash SR has Top/Bottom (TB) protect bit. Must be used withSPI_NOR_HAS_LOCK.SPI_NOR_TB_SR_BIT6β Top/Bottom (TB) is bit 6 of status register. Must be used withSPI_NOR_HAS_TB.SPI_NOR_4BIT_BPβ flash SR has 4 bit fields (BP0-3) for block protection.SPI_NOR_BP3_SR_BIT6β BP3 is bit 6 of status register. Must be used withSPI_NOR_4BIT_BP.SPI_NOR_SWP_IS_VOLATILEβ flash has volatile software write protection bits. Usually these will power-up in a write-protected state.SPI_NOR_NO_ERASEβ no erase command needed.SPI_NOR_QUAD_PPβ flash supports Quad Input Page Program.SPI_NOR_RWWβ flash supports reads while write.SPI_NOR_HAS_CMPβ flash SR2 has complement (CMP) protect bit. Must be used withSPI_NOR_HAS_LOCK.
no_sfdp_flagsβ flags that indicate support that can be discovered via SFDP. Used when SFDP tables are not defined in the flash. These flags are used together with theSPI_NOR_SKIP_SFDPflag. Meanings:SPI_NOR_SKIP_SFDPβ skip parsing of SFDP tables.SECT_4KβSPINOR_OP_BE_4Kworks uniformly.SPI_NOR_DUAL_READβ flash supports Dual Read.SPI_NOR_QUAD_READβ flash supports Quad Read.SPI_NOR_OCTAL_READβ flash supports Octal Read.SPI_NOR_OCTAL_DTR_READβ flash supports octal DTR Read.SPI_NOR_OCTAL_DTR_PPβ flash supports Octal DTR Page Program.
fixup_flagsβ flags that indicate support that can be discovered via SFDP ideally, but can not be discovered for this particular flash because the SFDP table that indicates this support is not defined by the flash. In case the table for this support is defined but has wrong values, one should instead use apost_sfdphook to set theSNOR_Fequivalent flag. (yes, that's the whole vibe of this field π )mfr_flagsβ manufacturer private flags. Used in the manufacturer fixup hooks to differentiate support between flashes of the same manufacturer.fixupsβ part specific fixup hooks.
π Description π
okay so these two belong to fixup_flags, and here's what they actually mean π
SPI_NOR_4B_OPCODESβ use dedicated 4byte address op codes to support memory size above128Mib.SPI_NOR_IO_MODE_EN_VOLATILEβ flash enables the best available I/O mode via a volatile bit.
ngl these are the ones that make the SFDP tables go "not defined by this flash" and you're out here doing the fixups manually. it's giving main character energy π«Ά
π SEE ALSO π
Kernel file ./drivers/mtd/spi-nor/core.h and also, bestie, go read these:
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_flash_parameter(9)struct spi_nor_fixups(9)struct spi_nor_id(9)struct spi_nor_manufacturer(9)struct sfdp(9)spi_nor_needs_sfdp(9)
π and that's the whole page, bestie! this one's from ./drivers/mtd/spi-nor, dated October 2026, page struct flash_info(9) β slay, go forth and describe your flash chips correctly πβ¨π
π¦ 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