The steps needed to write SPI client drivers are as follows:
- Declare device IDs supported by the driver. You can do that using spi_device_id. If the DT is supported, use of_device_id too. You can make an exclusive use of the DT.
- Call MODULE_DEVICE_TABLE(spi, my_id_table); to register your device list with the SPI core. If the DT is supported, you must call MODULE_DEVICE_TABLE(of, your_of_match_table); to register your device list with the of core.
- Write probe and remove functions according to their respective prototypes. The probe function must identify your device, configure it, define per-device (private) data, configure the bus if needed (SPI mode and so on) using the spi_setup function, and register with the appropriate kernel framework. In the remove function, simply undo everything done in the probe function.
- Declare and fill a struct spi_driver...