STRUCT SPI_TRANSFER_HEAD(9)
π NAME
Okay so welcome to the Kernel API Manual, bestie π β this is the page for struct spi_transfer_head(9), aka the virtio SPI transfer descriptor. No cap, thatβs the whole vibe of this struct. π¦
β¨ SYNOPSIS
struct spi_transfer_head {
__u8 chip_select_id;
__u8 bits_per_word;
__u8 cs_change;
__u8 tx_nbits;
__u8 rx_nbits;
__u8 reserved[3];
__le32 mode;
__le32 freq;
__le32 word_delay_ns;
__le32 cs_setup_ns;
__le32 cs_delay_hold_ns;
__le32 cs_change_delay_inactive_ns;
};
π Members
Hereβs the field-by-field tea, bestie β every single one, in order. π«Ά
chip_select_idβ the chipselect index the SPI transfer used. πbits_per_wordβ the number of bits in each SPI transfer word. β¨cs_changeβ whether to deselect device after finishing this transfer before starting the next transfer;0means cs keep asserted and1means cs deasserted then asserted again. πtx_nbitsβ bus width for write transfer. The values are:0,1: bus width is1, also known as SINGLE.2: bus width is2, also known as DUAL.4: bus width is4, also known as QUAD.8: bus width is8, also known as OCTAL.- other values are invalid.
rx_nbitsβ bus width for read transfer. The values are:0,1: bus width is1, also known as SINGLE.2: bus width is2, also known as DUAL.4: bus width is4, also known as QUAD.8: bus width is8, also known as OCTAL.- other values are invalid.
reservedβ for future use. π¦modeβ SPI transfer mode. Hereβs the bit-by-bit tea, highkey important:- bit
0: CPHA, determines the timing (i.e. phase) of the data bits relative to the clock pulses. ForCPHA=0, the "out" side changes the data on the trailing edge of the preceding clock cycle, while the "in" side captures the data on (or shortly after) the leading edge of the clock cycle. ForCPHA=1, the "out" side changes the data on the leading edge of the current clock cycle, while the "in" side captures the data on (or shortly after) the trailing edge of the clock cycle. - bit
1: CPOL, determines the polarity of the clock.CPOL=0is a clock which idles at0, and each cycle consists of a pulse of1.CPOL=1is a clock which idles at1, and each cycle consists of a pulse of0. - bit
2: CS_HIGH, if1, chip select active high, else active low. - bit
3: LSB_FIRST, determines per-word bits-on-wire, if0, MSB first, else LSB first. - bit
4: LOOP, loopback mode.
- bit
freqβ the transfer speed in Hz. β‘word_delay_nsβ delay to be inserted between consecutive words of a transfer, in ns unit. πΈcs_setup_nsβ delay to be introduced after CS is asserted, in ns unit. πcs_delay_hold_nsβ delay to be introduced before CS is deasserted for each transfer, in ns unit. πcs_change_delay_inactive_nsβ delay to be introduced after CS is deasserted and before next asserted, in ns unit. β¨
π¦ SEE ALSO
Kernel file ./include/uapi/linux/virtio_spi.h struct virtio_spi_config(9), struct spi_transfer_result(9) π
π«Ά signing off from ./include/uapi/linux, October 2026, with struct spi_transfer_head(9) β mwah πβ¨
π¦ 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