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.

PROCESSOR-SDK-AM68A: How to configure spidev for AM68A

Part Number: PROCESSOR-SDK-AM68A
Other Parts Discussed in Thread: SK-AM68, AM68, TDA4VM, SYSCONFIG, SK-TDA4VM

Hello, 

I tried to configure the SPI device interface(spidev) on our own board according to below guidance from TI experts.

But, the spidev was not present. 

So, I also tried to configure the SPI device interface(spidev) on SK-AM68 and the lastest SDK.

But I also could find a spidev on /dev. 

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

e2e.ti.com/.../4539931

https://e2e.ti.com/support/processors-group/processors/f/processors-forum/1188254/sk-tda4vm-spidev-not-showing-under-dev

Please check my problem. 

Below is what I tried. 

  • Checked in my side
    • root@am68a-sk:/sys/class# ls -l spi*
      spi_master:
      total 0
      lrwxrwxrwx 1 root root 0 Apr 28 2022 spi5 -> ../../devices/platform/bus@100000/2150000.spi/spi_master/spi5

      spidev:
      total 0
      root@am68a-sk:/sys/class#

      root@am68a-sk:/dev# ls -l spi*
      ls: cannot access 'spi*': No such file or directory

  • Setup Information
    • EVK : TI SK-AM68
    • SDK version : tti-processor-sdk-linux-edgeai-j721s2-evm-09_01_00_06-Linux-x86-Install.bin
    • SDK Image : tisdk-edgeai-image-j721s2-evm.wic.xz (Prebuilt EdgeAI Image) + custom kernel what i built (6.1.46-dirty)

  • What I tried 
    • changed the kernel configuration (arch/arm64/configs/defconfig)
      CONFIG_SPI_SPIDEV=y
      CONFIG_SPI_OMAP24XX=y
    • changed device tree files
      k3-am68-sk-base-board.dtb (I disabled pinmux settings of dss_vout0_pins_default and rpi_header_gpio0_pins_default for spidev.)
      #include <dt-bindings/mux/ti-serdes.h>
      
      / {
              compatible = "ti,am68-sk", "ti,j721s2";
              model = "Texas Instruments AM68 SK";
      
              chosen {
                      stdout-path = "serial2:115200n8";
              };
      
              aliases {
                      serial2 = &main_uart8;
                      mmc1 = &main_sdhci1;
                      spi5 = &main_spi5;
              };
      .......................
      .......................
      &main_pmx0 {
      .......................
              spi5_pins_default: spi5-pins-default {
                      pinctrl-single,pins = <
                              J721S2_IOPAD(0x07C, PIN_INPUT, 8) /* (T27) MCASP0_AXR3.SPI5_CLK */
                              J721S2_IOPAD(0x070, PIN_INPUT, 8) /* (R27) MCAN1_RX.SPI5_D0 */
                              J721S2_IOPAD(0x088, PIN_INPUT, 11) /* (AD27) MCAN4_RX.SPI5_D1 */ 
                              J721S2_IOPAD(0x068, PIN_INPUT, 8) /* (U28) MCAN0_RX.SPI5_CS0 */
                              J721S2_IOPAD(0x064, PIN_INPUT, 8) /* (W28) MCAN0_TX.SPI5_CS1 */
                              J721S2_IOPAD(0x054, PIN_INPUT, 8) /* (Y27) MCASP2_ACLKX.SPI5_CS2 */
                              J721S2_IOPAD(0x058, PIN_INPUT, 8) /* (AA27) MCASP2_AFSX.SPI5_CS3 */
                      >;
              };
      .......................
      
      &main_spi5 {
              pinctrl-names = "default";
              pinctrl-0 = <&spi5_pins_default>;
              status = "okay";
      
              spidev@0 {
                      spi-max-frequency = <2000000>;
                      reg = <0>;
                      compatible = "linux,spidev";
              };
      };
      .......................
       

Tnanks,

Jang

  • Hi Jang,

    Please give me a day to try to take a deeper look at this issue.

    One thing that could be happening is differences in GPIO since J721S2/AM68 is slightly different from J721E/TDA4VM which most of the E2E and application notes use. Another thing could be differences in SDK version. I think most of the examples we have tried in the past is on 8.x SDK, so there may be changes in 9.0/9.1 SDK that causes some of the examples in the past to fail.

    Regards,

    Takuma

  • Hi Takuma, 

    Thanks for your update.

    I will try with a version 8.x of SDK and SK-AM68. 

    And There is a typo. I'm sorry to make you confused.

    -My Typo-

    So, I also tried to configure the SPI device interface(spidev) on SK-AM68 and the lastest SDK.

    But I also could find a spidev on /dev.  ===> But I also could not find a spidev on /dev.

    Thanks, 

    Jang. 

  • Hi Jang,

    Looking through, it seems software-wise most of the things are in place. However, I do see some resource conflict issues regarding the pinmuxing if using the default SDK image.

    For SPI5 for AM68 in particular, the CLK line is used by DSS (aka, the display): https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/tree/arch/arm64/boot/dts/ti/k3-am68-sk-base-board.dts?h=ti-linux-5.10.y#n267. Additionally, one of the data line is used for MCAN: https://git.ti.com/cgit/ti-linux-kernel/ti-linux-kernel/tree/arch/arm64/boot/dts/ti/k3-am68-sk-base-board.dts?h=ti-linux-5.10.y#n351. Lastly, some of the chip select are used by various different modules. You would only need one CS per device, so if you are just connecting a single device you can delete the CS lines that are used in SPI5 pinmux.

    My recommendation would be two options:

    1. Continue to use SPI5, but not have display. If you delete the display node and MCAN, and free up the pins for SPI5, then SPI5 can be used. Most of the other SPI interface also uses clock and data lines that are pinmuxed for display.
    2. Through sysconfig tool select a different SPI interface like SPI2, which uses pins from MCAN7, Main I2C1 (which has a connection to a GPIO expander for CSI), and a pin from the 40 pin Raspberry Pi header for clock and data. Delete this pinmuxing such that SPI2 will be free to use these pins.

    Regards,

    Takuma

  • Hi Takuma, 

    Thanks for your update. 

    Regarding your options, 

    • #Option1,2 : Actually, I already tried this before I created this ticket. I disabled "all mcan devices", "ospi" and "DSS display node" 

    would you make sure whether you could see a spidev successfully using SDK 9.x with your two options?

    I am trying to work SDK 8.x now. I will share my status.

    Thanks, 

    Jang. 

  • Hi Takuma, 

    I share my debugging status. 

    I could find spidev using SDK 08_06_00_10 + SK AM68.  

    Below are logs what i captured.

    root@am68a-sk:/sys/class# ls -l spi*
    spi_master:
    total 0
    lrwxrwxrwx 1 root root 0 Mar 1 2023 spi10 -> ../../devices/platform/bus@100000/bus@100000:bus@28380000/40320000.spi/spi_master/spi10
    lrwxrwxrwx 1 root root 0 Mar 1 2023 spi11 -> ../../devices/platform/bus@100000/2100000.spi/spi_master/spi11
    lrwxrwxrwx 1 root root 0 Mar 1 2023 spi12 -> ../../devices/platform/bus@100000/2110000.spi/spi_master/spi12
    lrwxrwxrwx 1 root root 0 Mar 1 2023 spi13 -> ../../devices/platform/bus@100000/2120000.spi/spi_master/spi13
    lrwxrwxrwx 1 root root 0 Mar 1 2023 spi14 -> ../../devices/platform/bus@100000/2130000.spi/spi_master/spi14
    lrwxrwxrwx 1 root root 0 Mar 1 2023 spi15 -> ../../devices/platform/bus@100000/2140000.spi/spi_master/spi15
    lrwxrwxrwx 1 root root 0 Mar 1 2023 spi16 -> ../../devices/platform/bus@100000/2160000.spi/spi_master/spi16
    lrwxrwxrwx 1 root root 0 Mar 1 2023 spi17 -> ../../devices/platform/bus@100000/2170000.spi/spi_master/spi17
    lrwxrwxrwx 1 root root 0 Mar 1 2023 spi5 -> ../../devices/platform/bus@100000/2150000.spi/spi_master/spi5
    lrwxrwxrwx 1 root root 0 Mar 1 2023 spi6 -> ../../devices/platform/bus@100000/bus@100000:bus@28380000/47000000.syscon/47040000.spi/spi_master/spi6
    lrwxrwxrwx 1 root root 0 Mar 1 2023 spi7 -> ../../devices/platform/bus@100000/bus@100000:bus@28380000/47000000.syscon/47050000.spi/spi_master/spi7
    lrwxrwxrwx 1 root root 0 Mar 1 2023 spi8 -> ../../devices/platform/bus@100000/bus@100000:bus@28380000/40300000.spi/spi_master/spi8
    lrwxrwxrwx 1 root root 0 Mar 1 2023 spi9 -> ../../devices/platform/bus@100000/bus@100000:bus@28380000/40310000.spi/spi_master/spi9

    spidev:
    total 0
    lrwxrwxrwx 1 root root 0 Mar 1 2023 spidev5.0 -> ../../devices/platform/bus@100000/2150000.spi/spi_master/spi5/spi5.0/spidev/spidev5.0
    root@am68a-sk:/sys/class# cd /dev/
    root@am68a-sk:/dev# ls -l spi*
    crw------- 1 root root 153, 0 Jan 18 05:11 spidev5.0
    root@am68a-sk:/dev# uname -a
    Linux am68a-sk 5.10.162-g76b3e88d56 #1 SMP PREEMPT Thu Jan 18 15:48:30 KST 2024 aarch64 aarch64 aarch64 GNU/Linux
    root@am68a-sk:/dev#

    Thanks, 

    Jang. 

  • Hi Jang,

    Thanks for trying it out on 8.6 and thanks for the information. I will need a day to try this out myself and gather some initial information for 9.x SDK.

    Regards,

    Takuma

  • Hi Jang,

    I am currently setting up to do some experiments, but in parallel, can you check when you were using 9.x SDK whether the kernel module for SPI was loaded with modprobe?

    To list spi related modules, the following command can be used:

    • find /lib/modules/$(uname -r) -type f -name '*.ko' | grep -i spi

    And see if modprobing these generates an error or not for 9.x SDK.

    Regards,

    Takuma

  • Hi Jang,

    I did some experiments and also saw the same issue as you for 9.0.1 SDK. I used SK-TDA4VM as the device due to what was available to me immediately, but I believe I was able to reproduce the issue on there and make a patch to get basic functionality.

    Could you try applying this one line patch on top of the changes to device tree you have done?

    0001-adding-linux-spidev-device-tree-compatibility-into-s.patch

    It seems there was a change in spidev_probe function for matching driver to device on device tree that might have caused spidev to not come up under /dev folder.

    Let me know if this improves the behavior you were seeing on 9.x SDK for SK-AM68, since the driver should be shared between SK-AM68 and SK-TDA4VM.

    Regards,

    Takuma

  • Hi Takuma,

    I appreciate giving me good news.

    I will try with your patch next monday. And I will get back to you with feedback.

    Thanks,

    Jang.

  • Hi Takuma, 

    This issue was resolved with your patch. 

    Thanks, 

    Jang.

  • Hi Siwon,

    Glad to hear that!

    Regards,

    Takuma