STRUCT PL022(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’… struct pl022(9) β€” Kernel API Manual 🫢

okay so bestie, welcome to the ✨ private SSP driver data structure ✨ β€” this is struct pl022, and it's literally the main character of the PL022 SPI party. every field in here is part of the driver's own little world, no cap. let's get into it πŸ’–


✨ NAME ✨

struct pl022 β€” this is the private SSP driver data structure. that's it, that's the whole vibe. it's giving "backstage pass to the driver," iykyk πŸŽ€


🌸 SYNOPSIS 🌸

struct pl022 {
    struct amba_device              *adev;
    struct vendor_data              *vendor;
    resource_size_t phybase;
    void __iomem                    *virtbase;
    struct clk                      *clk;
    struct spi_controller           *host;
    struct pl022_ssp_controller     *host_info;
    struct spi_transfer             *cur_transfer;
    struct chip_data                *cur_chip;
    void *tx;
    void *tx_end;
    void *rx;
    void *rx_end;
    enum ssp_reading                read;
    enum ssp_writing                write;
    u32 exp_fifo_level;
    enum ssp_rx_level_trig          rx_lev_trig;
    enum ssp_tx_level_trig          tx_lev_trig;
  #ifdef CONFIG_DMA_ENGINE;
    struct dma_chan                 *dma_rx_channel;
    struct dma_chan                 *dma_tx_channel;
    struct sg_table                 sgt_rx;
    struct sg_table                 sgt_tx;
    char *dummypage;
    bool dma_running;
  #endif;
    int cur_cs;
 };

like, look at her. so organized. so demure. πŸ”₯


πŸ¦‹ Members πŸ¦‹

okay now the ✨cast of characters✨, one by one, no skips:

  • adev β€” the AMBA device model hookup 🫢
  • vendor β€” vendor data for the IP block, every IP block's got lore
  • phybase β€” the physical memory where the SSP device resides, like its actual home address
  • virtbase β€” the virtual memory where the SSP is mapped, aka the address it uses when it's out in the world
  • clk β€” the outgoing clock <italic>"SPICLK"</italic> for the SPI bus ⏰
  • host β€” the SPI framework hookup
  • host_info β€” controller-specific data from machine setup
  • cur_transfer β€” pointer to current spi_transfer
  • cur_chip β€” pointer to current clients chip (assigned from controller_state)
  • tx β€” current position in TX buffer to be read
  • tx_end β€” end position in TX buffer to be read
  • rx β€” current position in RX buffer to be written
  • rx_end β€” end position in RX buffer to be written
  • read β€” the type of read currently going on
  • write β€” the type of write currently going on
  • exp_fifo_level β€” expected FIFO level
  • rx_lev_trig β€” receive FIFO watermark level which triggers IRQ 🚨
  • tx_lev_trig β€” transmit FIFO watermark level which triggers IRQ 🚨
  • dma_rx_channel β€” optional channel for RX DMA
  • dma_tx_channel β€” optional channel for TX DMA
  • sgt_rx β€” scattertable for the RX transfer
  • sgt_tx β€” scattertable for the TX transfer
  • dummypage β€” a dummy page used for driving data on the bus with DMA πŸ™ˆ
  • dma_running β€” indicates whether DMA is in operation
  • cur_cs β€” current chip select index
quick reminder bestie: the DMA fields (dma_rx_channel, dma_tx_channel, sgt_rx, sgt_tx, dummypage, dma_running) only exist when CONFIG_DMA_ENGINE is defined β€” they're tucked inside that #ifdef, so no cap, they're conditional πŸ’…

🌈 SEE ALSO 🌈

go touch some grass in the kernel file ./drivers/spi/spi-pl022.c, and while you're there say hi to:

struct vendor_data(9), struct chip_data(9), internal_cs_control(9), flush(9), restore_state(9), load_ssp_default_config(9), configure_dma(9), pl022_interrupt_handler(9), pl022_setup(9), pl022_cleanup(9)

all iconic, all linked, periodt πŸ‘‘


and that's the whole page, bestie! 🧚 this one lives over in ./drivers/spi and the version we're looking at is from October 2026 β€” mwah, go read the source, ily πŸ’œπŸ“

πŸ“¦ where this page comes from