new SPI module interface to imx6DL board

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

new SPI module interface to imx6DL board

3,375 Views
srinivasaraopor
Contributor II

Hi,

We have ported Ubuntu to Wandboard Dual board  (IMX6DL)

While compiling we have enabled SPI support in the kernel. Also we have enabled ecspi in device before creating Device Tree Blob (dtb).

When we are issueing command from terminal

$zgrep SPI /proc/config.gz | grep -v SPIN | grep -v '^#'

It is giving output that SPI is enabled.

But when we are issueing another command from terminal like

$ dmesg | grep spi

then output is :

[10.886933] spi_imx : probe of 200c000.ecspi failed with error -22

[10.886987] spi_imx : probe of 2010000.ecspi failed with error -22

[10.887046] spi_imx : probe of 2014000.ecspi failed with error -22

and also when we checking in /dev we dont have any spidev0.0 or spidev1.0 etc.

I have added an entry for the spi device module in wandboard dtsi as follows(in imx6qdl.dtsi):

ecspi1: ecspi@02008000 {

#address-cells = <1>;

#size-cells = <0>;

compatible = "fsl,imx6q-ecspi", "fsl,imx51-ecspi";

reg = <0x02008000 0x4000>;

//interrupts = <0 31 IRQ_TYPE_LEVEL_HIGH>;

clocks = <&clks IMX6QDL_CLK_ECSPI1>,

<&clks IMX6QDL_CLK_ECSPI1>;

  cs-gpios = <&gpio2 30 0>;

  fsl,spi-num-chipselects = <2>;

clock-names = "ipg", "per";

dmas = <&sdma 3 7 1>, <&sdma 4 7 2>;

dma-names = "rx", "tx";

status = "okay";

  mpu9250@0 {

compatible = "invensense,mpu9250";

reg = <0>;

#address-cells = <1>;

#size-cells = <0>;

spi-max-frequency = <20000000>;

};

};

I tried change to mpu9250 to spidev and compatible="spidev" and also spi-max-frequency to 25000000, 24000000 also.

In IOMUX section i have included :

pinctrl_ecspi1: ecspi1grp {

fsl,pins = <

MX6QDL_PAD_EIM_D17__ECSPI1_MISO 0x100b1

MX6QDL_PAD_EIM_D18__ECSPI1_MOSI 0x100b1

MX6QDL_PAD_EIM_D16__ECSPI1_SCLK 0x100b1

//ECSPI1_SS0 0x000b1MX6QDL_PAD_EIM_EB2__GPIO2_IO30 0x100b1 /* CS0 */

MX6QDL_PAD_EIM_EB2__GPIO2_IO30 0x100b1 /* CS0 */

>;

};

also

&ecspi1 {

pinctrl-names = "default";

pinctrl-0 = <&pinctrl_ecspi1>;

cs-gpios = <&gpio2 30 0>;

status = "okay";

};

then generated dtb file and copied it to sd card. When booting to Ubuntu and checking in /dev, then no spidev0.0 . also how to confirm that our device tree file is correct only and there is problem with the hardware. is there any way to confirm that device tree is correct.

When we are issueing command to check spi as below:

$ dmesg | grep spi

then output is :

[10.886933] spi_imx : probe of 200c000.ecspi failed with error -22

[10.886987] spi_imx : probe of 2010000.ecspi failed with error -22

[10.887046] spi_imx : probe of 2014000.ecspi failed with error -22

and also when we checking in /dev we dont have any spidev0.0 or spidev1.0 etc.. what is error. how to resolve this

but is not showing anything about

spi_imx : probe of 2008000.ecspi

Labels (4)
4 Replies

1,307 Views
letan
Contributor III

Hi srinivasaraoporam

Any updates on this. Could you please share with me?

I am looking forward to your reply!

0 Kudos

1,307 Views
srinivasaporam
Contributor II

Hi,

I got to know by myself for the addition of new spi module. If you have any query then you can ask me... I will help you...

These are the steps

1.  have you enabled SPI in kernel

2. then in dtb file also spi should be enabled

where you got stuck????

1,307 Views
pooja_todakar
Contributor I

hello,

i enabled the spi in kernal also and my dts entry is also write but i am not getting driver initialization message in uboot log..and configuration is also right.but i m not getting any error message also.how to resolve this?

my dts entry is as below:

pinctrl_ecspi1: ecspi1grp-1 {
fsl,pins = <
MX6UL_PAD_CSI_DATA04__ECSPI1_SCLK 0x01f4/*spi clock signal*/
MX6UL_PAD_CSI_DATA05__ECSPI1_SS0 0x01F8
MX6UL_PAD_CSI_DATA07__ECSPI1_MISO 0x0200/*spi MISO */
MX6UL_PAD_UART2_CTS_B__GPIO1_IO22 0x009c
MX6UL_PAD_UART2_RTS_B__GPIO1_IO23 0x00a0
MX6UL_PAD_LCD_DATA22__ECSPI1_MOSI 0x0170
>;
};

DTS entry:

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

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

DTSI entry:

ecspi1: ecspi@02008000 {
#address-cells = <1>;
#size-cells = <0>;
compatible = "fsl,imx6ul-ecspi", "fsl,imx51-ecspi";
reg = <0x02008000 0x4000>;
interrupts = <GIC_SPI 31 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clks IMX6UL_CLK_ECSPI1>,
<&clks IMX6UL_CLK_ECSPI1>;
clock-names = "ipg", "per";
dmas = <&sdma 3 7 1>, <&sdma 4 7 2>;
dma-names = "rx", "tx";
status = "disabled";
};

0 Kudos

1,307 Views
letan
Contributor III

Hi,

Thank you so much for your help. Currently I had already enabled ECSPI2 well on imx6 dual.

1. Device tree

&iomuxc {

     ecspi2 {

          pinctrl_ecspi2_1: ecspi2grp-1 {

               fsl,pins = < MX6QDL_PAD_EIM_OE__ECSPI2_MISO 0x100b1

                            MX6QDL_PAD_EIM_CS1__ECSPI2_MOSI 0x100b1

                            MX6QDL_PAD_EIM_CS0__ECSPI2_SCLK 0x100b1

               >;

           };

     };

};

&ecspi2 {
      fsl,spi-num-chipselects = <0>;
      /*cs-gpios = <&gpio4 24 0>;*/
      pinctrl-names = "default";
      pinctrl-0 = <&pinctrl_ecspi2_1>;
      status = "okay";
      spidev@0 {
      compatible = "spidev";
      spi-max-frequency = <20000000>;
      reg = <0>;
      };
};

2. Linux kernel

I enable SPI in kernel also

So now it's working well :-)

0 Kudos