How to support spi slave in kernel4.1.15 & imx6?

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

How to support spi slave in kernel4.1.15 & imx6?

2,642 Views
zhipeng_wu
Contributor I

Hi ,

use imx6  ,linux kenerl version 4.1.15, I have patched "imx_add_spi_slave_mode.path"  and I have two boards(one work in spi master, the other work in spi slave). when I use spidev_test the spi slave function, MOSI,CS and CLK have correct signal, but MISO line is no signal,why?

My configures are as follow:

1.Connect both boards SPI buses directly :

cs->cs

clk->clk

miso->miso

mosi->mosi

2.devicetree;

1) spi slave board

&ecspi1 {
      pinctrl-0 = <&pinctrl_ecspi1>;
      status = "okay";
      spi-slave;

      slave@0{
         compatible = "rohm,dh2228fv";
         spi-max-frequency = <20000000>;
         reg = <0>;
      };
};

imx6qdl-sabresd {
      pinctrl_ecspi1: ecspi1grp {
         fsl,pins = <
         MX6QDL_PAD_KEY_COL1__ECSPI1_MISO 0x100b1
         MX6QDL_PAD_KEY_ROW0__ECSPI1_MOSI 0x100b1
         MX6QDL_PAD_KEY_COL0__ECSPI1_SCLK 0x100b1
         MX6QDL_PAD_KEY_ROW1__ECSPI1_SS0 0x100b1
      >;
};

2) spi master board:

&ecspi1 {

   fsl,spi-num-chipselects = <1>;
   cs-gpios = <&gpio4 9 0>;
   pinctrl-names = "default";
   pinctrl-0 = <&pinctrl_ecspi1>;
   status = "okay";

   spidev:spidev@0{
      compatible = "rohm,dh2228fv";
      spi-max-frequency = <20000000>;
      reg = <0>;
     }; 

};

pinctrl_ecspi1: ecspi1grp {
   fsl,pins = <
      MX6QDL_PAD_KEY_COL1__ECSPI1_MISO 0x100b1
      MX6QDL_PAD_KEY_ROW0__ECSPI1_MOSI 0x100b1
      MX6QDL_PAD_KEY_COL0__ECSPI1_SCLK 0x100b1
      MX6QDL_PAD_KEY_ROW1__GPIO4_IO09 0x1b0b0
   >;
};

3. I  run the spidev_test application on the slave board firstly:(at this momnet,all spi buses are no signals )

spidev_test -D /dev/spidev0.0 -p "SLAVE_HELLO_TO_MASTER" -v

and then run the spidev_test on the master board :(CS, CLK and MOSI have correct signals, but MISO's line no any signal)

spidev_test -D /dev/spidev0.0 -p "MASTER_HELLO_TO_SLAVE" -v

Can any one give me suggestion? thanks.

and I add the patch file to the attachment.

0 Kudos
10 Replies

2,263 Views
mahmood_md
Contributor I

Hi all, 

If anyone get solution for this issue.Pleae  help us to know root cause of issue.As we facing the same issue.

Thanks 

0 Kudos

2,263 Views
wbxiang
Contributor I

Hi lsharat,

     Have you set the DMA Control Register  RX_THRESHOLD ?The RXFIFO Data Request Interrupt will trigger.

0 Kudos

2,263 Views
mahmood_md
Contributor I

Hi wu,

I am also facing the same issue .If you are able to get solution of it ,please provide the solution of it.

Thanks

0 Kudos

2,263 Views
igorpadykov
NXP Employee
NXP Employee

Hi wu

one can check ecspi slave patch on

[PATCH RFC 0/5] *** SPI Slave mode support *** 

and its limitations

[PATCH RFC 5/5] spi: imx: Add support for SPI Slave mode for imx53 and imx6 chips 

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos

2,263 Views
zhipeng_wu
Contributor I

hi igorpadykov

thanks for your respond

the link you gived is the mail list, how to use it? should I diff every item of the mail list? 

do you have a complete patch file for kernel4.1.15 and imx6?

thanks!

0 Kudos

2,263 Views
igorpadykov
NXP Employee
NXP Employee

Hi wu

 

you can try to apply them manually in your sources

 

Best regards
igor

0 Kudos

2,263 Views
zhipeng_wu
Contributor I

Hi igor

my kernel's version is 4.1.15, and the mail list's patch maybe base other version, 

so there are so many different places between these two codes,

could you provide a patch file based on 4.1.15, please? 

thanks!

0 Kudos

2,263 Views
igorpadykov
NXP Employee
NXP Employee

Hi wu

 

nxp has special service for helping customers to port software

Commercial Support and Engineering Services | NXP 

 

Best regards
igor

0 Kudos

2,263 Views
zhipeng_wu
Contributor I

Hi igor

I debug the spi slave driver,

firstly, I sends 32-byte data on slave board, and then I sends the same bytes data on the master board,

slave board didn't enter interrupt service routing(spi_imx_isr)  no matter whether master board sends data or not,

why?

0 Kudos

2,263 Views
igorpadykov
NXP Employee
NXP Employee

Hi wu

one can try to debug using ecspi baremetal test:

rt-thread/spi_test.c at master · RT-Thread/rt-thread · GitHub 

Best regards
igor

0 Kudos