STRUCT MTK_SPI(9)
π struct mtk_spi(9) β the Kernel API Manual tea π
okay so bestie, this page is from the Kernel API Manual and it's literally about struct mtk_spi β the SPI driver instance β¨ buckle up, it's a struct tour and honestly it's giving "backstage pass to the SPI controller" energy π
πΈ NAME πΈ
struct mtk_spi β SPI driver instance π«Ά that's it, that's the whole name, no notes.
β¨ SYNOPSIS β¨
here's the whole struct, character for character, don't touch it, it's perfect:
struct mtk_spi {
void __iomem *base;
u32 state;
int pad_num;
u32 *pad_sel;
struct clk *parent_clk, *sel_clk, *spi_clk, *spi_hclk;
struct spi_transfer *cur_transfer;
u32 xfer_len;
u32 num_xfered;
struct scatterlist *tx_sgl, *rx_sgl;
u32 tx_sgl_len, rx_sgl_len;
const struct mtk_spi_compatible *dev_comp;
struct pm_qos_request qos_request;
u32 spi_clk_hz;
struct completion spimem_done;
bool use_spimem;
struct device *dev;
dma_addr_t tx_dma;
dma_addr_t rx_dma;
};
π Members π
every single field, one by one, no skipping, we stay thorough π
baseβ start address of the SPI controller registers π like the front door of the controller, that's where everything lives.stateβ the SPI controller state π current mood of the controller, but make itu32.pad_numβ how manypad_selentries there are π’ (yes it's a count, yes it counts the next field, they're a package deal).pad_selβ groups of pins to select π pin-selection groups, that's the whole vibe.parent_clkβ parent ofsel_clkπ« the clock above the mux clock, the ancestor of it all.sel_clkβ the SPI host mux clock π°οΈ mux clock for the SPI host, yes mux, yes that's a real word here.spi_clkβ peripheral clock π the peripheral-side clock.spi_hclkβ AHB bus clock π the AHB bus clock, bus clock, love that for it.cur_transferβ currently processed SPI transfer π the transfer that's being handled right now, main character energy.xfer_lenβ number of bytes to transfer π how many bytes are on the to-do list.num_xferedβ number of transferred bytes β how many bytes have already been transferred.tx_sglβ TX transfer scatterlist π€ the scatterlist for the TX transfer.rx_sglβ RX transfer scatterlist π₯ and the scatterlist for the RX transfer.tx_sgl_lenβ size of TX DMA transfer π¦ how big the TX DMA transfer is.rx_sgl_lenβ size of RX DMA transfer π how big the RX DMA transfer is.dev_compβ device data structure 𧬠the device data structure,constbecause we respect it.qos_requestβ QoS request β‘ a QoS request, and it is what it is.spi_clk_hzβ current SPI clock in Hz π΅ the current SPI clock, measured in Hz, exact.spimem_doneβ SPI-MEM operation completion π the completion for the SPI-MEM operation β it fires when the op is done.use_spimemβ enables SPI-MEM π¦ the bool that turns SPI-MEM on.devβ device pointer π a pointer to the device.tx_dmaβ DMA start for SPI-MEM TX π the DMA start address for SPI-MEM TX.rx_dmaβ DMA start for SPI-MEM RX π¬ and the DMA start address for SPI-MEM RX.
π¦ SEE ALSO π¦
go peek at these, iykyk π
- Kernel file
./drivers/spi/spi-mt65xx.c struct mtk_spi_compatible(9)./drivers/spi(the directory itself, say hi to it)
and that's the whole page, bestie π no cap, every field accounted for, periodt π
fr fr read the source too, ./drivers/spi/spi-mt65xx.c is right there and it ate π
π cute little sign-off π β this page lives under ./drivers/spi, and it's dated October 2026 β so yes, from the future, slay π bye bestie ππ«Ά
π¦ 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