RE: Issues with i.MX SPI DMA transfers

From: Robin Gong
Date: Tue Apr 02 2019 - 04:33:30 EST


> -----Original Message-----
> From: Igor Plyatov <plyatov@xxxxxxxxx>
> Sent: 2019å4æ2æ 15:20
> To: Robin Gong <yibin.gong@xxxxxxx>; Uwe Kleine-KÃnig
> <u.kleine-koenig@xxxxxxxxxxxxxx>
> Cc: linux-kernel@xxxxxxxxxxxxxxx; linux-arm-kernel@xxxxxxxxxxxxxxxxxxx;
> linux-spi@xxxxxxxxxxxxxxx; dl-linux-imx <linux-imx@xxxxxxx>; Fabio Estevam
> <festevam@xxxxxxxxx>; Pengutronix Kernel Team <kernel@xxxxxxxxxxxxxx>;
> Sascha Hauer <s.hauer@xxxxxxxxxxxxxx>; Shawn Guo
> <shawnguo@xxxxxxxxxx>; Mark Brown <broonie@xxxxxxxxxx>;
> dmaengine@xxxxxxxxxxxxxxx; Vinod Koul <vkoul@xxxxxxxxxx>; Dan Williams
> <dan.j.williams@xxxxxxxxx>; Andy Duan <fugang.duan@xxxxxxx>; Han Xu
> <han.xu@xxxxxxx>; Clark Wang <xiaoning.wang@xxxxxxx>
> Subject: Re: Issues with i.MX SPI DMA transfers
>
> Dear Robin Gong,
>
>
> >> Sorry...below another sdma patch(ad0d92d7ba6a) need to be reverted,
> >> because spi driver may dynamically change burst length.
>
>
> now I have reverted patch ad0d92d7ba6a.
>
> Patches 0001-dma-engine-imx-sdma-add-mcu_2_ecspi-script.patch and
> 0002-spi-spi-imx-fix-ERR009165.patch are applied.
>
>
> Kernel log show messages
>
> [ÂÂ 29.202639] imx-sdma 20ec000.sdma: loaded firmware 3.3
> [ÂÂ 29.238595] spi_imx 2008000.spi: probed
> [ÂÂ 29.242802] spi_imx 200c000.spi: probed
> [ÂÂ 29.245217] spi_imx 2018000.spi: probed
>
> SPI DMA transfers still not work.
>
> If I test 32 byte transfers, then they work fine. But 64 byte transfers
> fails always and I see error messages
>
> root@cr7:~# spidev_test -D /dev/spidev4.1 -s 1200000 -b 8 -S 64 -I 1 -l
> spi mode: 0x20
> bits per word: 8
> max speed: 1200000 Hz (1200 KHz)
> [Â 423.686736] spi_master spi4: I/O Error in DMA RX
> [Â 423.691392] spidev spi4.1: SPI transfer failed: -110
> [Â 423.696382] spi_master spi4: failed to transfer one message from queue
> can't send spi message: Connection timed out
> Aborted (core dumped)
>
> I suppose, transfers shorter then 64 bytes made with help of PIO.
>
> Robin, is there any chance for you to find some time and look at this
> issue again?
I have quick test with spidev_test loopback, but didn't meet your error,
Is your code the almost latest code in linux-next as mine?

root@imx6qpdlsolox:~# cat /proc/interrupts | grep sdma
48: 37 GPC 2 Level sdma
-lt@imx6qpdlsolox:~# ./spidev_test -D /dev/spidev0.0 -s 1200000 -b 8 -S 64 -I 1 -l
spi mode: 0x20
bits per word: 8
max speed: 1200000 Hz (1200 KHz)
root@imx6qpdlsolox:~# cat /proc/interrupts | grep sdma
48: 43 GPC 2 Level sdma
./spidev_test -D /dev/spidev0.0 -s 1200000 -b 8 -S 512 -I 1 -l
spi mode: 0x20
bits per word: 8
max speed: 1200000 Hz (1200 KHz)
total: tx 0.5KB, rx 0.5KB
>
> Best wishes.
> --
> Igor Plyatov