Block Diagram

The following block diagram shows the 3 layers of the SPI driver framework.
Figure 1. Block Diagram

The following sections describe each layer in the above diagram.

User Space

The user space layer includes all the applications which use the SPI device. In this layer, users can customize their SPI device based on their specific needs.

Kernel Space

The kernel space layer can be divided into the following 3 parts.
  • SPI Device Driver Layer:

    The Linux kernel does not provide a specific SPI device driver, since the devices on an SPI may vary from case to case. Users have to use the general SPI device driver which can only communicate with the SPI device in synchronous modes. So only some simple and not-so-much-data-consumptive devices are supported in this layer.

    In this layer, we provide spidev.c as the standard SPI driver and spi-nand.c as the NAND driver for SPI.

  • SPI General Interface Package Layer:

    To simplify SPI driver programming and reduce driver program coupling, Linux kernel packages some general programs of drivers for controllers and protocols to form the SPI general interface package layer.

    In this layer, we provide the Linux original driver spi.c.
  • SPI Controller Driver Layer:

    This layer is the focus of our attention, it will be introduced in detail in the following parts of the document.

    In this layer, we provide the driver spi-pl022-starfive.c.

Hardware

The hardware layer is the physical device layer. In this layer, SPI controllers and the connected SPI devices communicate with CPU via SPI bus.