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: Connecting QSPI NOR flash to MCSPI

Part Number: TDA4VM
Other Parts Discussed in Thread: AM4372

Hi, we are analyzing TDA4 SoC QSPI capabilities with goal of using it to connect to flash memory.

We noticed several instances of Multichannel SPI on TDA4 device supporting Quad data lanes, and want to use either MCSPI0 or MCU_MCSPI0 to connect to flash memory of FPGA.The flash memory does not support octal SPI and therefor we decided not to use TDA4 OSPI but regular (Quad) MCSPI interfaces.

Please note:

  • Processor SDK version: 06_02_00 - we are planing to upgrade to 7_01_00 in near future.
  • We are trying to keep pinout simmilar as possible to current default configuration for EVM board

Looking through PROCESSOR SDK Linux and RTOS user guides we did not find anything helpful on how to enable and use MCSPI interfaces. Ill elaborate:

When adding SPI to device tree we referred to kenrel documentation Documentation/devicetree/bindings/spi/ti_qspi.txt to see how to properly include it, but it seemd somewhat outdated as it shows examples only for am4372 and dra7xxx devices using TI QSPI, but TDA4 upgraded to TI McSPI.

User guide also instructs how to enable linux QSPI driver support, but:

<*> DRA7xxx QSPI controller support

Is no where to be found, my guess is, for TDA4 it is replaced with:

<*>   McSPI driver for OMAP

which is enabled by default.
But only driver we find when linux boots is cadence-qspi and module cxd2880-spi.ko:

root@j7-evm:~# dmesg | grep spi
[    4.703505] cadence-qspi 47050000.spi: n25q512a (65536 Kbytes)
[    4.723071] cadence-qspi 47050000.spi: Cadence QSPI NOR probe failed -517
[    5.449308] cadence-qspi 47050000.spi: n25q512a (65536 Kbytes)

root@j7-evm:~# find /lib/modules/ -iname "*spi*"
/lib/modules/4.19.94-g5a23bc00e0/kernel/drivers/media/spi
/lib/modules/4.19.94-g5a23bc00e0/kernel/drivers/media/spi/cxd2880-spi.ko
/lib/modules/4.19.94/kernel/drivers/media/spi
/lib/modules/4.19.94/kernel/drivers/media/spi/cxd2880-spi.ko

We also could not figure out which driver API we are suppose to use, as we noticed several being mentioned in documentation, with no clear examples on how to use them:

  • psdkra/pdk/packages/ti/drv/spi/src/SPI_drv.c
  • psdkla/board-support/linux-4.19.94+gitAUTOINC+5a23bc00e0-g5a23bc00e0/drivers/spi/spi-ti-qspi.c

We can see some useful instructions in this doc: software-dl.ti.com/.../spi.html
but at this point we are wonder can we even enable MCSPI to be used to connect to NOR flash?

Can you help us to achieve the following:

  1. include MCSPI to linux device tree
  2. figure out which driver, and which API we can use to perform read and write to flash memory
  3. enable driver for quad SPI
  4. How to write some kind QSPI_FlashReadWrite Example application for TDA4x

Regards.
Uros

  • Hi Uros,

    There is no mention of McSPI supporting quad mode. Did you find it in TRM?
    Do you want to use QSPI nor flash as the primary boot media?

    What is the use case?

    - Keerthy

  • Hi Keerthy

    >>There is no mention of McSPI supporting quad mode. Did you find it in TRM?<<
    - Reading user guides we saw documentation for OSPI and QSPI, and in technical documentation we saw OSPI and MCSPI interfaces and for some reason we drew a parallel between the two. That's why we made a mistake thinking MCSPI supports quad speeds, but now, after we double checked it is true that TRM does not mention MCSPI supporting quad mode.

    >>Do you want to use QSPI nor flash as the primary boot media?<<
    - No, at this stage we do not want to boot from flash.

    I will explain what is our goal:

    The custom device we are developing includes FPGA chip. The flash memory of FPGA is, by design, connected to TDA4 SoC via SPI interface.
    SPI interfaces used are MCSPI0 and/or MCU_MCSPI0.

    Goal is to be able to read current state (data) of FPGA flash memory and if necessary flash new data to it from TDA4 SoC.

    For this version of hardware we want to be able to use either MCSPI0 or MCU_MCSPI0, as normal SPI hence it does not support quad mode, to connect to flash memory.

    Can you support us to achieve that, if it is possible?

    We need to include mcspi device to kernel device tree, and figure out which driver, and how to use it.

    Regards.
    Uros

  • Hi Uros,

    You can look at this e2e thread on something similar: https://e2e.ti.com/support/processors/f/791/t/884031

    The suggestion is to use spidev. Documentation on spidev: https://pypi.org/project/spidev/

    Regards,
    Keerthy

  • Hi Keerthy,

    Thank you for your response, and suggestions.
    I will continue the work regarding the SPI with your suggestions, and will contact you soon with further info and results.

    Regards
    Uros