• TI Thinks Resolved

Linux/TDA2EVM5777: QSPI Flash can't work on DMA mode

Part Number: TDA2EVM5777

Tool/software: Linux

Dear Guys,

      As the QSPI read speed was too slow on Linux  3.14.57, we try to merge the last QSPI driver from kernel git, but it can't work fine, the log as below.

      When probe QSPI driver, the error info as "ti-qspi 4b300000.qspi: No Rx DMA available, trying mmap mode"

      In spi_ti_qspi.c, the driver try to request dma channel, but get fails.

 dma_cap_zero(mask);
 dma_cap_set(DMA_MEMCPY, mask);
 qspi->rx_chan = dma_request_channel(mask, NULL, NULL);
 if (!qspi->rx_chan) {
  dev_err(qspi->dev,
   "No Rx DMA available, trying mmap mode\n");
  ret = 0;
  goto no_dma;
 }

     Why the dma_request_channel() return fail?

waley

  • Hi Waley,

    I'm not sure I follow the changes made here. What changes did you make to your driver and where did you pick these changes from? Which kernel version are you based off?

    Regards
    Shravan
  • In reply to Shravan Karthik:

    Hi Shravan,

    Thanks for your quickly response.

    1. I got the new kernel source from git://git.ti.com/glsdk/infoadas-kernel.git
    2. I updated the files of QSPI driver as below listed.
    drivers/spi/spi.c
    drivers/spi/spidev.c
    include/linux/spi/spi.h
    drivers/spi/spi-ti-qspi.c
    drivers/mtd/devices/m25p80.c
    3. Let it compile pass.
    4. After that, the system can bring up, but QSPI work abnormal.

    waley
  • In reply to wade:

    Hi Waley,

    Is the rest of your system based of Kernel 3.14? Migrating the qspi driver code alone isn't recommended. There are changes made to the dma APIs between the two kernel revisions (infoadas-kernel is based off K-4.4), and thus its recommend you rebase to kernel 4.4.
    Below is a patch-set (not exhaustive) on and an article on the dma driver change between the two revisions.

    lwn.net/.../
    patchwork.kernel.org/.../

    Regards
    Shravan
  • In reply to Shravan Karthik:

    Hi Shravan,

         Thanks for your reply.

         But I tried another test, the problem is still. Maybe the reason is DMA feature works abnormal.

         I added dma_request_channel() in QSPI driver based on Kernel 3.14 as below, not merge new drivers from Kernel 4.4.

    -----------------------------------------------------------------------------------------------------------------------------

         In function ti_qspi_probe() of .\kernel\omap\drivers\spi\spi-ti-qspi.c file.

    #if 1  //for test only
     dma_cap_zero(mask);
     dma_cap_set(DMA_MEMCPY, mask);
     rx_chan = dma_request_channel(mask, NULL, NULL);
     if (!rx_chan) {
      dev_err(&pdev->dev,
       "No Rx DMA available, trying mmap mode\n");
     }else{
         dev_err(&pdev->dev,
       "Request Rx DMA Channel, OK!!!\n");
     }
    #endif
    -------------------------------------------------------------------------------------------------------------------------

        But the dma channel can't be allocated. So, I guess  if the dtb or config files are incorrect?  Or the dma feature is not ready on Kernel 3.14.

    Waley

  • In reply to wade:

    Hi Waley,

    The DMA feature on SPI was only added in K4.4, which is why I recommend moving to the K4.4 code base.

    Regards
    Shravan
  • In reply to Shravan Karthik:

    Hi Shravan,

    Thank you very much! I will try.

    Waley