This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TDA4VM: SPI / SPIDEV issue

Part Number: TDA4VM

Hello,

 

on our custom board we have an ASIC which is configurable via SPI (SPI Slave).

This ASIC is connected to MCSPI0

 

Ball        TDA4

AA1       SPI0_CLK

Y4           SPI0_CS1

AB5        SPI0_D0

AA3       SPI0_D1

 

We currently use a modified SDK version 06_01_00_05 (adapted to our custom board)

 

My Steps:

 

arch/arm64/boot/dts/ti/k3-j721e-main.dtsi

 

main_spi0: spi@2100000 {

compatible = "ti,am654-mcspi","ti,omap4-mcspi";

reg = <0x0 0x2100000 0x0 0x400>;

interrupts = <GIC_SPI 184 IRQ_TYPE_LEVEL_HIGH>;

clocks = <&k3_clks 266 1>;

power-domains = <&k3_pds 266 TI_SCI_PD_EXCLUSIVE>;

#address-cells = <1>;

#size-cells = <0>;

};

 

arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts

 

&main_pmx0 {

 

         ...

 

         myspi1_pins_default: myspi1_pins_default {

                   pinctrl-single,pins = <

                           J721E_IOPAD(0x1c8, PIN_OUTPUT, 0) /* (AA1) SPI0_CLK */

                           J721E_IOPAD(0x1c4, PIN_OUTPUT, 0) /* (Y4) SPI0_CS1 */

                          J721E_IOPAD(0x1cc, PIN_INPUT, 0) /* (AB5) SPI0_D0 */

                           J721E_IOPAD(0x1d0, PIN_OUTPUT, 0) /* (AA3) SPI0_D1 */

                   >;

         };

};

 

&main_spi0 {

status = "okay";

pinctrl-names = "default";

pinctrl-0 = <&myspi1_pins_default>;

spidev@1 {

spi-max-frequency = <24000000>;

reg = <0>;

compatible = "linux,spidev";

};

};


arch/arm64/configs/tisdk_j7-evm_defconfig

 

CONFIG_SPI=y

CONFIG_SPI_MASTER=y

CONFIG_SPI_SPIDEV=y

 

After compilation and reboot:

 

[   1.308485] spidev spi2.0: buggy DT: spidev listed directly in DT

[   1.319201] WARNING: CPU: 1 PID: 27 at drivers/spi/spidev.c:730 spidev_probe+0x1cc/0x1e0

[   1.353314] pc : spidev_probe+0x1cc/0x1e0

[   1.357309] lr : spidev_probe+0x1cc/0x1e0

[   1.446466] spidev_probe+0x1cc/0x1e0

[   1.450112] spi_drv_probe+0x7c/0xd8

[   1.484846] spi_add_device+0xac/0x168

 

 

root@j7-evm:~# ls -la /dev/spi*

crw------- 1 root root 153, 0 Oct 24 03:20 /dev/spidev2.0

 

 

root@j7-evm:~# ls -la /sys/class/spi*

/sys/class/spi_master:

total 0

drwxr-xr-x 2 root root 0 Oct 24 03:20 .

drwxr-xr-x 60 root root 0 Oct 24 03:20 ..

lrwxrwxrwx 1 root root 0 Oct 24 03:20 spi2 -> ../../devices/platform/interconnect@100000/2100000.spi/spi_master/spi2

 

/sys/class/spidev:

total 0

drwxr-xr-x 2 root root 0 Oct 24 03:20 .

drwxr-xr-x 60 root root 0 Oct 24 03:20 ..

lrwxrwxrwx 1 root root 0 Oct 24 03:20 spidev2.0 -> ../../devices/platform/interconnect@100000/2100000.spi/spi_master/spi2/spi2.0/spidev/spidev2.0

 

 

In the next step I will write a little python script to initialize and read/write data. But as you can see, there is an error.

 

root@j7-evm:~# python

Python 2.7.16 (default, Oct 24 2019, 04:00:06)

[GCC 8.3.0] on linux2

Type "help", "copyright", "credits" or "license" for more information.

>>> import spidev

Traceback (most recent call last):

File "<stdin>", line 1, in <module>

ImportError: No module named spidev

>>> 

 

Is my configuration correct? As you can see, the log shows a buggy DT and a WARNING.

 

Thanks a lot for your help,

Sergei

  • Hi Sergei,

    Snippet from Linux driver below on why you are seeing the warning.

            /*
             * spidev should never be referenced in DT without a specific
             * compatible string, it is a Linux implementation thing
             * rather than a description of the hardware.
             */
            WARN(spi->dev.of_node &&
                 of_device_is_compatible(spi->dev.of_node, "spidev"),
                 "%pOF: buggy DT: spidev listed directly in DT\n", spi->dev.of_node);
    



    The issue you are seeing is with python module present on Linux File system?



    Regards,
    Vishal

  • Hi Sergei,

    There is one mismatch in the configuration regarding chip select.

    Spi slave node has:

    spidev@1 {
            spi-max-frequency = <24000000>;
            reg = <0>;
            compatible = "";
    };

    But pinmux has:
    J721E_IOPAD(0x1c4, PIN_OUTPUT, 0) /* (Y4) SPI0_CS1 */

    If slave is on CS1, then set: reg = <1>;
    If slave is on CS0, then pinmux is wrong and should configure SPI0_CS0 pin instead.


    Regards,
    Vishal