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-Q1: J721e

Part Number: TDA4VM-Q1
Other Parts Discussed in Thread: TDA4VM

Tool/software:

Hello, TI, Urgent need for support

I need to enable the MCSPI3 function, and the TDA4 is the master. I followed the operation of this document and imitated SPI6 to set SPI3. The result was that the spidev node under /dev/ was not generated.

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/947437/faq-ccs-tda4vm-how-to-use-spi-spi_dev-on-tda4-j721e

root@j721e-evm:~# ls -l /sys/class/spi*
/sys/class/spi_master:
total 0
lrwxrwxrwx 1 root root 0 Feb 27 17:26 spi0 -> ../../devices/platform/bus@100000/2130000.spi/spi_master/spi0
lrwxrwxrwx 1 root root 0 Feb 27 17:26 spi1 -> ../../devices/platform/bus@100000/bus@100000:bus@28380000/47000000.bus/47040000.spi/spi_master/spi1

/sys/class/spi_slave:
total 0

/sys/class/spidev:
total 0

SDK is the  "ti-processor-sdk-linux-adas-j721e-evm-10_00_00_08-Linux-x86-Install"

      

Linux/board-support/ti-linux-kernel-6.6.32+git-ti/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts
add:
+spi3_pins_default: spi3_pins_default {
+pinctrl-single,pins = <
+J721E_IOPAD(0x144, PIN_INPUT, 4) /* (Y25) PRG0_PRU1_GPO17.SPI3_CLK */
+J721E_IOPAD(0x148, PIN_INPUT, 4) /* (AA26) PRG0_PRU1_GPO18.SPI3_D0 */
+J721E_IOPAD(0x14c, PIN_INPUT, 4) /* (AA29) PRG0_PRU1_GPO19.SPI3_D1 */
+J721E_IOPAD(0x11c, PIN_INPUT, 4) /* (AA24) PRG0_PRU1_GPO7.SPI3_CS0 */
+>;
+};
+&main_spi3 {
+pinctrl-names = "default";
+pinctrl-0 = <&spi3_pins_default>;
+status = "okay";
+spidev@0 {
+spi-max-frequency = <24000000>;
+reg = <0>;
+compatible = "linux,spidev";
+};
+};
  • more information

  • Hi Sijia,

    It looks like there were some changes in the driver that has made the FAQ a bit outdated. Could you reference below patch? Specifically, the last portion that adds the line "{ .compatible = "linux,spidev", .data = &spidev_of_check },".

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/7674.0001_2D00_Enable_2D00_main_5F00_spi6_2D00_for_2D00_J7200_2D00_9.2_2D00_SDK.patch

    It used to be that the spidev compatible field can be used in previous Linux kernel like this: https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/tree/drivers/spi/spidev.c?h=ti-linux-5.10.y#n744

    But, in more recent kernels, they put more stricter checks to enforce proper spidev compatible field: https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/tree/drivers/spi/spidev.c?h=ti-linux-6.6.y#n721

    Regards,

    Takuma

  • Hi, Takuma, I tried adding the patch to spidev.c, but it still doesn't work.

    "root@j721e-evm:~# ls -l /sys/class/spi*
    /sys/class/spi_master:
    total 0
    lrwxrwxrwx 1 root root 0 Feb 27 17:26 spi0 -> ../../devices/platform/bus@100000/2130000.spi/spi_master/spi0
    lrwxrwxrwx 1 root root 0 Feb 27 17:26 spi1 -> ../../devices/platform/bus@100000/bus@100000:bus@28380000/47000000.bus/47040000.spi/spi_master/spi1

    /sys/class/spi_slave:
    total 0

    /sys/class/spidev:
    total 0

    root@j721e-evm:~# ls -l /dev/spi*
    ls: cannot access '/dev/spi*': No such file or directory
    root@j721e-evm:~#"

    The following are the modifications to the dts and spidev.c in my project. SDK is the  "ti-processor-sdk-linux-adas-j721e-evm-10_00_00_08-Linux-x86-Install"

      

    --- /home/sijia/Linux_SDK/board-support/ti-linux-kernel-6.6.32+git-ti/drivers/spi/spidev.c	2018-03-09 20:34:56.000000000 +0800
    +++ /home/sijia/TDA4_SDK/Linux/board-support/ti-linux-kernel-6.6.32+git-ti/drivers/spi/spidev.c	2024-11-13 11:02:24.822241076 +0800
    @@ -732,6 +732,7 @@
     }
     
     static const struct of_device_id spidev_dt_ids[] = {
    +	{ .compatible = "linux,spidev", .data = &spidev_of_check },
     	{ .compatible = "cisco,spi-petra", .data = &spidev_of_check },
     	{ .compatible = "dh,dhcom-board", .data = &spidev_of_check },
     	{ .compatible = "lineartechnology,ltc2488", .data = &spidev_of_check },
    

    --- /home/sijia/Linux_SDK/board-support/ti-linux-kernel-6.6.32+git-ti/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts	2018-03-09 20:34:56.000000000 +0800
    +++ /home/sijia/TDA4_SDK/Linux/board-support/ti-linux-kernel-6.6.32+git-ti/arch/arm64/boot/dts/ti/k3-j721e-common-proc-board.dts	2024-11-13 10:19:44.085397874 +0800
    @@ -334,6 +334,15 @@
     			J721E_IOPAD(0x200, PIN_INPUT, 7) /* (AC4) UART1_CTSn.GPIO0_127 */
     		>;
     	};
    +
    +	spi3_pins_default: spi3_pins_default {
    +        pinctrl-single,pins = <
    +            J721E_IOPAD(0x144, PIN_INPUT, 4) /* (Y25) PRG0_PRU1_GPO17.SPI3_CLK */
    +            J721E_IOPAD(0x148, PIN_INPUT, 4) /* (AA26) PRG0_PRU1_GPO18.SPI3_D0 */
    +            J721E_IOPAD(0x14c, PIN_INPUT, 4) /* (AA29) PRG0_PRU1_GPO19.SPI3_D1 */
    +            J721E_IOPAD(0x11c, PIN_INPUT, 4) /* (AA24) PRG0_PRU1_GPO7.SPI3_CS0 */
    +        >;
    +    };
     };
     
     &wkup_pmx0 {
    @@ -995,3 +1004,16 @@
     			>;
     	};
     };
    +
    +&main_spi3 {
    +	status = "okay";
    +    pinctrl-names = "default";
    +    pinctrl-0 = <&spi3_pins_default>;
    +    
    + 
    +    spidev@0 {
    +        spi-max-frequency = <24000000>;
    +        reg = <0>;
    +        compatible = "linux,spidev";
    +    };
    +};
    \ No newline at end of file

    After I modified it, I executed

    #make linux

    and then executed

    #sudo make linux_install  

    to update my SD card.

    Below is the startup log

    2555.start_log.txt

  • Hi Sijia,

    Maybe something has changed in the latest kernel. Attached patch was for 9.2 SDK that uses the 6.1 Linux kernel. Could you give me 2 business days to see if I can port the patch to 10.0 SDK?

    Regards,

    Takuma

  • Okay, thanks for support, waiting for the news.

  • Hi Sijia,

    Looks like the 6.6 Linux kernel used in 10.0 SDK has some additional checks for spidev and the compatible field needs to be unique.

    https://e2e.ti.com/cfs-file/__key/communityserver-discussions-components-files/791/0001_2D00_J721E_2D00_TDA4VM_2D00_10.0_2D00_SDK_2D00_enable_2D00_spi3.patch

    ^ Could you try above patch? With this, I see spidev get created under /dev.

    Regards,

    Takuma

  • Hello, Takuma

        It works. Thank a lot.

  • Hi Fei,

    Do you work with Sijia? Mainly trying to see if I can assume if this is on the same SDK and system as described by Sijia.

    In any case, the spidev_test is an application from upstream Linux. So the source code is available here: https://github.com/torvalds/linux/blob/master/tools/spi/spidev_test.c

    Looking through the source code, it seems there is a "bpw" bits per word argument you could give to spidev_test.

    Regards,

    Takuma

  • HI Takuma,

    yes we are one team and focus on the same spi problem,we try 8 or 16bits per word but RX still zero,spidev_test has defalut bpw 8 bits

    BR

  • Hi Fei, 

    Let's close this thread and continue on the other thread here: https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1441122/tda4vm-q1-spidev_test-rx-fail

    It sounds like you are mixing the RX being 0 and bits per word issue.

    Regards,

    Takuma