Having issues with spi on Aplis tk1 with bsp 5.0

Hello! I have an issue with spi when i upgraded to bsp 5.0 version. The spi doesn’t appear anymore in /dev folder, look:

root@apalis-tk1-06770981:/# ls /dev/spi*
ls: cannot access ‘/dev/spi*’: No such file or directory
root@apalis-tk1-06770981:/# ls: cannot access ‘/dev/spi*’: No such file or directory

Can someone help me solve this?

Thanks a lot!

Hello @liligade ,

Welcome to the Toradex community.

By standard the spidev doesn’t come enabled on the BSP 5, this happens because this BSP is based on the mainline.

To enable the spidev, you need to recompile the kernel and the device tree, for the kernel you should enable the CONFIG_SPI_SPIDEV flag.

On the device tree, you should insert the devices into the correct nodes, the below patch can be used:

diff --git a/arch/arm/boot/dts/tegra124-apalis-eval.dts b/arch/arm/boot/dts/tegra124-apalis-eval.dts
index ceb3f6388c7d..0bdb09a38455 100644
--- a/arch/arm/boot/dts/tegra124-apalis-eval.dts
+++ b/arch/arm/boot/dts/tegra124-apalis-eval.dts
@@ -106,12 +106,24 @@
        spi@7000d400 {
                status = "okay";
                spi-max-frequency = <50000000>;
+
+               spidev0: spidev@0 {
+                       compatible = "spidev";
+                       reg = <0>;
+                       spi-max-frequency = <25000000>;
+               };
        };
 
        /* SPI4: Apalis SPI2 */
        spi@7000da00 {
                status = "okay";
                spi-max-frequency = <50000000>;
+
+               spidev3: spidev@0 {
+                       compatible = "spidev";
+                       reg = <0>;
+                       spi-max-frequency = <25000000>;
+               };
        };
 
        /* Apalis Serial ATA */

To compile the kernel and the device tree you can check the documentation provided in this article.

Please let me know if you need any help.

Best regards,
Daniel Morais

Thanks a lot. I insert the devices into the correct nodes, as show below:

/* SPI1: Apalis SPI1 */
spi@7000d400 {
status = “okay”;
spi-max-frequency = <50000000>;

spidev0: spidev@0 {
compatible = “spidev”;
reg = <0>;
spi-max-frequency = <25000000>;
};
};

/* SPI1: Apalis SPI1 */
spi@7000d600 {
status = “okay”;
spi-max-frequency = <50000000>;

spidev1: spidev@2 {
compatible = “spidev”;
reg = <2>;
spi-max-frequency = <25000000>;
};
};

/* SPI1: Apalis SPI1 */
spi@7000d800 {
status = “okay”;
spi-max-frequency = <50000000>;

};

/* SPI4: Apalis SPI2 */
spi@7000da00 {
status = “okay”;
spi-max-frequency = <50000000>;

spidev3: spidev@0 {
compatible = “spidev”;
reg = <0>;
spi-max-frequency = <25000000>;
};
};

and it finally worked.

Thanks again for your help.