Migration from Rocko 2.8 to scathgap

Hi Folks,

I am facing spi driver issue on apalis imx with custom board. The spi doesnot bind automatically and therefore doesnot show up in the /dev/spi*. I am following the tutorial “SPI (Linux) | Toradex Developer Center”.

here is my dts file configuration for spi:

&ecspi1 {
	status = "okay";

	spidev0: spidev@1 {
		compatible = "spidev";
		reg = <0>;
		spi-max-frequency = <18000000>;
	};
};

Thank you.

Hi, I’m the Toradex AI Assistant.

I might make mistakes. Our support team will step in if needed. If I answered your question, please tick the “Solution” checkbox. For follow-up questions to me, please use @ToradexAI in your post.

Did you like my answer? :+1: :-1:


Hello! Thank you for reaching out with your SPI driver issue on the Apalis iMX with a custom board.

Based on your device tree configuration, there are a couple of items you should adjust to ensure proper automatic driver binding:

1. Node Name and reg Property Alignment

Your node is named spidev@1 but uses reg = <0>. For proper binding, these must be consistent:

  • Option 1: spidev@0 with reg = <0>
  • Option 2: spidev@1 with reg = <1>

Choose the option that matches your intended chip select.

2. Compatible String

For Apalis modules, using compatible = "spidev" may not work reliably. It’s recommended to use compatible = "toradex,evalspi".

3. Corrected Device Tree Snippet

Here’s how your device tree should look:

&ecspi1 {
    status = "okay";

    spidev0: spidev@0 {
        compatible = "toradex,evalspi";
        reg = <0>;
        spi-max-frequency = <18000000>;
    };
};

Make sure the node name and reg property match, and use the recommended compatible string.

For more detail, see:

4. Manual Binding (If Automatic Fails)

If the device node still doesn’t appear in /dev/spi* (or /dev/apalis-spi...), try manual binding:

  1. List SPI devices:
    ls /sys/bus/spi/devices
    
  2. If you see (for example) spi1.0, bind manually:
    echo spidev > /sys/bus/spi/devices/spi1.0/driver_override
    echo spi1.0 > /sys/bus/spi/drivers/spidev/bind
    
  3. Check device nodes:
    ls -la /dev/apalis-spi*
    

Reference:

5. Device Node Names

For Apalis modules, SPI devices usually appear as /dev/apalis-spi1-cs0, /dev/apalis-spi2-cs0, etc., not /dev/spi*.


Try updating your device tree as above, rebuild and deploy, then reboot and check /dev for the SPI devices.

Let me know if this resolves the issue or if you need further assistance!

Best regards,
Toradex AI Assistant.

Yes manual binding works fine as shown here:

echo spidev > /sys/bus/spi/devices/spi1.0/driver_override
echo spi1.0 > /sys/bus/spi/drivers/spidev/bind

ls -la /dev/spi*
crw------- 1 root root 153, 0 Jul 29 12:28 /dev/spidev1.0

I already tried both option mentioned in Node Name and reg Property Alignment, But still same issue.

I am using linux-toradex-upstream branch version 6.6

Hello @farooq,

For BSP 7 (scarthgap), we have overlays to enable spidev.
Please have a look at them depending on the SPI interface you want to use as spidev:

If you are enabling these in your device tree, it is a good idea to not also use the respective overlays.

Best Regards,
Bruno

Hello Bruno,

Thanks for your quick response. I have my own custom board based on apalis-eval board. So therefore i have my own device file and already the respective nodes for spi i am using from bsp 2.8. But i am facing issue with binding as i mentioned above. Thank you

Hello @farooq,

I understand, therefore setting the spidev as follows should be enough, with no need to manually bind it at runtime. This is a direct copy from the SPI1 overlay, as I see you are using ecspi1:

/* Apalis SPI1 */
&ecspi1 {
	#address-cells = <1>;
	#size-cells = <0>;
	status = "okay";

	spidev@0 {
		/* Use compatible "rohm,dh2228fv" to bind spidev driver */
		compatible = "rohm,dh2228fv";
		reg = <0>;
		spi-max-frequency = <10000000>;
	};
};

Best Regards,
Bruno