<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>i.MX ProcessorsのトピックRe: i.MX8M FlexSPI DMA callback never called</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/i-MX8M-FlexSPI-DMA-callback-never-called/m-p/1424874#M187970</link>
    <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;In Linux FlexSPI driver do not have DMA support.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Aldo.&lt;/P&gt;</description>
    <pubDate>Wed, 09 Mar 2022 02:09:15 GMT</pubDate>
    <dc:creator>AldoG</dc:creator>
    <dc:date>2022-03-09T02:09:15Z</dc:date>
    <item>
      <title>i.MX8M FlexSPI DMA callback never called</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX8M-FlexSPI-DMA-callback-never-called/m-p/1420582#M187588</link>
      <description>&lt;P&gt;Hi,&amp;nbsp;&lt;/P&gt;&lt;P&gt;We are developing a solution using FlexSPI to read some values from a FPGA and we are having issues with the FlexSPI driver when running DMA.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;This issue is reproduced in i.MX8M Mini and Plus.&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;So far we managed to:&lt;/P&gt;&lt;P&gt;1. Initialize the DMA channels for FlexSPI (SDMA1, channels 36 and 37).&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;&amp;amp;flexspi {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = &amp;lt;&amp;amp;pinctrl_flexspi0&amp;gt;;
	dmas = &amp;lt;&amp;amp;sdma1 36 8 2&amp;gt;, &amp;lt;&amp;amp;sdma1 37 8 1&amp;gt;;
	dma-names = "tx", "rx";
	fpga0: fpga@0 {
		reg = &amp;lt;0&amp;gt;;
		#address-cells = &amp;lt;1&amp;gt;;
		#size-cells = &amp;lt;1&amp;gt;;
		compatible = "fpga,fspi";
		spi-max-frequency = &amp;lt;100000&amp;gt;;
		spi-tx-bus-width = &amp;lt;4&amp;gt;;
		spi-rx-bus-width = &amp;lt;4&amp;gt;;
	};&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;(dma_request_slave_channel_reason ,&amp;nbsp;dma_alloc_coherent and&amp;nbsp;dmaengine_slave_config all returned OK)&amp;nbsp;&lt;/P&gt;&lt;P&gt;Our DMA channel config:&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;cfg.src_addr = (phys_addr_t)(f-&amp;gt;iobase + FSPI_RFDR);
	cfg.src_addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES;
	cfg.src_maxburst = 2;
	cfg.direction = DMA_DEV_TO_MEM;&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2. Use the IP mode for FlexSPI without DMA without issues.&lt;/P&gt;&lt;P&gt;So, we are modifying the spi-nxp-fspi driver and trying to get DMA + IP mode working.&amp;nbsp;&lt;/P&gt;&lt;P&gt;IPRXFCR:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;IPRXFCR_DMA_EN set.&lt;/LI&gt;&lt;LI&gt;IPRXFCR_CLR set (for clearing RX FIFO)&lt;/LI&gt;&lt;LI&gt;Write 1 with&amp;nbsp;IPRXFCR_WMRK (This one we are not too sure)&lt;/LI&gt;&lt;LI&gt;Run the DMA submit&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;However, we always get a DMA timeout. Here is the snippet of the DMA request (based on&amp;nbsp;spi-fsl-dspi.c) :&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="c"&gt;static int fspi_next_xfer_dma_submit(struct nxp_fspi *f)
{
	struct device *dev = f-&amp;gt;dev;
	struct nxp_fspi_dma *dma = f-&amp;gt;dma;

	dma-&amp;gt;rx_desc = dmaengine_prep_slave_single(dma-&amp;gt;chan_rx,
					dma-&amp;gt;rx_dma_phys,
					dma-&amp;gt;curr_xfer_len *
					DMA_SLAVE_BUSWIDTH_4_BYTES,
					DMA_DEV_TO_MEM,
					DMA_PREP_INTERRUPT | DMA_CTRL_ACK);
	if (!dma-&amp;gt;rx_desc) {
		dev_err(dev, "Not able to get desc for DMA xfer\n");
		return -EIO;
	}

	dma-&amp;gt;rx_desc-&amp;gt;callback = fspi_rx_dma_callback;
	dma-&amp;gt;rx_desc-&amp;gt;callback_param = f;
	if (dma_submit_error(dmaengine_submit(dma-&amp;gt;rx_desc))) {
		dev_err(dev, "DMA submit failed\n");
		return -EINVAL;
	}

	reinit_completion(&amp;amp;f-&amp;gt;dma-&amp;gt;cmd_rx_complete);

	dma_async_issue_pending(dma-&amp;gt;chan_rx);

	return 0;
}&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here are the status of the related registers after failing the transfer (in hex):&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;IPRXFCR: 0002&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;(RXDMAEN 1)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;INTR: 0060&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;(IPTXWE 1&amp;nbsp;IPRXWA 1)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;INTEN: 0001&lt;/STRONG&gt;&lt;BR /&gt;&lt;STRONG&gt;(IPCMDGE 1)&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;We are testing this with the interface we made to test the driver that creates a device in /dev/. This sample program simply tries to read the RX FIFO buffer with a dd read operation to this created device. We should get some stored data (or 0s) but we are always getting a DMA RX timeout.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Any idea? We think that we are probably not setting the watermark levels correctly but don't really know what we should set them to. Thanks.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;EDIT&lt;/STRONG&gt;: We found out that the problem is the callback (fspi_rx_dma_callback) is never being called. However, we don't know why....&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 01 Mar 2022 06:38:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX8M-FlexSPI-DMA-callback-never-called/m-p/1420582#M187588</guid>
      <dc:creator>alvaro_tx</dc:creator>
      <dc:date>2022-03-01T06:38:35Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX8M FlexSPI DMA callback never called</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX8M-FlexSPI-DMA-callback-never-called/m-p/1424874#M187970</link>
      <description>&lt;P&gt;Hello,&lt;BR /&gt;&lt;BR /&gt;In Linux FlexSPI driver do not have DMA support.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;BR /&gt;Aldo.&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2022 02:09:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX8M-FlexSPI-DMA-callback-never-called/m-p/1424874#M187970</guid>
      <dc:creator>AldoG</dc:creator>
      <dc:date>2022-03-09T02:09:15Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX8M FlexSPI DMA callback never called</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX8M-FlexSPI-DMA-callback-never-called/m-p/1424936#M187977</link>
      <description>&lt;P&gt;Hi Aldo, yes, we know that it doesn't have it, that is why we are trying to add it from our side (hence the question with the implementation).&lt;/P&gt;&lt;P&gt;Alvaro.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 09 Mar 2022 03:24:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX8M-FlexSPI-DMA-callback-never-called/m-p/1424936#M187977</guid>
      <dc:creator>alvaro_tx</dc:creator>
      <dc:date>2022-03-09T03:24:14Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX8M FlexSPI DMA callback never called</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX8M-FlexSPI-DMA-callback-never-called/m-p/1572003#M198958</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/197499"&gt;@alvaro_tx&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have you managed to implement FlexSPI DMA support?&amp;nbsp;&lt;/P&gt;&lt;P&gt;If so, could you please share your patch?&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 19 Dec 2022 16:42:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX8M-FlexSPI-DMA-callback-never-called/m-p/1572003#M198958</guid>
      <dc:creator>festevam</dc:creator>
      <dc:date>2022-12-19T16:42:15Z</dc:date>
    </item>
    <item>
      <title>Re: i.MX8M FlexSPI DMA callback never called</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/i-MX8M-FlexSPI-DMA-callback-never-called/m-p/1572169#M198973</link>
      <description>&lt;P&gt;Unfortunately no. We ended up using FlexSPI without DMA.&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 20 Dec 2022 01:57:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/i-MX8M-FlexSPI-DMA-callback-never-called/m-p/1572169#M198973</guid>
      <dc:creator>alvaro_tx</dc:creator>
      <dc:date>2022-12-20T01:57:56Z</dc:date>
    </item>
  </channel>
</rss>

