STRUCT NAND_DEVICE(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

✨ struct nand_device(9) ✨

okay bestie so this is a page from the Kernel API Manual and it's all about struct nand_device β€” literally the blueprint for a NAND device πŸ’… let's get into it


πŸŽ€ NAME πŸŽ€

struct nand_device β€” NAND device, that's the whole vibe


🌸 SYNOPSIS 🌸

struct nand_device {
    struct mtd_info mtd;
    struct nand_memory_organization memorg;
    struct nand_ecc ecc;
    struct nand_row_converter rowconv;
    struct nand_bbt bbt;
    const struct nand_ops *ops;
 };

πŸ’– Members πŸ’–

  • mtd β€” the MTD instance that's attached to the NAND device, it's giving main character energy fr
  • memorg β€” memory layout, the whole map of it
  • ecc β€” the NAND ECC object attached to the NAND device ✨
  • rowconv β€” converter that turns a position into a row address
  • bbt β€” bad block table info, no cap
  • ops β€” the NAND operations attached to the NAND device

πŸ¦‹ Description πŸ¦‹

So this is the generic NAND object, okay?

The specialized NAND layers β€” you know the ones, raw NAND, SPI NAND, OneNAND β€” they should declare their own NAND object that embeds a nand_device struct. Yup, that's literally how inheritance is done around here 😌 iconic.

Both struct_nand_device->memorg and struct_nand_device->ecc.requirements need to be filled in at device detection time so they reflect what the NAND device can do and what it needs (capabilities/requirements, yk).

Once that's done, you can call nanddev_init 🫢 It handles converting NAND info into MTD info for you, which means the specialized NAND layers should never manually tweak struct_nand_device->mtd β€” the one exception is the ->_read/write hooks, obvi.

bestie this part matters: don't go hand-editing ->mtd yourself, let nanddev_init do it πŸ’€

πŸ‘‘ SEE ALSO πŸ‘‘

Kernel file ./include/linux/mtd/nand.h, plus a whole friend group of references:


and that's the whole page bestie πŸ“ this one came from ./include/linux/mtd and it's dated October 2026, filed under struct nand_device(9) β€” periodt πŸ’œ

πŸ“¦ where this page comes from