Re: spi: imx: Increase imx51 ecspi burst length fails on imx6dl and imx8mm

From: linux
Date: Mon Nov 20 2023 - 03:27:19 EST


Hi Stefan

Thanks for analyzing the problem and sorry for the delay, I had to simplify the code to a minimum so that I can send to you.
Now I was able to use spidev.
I have an environment with yocto kirstone 4.0.10.
Load the spi-dma (imx-sdma 302c0000.dma-controller: loaded firmware 4.5), run the spi_imx and the spidev as kenelmodule.

I run the code on a Toradex Verdin Development Board and use the imx8mm-verdin-nonwifi-dev.dts

To add the spidev I patched imx8mm-verdin.dtsi
diff --git a/arch/arm64/boot/dts/freescale/imx8mm-verdin.dtsi b/arch/arm64/boot/dts/freescale/imx8mm-verdin.dtsi
index 6f0811587142..262500940adc 100644
--- a/arch/arm64/boot/dts/freescale/imx8mm-verdin.dtsi
+++ b/arch/arm64/boot/dts/freescale/imx8mm-verdin.dtsi
@@ -209,6 +209,15 @@ &ecspi2 {
cs-gpios = <&gpio5 13 GPIO_ACTIVE_LOW>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi2>;
+
+ spidev@0{
+ compatible = "micron,spi-authenta";
+ reg = <0>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ spi-max-frequency = <20000000>;
+ status = "okay";
+ };
};

as a spidev test program I used
https://raw.githubusercontent.com/raspberrypi/linux/rpi-3.10.y/Documentation/spi/spidev_test.c

I changed the transmitted data
diff --git a/recipes-spi/spidev/files/spidev_test.c b/recipes-spi/spidev/files/spidev_test.c
index 16feda9..6056ffd 100644
--- a/recipes-spi/spidev/files/spidev_test.c
+++ b/recipes-spi/spidev/files/spidev_test.c
@@ -39,13 +39,22 @@ static void transfer(int fd)
{
int ret;
uint8_t tx[] = {
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0x40, 0x00, 0x00, 0x00, 0x00, 0x95,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
- 0xDE, 0xAD, 0xBE, 0xEF, 0xBA, 0xAD,
- 0xF0, 0x0D,
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, // 16
+ 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
+ 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, // 32
+ 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
+ 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x20, // 48
+ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
+ 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, 0x40, // 64
+ 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
+ 0x09, 0x0a, 0x0b, 0x0c, 0x0d, 0x0e, 0x0f, 0x10, // 80
+ 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17, 0x18,
+ 0x19, 0x1a, 0x1b, 0x1c, 0x1d, 0x1e, 0x1f, 0x20, // 96
+ 0x21, 0x22, 0x23, 0x24, 0x25, 0x26, 0x27, 0x28,
+ 0x29, 0x2a, 0x2b, 0x2c, 0x2d, 0x2e, 0x2f, 0x20, // 112
+ 0x31, 0x32, 0x33, 0x34, 0x35, 0x36, 0x37, 0x38,
+ 0x39, 0x3a, 0x3b, 0x3c, 0x3d, 0x3e, 0x3f, // 127
};
uint8_t rx[ARRAY_SIZE(tx)] = {0, };

sending the content showed again the bad data
spidev_test --device /dev/spidev1.0 --speed 20000000 --bpw 8

0x00,0x00,0x01,
0x00,0x00,0x00,0x02,
0x00,0x00,0x00,0x03,
0x00,0x00,0x00,0x04,

I you need more information let me know.

Best Regards
Stefan Bigler

Am 2023-11-19T08:52:54.000+01:00 hat Stefan Moring <stefan.moring@xxxxxxxxxxxxxxx> geschrieben:
> Hi Stefan,
>
> Can you maybe share me your test code? I can try to reproduce it tomorrow.
>
> Kind regards,
>
> Stefan Moring