Device tree overlay for custom SPI driver

Dear all,

Background

We are currently working on a product using the Apalis TK1 computer on module and the Ixora 1.1 carrier board, where we would like to interface an external custom-built module through an SPI interface.

This module uses an additional protocol layer on top of the SPI bus (let’s call this protocol RAP, Register Access Protocol for the sake of this post), therefore we need to integrate a new device driver as a Loadable Kernel Module, replacing the spidev driver for the SPI2 interface.

We already have a working rapdev driver tested a long time ago on a BeagleBone Black.
Customization of the device tree was done using Device Tree Overlays (DTOs) and the BeagleBone’s cape management system for dynamic loading/unloading of .dtbo files.

However, we are struggling to port this system to the current hardware setup, mainly because of the Device Tree aspect of things.

Questions

Here are our main questions :

  1. Is it possible to dynamically load/unload DTOs using the Toradex linux kernel (toradex_tk1_l4t_r21.7 branch) ? We could not find the usual entries in the configfs.
  2. Planning to use the Apalis SPI2 interface, is it advisable to use a mainline linux kernel ? We imagine some modifications would be needed to properly configure the SPI2 interface. Using a newer (~4.19) kernel version than Toradex’s one (~3.10) may allow more flexibility in the DTOs management.

As a side note, we are trying to avoid to build a custom kernel for this project, is it makes up for an easier deployment if our staff can use Toradex’s easy installer and install the LXDE distribution (with either the Toradex or mainline kernel). We should add that it is not a problem for us to build loadable kernel modules for those kernels.
Our difficulties really seem to lie in the DTO side of things.

Thank you very much in advance for any kind of help,

Best regards,

Alexandre Monti & the R&D Team, G2Metric France

Hi @amonti and Welcome to the Toradex Community!

Could you provide the version of the hardware and software of your module?

This module uses an additional protocol layer on top of the SPI bus (let’s call this protocol RAP, Register Access Protocol for the sake of this post), therefore we need to integrate a new device driver as a Loadable Kernel Module, replacing the spidev driver for the SPI2 interface.

There is something wrong in your concept. Usually you write a kernel driver for the device instead of creating a pseudo protocol layer.

Here are our main questions :

  1. Is it possible to dynamically load/unload DTOs using the Toradex linux kernel (toradex_tk1_l4t_r21.7 branch) ? We could not find the usual entries in the configfs.

No, this is not supported.

  1. Planning to use the Apalis SPI2 interface, is it advisable to use a mainline linux kernel ? We imagine some modifications would be needed to properly configure the SPI2 interface. Using a newer (~4.19) kernel version than Toradex’s one (~3.10) may allow more flexibility in the DTOs management.

Sure, you can use the SPI2 interface in mainline Linux kernel. Regarding dynamically unloading/loading Device Tree Overlay in mainline kernel is/will be supported in mainline kernel.

Best regards,
Jaski