STRUCT PLATFORM_NAND_CTRL(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ struct platform_nand_ctrl(9) ✨

okay so picture this: it's giving Kernel API Manual energy, and today's main character is struct platform_nand_ctrl β€” the controller level device structure. that's the whole vibe. bestie, this is the struct you reach for when you're working at the controller layer of NAND flash, and honestly? she's iconic. πŸ’…


πŸŽ€ NAME πŸŽ€

struct platform_nand_ctrl β€” the controller level device structure. literally what it says on the tin, no cap. 🌸


πŸ¦‹ SYNOPSIS πŸ¦‹

here's the whole glow-up, verbatim, don't touch the code bestie:

       struct platform_nand_ctrl {
           int (*probe)(struct platform_device *pdev);
           void (*remove)(struct platform_device *pdev);
           int (*dev_ready)(struct nand_chip *chip);
           void (*select_chip)(struct nand_chip *chip, int cs);
           void (*cmd_ctrl)(struct nand_chip *chip, int dat, unsigned int
       ctrl);
           void (*write_buf)(struct nand_chip *chip, const uint8_t *buf, int
       len);
           void (*read_buf)(struct nand_chip *chip, uint8_t *buf, int len);
           void *priv;
        };

like, look at all those function pointers. she's fully stacked. 🫢


πŸ’– Members πŸ’–

okay let's meet the cast, one by one, no skipping πŸ“‹

  • probe β€” the platform specific function that probes/sets up the hardware. it's the "hey bestie, wake up, we're doing this" moment. ✨
  • remove β€” the platform specific function that removes/tears down the hardware. it's the goodbye. 😭 tear down responsibly.
  • dev_ready β€” the platform specific function that reads the ready/busy pin. she's just checking in on you, that's all. πŸ’€
  • select_chip β€” the platform specific chip select function. picking your fave, one chip at a time πŸ‘‘
  • cmd_ctrl β€” the platform specific function for controlling ALE/CLE/nCE. also used to write command and address. miss girl is doing so much work, highkey the busiest one here πŸ”₯
  • write_buf β€” the platform specific function for write buffer. sending the data out πŸ’Œ
  • read_buf β€” the platform specific function for read buffer. receiving the data in. the way that these two are a matched set, i can't 🌈
  • priv β€” private data to transport driver specific settings. it's the little handbag where your driver keeps its own stuff πŸŽ€

🌟 Description 🌟

okay so the important thing, and i need you to hear me on this:

all fields are optional and depend on the hardware driver requirements πŸ’…

every single one. optional. none of them are the moment until your hardware driver says they are. so don't stress about filling the whole struct, just fill what your hardware actually needs. fr fr. πŸ¦‹


πŸ‘€ SEE ALSO πŸ‘€

go read these next, bestie, i'm obsessed with cross-referencing:

  • the kernel file ./include/linux/mtd/platnand.h
  • struct platform_nand_chip(9)
  • struct platform_nand_data(9)

and that's the tea πŸ“ this little write-up lives in ./include/linux/mtd, dated October 2026 β€” same header/footer energy, just cuter. mwah, go read your structs πŸ’œπŸ§šβ€β™€οΈ

πŸ“¦ where this page comes from