Hi
I am trying to enable SPI (spi2) in slave mode on imx6ul controller.
I am using a module from variscite - DART-6UL, Linux kernel 5.15.71 and yocto Kirkstone
The dtb changes are as follows
&ecspi2 {
cs-gpios = <&gpio4 22 0>;
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_ecspi2_1>;
status = "okay";
#address-cells = <0>;
spi-slave;
slave@0 {
compatible = "var,spidev";
status = "okay";
};
};
&iomuxc {
pinctrl_ecspi2_1: ecspi2grp {
fsl,pins = <
MX6UL_PAD_CSI_DATA03__ECSPI2_MISO 0x100a0 /* from J13.2 */
MX6UL_PAD_CSI_DATA02__ECSPI2_MOSI 0x000a0 /* from J6.7 */
MX6UL_PAD_CSI_DATA00__ECSPI2_SCLK 0x000a0 /* from J11.9 */
MX6UL_PAD_CSI_DATA01__ECSPI2_SS0 0x070a0 /* from J6.5 */
>;
};
};
The SPI_SLAVE is enabled, as shown
root@imx6ul-var-dart:~# zcat /proc/config.gz | grep SLAVE
CONFIG_I2C_SLAVE=y
# CONFIG_I2C_SLAVE_EEPROM is not set
# CONFIG_I2C_SLAVE_TESTUNIT is not set
CONFIG_SPI_SLAVE=y
# CONFIG_SPI_SLAVE_TIME is not set
# CONFIG_SPI_SLAVE_SYSTEM_CONTROL is not set
using the command spidev_test -v -D /dev/spidev1.0 -p 12345678
I wait for the master clock but the spi transmission is blocked for ever.
dmesg logs
root@imx6ul-var-dart:~# dmesg | grep spi
[ 2.375428] spi_imx 200c000.spi: can't get the TX DMA channel, error -517!
[ 2.717310] SPI driver ads7846 has no spi_device_id for ti,tsc2046
[ 2.723788] SPI driver ads7846 has no spi_device_id for ti,ads7843
[ 2.730005] SPI driver ads7846 has no spi_device_id for ti,ads7845
[ 2.736317] SPI driver ads7846 has no spi_device_id for ti,ads7873
[ 3.223609] spi_imx 200c000.spi: can't get the TX DMA channel, error -517!
[ 3.459763] spi_imx 200c000.spi: can't get the TX DMA channel, error -517!
[ 3.483822] spi_imx 200c000.spi: can't get the TX DMA channel, error -517!
[ 3.521413] spi_imx 200c000.spi: can't get the TX DMA channel, error -517!
[ 6.218254] spi spi1.0: spi_imx_setup: mode 0, 8 bpw, 0 hz
[ 1199.279709] spidev spi1.0: spi_imx_setup: mode 0, 8 bpw, 0 hz
[ 1199.279836] spidev spi1.0: spi_imx_setup: mode 0, 8 bpw, 0 hz
[ 1199.279908] spidev spi1.0: spi_imx_setup: mode 0, 8 bpw, 500000 hz
[ 1199.281368] mx51_ecspi_prepare_transfer : inside 692
[ 1199.281440] spi_imx_transfer: 1661: -----
[ 1199.281481] mx51_ecspi_intctrl : inside 486
[ 1199.461488] mx51_ecspi_intctrl : inside 486
[ 1205.547012] spidev spi1.0: interrupted
[ 1205.547098] spidev spi1.0: SPI transfer failed: -4
[ 1205.547200] spi_slave spi1: failed to transfer one message from queue
on the logic analyzer I see that the chip sends a 0x30 as shown below
I am aware of the HW issues with the SPI slave mode in ECSPI and the datasheet AN13633. I see that the AN13633SW patches are integrated into the kernel 5.15. The information was available here https://community.toradex.com/t/spi-slave-mode-for-imx6ull-com/17214
I aslo find that there are closed tickets on this topic but do not find a solution for the same, e.g https://community.nxp.com/t5/i-MX-Processors/IMX6-Linux-SPI-Slave-mode-not-running/m-p/1161156#M1627...
My questions
1. Is my DTB correct?
2. Could anyone please point me out, my mistake?
3. If the SPI mode works on older kernels, could anyone suggest me that, as I find the same behavior in 5.10.72 and 5.4.142.
Regards
Prajosh Premdas
did you apply for the patches from AN13633? it seems the bsp you use(variscite ) is different from nxp bsp, you can compare with them,
"https://github.com/nxp-imx"
for dts, pls check if you add "spi-slave" in your dts file as description as below?
you also can refer to the link as below:
I think I give you suggestion that try to add "spi-slave" in your dts