Cannot Find SPI driver in /dev for Colibri i.MX7D

We’re trying to access our SPI device driver for a Colibri i.MX7D. When looking in /dev, on the device, the SPI driver is not listed as one of the drivers in the device tree. I found a similar community forum post to this one regarding the issue where someone had a similar question to this about a Colibri i.MX7 board:

Unable to find SPI node in /dev directory

The post mentioned that in order for the SPI driver to work the CAN driver needs to be disabled. There’s also a link to imx7-colibri-eval-v3.dtsi that opens the file in the section where the modification is needed.

What exactly must be done to the file?

In the spidev0: spidev@0 section there is the line: status = “disabled”. Does this just need to be changed to status = “enabled”? I’ve viewed the spi-imx.c file and it appears that the spi_imx_dt_ids structure is defined and setup properly, but I don’t see spi anywhere in the /dev folder on our device. I’ve rebuilt the imx7-colibri-eval-v3.dtsi file and copied the corresponding imx7d-colibri-eval-v3.dtb file, after modification, to the device but I still don’t see the spi driver in the list of devices.

What needs to be done to make this work?

In the spidev0: spidev@0 section there is the line: status = “disabled”. Does this just need to be changed to status = “enabled”?

Yes. The diff of the kernel source would be as below for enabling spidev on iMX7.

diff --git a/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi b/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
index 1db5aa5365b2..28a8bc7ad44c 100644
--- a/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
+++ b/arch/arm/boot/dts/imx7-colibri-eval-v3.dtsi
@@ -101,14 +101,14 @@
                interrupt-parent = <&gpio5>;
                interrupts = <2 IRQ_TYPE_EDGE_FALLING>;
                spi-max-frequency = <10000000>;
-               status = "okay";
+               status = "disabled";
        };
 
        spidev0: spidev@0 {
                compatible = "toradex,evalspi";
                reg = <0>;
                spi-max-frequency = <23000000>;
-               status = "disabled";
+               status = "okay";
        };
 };

The “status” property for mcp258x0 needs to be changed to “disabled” and for spidev it needs to be changed to “okay”.

Thank you sanchayan.tx! This is exactly what we needed to make this work. spidev is now showing up in /dev when the embedded Linux OS is loaded.

Is there a document somewhere on your website that specifies the function calls that we must make from user space in an application to access the spi-imx device driver to read from and write to a device? Function calls like open() and ioctl(). I’m not familiar with embedded Linux device drivers, but do have familiarity with Windows CE and vxworks.

Is there a document somewhere on your website that describes how to make the calls to access the SPI device driver?

Thank You again for all of your help

The documentation is included in the kernel source. Please see the spidev document and spidev test code.

Perfect! We appreciate your help with everything. :).

Thanks Again.