STRUCT SPI_NOR_CONTROLLER_OPS(9)
π struct spi_nor_controller_ops(9) π
okay so bestie, welcome to the Kernel API Manual β we're looking at struct spi_nor_controller_ops today and honestly? it's giving backstage-pass energy. ποΈβ¨
πΈ NAME πΈ
struct spi_nor_controller_ops β the SPI NOR controller driver specific operations. literally the little hook table your controller driver fills in so the generic SPI NOR code knows how to actually talk to your hardware. no cap. π¦
β¨ SYNOPSIS β¨
struct spi_nor_controller_ops {
int (*prepare)(struct spi_nor *nor);
void (*unprepare)(struct spi_nor *nor);
int (*read_reg)(struct spi_nor *nor, u8 opcode, u8 *buf, size_t len);
int (*write_reg)(struct spi_nor *nor, u8 opcode, const u8 *buf, size_t len);
ssize_t (*read)(struct spi_nor *nor, loff_t from, size_t len, u8 *buf);
ssize_t (*write)(struct spi_nor *nor, loff_t to, size_t len, const u8 *buf);
int (*erase)(struct spi_nor *nor, loff_t offs);
};
it's just a struct full of function pointers and every single one of them gets a struct spi_nor *nor as its first argument. main character struct, honestly. π
π Members π
prepareβ [OPTIONAL] does some preparations for the read/write/erase/lock/unlock operations. like doing your skincare before the event, but for flash I/O. π§ββοΈunprepareβ [OPTIONAL] does some post work after the read/write/erase/lock/unlock operations. the wind-down. the debrief. the "okay we're done here." π«Άread_regβ reads out the register. that's it, that's the whole vibe. πwrite_regβ writes data to the register. βοΈreadβ reads data from the SPI NOR. π₯writeβ writes data to the SPI NOR. π€eraseβ erases a sector of the SPI NOR at the offset offs. and here's the tea β: if the driver doesn't provide this one, SPI NOR will send the erase opcode viawrite_reginstead. so it's lowkey optional but the fallback path is real. iykyk. π₯
ngl bestie,prepareandunprepareare marked[OPTIONAL]β the rest are just... the job. no skipping. π
π¦ SEE ALSO π¦
- Kernel file
./include/linux/mtd/spi-nor.h struct spi_nor_hwcaps(9)enum spi_nor_cmd_ext(9)struct spi_nor(9)spi_nor_scan(9)
and that's the whole page, bestie!! π go read spi-nor.h, it's literally right there. this lil gem lives in ./include/linux/mtd, dated October 2026, and the page itself is called struct spi_...ntroller_ops(9) (yes the ellipsis is canon, don't @ me). slay, bye! ππβ
π¦ 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