AnsweredAssumed Answered

CS not working as GPIO, just native

Question asked by Silke Bockhorn on May 18, 2020
Latest reply on Jun 15, 2020 by Silke Bockhorn

Hi guys,

I have a problem with my spi settings.

When I use the CS in native configuration, like so:

 

diff --git a/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts b/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
index 039ece96b9b2..a96340455ef3 100644
--- a/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
@@ -282,6 +282,16 @@
>;
};

+ pinctrl_ecspi2: ecspi2grp {
+ fsl,pins = <
+ MX8MN_IOMUXC_ECSPI2_SCLK_ECSPI2_SCLK 0x156
+ MX8MN_IOMUXC_ECSPI2_MOSI_ECSPI2_MOSI 0x156
+ MX8MN_IOMUXC_ECSPI2_MISO_ECSPI2_MISO 0x156
+ MX8MN_IOMUXC_ECSPI2_SS0_ECSPI2_SS0 0x156
+
+ >;
+ };
+
pinctrl_usdhc1_gpio: usdhc1grpgpio {
fsl,pins = <
MX8MN_IOMUXC_SD1_RESET_B_GPIO2_IO10 0x41
@@ -754,6 +764,19 @@
status = "okay";
};

+&ecspi2 {
+ fsl,spi-num-chipselects = <1>;
+ pinctrl-names = "default";
+ pinctrl-0 = <&pinctrl_ecspi2>;
+ status = "okay";
+
+ spidev@0x00 {
+ compatible = "spidev";
+ reg = <0>;
+ spi-max-frequency = <10000000>;
+ };
+};
+
&usbotg1 {
picophy,pre-emp-curr-control = <3>;
picophy,dc-vol-level-adjust = <7>;
--
2.17.1

 

it works:

ECSPI2 with native CS

but using it as GPIO, like:

 

diff --git a/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts b/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
index 039ece96b9b2..f8350b5078e8 100644
--- a/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
+++ b/arch/arm64/boot/dts/freescale/imx8mn-ddr4-evk.dts
@@ -282,6 +282,16 @@
                >;
        };

 

+       pinctrl_ecspi2: ecspi2grp {
+               fsl,pins = <
+                       MX8MN_IOMUXC_ECSPI2_SCLK_ECSPI2_SCLK            0x156
+                       MX8MN_IOMUXC_ECSPI2_MOSI_ECSPI2_MOSI            0x156
+                       MX8MN_IOMUXC_ECSPI2_MISO_ECSPI2_MISO            0x156
+                       MX8MN_IOMUXC_ECSPI2_SS0_GPIO5_IO13              0x156
+
+               >;
+       };
+       
        pinctrl_usdhc1_gpio: usdhc1grpgpio {
                fsl,pins = <
                        MX8MN_IOMUXC_SD1_RESET_B_GPIO2_IO10     0x41
@@ -754,6 +764,20 @@
        status = "okay";
 };

 

+&ecspi2 {
+        fsl,spi-num-chipselects = <1>;
+        pinctrl-names = "default";
+        pinctrl-0 = <&pinctrl_ecspi2>;
+        cs-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>;
+        status = "okay";
+
+       spidev@0x00 {
+             compatible = "spidev";
+             reg = <0>;
+             spi-max-frequency = <10000000>;
+       };
+};
+
 &usbotg1 {
        picophy,pre-emp-curr-control = <3>;
        picophy,dc-vol-level-adjust = <7>;
--
2.17.1

 

it does not work

ECSPI2 with gpio CS

 

My Board is a NXP i.MX8MNano DDR4 EVK board.

I use the patches for linux-imx in yocto with this build configuration:

 

Build Configuration:
BB_VERSION           = "1.44.0"
BUILD_SYS            = "x86_64-linux"
NATIVELSBSTRING      = "ubuntu-18.04"
TARGET_SYS           = "aarch64-poky-linux"
MACHINE              = "imx8mnevk"
DISTRO               = "fsl-imx-xwayland"
DISTRO_VERSION       = "5.4-zeus"
TUNE_FEATURES        = "aarch64"
TARGET_FPU           = ""

 

Is there something wrong with my gpio configuration for spi-imx driver?

Thanks in advance,

Silke

Outcomes