STRUCT BCM2835_SPI(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– struct bcm2835_spi β€” BCM2835 SPI controller πŸ’–

okay so bestie, this is the kernel API manual page for struct bcm2835_spi(9), and it's lowkey one of those pages that looks like a giant struct but is actually just the BCM2835 SPI controller's whole personality in C form. no cap. ✨


🌸 NAME 🌸

struct bcm2835_spi β€” BCM2835 SPI controller. that's it, that's the vibe. πŸŽ€


πŸ¦‹ SYNOPSIS πŸ¦‹

struct bcm2835_spi {
    void __iomem *regs;
    struct clk *clk;
    struct gpio_desc *cs_gpio;
    unsigned long clk_hz;
    int irq;
    struct spi_transfer *tfr;
    struct spi_controller *ctlr;
    const u8 *tx_buf;
    u8 *rx_buf;
    int tx_len;
    int rx_len;
    int tx_prologue;
    int rx_prologue;
    unsigned int tx_spillover;
    struct dentry *debugfs_dir;
    u64 count_transfer_polling;
    u64 count_transfer_irq;
    u64 count_transfer_irq_after_polling;
    u64 count_transfer_dma;
    struct bcm2835_spidev *target;
    unsigned int tx_dma_active;
    unsigned int rx_dma_active;
    struct dma_async_tx_descriptor *fill_tx_desc;
    dma_addr_t fill_tx_addr;
};

she's giving "struct with lore" and honestly? obsessed. πŸ’…


πŸŽ€ Members πŸŽ€

  • regs β€” base address of the register map. the home base, the main character location. πŸ—ΊοΈ
  • clk β€” the core clock, divided to calculate the serial clock. math but make it sparkly. ✨
  • cs_gpio β€” chip-select GPIO descriptor. it's the little handle that says "this one, bestie." 🫢
  • clk_hz β€” the core clock's cached speed. cached, so we don't have to keep asking. πŸ’…
  • irq β€” the interrupt; it signals when TX FIFO is empty or RX FIFO is ΒΎ full. yes, exactly ΒΎ, not 3/4 casually β€” the manual said ΒΎ and we respect it. 😭
  • tfr β€” the SPI transfer currently being processed. current hyperfixation, basically. πŸ”₯
  • ctlr β€” SPI controller reverse lookup. like finding the controller's insta from its @ handle. πŸ”
  • tx_buf β€” pointer where the next transmitted byte is read from. the outgoing mail slot. πŸ“€
  • rx_buf β€” pointer where the next received byte is written. the incoming mail slot. πŸ“₯
  • tx_len β€” remaining bytes to transmit. how much yapping is left, in bytes. πŸ—£οΈ
  • rx_len β€” remaining bytes to receive. how much listening is left, in bytes. πŸ‘‚
  • tx_prologue β€” bytes transmitted without DMA if the first TX sglist entry's length is not a multiple of 4 (to overcome a hardware limitation). not me fixing the hardware's little quirk with a prologue. 🧚
  • rx_prologue β€” bytes received without DMA if the first RX sglist entry's length is not a multiple of 4 (to overcome a hardware limitation). same energy, receive edition. πŸ¦‹
  • tx_spillover β€” whether tx_prologue spills over into the second TX sglist entry. spill the tea, but like, into the next sglist entry. πŸ“
  • debugfs_dir β€” the debugfs directory β€” neede to remove debugfs when unloading the module. yes bestie, "neede" is literally what the source says, and honestly? relatable typo. πŸ’€
  • count_transfer_polling β€” count of how often polling mode is used. keeping receipts on polling. 🧾
  • count_transfer_irq β€” count of how often interrupt mode is used. keeping receipts on interrupts too. πŸ”₯
  • count_transfer_irq_after_polling β€” count of how often we fall back to interrupt mode after starting in polling mode. and these are counted as well in count_transfer_polling and count_transfer_irq β€” yes, double-counted, it's giving "counted twice because the vibes require it." 😭
  • count_transfer_dma β€” count how often DMA mode is used. DMA receipt-keeping: activated. πŸ’…
  • target β€” SPI target currently selected (used by bcm2835_spi_dma_tx_done to write clear_rx_cs). the chosen one, iykyk. πŸ‘‘
  • tx_dma_active β€” whether a TX DMA descriptor is in progress. is TX DMA active? the field says yes/no. iconic. πŸŽ€
  • rx_dma_active β€” whether a RX DMA descriptor is in progress (used by bcm2835_spi_dma_tx_done to handle a race). yes, there's a race, and this field is the little referee. 🏁
  • fill_tx_desc β€” a preallocated TX DMA descriptor used for RX-only transfers (it cyclically copies from zero page to TX FIFO). zero page to TX FIFO on loop, like a playlist you put on repeat. πŸ”
  • fill_tx_addr β€” bus address of zero page. the address of the zero page, bestie. that's the fact. 🫢

πŸ’« SEE ALSO πŸ’«


and that's the page, bestie. this little baddie lives at source ./drivers/spi and is dated October 2026 β€” screenshot it, cite it, slay it. πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈπŸ’…πŸ«Ά

πŸ“¦ where this page comes from