Arm Mbed and Pelion Device Management support forum

SPI on IMX7D with mbl-os

I have a pico-pi-imx7 and am trying to get the SPI interface to show up on my /dev/ listing.

I have put mbl-os 0.8 and 0.9 on it as well as going into the Linux/arm Kernel Configuration and enabled the “User mode SPI device driver support” and rebuilding. After that I checked every box on the SPI configuration page and saved and rebuilt as well.

The custom build instructions used are from: https://os.mbed.com/docs/mbed-linux-os/v0.9/develop-mbl/mbed-linux-os-distribution-development-with-mbl-tools.html

When running Ubuntu on the pico-pi-imx7d I see the spidev listed under /dev/ but when putting on any versions of the mbl-os I have tried (0.8, 0.9, 0.9 custom configurations) I can’t get the spi to show up.

When checking the config files there are changes in /proc/config.gz on the SPI fields for differently configured builds.

Could someone suggest how I should set up the Linux/arm Kernel Configuration in order to have the SPI listed in /dev/?

image


image

Hi Liam,

We apologize for get back to you so late.

The linux-mbl source tree needs to be patched to expose the SPI interface to userspace via /dev node files.

The following Kernel config needs to be added:
CONFIG_SPI_SPIDEV=y

And the following changes to imx7d-pico.dts file:

diff --git a/arch/arm/boot/dts/imx7d-pico.dts b/arch/arm/boot/dts/imx7d-pico.dts
index b695f61..7272e65 100644
--- a/arch/arm/boot/dts/imx7d-pico.dts
+++ b/arch/arm/boot/dts/imx7d-pico.dts
@@ -451,6 +451,20 @@
                >;
        };
 
+       pinctrl_ecspi3: ecspi3grp {
+                       fsl,pins = <
+                               MX7D_PAD_I2C1_SCL__ECSPI3_MISO  0x2
+                               MX7D_PAD_I2C1_SDA__ECSPI3_MOSI  0x2
+                               MX7D_PAD_I2C2_SCL__ECSPI3_SCLK  0x2
+                       >;
+               };
+
+       pinctrl_ecspi3_cs: ecspi3_cs_grp {
+                       fsl,pins = <
+                               MX7D_PAD_I2C2_SDA__GPIO4_IO11   0x80000000
+                       >;
+               };
+
 };
 
 &iomuxc_lpsr {
@@ -460,3 +474,18 @@
                >;
        };
 };
+
+&ecspi3 {
+       fsl,spi-num-chipselects = <2>;
+       cs-gpios = <&gpio4 11 GPIO_ACTIVE_LOW>;
+       pinctrl-names = "default";
+       pinctrl-0 = <&pinctrl_ecspi3 &pinctrl_ecspi3_cs>;
+       status = "okay";
+
+       spidev: spidev@3 {
+               status = "okay";
+               compatible = "linux,spidev";
+               spi-max-frequency = <25000000>;
+               reg = <0>;
+       };
+};

Please let us know for any questions.

Regards,
Desmond