<?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: mx28 I2C support for RESTART operation in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/mx28-I2C-support-for-RESTART-operation/m-p/204103#M11536</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Matthew, thank you for your tip!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have searched for fixes to "i2c-mxs.c" bugs for days by now and hope that your suggestion helps.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;We have problems that when using the I2C in DMA-mode it causes the kernel crash because DMA-code assumes only one scatter-gather DMA-task can be completed between the DMA-interrupts. Sometimes two tasks are completed and the driver crashes. That happens with touch screen controller at the moment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In PIO-mode some I2C devices works OK (e.g.touch screen and audio-chip) but when user space application tries to access real-time clock chip using the I2C user space interface, the I2C driver (i2c-mxc.c) returns ETIMEDOUT error which means that the "Connection Timed Out".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope your suggestion fixes the timeouts in the I2C driver and we get the devices working.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 11 Dec 2012 21:17:37 GMT</pubDate>
    <dc:creator>harryflink</dc:creator>
    <dc:date>2012-12-11T21:17:37Z</dc:date>
    <item>
      <title>mx28 I2C support for RESTART operation</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/mx28-I2C-support-for-RESTART-operation/m-p/204102#M11535</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; Some I2C peripherals require a RESTART sequence to read registers, e.g.&lt;/P&gt;&lt;P&gt;START, I2C address+WR, write register number, RESTART, I2C address+RD, read register value, STOP&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Previous Freescale I2C drivers handled this OK but the mx28 driver linux-2.6.35.3/drivers/i2c/busses/i2c-mxs.c has a couple of bugs that prevent this from working.&lt;/P&gt;&lt;P&gt;In DMA mode, the function hw_i2c_dma_setup_write has line desc[2]-&amp;gt;cmd.pio_words[0] |= BM_I2C_CTRL0_POST_SEND_STOP; which forces a STOP operation on the bus instead of allowing a possible RESTART.&lt;/P&gt;&lt;P&gt;This line can be safely deleted as the very next line ORs in "flags" which will assert STOP only when necessary.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In PIOQUEUE mode as it stands the I2C operation times out as the isr never sees the bus go idle after the I2C write sequence - we are correctly holding the bus for a RESTART.&amp;nbsp; One way to make it work is to queue up both the I2C write and I2C read commands before looking for command completion.&amp;nbsp; This way both commands run and the isr correctly completes after the read portion.&lt;BR /&gt;i.e. in mxs_i2c_xfer_msg&lt;/P&gt;&lt;P&gt;hw_i2c_pioq_setup_write(dev,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; msg-&amp;gt;addr,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; msg-&amp;gt;buf, msg-&amp;gt;len, flags);&lt;/P&gt;&lt;P&gt;hw_i2c_pioq_run(dev);&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;---becomes---&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;hw_i2c_pioq_setup_write(dev,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; msg-&amp;gt;addr,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; msg-&amp;gt;buf, msg-&amp;gt;len, flags);&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;if (!stop)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return dev-&amp;gt;cmd_err;&lt;/P&gt;&lt;P&gt;hw_i2c_pioq_run(dev);&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In keeping with the rest of the file there is no error checking on FIFO space available.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It would also be nice to be able to specify the I2C clock speed in the platform data and have the module calculate values for the TIMING registers.&amp;nbsp; At present I've just hard coded these into the i2c-mxs.c file and apply them anytime the I2C module is reset.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;SPAN class="mce_paste_marker"&gt;Hope this helps some-one.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;SPAN class="mce_paste_marker"&gt; Matt.&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;/SPAN&gt; &lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Dec 2012 15:21:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/mx28-I2C-support-for-RESTART-operation/m-p/204102#M11535</guid>
      <dc:creator>Matt_</dc:creator>
      <dc:date>2012-12-11T15:21:08Z</dc:date>
    </item>
    <item>
      <title>Re: mx28 I2C support for RESTART operation</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/mx28-I2C-support-for-RESTART-operation/m-p/204103#M11536</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Matthew, thank you for your tip!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have searched for fixes to "i2c-mxs.c" bugs for days by now and hope that your suggestion helps.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;We have problems that when using the I2C in DMA-mode it causes the kernel crash because DMA-code assumes only one scatter-gather DMA-task can be completed between the DMA-interrupts. Sometimes two tasks are completed and the driver crashes. That happens with touch screen controller at the moment.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In PIO-mode some I2C devices works OK (e.g.touch screen and audio-chip) but when user space application tries to access real-time clock chip using the I2C user space interface, the I2C driver (i2c-mxc.c) returns ETIMEDOUT error which means that the "Connection Timed Out".&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I hope your suggestion fixes the timeouts in the I2C driver and we get the devices working.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Dec 2012 21:17:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/mx28-I2C-support-for-RESTART-operation/m-p/204103#M11536</guid>
      <dc:creator>harryflink</dc:creator>
      <dc:date>2012-12-11T21:17:37Z</dc:date>
    </item>
    <item>
      <title>Re: mx28 I2C support for RESTART operation</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/mx28-I2C-support-for-RESTART-operation/m-p/204104#M11537</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I tried the Matthew's patch and the I2C driver works better but eventually it will timeout after a while. I get kernel error message "mxs_i2c_xfer_msg: Timeout!" and after this reading the I2C touch screen doesn't work anymore.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Anyone else have any idea how to get "i2c-mxs.c" working in PIOQUEUE mode without timeouts? At this time i.MX28 CPU's I2C bus is totally unusable with Kernel 2.6.35.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Dec 2012 21:41:15 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/mx28-I2C-support-for-RESTART-operation/m-p/204104#M11537</guid>
      <dc:creator>harryflink</dc:creator>
      <dc:date>2012-12-11T21:41:15Z</dc:date>
    </item>
    <item>
      <title>Re: mx28 I2C support for RESTART operation</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/mx28-I2C-support-for-RESTART-operation/m-p/204105#M11538</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Sorry it didn't work for you.&lt;/P&gt;&lt;P&gt;We have a very simple periperal on the I2C and never send/receive more than a byte (after the address) and I guess for a touch screen you're probably streaming quite a few bytes.&lt;/P&gt;&lt;P&gt;I wonder whether you are getting FIFO issues?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The code for PIOQUEUE really needs to be rewritten using the QUEUE_IRQs to properly unload the FIFOs as they fill.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Good luck&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 11 Dec 2012 22:24:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/mx28-I2C-support-for-RESTART-operation/m-p/204105#M11538</guid>
      <dc:creator>Matt_</dc:creator>
      <dc:date>2012-12-11T22:24:49Z</dc:date>
    </item>
    <item>
      <title>Re: mx28 I2C support for RESTART operation</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/mx28-I2C-support-for-RESTART-operation/m-p/204106#M11539</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Have you tried this :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/message/283782"&gt;Re: i.MX28 Linux BSP I2C source codes bug&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have a problem connecting 2 seperate i2c on imx283, so I'd like to have some tips if any... Here my 2 issues :&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/thread/302722"&gt;I2C frequency on 2 buses&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/thread/302723"&gt;Conflict on 2 I2C buses&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sam.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 14 Dec 2012 17:29:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/mx28-I2C-support-for-RESTART-operation/m-p/204106#M11539</guid>
      <dc:creator>samuelsalas</dc:creator>
      <dc:date>2012-12-14T17:29:13Z</dc:date>
    </item>
    <item>
      <title>Re: mx28 I2C support for RESTART operation</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/mx28-I2C-support-for-RESTART-operation/m-p/204107#M11540</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Sam,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm not sure the ERESTARTSYS return value is relevent to my RESTART issue.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;On the idea of seperate frequencies for each bus I would suggest setting flags in device.c along similar lines to the pioqueue_mode flag and making i2c-mxs.c change the timing accordingly after any i2c resets.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now I'd like to point out that I'm not a s/w engineer, I'm just a h/w engineer you has to fix things in s/w now and again so the following might be rubbish.....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;At the top of i2c-mxs.c some static variables are declared which might mean that two instances of I2C would share the same data.&amp;nbsp; I think this is dangerous and that the variables should be contained in within each instance of I2c, e.g. in the mxs_i2c_dev structure.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; I think some-one who knows what they're doing needs to fix this driver!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt; Matt.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 17 Dec 2012 10:59:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/mx28-I2C-support-for-RESTART-operation/m-p/204107#M11540</guid>
      <dc:creator>Matt_</dc:creator>
      <dc:date>2012-12-17T10:59:17Z</dc:date>
    </item>
  </channel>
</rss>

