imx.6ull SPI3 send date error, spi_master spi2: I/O Error in DMA RX:400

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

imx.6ull SPI3 send date error, spi_master spi2: I/O Error in DMA RX:400

1,548 Views
winstonshi_aure
Contributor II

Hi there,

I am trying to use spi3 of this device to send data to a spi slave. When I send date byte less than 64 bytes it is OK. But when I send more than 64 byte I got error:

[ 115.830065] spi_master spi2: I/O Error in DMA RX:400
[ 115.841541] spi_master spi2: failed to transfer one message from queue

cos I need a fast speed I want to send one message(transfer) bigger than 64B. Is there anyway to do this?

other questions:

1. what is the largest number of DMA transfer? is it max_dma_len = 32768?

2. I am using spi3 but I saw the error report spi2. Is there anything related to this failure?

following is  the dts I am using.

ecspi3: ecspi@02010000 {
                    #address-cells = <1>;
                    #size-cells = <0>;
                    compatible = "fsl,imx6ul-ecspi", "fsl,imx51-ecspi";
                    reg = <0x02010000 0x4000>;
                    interrupts = <GIC_SPI 33 IRQ_TYPE_LEVEL_HIGH>;
                    clocks = <&clks IMX6UL_CLK_ECSPI3>,
                         <&clks IMX6UL_CLK_ECSPI3>;
                    clock-names = "ipg", "per";
                    dmas = <&sdma 7 7 1>, <&sdma 8 7 2>;
                    dma-names = "rx", "tx";
                    status = "disabled";
                };
 
pinctrl_ecspi3: cps {
                fsl,pins = <
                        MX6UL_PAD_UART2_RTS_B__ECSPI3_MISO 0x100b1 /* MISO*/
                        MX6UL_PAD_UART2_CTS_B__ECSPI3_MOSI 0x100b1 /* MOSI*/
                        MX6UL_PAD_UART2_RX_DATA__ECSPI3_SCLK 0x100b1 /* CLK*/
                        MX6UL_PAD_UART2_TX_DATA__GPIO1_IO20 0x100b0 /* CS*/
                >;

        };
&ecspi3 {
fsl,spi-num-chipselects = <1>;
cs-gpio = <&gpio1 20 GPIO_ACTIVE_LOW>; /* cant't use cs-gpios! */
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi3>;
status = "okay";

spidev: cps@0 {
compatible = "aure,cps";
spi-max-frequency = <40000000>;
reg = <0>;
};
};
 
11 Replies

1,402 Views
Edward_sk
Contributor I

is there anyone who find the root cause? i have the same question.

0 Kudos

1,387 Views
winstonshi_aure
Contributor II

we found sdma didn't work but so far we can't find out why.

0 Kudos

1,487 Views
winstonshi_aure
Contributor II

by the way, I found some sample code use 0x100b1 to configure the spi pins while some use 0x10b1. which one is correct?

MX6UL_PAD_UART2_RTS_B__ECSPI3_MISO        0x100b1  /* MISO*/
MX6UL_PAD_UART2_CTS_B__ECSPI3_MOSI        0x100b1  /* MOSI*/
 MX6UL_PAD_UART2_RX_DATA__ECSPI3_SCLK      0x100b1  /* CLK*/
MX6UL_PAD_UART2_TX_DATA__ECSPI3_SS0       0x100b0  /* CS*/

MX6UL_PAD_UART2_RTS_B__ECSPI3_MISO        0x10b1  /* MISO*/
MX6UL_PAD_UART2_CTS_B__ECSPI3_MOSI        0x10b1  /* MOSI*/
MX6UL_PAD_UART2_RX_DATA__ECSPI3_SCLK      0x10b1  /* CLK*/
MX6UL_PAD_UART2_TX_DATA__ECSPI3_SS0       0x10b0  /* CS*/

0 Kudos

1,538 Views
kef2
Senior Contributor IV

Perhaps SDMA firmware isn't loaded? Check messages in dmesg.

dmesg | grep -i dma

0 Kudos

1,528 Views
winstonshi_aure
Contributor II

thanks for the reply.

i checked the demsg

~$:dmesg | grep -i dma
[ 0.000000] Reserved memory: initialized node linux,cma, compatible id shared-dma-pool
[ 0.096339] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.298685] mxs-dma 1804000.dma-apbh: initialized
[ 0.310357] i2c i2c-1: can't use DMA
[ 0.572015] imx-sdma 20ec000.sdma: no event needs to be remapped
[ 0.572242] imx-sdma 20ec000.sdma: loaded firmware 3.3
[ 0.579422] imx-sdma 20ec000.sdma: initialized
[ 1.404321] spi_imx_sdma_init
[ 1.416760] spi max_dma_len = 32768
[ 3.112471] mmc0: SDHCI controller on 2190000.usdhc [2190000.usdhc] using ADMA
[ 3.191040] mmc1: SDHCI controller on 2194000.usdhc [2194000.usdhc] using ADMA

It seems like the firmware 3.3 is loaded.

Is there anything need to be checked?

thanks.

Tags (1)
0 Kudos

1,520 Views
kef2
Senior Contributor IV

Latest one is 3.5, I think

0 Kudos

1,512 Views
winstonshi_aure
Contributor II

I updated the firmware to 3.5 but it doesn't help.

[root@AURE-IMX6ULL]:~$:dmesg | grep -i dma
[ 0.000000] Reserved memory: initialized node linux,cma, compatible id shared-dma-pool
[ 0.096402] DMA: preallocated 256 KiB pool for atomic coherent allocations
[ 0.298754] mxs-dma 1804000.dma-apbh: initialized
[ 0.310518] i2c i2c-1: can't use DMA
[ 0.572450] imx-sdma 20ec000.sdma: no event needs to be remapped
[ 0.572697] imx-sdma 20ec000.sdma: loaded firmware 3.5
[ 0.579867] imx-sdma 20ec000.sdma: initialized

[ 60.948886] spi write
[ 63.950077] spi_master spi2: I/O Error in DMA RX:400
[ 63.955148] spi_master spi2: failed to transfer one message from queue

 

0 Kudos

1,507 Views
kef2
Senior Contributor IV

Well, it's weird. Aren't you using some outdated kernel? Perhaps there's mismatch between SDMA FW and eCSPI driver. SDMA FW version should be supported by eCSPI driver in your kernel. There's default FW in chip ROM, but it as well won't work with all eCSPI driver versions, certainly not with recent ones. 

0 Kudos

1,501 Views
winstonshi_aure
Contributor II

I am using 4.1.15. is it too old? Thanks.

[root@AURE-IMX6ULL]:~$:cat /proc/version
Linux version 4.1.15-gf03399f-dirty (liping@liping-VirtualBox) (gcc version 4.9.4 (Linaro GCC 4.9-2017.01) ) #71 SMP PREEMPT Wed Jun 15 20:01:44 CST 2022

0 Kudos

1,495 Views
kef2
Senior Contributor IV
  • I am using 4.1.15. is it too old? 

I don't know. What I know is that there could be mismatch between eCSPI driver in your kernel and SDMA FW. Your rootfs (including SDMA FW) and kernel should be from the same BSP

0 Kudos

1,489 Views
winstonshi_aure
Contributor II

is there any possibility to set the spi3 to tx only. in fact i don't need rx.

thanks.

0 Kudos