spi_nor_read_sfdp(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… 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 a struct 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:


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