STRUCT AX_SPI(9)
π NAME π
struct ax_spi β bestie, this is the definition that defines a spi driver instance β¨ like it's literally the blueprint for one whole SPI driver living its main character life π«Ά
β¨ SYNOPSIS β¨
struct ax_spi {
void __iomem *regs;
struct clk *ref_clk;
struct clk *pclk;
unsigned int clk_rate;
u32 speed_hz;
const u8 *tx_buf;
u8 *rx_buf;
int tx_bytes;
int rx_bytes;
unsigned int tx_fifo_depth;
u32 current_rx_fifo_word;
int bytes_left_in_current_rx_word;
u32 current_rx_fifo_word_for_irq;
int bytes_left_in_current_rx_word_for_irq;
int rx_discard;
int rx_copy_remaining;
};
Ok so quick vibe check β this is the struct ax_spi from the Kernel API Manual, section 9. Every single field is iconic in its own way, so let's go through them one by one, no skips, no cap π
π Members π
regsβ the virtual address of the SPI controller registers. Like, where the hardware actually lives in memory, spiritually πref_clkβ pointer to the peripheral clock. Its lil clock bestie β°pclkβ pointer to the APB clock. Yeah, second clock, she's also invited πclk_rateβ reference clock rate in Hz. Numbers, we love her π’speed_hzβ the current SPI bus clock speed in Hz. Current being the keyword, she can change πtx_bufβ pointer to the TX buffer. Sending out the good stuff π€rx_bufβ pointer to the RX buffer. Receiving it right back π₯tx_bytesβ number of bytes left to transfer. The countdown is real πrx_bytesβ number of bytes requested. Not left β requested, important distinction bestie π«Άtx_fifo_depthβ depth of the TX FIFO. How deep the queue goes, lowkey fascinating πcurrent_rx_fifo_wordβ buffers the 32-bit word read fromRXFIFO. One whole word, kept safe π§bytes_left_in_current_rx_wordβ bytes to be extracted from the current 32-bit word. Extraction era πcurrent_rx_fifo_word_for_irqβ buffers the 32-bit word read fromRXFIFOfor IRQ. Same energy, IRQ edition β‘bytes_left_in_current_rx_word_for_irqβ IRQ bytes to be extracted from the current 32-bit word. Yes the name is long, she earned it πrx_discardβ number of bytes to discard. Bye, not needed πrx_copy_remainingβ number of bytes to copy. The keeper bytes π
π SEE ALSO π
- Kernel file
./drivers/spi/spi-axiado.hβ go read her, she's right there π
And that's the whole page, fr fr π huge slay to ./drivers/spi for shipping this one β October 2026, struct ax_spi(9), signing off πβ¨
π¦ 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