STRUCT SPI_MEM_DIRMAP_INFO(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct spi_mem_dirmap_info(9) πŸ’…

okay so bestie, we're in the Kernel API Manual today and the star of the show is struct spi_mem_dirmap_info β€” literally the "Direct mapping information" struct. no cap, this is the glow-up era of SPI memory docs ✨


🌸 NAME 🌸

struct spi_mem_dirmap_info β€” Direct mapping information. that's it, that's the whole name, and honestly? it ate. πŸŽ€


✨ SYNOPSIS ✨

here's the whole struct, copy it exactly, don't touch a single character, i'm watching πŸ‘€

struct spi_mem_dirmap_info {
    struct spi_mem_op *op_tmpl;
    struct spi_mem_op primary_op_tmpl;
    struct spi_mem_op secondary_op_tmpl;
    u64 offset;
    u64 length;
 };

🫢 Members 🫢

  • op_tmpl β€” the operation template that the direct mapping should use when the memory device gets accessed. this is the main character of the whole struct, fr fr πŸ‘‘
  • secondary_op_tmpl β€” a secondary template, and it may be used as an alternative to the primary template. who decides? the upper layer, so don't @ us πŸ’…
  • offset β€” the absolute offset this direct mapping is pointing to πŸ“
  • length β€” the length in byte of this direct mapping. yes, byte, singular, that's how the manpage says it and i'm not about to fight it πŸ“
lowkey side note: you'll clock primary_op_tmpl chilling in the struct up there in the synopsis, but this manpage's Members list doesn't give it its own blurb. i'm not gonna invent lore for it β€” iykyk πŸ™ˆ

πŸ’– Description πŸ’–

so what are these information for? the controller-specific implementation uses them to know two things: which portion of memory is directly mapped, and which spi_mem_op it should use to access the device. two vibes, one struct, we love efficient communication πŸ’…

and here's the ⚠️ caution ⚠️ part, so listen up: a direct mapping is only valid for one direction (read or write). one. direction. periodt. and that direction is directly encoded in the ->op_tmpl.data.dir field β€” so it's not hiding, it's just sitting there in plain sight 🌈


πŸ”₯ SEE ALSO πŸ”₯

go read these next, bestie, they're all in the same friend group:

  • Kernel file ./include/linux/spi/spi-mem.h
  • enum spi_mem_data_dir(9)
  • struct spi_mem_op(9)
  • struct spi_mem_dirmap_desc(9)
  • struct spi_mem(9)
  • spi_mem_set_drvdata(9)
  • spi_mem_get_drvdata(9)
  • struct spi_controller_mem_ops(9)
  • struct spi_controller_mem_caps(9)
  • struct spi_mem_driver(9)

okay that's the whole page, we're done here πŸ¦‹ this iconic little writeup lives in ./include/linux/spi and it's dated October 2026 β€” mwah, sending you off with a struct spi_mem_dirmap_info(9) and a kiss πŸ’œπŸ§šβ€β™€οΈβ­

πŸ“¦ where this page comes from