spi_nor_parse_bfpt(9)

๐Ÿ“ฆ version 7.3.1, in nixpkgs unstable

๐Ÿ’… spi_nor_parse_bfpt(9) โ€” like, the Kernel API Manual page, bestie โœจ

okay so this is a page from the Kernel API Manual and it's about spi_nor_parse_bfpt โ€” which literally reads and parses the Basic Flash Parameter Table. yes that's a mouthful, we'll get there ๐ŸŽ€


โœจ NAME โœจ

spi_nor_parse_bfpt โ€” read and parse the Basic Flash Parameter Table ๐Ÿ’–


๐ŸŒธ SYNOPSIS ๐ŸŒธ

int spi_nor_parse_bfpt (struct spi_nor *nor , const struct
       sfdp_parameter_header *bfpt_header );

like, it takes two things and returns an int, that's the whole vibe ๐Ÿฆ‹


๐ŸŽ€ ARGUMENTS ๐ŸŽ€

  • nor โ€” pointer to a 'struct spi_nor' ๐Ÿ’ซ
  • bfpt_header โ€” pointer to the 'struct sfdp_parameter_header' that's describing the Basic Flash Parameter Table's length and version ๐Ÿ‘‘

๐Ÿ”ฅ DESCRIPTION ๐Ÿ”ฅ

okay so picture this: the Basic Flash Parameter Table is the main and only mandatory table as defined by the SFDP (JESD216) specification. like, it's the main character, there is no skipping it ๐Ÿ’…

what it gives us:

  • the total size (memory density) of the data array ๐Ÿ“
  • the number of address bytes for Fast Read, Page Program and Sector Erase commands ๐Ÿงฎ

and for Fast READ commands, it also hands us the number of mode clock cycles and wait states โ€” all regrouped into the number of dummy clock cycles โ€” for each supported instruction op code โฑ๏ธโœจ

for Page Program, the page size is now available since JESD216 rev A ๐ŸŽ‰ but the supported instruction op codes are still not provided, which is giving unfinished business ngl ๐Ÿ™ˆ

for Sector Erase commands, this table stores the supported instruction op codes and the associated sector sizes ๐Ÿ—‚๏ธ

and finally (yes there's more, she's thorough ๐Ÿ’…): the Quad Enable Requirements (QER) are also available since JESD216 rev A. The QER bits encode the manufacturer dependent procedure that you have to execute to set the Quad Enable (QE) bit in some internal register of the Quad SPI memory ๐Ÿ”ง

fr fr โ€” the QE bit, when it exists, must be set before sending any Quad SPI command to the memory. no skipping ahead bestie ๐Ÿ˜ญ

so what's actually happening when you set it? setting the QE bit tells the memory to reassign its WP# and HOLD#/RESET# pins to functions IO2 and IO3 โ€” hence enabling 4 (Quad) I/O lines ๐ŸŒˆ slay.


โญ RETURN โญ

0 on success, -errno otherwise. that's it, that's the return ๐Ÿ˜Œ


๐Ÿฆ‹ SEE ALSO ๐Ÿฆ‹

kernel file ./drivers/mtd/spi-nor/sfdp.c ๐Ÿ‘€ plus the whole friend group:


okay and before you go โ€” cute lil sign-off ๐Ÿ’– this page lives in ./drivers/mtd/spi-nor and it's dated October 2026. go read the source, ily, bye ๐Ÿซถโœจ

๐Ÿ“ฆ where this page comes from