spi_nor_read_sfdp(9)
π spi_nor_read_sfdp(9) β bestie edition
okay so this is a page from the Kernel API Manual, and the function we're stanning today is spi_nor_read_sfdp(9). it's giving "let me just peek at the flash's little rΓ©sumΓ©" energy, and honestly? iconic.
β¨ NAME β¨
spi_nor_read_sfdp β read Serial Flash Discoverable Parameters. literally the flash chip handing you its business card π«Ά
πΈ SYNOPSIS πΈ
int spi_nor_read_sfdp (struct spi_nor *nor , u32 addr , size_t len ,
void *buf );
π ARGUMENTS π
norβ pointer to astruct spi_nor. this is your main character, the flash device you're talking to πaddrβ the offset in the SFDP area where you wanna start reading data from. like picking which page of the rΓ©sumΓ© to start on πlenβ number of bytes to read. how much tea you're asking for βbufβ the buffer where the SFDP data get copied into. and heads up: it has to be dma-safe memory β do not skimp on this, it's not a vibe to ignore π«
π¦ DESCRIPTION π¦
so here's the thing, bestie: no matter what the actual numbers of bytes for address and dummy cycles happen to be for (Fast) Read commands, the Read SFDP (5Ah) instruction is always followed by a 3-byte address and 8 dummy clock cycles. always always. no notes, no exceptions, no "but what if" β that's just how it is β¨
π₯ RETURN π₯
0 on success, -errno otherwise. so likeβ¦ hit me with that zero and we're golden, anything else and it's a whole mood π
π SEE ALSO π
Kernel file ./drivers/mtd/spi-nor/sfdp.c plus the whole friend group:
spi_nor_read_raw(9)spi_nor_read_sfdp_dma_unsafe(9)spi_nor_set_erase_settings_from_bfpt(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)
that's the whole page, bestie!! π₯³ this gem lives in <code>./drivers/mtd/spi-nor</code> and the version we were reading is dated <strong>October 2026</strong> β go forth and read those discoverable parameters πβ¨
π¦ 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