Hi,
We are using a custom board with the imx6qdl processor, with our image based on freescale community bsp for yocto krogoth release.
Kernel version: 4.1.15
Yocto branch: krogoth, 2.0ga
We are extensively using SPI to communicate with several devices(texas istruments microcontrollers) on the SPI bus. Please find our spi-imx.c driver attached.
We are encountering several different errors:
1) Below are the results of attempting SPI transactions of every length from 0 to 200 16-bit words. The following ranges of message lengths are affected, in bytes:
96-126, 160-190, 224-254, 288-318, 352-382 (decimal).
Transactions with lengths falling in these ranges always fail. This is completely consistent and reproducible.
spi_master spi1: I/O Error in DMA RX:60
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:62
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:64
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:66
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:68
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:6a
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:6c
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:6e
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:70
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:72
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:74
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:76
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:78
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:7a
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:7c
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:7e
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:a0
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:a2
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:a4
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:a6
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:a8
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:aa
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:ac
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:ae
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:b0
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:b2
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:b4
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:b6
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:b8
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:ba
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:bc
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:be
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:e0
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:e2
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:e4
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:e6
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:e8
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:ea
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:ec
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:ee
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:f0
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:f2
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:f4
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:f6
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:f8
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:fa
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:fc
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:fe
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:120
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:122
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:124
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:126
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:128
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:12a
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:12c
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:12e
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:130
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:132
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:134
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:136
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:138
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:13a
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:13c
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:13e
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:160
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:162
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:164
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:166
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:168
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:16a
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:16c
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:16e
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:170
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:172
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:174
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:176
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:178
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:17a
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:17c
spi_master spi1: failed to transfer one message from queue
spi_master spi1: I/O Error in DMA RX:17e
spi_master spi1: failed to transfer one message from queue
2) Additionally, there is the very rare intermittent fault, that shows up like this:
May 24 16:15:08 imx6dl-ctems kernel: spi_master spi2: I/O Error in RX tail
May 24 16:15:08 imx6dl-ctems kernel: spi_master spi2: failed to transfer one message from queue
May 24 16:15:11 imx6dl-ctems kernel: spi_master spi2: I/O Error in DMA RX:8c
May 24 16:15:11 imx6dl-ctems kernel: spi_master spi2: failed to transfer one message from queue
The second error here is caused by attempting to retry the transaction.
This intermittent fault shows up very roughly once in 100000 transactions.
I have tried the fix from this question : imx6 SPI in DMA mode sometime throws "I/O Error in DMA RX" but that didn't work
According to this question: SPI DMA support in imx6 and documentation, DMA is not supported in SPI by default. So, how come that all the errors come from the DMA handling code ?
I have not yet tried the patchset from https://community.nxp.com/message/888805?commentID=888805#comment-888805 , but i would like to ask, if there is anywhere i can find an up to date spi-imx.c driver that is compatible with kernel 4.1.15 ?
I could not find the root cause, but the I/O Error in DMA RX seem to have been fixed by updating the spi-imx.c driver to a version from the Boundary Devices github page: GitHub - boundarydevices/linux-imx6 at boundary-imx_4.1.15_2.0.0_ga
Compared to the .c file from krogoth branch, the new one seems to be a lot reliable, with DMA transfer function restructured and workarounds for several silicon ERRATAS added.
I was unable to do anything about the I/O Error in RX tail, so if anyone has any input on this, i would greatly appreciate it :smileyhappy:
Thanks
can you show me your spi setting in the device tree file?
Hi, thanks for your reply !
We are using #include "imx6dl.dtsi" in the dts file, and so everything added by that is unchanged. Below are all our SPI related dts changes:
pin control:
pinctrl_ecspi1: ecspi1grp {
fsl,pins = <
MX6QDL_PAD_DISP0_DAT22__ECSPI1_MISO 0x100b1
MX6QDL_PAD_DISP0_DAT21__ECSPI1_MOSI 0x100b1
MX6QDL_PAD_DISP0_DAT20__ECSPI1_SCLK 0x100b1
MX6QDL_PAD_DISP0_DAT23__GPIO5_IO17 0x1b0b0
MX6QDL_PAD_DISP0_DAT15__GPIO5_IO09 0x1b0b0
>;
};
pinctrl_ecspi2: ecspi2grp {
fsl,pins = <
MX6QDL_PAD_DISP0_DAT17__ECSPI2_MISO 0x100b1
MX6QDL_PAD_DISP0_DAT16__ECSPI2_MOSI 0x100b1
MX6QDL_PAD_DISP0_DAT19__ECSPI2_SCLK 0x100b1
MX6QDL_PAD_DISP0_DAT18__GPIO5_IO12 0x1b0b0
MX6QDL_PAD_EIM_D25__GPIO3_IO25 0x1b0b0
>;
};
pinctrl_ecspi3: ecspi3grp {
fsl,pins = <
MX6QDL_PAD_DISP0_DAT2__ECSPI3_MISO 0x100b1
MX6QDL_PAD_DISP0_DAT1__ECSPI3_MOSI 0x100b1
MX6QDL_PAD_DISP0_DAT0__ECSPI3_SCLK 0x100b1
MX6QDL_PAD_DISP0_DAT3__GPIO4_IO24 0x1b0b0
>;
};
SPI devices:
&ecspi1 {
fsl,spi-num-chipselects = <2>;
cs-gpios = <&gpio5 17 0>, <&gpio5 9 0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi1>;
status = "okay";
spidev0: spi@0 {
compatible = "company,SPIdevice";
reg = <0>;
spi-max-frequency = <5000000>;
};
spidev1: spi@1 {
compatible = "company,SPIdevice";
reg = <1>;
spi-max-frequency = <5000000>;
};
};
&ecspi2 {
fsl,spi-num-chipselects = <2>;
cs-gpios = <&gpio5 12 0>, <&gpio3 25 0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi2>;
status = "okay";
spidev2: spi@0 {
compatible = "company,SPIdevice";
reg = <0>;
spi-max-frequency = <5000000>;
};
spidev3: spi@1 {
compatible = "company,SPIdevice";
reg = <1>;
spi-max-frequency = <5000000>;
};
};
&ecspi3 {
fsl,spi-num-chipselects = <1>;
cs-gpios = <&gpio4 24 0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi3>;
status = "okay";
spidev4: spi@0 {
compatible = "company,SPIdevice";
reg = <0>;
spi-max-frequency = <5000000>;
};
};