cypress_nor_..._mode_by_sr1(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸŽ€ 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 a struct 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 πŸ”₯

  • 0 on success β€” slay, we nailed it πŸŽ‰
  • -errno otherwise β€” 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:


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