iMX6 enable ECSPI1

Colibri EvalBoard
Colibri iMX6DL
Yocto Angstrom

I need to enable the SPI (ECSPI1) in my custom device-tree (only MOSI needed, therefore MISO is not in the pinmux group).

/dts-v1/;

#include <dt-bindings/input/input.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include "imx6dl.dtsi"
#include "imx6qdl-colibri.dtsi"

&ecspi1 {
        status = "okay";
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1>;

        spidev0: spidev@0 {
                status = "okay";
                compatible = "spidev";
                reg = <0>;
                spi-max-frequency = <23000000>;
        };
};

&iomuxc {
        pinctrl-names = "default";
        pinctrl-0 = <
                &pinctrl_ecspi1
        >;

        pinctrl_ecspi1: ecspi1grp {
                fsl,pins = <
                        MX6QDL_PAD_CSI0_DAT4__ECSPI1_SCLK       PAD_CTRL_HYS_PU
                        MX6QDL_PAD_CSI0_DAT5__ECSPI1_MOSI       PAD_CTRL_HYS_PU
                        MX6QDL_PAD_CSI0_DAT7__ECSPI1_SS0        PAD_CTRL_HYS_PU
                >;
        };

but then “dmesg | grep spi” shows

[    0.092025] imx6dl-pinctrl 20e0000.iomuxc: no groups defined in /soc/aips-bus@02000000/iomuxc@020e0000/ecspi1grp 
[    0.092382] imx6dl-pinctrl 20e0000.iomuxc: unable to find group for node ecspi1grp                               
[    1.184206] spi_imx: probe of 2008000.ecspi failed with error -22  

and of course no spi in /dev.

I have seen EIM is default on the ECSPI1 pins. Do these need to be disable? how?

&weim {
        status = "disabled";
};

Hi @codeshredder726b !

Is there a reason for you to use Yocto Angstrom?

It is a really old BSP and is EOL’ed (as you can see from Embedded Linux Release Matrix | Toradex Developer Center).

Also, please take a look at our documentation about Device Trees. It will certainly help you to better understand it: Device Tree Documentation Overview | Toradex Developer Center

For example, by following the examples from How to Customize Device Trees | Toradex Developer Center, you will see that a pinctrl group (pinctrl_ecspi1, in your case) should not be referenced in more than one enabled node.

Best regards,

Does ECSPI not work with Yocto Angstrom?

I adapted the device-tree to this (only ecspi1 relevant stuff shown).

&ecspi1 {
        fsl,spi-num-chipselects = <1>;
        cs-gpios = <&gpio5 25 0>;
        pinctrl-names = "default";
        pinctrl-0 = <&pinctrl_ecspi1 &pinctrl_ecspi1_cs1>;
        status = "okay";

        spidev1: spidev@1 {
                //compatible = "toradex,evalspi";
                compatible = "spidev";
                reg = <0>;
                spi-max-frequency = <23000000>;
                status = "okay";
        };
};
&iomuxc {
        pinctrl-names = "default";
        pinctrl-0 = <
                &pinctrl_ecspi1
                &pinctrl_ecspi1_cs1
        >;

        ecspi1 {
                pinctrl_ecspi1: ecspi1grp {
                        fsl,pins = <
                                MX6QDL_PAD_CSI0_DAT4__ECSPI1_SCLK       PAD_CTRL_HYS_PU
                                MX6QDL_PAD_CSI0_DAT5__ECSPI1_MOSI       PAD_CTRL_HYS_PU
                                MX6QDL_PAD_CSI0_DAT6__ECSPI1_MISO       PAD_CTRL_HYS_PU
                        >;
                };
                pinctrl_ecspi1_cs1: ecspi_cs1 {
                        fsl,pins = <
                                MX6QDL_PAD_CSI0_DAT7__ECSPI1_SS0          PAD_CTRL_HYS_PU
                        >;
                };
        };

not sure about the compatible “spidev” vs “toradex,evalspi”, neither is working.

the “no groups defined” and “unable to find group for node ecspi1grp” are gone but ECSPI1 is still not working because the pin MX6DL_PAD_CSI0_DAT4 (should be muxed as ECSPI1_MISO) is already used.

[    1.141777] imx6dl-pinctrl 20e0000.iomuxc: pin MX6DL_PAD_CSI0_DAT4 already requested by 20e0000.iomuxc; cannot claim for 20080i
[    1.153949] imx6dl-pinctrl 20e0000.iomuxc: pin-29 (2008000.ecspi) status -22
[    1.161028] imx6dl-pinctrl 20e0000.iomuxc: could not request pin 29 (MX6DL_PAD_CSI0_DAT4) from group ecspi1grp  on device 20e0c

I tried to disable weim

&weim {
        status = "disabled";
};

or to delete the node

/delete-node/ &weim;

Hi @codeshredder726b !

Could you please answer the question from my previous message?

It will help us to understand your use case in order to help you.

Best regards,

It is quite an old project, upgrade will happen but we need to work out other stuff first to integrate into new HW.
It seems like the pinctrl group issue is fixed.
But there is a new issue, MX6DL_PAD_CSI0_DAT4 is already used but I dont see how since &weim should be disabled/deleted.

Hi @codeshredder726b !

Which exact kernel version (branch from linux-toradex) are you using?

Best regards,