<?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>topic Re: LS1043 i2c dma problem in Layerscape</title>
    <link>https://community.nxp.com/t5/Layerscape/LS1043-i2c-dma-problem/m-p/1270699#M7907</link>
    <description>&lt;P&gt;Wow,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;all reply i got fom NXP was an automatic email if the answer (that i provided myself) "did solve your problem"...&lt;/P&gt;</description>
    <pubDate>Fri, 30 Apr 2021 07:02:04 GMT</pubDate>
    <dc:creator>thorstenpohlman</dc:creator>
    <dc:date>2021-04-30T07:02:04Z</dc:date>
    <item>
      <title>LS1043 i2c dma problem</title>
      <link>https://community.nxp.com/t5/Layerscape/LS1043-i2c-dma-problem/m-p/1266706#M7859</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;Custom LS1043 Board&lt;/P&gt;&lt;P&gt;Linux version 5.4.47-2.3 (NXP-SDK 2.2 dunfell)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;i've got a weird I2C problem:&lt;/P&gt;&lt;P&gt;Everything is working quite fine, reading temperature-sensors, reading/setting rtcs (all transfers &amp;lt; 16 bytes)...&lt;/P&gt;&lt;P&gt;But I need to transmit 4kB of data to a I2C slave, so the drivers/i2c/busses/i2c-imx.c&amp;nbsp; driver selects DMA ( i2c_imx_xfer line 1171).&lt;/P&gt;&lt;P&gt;The problem: DMA transfer just transmits garbarge over i2c, some unknown part of memory to be precise. I saw parts of the boot-message (klog), different contents on every transfer. I tracked down to the dma_map_single()&amp;nbsp; (i2c_imx_dma_xfer line 457), everything seems to be correct (msgs-&amp;gt;buf contains the correct data).&lt;/P&gt;&lt;P&gt;If i increase the DMA_THRESHOLD so dma isnt used, everything works fine.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Its also reproducable with the i2ctransfer tool, e.g. i2ctransfer -y 0 w10@0x12 0+ sends incremental data, i2ctransfer -y 0 w4000@0x12 0+ sends complete nonsense.&lt;/P&gt;&lt;P&gt;(Nonsense sent is validated with a DigiView probe)&lt;/P&gt;&lt;P&gt;Any suggestions?&lt;/P&gt;</description>
      <pubDate>Thu, 22 Apr 2021 13:53:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Layerscape/LS1043-i2c-dma-problem/m-p/1266706#M7859</guid>
      <dc:creator>thorstenpohlman</dc:creator>
      <dc:date>2021-04-22T13:53:34Z</dc:date>
    </item>
    <item>
      <title>Re: LS1043 i2c dma problem</title>
      <link>https://community.nxp.com/t5/Layerscape/LS1043-i2c-dma-problem/m-p/1268065#M7879</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;obviously the LS1043/1046 don't provide cache/DMA coherency for I2C device DMA?!&lt;/P&gt;&lt;P&gt;So the write buffer stays in cpu cache and is not visible to DMA.&lt;/P&gt;&lt;P&gt;Who is the maintainer for this driver now?&lt;/P&gt;&lt;P&gt;This patch is working for me now (altough i could only test the write-part)&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c&lt;BR /&gt;index af352886ef6f..54e2a7b88f0a 100644&lt;BR /&gt;--- a/drivers/i2c/busses/i2c-imx.c&lt;BR /&gt;+++ b/drivers/i2c/busses/i2c-imx.c&lt;BR /&gt;@@ -441,6 +441,9 @@ static void i2c_imx_dma_callback(void *arg)&lt;BR /&gt;struct imx_i2c_struct *i2c_imx = (struct imx_i2c_struct *)arg;&lt;BR /&gt;struct imx_i2c_dma *dma = i2c_imx-&amp;gt;dma;&lt;BR /&gt;&lt;BR /&gt;+ if(dma-&amp;gt;dma_transfer_dir == DMA_DEV_TO_MEM)&lt;BR /&gt;+ dma_sync_single_for_device(&amp;amp;i2c_imx-&amp;gt;adapter.dev, dma-&amp;gt;dma_buf, dma-&amp;gt;dma_len, dma-&amp;gt;dma_transfer_dir);&lt;BR /&gt;+&lt;BR /&gt;dma_unmap_single(dma-&amp;gt;chan_using-&amp;gt;device-&amp;gt;dev, dma-&amp;gt;dma_buf,&lt;BR /&gt;dma-&amp;gt;dma_len, dma-&amp;gt;dma_data_dir);&lt;BR /&gt;complete(&amp;amp;dma-&amp;gt;cmd_complete);&lt;BR /&gt;@@ -461,7 +464,8 @@ static int i2c_imx_dma_xfer(struct imx_i2c_struct *i2c_imx,&lt;BR /&gt;goto err_map;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;+ if(dma-&amp;gt;dma_transfer_dir == DMA_MEM_TO_DEV)&lt;BR /&gt;+ dma_sync_single_for_device(dev, dma-&amp;gt;dma_buf, dma-&amp;gt;dma_len, dma-&amp;gt;dma_transfer_dir);&lt;BR /&gt;&lt;BR /&gt;txdesc = dmaengine_prep_slave_single(dma-&amp;gt;chan_using, dma-&amp;gt;dma_buf,&lt;BR /&gt;dma-&amp;gt;dma_len, dma-&amp;gt;dma_transfer_dir,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Apr 2021 09:47:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Layerscape/LS1043-i2c-dma-problem/m-p/1268065#M7879</guid>
      <dc:creator>thorstenpohlman</dc:creator>
      <dc:date>2021-04-26T09:47:16Z</dc:date>
    </item>
    <item>
      <title>Re: LS1043 i2c dma problem</title>
      <link>https://community.nxp.com/t5/Layerscape/LS1043-i2c-dma-problem/m-p/1270699#M7907</link>
      <description>&lt;P&gt;Wow,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;all reply i got fom NXP was an automatic email if the answer (that i provided myself) "did solve your problem"...&lt;/P&gt;</description>
      <pubDate>Fri, 30 Apr 2021 07:02:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Layerscape/LS1043-i2c-dma-problem/m-p/1270699#M7907</guid>
      <dc:creator>thorstenpohlman</dc:creator>
      <dc:date>2021-04-30T07:02:04Z</dc:date>
    </item>
  </channel>
</rss>

