Understanding the SPI framework abstractions in the Linux kernel
The Linux kernel SPI framework is made up of a few data structures, the most important of which are the following:
spi_controller
, used to abstract the SPI master device.spi_device
, used to abstract a slave device sitting on the SPI bus.spi_driver
, the driver of the slave device.spi_transfer
, which is the low-level representation of one segment of a protocol. It represents a single operation between the master and slave. It expects Tx and/or Rx buffers as well as the length of the data to be exchanged and an optional CS behavior.spi_message
, which is an atomic sequence of transfers.
Let's now introduce each of these data structures, one after the other, starting with the most complex, which represents the SPI controller's data structure.
Brief introduction to struct spi_controller
Throughout this chapter, we will reference the controller because it is deeply coupled with...