STRUCT STM32_SPI(9)
๐ struct stm32_spi(9) ๐
okay so bestie, welcome to the Kernel API Manual โ this is the page for struct stm32_spi, aka the private data of the SPI controller. it's giving "backstage pass to the SPI vibe" and honestly? iconic. ๐
โจ NAME โจ
struct stm32_spi โ the private data of the SPI controller. no cap, this is where all the controller's personal business lives. ๐
๐ธ SYNOPSIS ๐ธ
here's the whole squad, laid out exactly how the kernel declares them:
struct stm32_spi {
struct device *dev;
struct spi_controller *ctrl;
const struct stm32_spi_cfg *cfg;
void __iomem *base;
struct clk *clk;
u32 clk_rate;
spinlock_t lock;
int irq;
unsigned int fifo_size;
unsigned int t_size_max;
unsigned int feature_set;
#define STM32_SPI_FEATURE_LIMITED
STM32MP25_SPI_HWCFGR1_FULLCFG_LIMITED ;
#define STM32_SPI_FEATURE_FULL
STM32MP25_SPI_HWCFGR1_FULLCFG_FULL ;
unsigned int cur_midi;
unsigned int cur_speed;
unsigned int cur_half_period;
unsigned int cur_bpw;
unsigned int cur_fthlv;
unsigned int cur_comm;
unsigned int cur_xferlen;
bool cur_usedma;
const void *tx_buf;
void *rx_buf;
int tx_len;
int rx_len;
struct dma_chan *dma_tx;
struct dma_chan *dma_rx;
dma_addr_t phys_addr;
bool device_mode;
struct gen_pool *sram_pool;
size_t sram_rx_buf_size;
void *sram_rx_buf;
dma_addr_t sram_dma_rx_buf;
struct dma_chan *mdma_rx;
};
fr fr, copy that block character for character โ the#defines sitting inside there areSTM32_SPI_FEATURE_LIMITEDandSTM32_SPI_FEATURE_FULL, and they're part offeature_set's whole situation. ๐ซถ
๐ฆ Members ๐ฆ
time for the member-by-member vibe check, bestie. every single one, no skipping. ๐
devโ the driver model representation of the controller. it's the controller's official ID photo. ๐ธctrlโ the controller interface. the actual SPI controller hookup. ๐cfgโ compatible configuration data. every compatible gets its own little outfit. ๐baseโ the virtual memory area. where the registers hang out in memory. ๐บ๏ธclkโ the hw kernel clock feeding the SPI clock generator. the clock's clock, yes really. โฐclk_rateโ the rate of the hw kernel clock feeding the SPI clock generator. same clock, but now with a number attached. ๐ขlockโ prevents I/O concurrent access. one at a time, bestie, we're not doing chaos here. ๐irqโ the SPI controller interrupt line. the "hey bestie, something happened" phone line. โ๏ธfifo_sizeโ size of the embedded fifo, in bytes. ๐t_size_maxโ the maximum number of data of one transfer. the ceiling, the limit, the "know your bounds". ๐feature_setโ SPI full or limited feature set. full feature set vs. limited feature set, and this field tells you which one you got. ๐๏ธcur_midiโ host inter-data idleness in ns. yes, ns. nanoseconds of doing nothing, on purpose. ๐ดcur_speedโ speed configured in Hz. ๐๏ธcur_half_periodโ time of a half bit in us. half a bit! in microseconds! the precision of it all. โฑ๏ธcur_bpwโ number of bits in a single SPI data frame. ๐งฎcur_fthlvโ fifo threshold level (data frames in a single data packet). ๐ฆcur_commโ SPI communication mode. ๐ฃ๏ธcur_xferlenโ current transfer length in bytes. ๐ฆcur_usedmaโ boolean to know if dma is used in current transfer.true/false, dma or no dma. โtx_bufโ data to be written, orNULL. ๐คrx_bufโ data to be read, orNULL. ๐ฅtx_lenโ number of data to be written, in bytes. ๐คโก๏ธ๐ขrx_lenโ number of data to be read, in bytes. ๐ขโฌ ๏ธ๐ฅdma_txโ dma channel for TX transfer. ๐dma_rxโ dma channel for RX transfer. ๐phys_addrโ SPI registers physical base address. the physical one, not the virtual one up inbase. respect the distinction, bestie. ๐device_modeโ the controller is configured as SPI device. plot twist: it's the device now. ๐ญsram_poolโ SRAM pool for DMA transfers. ๐sram_rx_buf_sizeโ size of SRAM buffer for RX transfer. ๐sram_rx_bufโ SRAM buffer for RX transfer. the buffer itself. ๐งบsram_dma_rx_bufโ SRAM buffer physical address for RX transfer. again: the physical address. ๐mdma_rxโ MDMA channel for RX transfer. notdma_rxโ MDMA. different little guy entirely. ๐
๐ SEE ALSO ๐
everything below lives in the kernel file ./drivers/spi/spi-stm32.c โ go say hi to the whole extended fam: ๐
struct stm32_spi_reg(9)struct stm32_spi_regspec(9)struct stm32_spi_cfg(9)stm32h7_spi_get_fifo_size(9)stm32f4_spi_get_bpw_mask(9)stm32f7_spi_get_bpw_mask(9)stm32h7_spi_get_bpw_mask(9)stm32mp25_spi_get_bpw_mask(9)stm32_spi_prepare_mbr(9)stm32h7_spi_prepare_fthlv(9)stm32f4_spi_write_tx(9)stm32f7_spi_write_tx(9)stm32h7_spi_write_txfifo(9)stm32f4_spi_read_rx(9)stm32f7_spi_read_rx(9)stm32h7_spi_read_rxfifo(9)stm32_spi_enable(9)stm32fx_spi_disable(9)stm32h7_spi_disable(9)stm32_spi_can_dma(9)stm32fx_spi_irq_event(9)stm32fx_spi_irq_thread(9)stm32h7_spi_irq_thread(9)stm32_spi_prepare_msg(9)stm32fx_spi_dma_tx_cb(9)stm32_spi_dma_rx_cb(9)stm32_spi_dma_config(9)stm32fx_spi_transfer_one_irq(9)stm32h7_spi_transfer_one_poll(9)stm32h7_spi_transfer_one_irq(9)stm32fx_spi_transfer_one_dma_start(9)stm32f7_spi_transfer_one_dma_start(9)stm32h7_spi_transfer_one_dma_start(9)stm32_spi_prepare_rx_dma_mdma_chaining(9)stm32_spi_transfer_one_dma(9)stm32f4_spi_set_bpw(9)stm32f7_spi_set_bpw(9)stm32h7_spi_set_bpw(9)stm32_spi_set_mbr(9)stm32_spi_communication_type(9)stm32fx_spi_set_mode(9)stm32h7_spi_set_mode(9)stm32h7_spi_data_idleness(9)stm32h7_spi_number_of_data(9)stm32_spi_transfer_one_setup(9)stm32_spi_can_poll(9)stm32_spi_transfer_one(9)stm32_spi_unprepare_msg(9)stm32fx_spi_config(9)stm32h7_spi_config(9)
and that's the page, bestie ๐ซถ this lil masterpiece comes to you from ./drivers/spi, dated October 2026 โ go forth and read your registers responsibly. periodt. ๐โจ
๐ฆ 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