STRUCT MTK_SPI(9)

πŸ“¦ version 7.3.1, in nixpkgs unstable

πŸ’– 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 it u32.
  • pad_num β€” how many pad_sel entries 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 of sel_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, const because 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