STRUCT NAND_CONTROLLER_OPS(9)
π struct nand_controller_ops(9)
okay so this is a page from the Kernel API Manual, and it's literally the cheat sheet for struct nand_controller_ops β the controller operations table. bestie, this is where your NAND controller driver gets to show off its main character energy β¨
πΈ NAME πΈ
struct nand_controller_ops β Controller operations. that's it, that's the vibe π
β¨ SYNOPSIS β¨
struct nand_controller_ops {
int (*attach_chip)(struct nand_chip *chip);
void (*detach_chip)(struct nand_chip *chip);
int (*exec_op)(struct nand_chip *chip, const struct nand_operation
*op, bool check_only);
int (*setup_interface)(struct nand_chip *chip, int chipnr, const
struct nand_interface_config *conf);
};
π¦ Members π¦
these are the hooks, and ngl they're all optional unless stated β the kernel is chill like that π
attach_chipβ this method gets called after the NAND detection phase, i.e. after the flash ID and the MTD fields (like erase size, page size and OOB size) have already been set up. ECC requirements are available to you if the NAND chip or the device tree provided them. what's it for? typically choosing the right ECC configuration and allocating the associated resources. lowkey the glow-up phase. This hook is optional.detach_chipβ frees all the resources you allocated/claimed back innand_controller_ops->attach_chip. cleanup era, we love to see it π§Ή This hook is optional.exec_opβ the controller-specific method that actually executes NAND operations. and here's the tea: this method replaceschip->legacy.cmdfunc,chip->legacy.{read,write}_{buf,byte,word}(),chip->legacy.dev_readyandchip->legacy.waitfunc. yes, all of them. iconic honestly πsetup_interfaceβ sets up the data interface and timing. ifchipnris set toNAND_DATA_IFACE_CHECK_ONLY, that means the configuration should not be applied, just checked. so it's a vibe check, not a commitment π This hook is optional.
π SEE ALSO π
Kernel file ./include/linux/mtd/rawnand.h, plus the whole friend group:
struct nand_parameters(9), struct nand_id(9), struct nand_ecc_step_info(9), struct nand_ecc_caps(9), struct nand_ecc_ctrl(9), struct nand_sdr_timings(9), struct nand_nvddr_timings(9), enum nand_interface_type(9), struct nand_interface_config(9), nand_interface_is_sdr(9), nand_interface_is_nvddr(9), nand_get_sdr_timings(9), nand_get_nvddr_timings(9), struct nand_op_cmd_instr(9), struct nand_op_addr_instr(9), struct nand_op_data_instr(9), struct nand_op_waitrdy_instr(9), enum nand_op_instr_type(9), struct nand_op_instr(9), struct nand_subop(9), struct nand_op_parser_addr_constraints(9), struct nand_op_parser_data_constraints(9), struct nand_op_parser_pattern_elem(9), struct nand_op_parser_pattern(9), struct nand_op_parser(9), struct nand_operation(9), struct nand_controller(9), struct nand_legacy(9), struct nand_chip_ops(9), struct nand_manufacturer(9), struct nand_secure_region(9), struct nand_chip(9), nand_get_interface_config(9), struct nand_flash_dev(9), nand_opcode_8bits(9), nand_get_data_buf(9)
mwah π this page lives at ./include/linux/mtd, dated October 2026, and it's the struct nand_controller_ops(9) page β go read it again whenever your controller needs a vibe check. slay, periodt, 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