cypress_nor_..._mode_by_sr1(9)
π NAME π
cypress_nor_determine_addr_mode_by_sr1 β the little function that figures out what address mode (3-byte or 4-byte, bestie, we're talking width here) you're currently in, by going and asking status register 1 (SR1) directly π
Okay so real talk, this lives in the Kernel API Manual, and honestly? She's giving "detective but make it SPI NOR." πβ¨
β¨ SYNOPSIS β¨
int cypress_nor_determine_addr_mode_by_sr1 (struct spi_nor *nor , u8
*addr_mode );
Not me dropping the signature exactly as-is because we do not freestyle the prototype in this house π«Ά
πΈ ARGUMENTS πΈ
norβ a pointer to astruct spi_nor. That's your chip's whole situation, right there. πaddr_modeβ a pointer to a buffer where we return the determined address mode. Yes, it's where the answer goes when we're done sleuthing π΅οΈββοΈπ
π« DESCRIPTION π«
So here's the vibe: this function tries to determine the current address mode by comparing the SR1 value from three different reads:
RDSR1(no address) β literally just asking, no address attached πRDAR(3-byte address) β asking with a 3-byte address flavor πRDAR(4-byte address) β asking with a 4-byte address flavor π¦
She compares all three and that's how the current address mode gets determined. Comparison is the whole personality. Iconic behavior, no notes. β¨
π₯ RETURN π₯
0on success β slay, we nailed it π-errnootherwise β bestie it went wrong and the errno will tell you how π
π SEE ALSO π
Kernel file ./drivers/mtd/spi-nor/spansion.c and the whole friend group:
spansion_nor_params(9)spansion_nor_clear_sr(9)cypress_nor_sr_ready_and_clear(9)cypress_nor_quad_enable_volatile(9)cypress_nor_set_addr_mode_nbytes(9)cypress_nor_get_page_size(9)cypress_nor_set_octal_dtr(9)spansion_nor_sr_ready_and_clear(9)
And that's the whole page, bestie π This one lives in ./drivers/mtd/spi-nor, dated October 2026, and it's part of the Kernel API Manual. Go read the source, it's lowkey gorgeous. Periodt. ππΈ
π¦ 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