spi_nor_set_...gs_from_bfpt(9)
π spi_nor_set_erase_settings_from_bfpt(9)
okay so this is a page from the Kernel API Manual, and honestly? it's a little function that does one very specific little thing and does it beautifully. let's get into it π
β¨ NAME β¨
spi_nor_set_erase_settings_from_bfpt β bestie, it sets the erase type settings straight from the BFPT. that's the whole job. no cap. π
πΈ SYNOPSIS πΈ
void spi_nor_set_erase_settings_from_bfpt (struct spi_nor_erase_type
*erase , u32 size , u8 opcode , u8 i );
like, it returns nothing (void), it takes four things, and it's literally just here to hand you the vibe of an erase type. iconic behavior honestly β¨
π¦ ARGUMENTS π¦
eraseβ a pointer to a structure that describes a SPI NOR erase type. it's giving "here's the blank canvas, go fill it in" π¨sizeβ the size of the sector/block that this erase type erases. big block energy or tiny block energy, you decide π«opcodeβ the SPI command op code used to erase that sector/block. the literal instruction, the main character of the operation πiβ the erase type index as sorted in the Basic Flash Parameter Table. remember this one, it comes back later (see below, iykyk) π₯
π DESCRIPTION π
so here's the tea, bestie π΅ β the supported Erase Types get sorted at init in ascending order, and the smallest Erase Type size ends up as the first member in the erase_type array of the spi_nor_erase_map structure. so like, smallest first, always, that's the rule π
what this function does is save the Erase Type index as sorted in the Basic Flash Parameter Table, and the reason it bothers is genuinely important: that index gets used later on to synchronize with the supported Erase Types defined in SFDP optional tables. so don't lose it, okay? it's load-bearing π«Ά
π SEE ALSO π
kernel file ./drivers/mtd/spi-nor/sfdp.c β go read it, it's right there π
and the whole friend group:
spi_nor_read_raw(9)spi_nor_read_sfdp(9)spi_nor_read_sfdp_dma_unsafe(9)spi_nor_map_cmp_erase_type(9)spi_nor_sort_erase_mask(9)spi_nor_regions_sort_erase_types(9)spi_nor_parse_bfpt(9)spi_nor_smpt_addr_nbytes(9)spi_nor_smpt_read_dummy(9)spi_nor_get_map_in_use(9)spi_nor_region_check_overlay(9)spi_nor_init_non_uniform_erase_map(9)spi_nor_parse_smpt(9)spi_nor_parse_4bait(9)spi_nor_parse_profile1(9)spi_nor_parse_sccr(9)spi_nor_parse_sccr_mc(9)spi_nor_post_sfdp_fixups(9)spi_nor_check_sfdp_signature(9)spi_nor_parse_sfdp(9)
okay that's the whole page, go forth and sort your erase types ascendingly, mwah π
sign-off time π this little masterpiece lives in ./drivers/mtd/spi-nor, it's dated October 2026, and it's from the Kernel API Manual (version: the kernel's own, bestie, it's a kernel doc). slay, 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