i.MX6 ESPI slave mode support patch based on rel_imx_3.0.35_4.1.0

cancel
Showing results for 
Search instead for 
Did you mean: 

i.MX6 ESPI slave mode support patch based on rel_imx_3.0.35_4.1.0

No ratings

i.MX6 ESPI slave mode support patch based on rel_imx_3.0.35_4.1.0

This patch is for i.MX6 ESPI controller slave mode (SPI timing mode 0 and 3) support.

Hardware prepare:

  Connect two i.MX6 Sabresd boards, remove U14 SPI nor device, connect two boards like:

         MISO --- MISO

         MOSI --- MOSI

         SS     --- SS

         CLK   --- CLK

         GND  ---  GND

Software prepare:

1>Apply patch spi_slave_2013_10_12.patch on 3.0.35_4.1.0 Linux BSP release.

    Note two board all need choose CONFIG_IMX6_SDP_MISCSPI, CONFIG_SPI_SPIDEV of kernel

Symbol: IMX6_SDP_MISCSPI [=y]                                                                                                             

Location:

  |     -> Device Drivers                                                                                                                   

  |       -> Misc devices (MISC_DEVICES [=y])

Symbol: SPI_SPIDEV [=y] 

Location:                                                                                                                                         

  |     -> Device Drivers                        

  |       -> SPI support (SPI [=y])

   Spi master board choose CONFIG_SPI_IMX_VER_2_3

Symbol: SPI_IMX_VER_2_3 [=y]

Location:                                                                                                                                        

  |     -> Device Drivers                                                                                                                              

  |       -> SPI support (SPI [=y])                                                                                                                    

  |         -> Choose IMX SPI work mode (<choice> [=y])

   Spi slave board choose CONFIG_SPI_IMX_VER_2_3_SLAVE.

Symbol: SPI_IMX_VER_2_3_SLAVE [=y]

Location:                                                                                                                                        

  |     -> Device Drivers                                                                                                                              

  |       -> SPI support (SPI [=y])                                                                                                                    

  |         -> Choose IMX SPI work mode (<choice> [=y])

2>Compile test application  mxc_spi_test1.c to generate mxc_spi_test.

3> Test steps :

  1. First  spi slave board input cmd mxc-spi-test –D 0 –b 32 –L 32
  2. Then spi master board input cmd mxc-spi-test –D 0 –b 32 –L 32

          This tool will write its buffer ( the content is same in two side ) to the  other board  through  SPI bus , then read data from the other board , and compare with its write buffer.

Tags (3)
Attachments
Comments

Dear Peng,

     When I had seen your SPI patch for the i.MX6 slave mode. I meet the same question at the i.MX27 too. I have not use the the i.MX6 so I can't get the SPI programe and make the patch. So I want ask you some quetions in order to solve it because I think the i.MX27 is same as the i.MX6 for the SPI.    


     The follow is my testing procedure:

    

     I want to configure spi1 in slave mode in Linux 2.6.19.2 for i.mx27. That is I am using an i.mx27 board as a SPI MASTER and other board as a SLAVE to communicate with each other. I adopt the 3-wire link each other such as master MOSI<->slave MOSI , master MISO<-> slave MISO  and master CLK->slave CLK . The master SPI only send the data and slave SPI only receive the data.

    

     According to the SPI device and driver of the i.MX27 we only change the master to the SLAVE of the MODE bit in the CONREG Register in Linux and tranfer same 8bit every time at about 8*1000*1000 bauterate .The master mode work well where the MOSI pin can transfer the data and the CLK pin can get the clock .But the SLAVE mode can’t work and the i.mx27 cannot react the interrupt and still only stay in the spi_put_tx_data function state and can not go to the receive mode in which the processor is  be the slave mode. 

     The SPI can only inturrupt to receive once and later transfer the data. 
    

cmd->port is 1

The SPI is 1 and the fd is 4

spi_bitbang :bitbang_work

mxc_spi :mxc_spi_chipselect

The origin mxc_spi_chipselect control register is 1024

The origin mxc_spi_chipselect control registre masked is 1024

mxc_spi :spi_find_baudrate The SPI probe as slave and work mode is SPI_MODE_0.

The mxc_spi_chipselect control register is 66567

mxc_spi :mxc_spi_transfer

mxc_spi :spi_enable_interrupt

mxc_spi :mxc_spi_isr

mxc_spi :spi_get_rx_data

mxc_spi :spi_put_tx_data

mxc_spi :mxc_spi_isr

   mxc_spi :spi_put_tx_data

   mxc_spi :mxc_spi_isr

   mxc_spi :spi_put_tx_data

   mxc_spi :mxc_spi_isr

   mxc_spi :spi_put_tx_data

   mxc_spi :mxc_spi_isr

   mxc_spi :mxc_spi_isr

   mxc_spi :spi_put_tx_data

   mxc_spi :mxc_spi_isr

   mxc_spi :spi_put_tx_data

   mxc_spi :mxc_spi_isr

   mxc_spi :spi_put_tx_data



     I donot know why the slave can't receive anything.

     My question is :

      1.I do't know where I forget or make mistake to change both software and the hardware. So In order to work in slave mode can any body provide me some link.

     2.how to update i.mx27 spi device file and driver file.if you want get the  C resouce, please tell me. I will give you later.

     3. Would you mind give me the SPI master and slave programe source. I can study where the register and the programe should change for the SPI slave.

     4.If you are a chinese,I want communicate with each other in chinese .

     Please give me some advice.

    

Thanks

wangjian 

Could anyone comment on how to modify this patch to allow both master and slave mode drivers to be used at the same time?

Is there a version of this available that is compatible with the 3.10.17 driver or similar? The freescale 3.10.17 kernel repo's SPI driver still doesn't have SPI slave mode support.

I am using a hummingboard-gate which has imx6solo processor.

I compiled mainline kernel 4.2.6, it runs ok headless. now how do I add spi slave device support to it?

can you update your patch or at least point me where I should look. I am new to the device tree structure.

Version history
Revision #:
1 of 1
Last update:
‎10-12-2013 12:16 AM
Updated by: