<?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: GPIO IRQ Handler crashing kernel in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/GPIO-IRQ-Handler-crashing-kernel/m-p/153548#M1685</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I just encountered same issue and come across this article. It was very helpful to pull me out from wasting my time to investigate GPIO group0. Thank you.&lt;/P&gt;&lt;P&gt;I solved this issue by adding 2 lines in kernel interrupt dispatcher macro to check ISR bit 31 in HW_ICOLL_RAW3 to tell false interrupt from IRQ #127. The file is arch/arm/plat-mxs/include/mach/entry-macro.S.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .macro&amp;nbsp;&amp;nbsp; &amp;nbsp;get_irqnr_and_base, irqnr, irqstat, base, tmp&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ldr \base, =g_icoll_base&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ldr \base, [\base]&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ldr \irqnr, [\base, #0x70]&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;cmp \irqnr, #0x7F&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;bne 2f&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ldr \tmp, [\base, #0xD0]&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;tst \tmp, #0x80000000&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;moveqs \irqnr, #0&lt;BR /&gt;2:&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.endm&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I confirmed I could use GPIO IRQ0 on Linux with this modification.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 27 Jun 2012 00:54:27 GMT</pubDate>
    <dc:creator>YS</dc:creator>
    <dc:date>2012-06-27T00:54:27Z</dc:date>
    <item>
      <title>GPIO IRQ Handler crashing kernel</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/GPIO-IRQ-Handler-crashing-kernel/m-p/153545#M1682</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I am having trouble trying to setup a GPIO input as an interrupt to a driver. When I ground the GPIO pin, the kernel is crashing. I have requested the irq I want to use and I do not get an error so I don't know why the kernel crashes. I am using BSP L2.6.35_10.12.01. Here is some snippets of my code.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;if (mxt-&amp;gt;irq) {&lt;BR /&gt;&amp;nbsp;&amp;nbsp;/* Try to request IRQ with falling edge first. This is&lt;BR /&gt;&amp;nbsp;&amp;nbsp;* not always supported. If it fails, try with any edge. */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;printk(KERN_WARNING "register irq handler: irq = %i, address = %p, flags = %i, name = %s\n",&lt;BR /&gt;&amp;nbsp;&amp;nbsp;mxt-&amp;gt;irq, mxt_irq_handler, IRQF_TRIGGER_FALLING, client-&amp;gt;dev.driver-&amp;gt;name);&lt;BR /&gt; &lt;BR /&gt;&amp;nbsp;&amp;nbsp;error = request_irq(mxt-&amp;gt;irq,&amp;nbsp;mxt_irq_handler,&amp;nbsp;IRQF_TRIGGER_FALLING, "IRQ_ATMEL_TOUCH");&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is the output from cat /proc/interrupts. IRQ 151 is the interrupt that I am using.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;root@freescale ~$ cat /proc/interrupts &lt;BR /&gt; CPU0&lt;BR /&gt;6: 0 - pswitch&lt;BR /&gt;17: 261 - mxs-kbd&lt;BR /&gt;25: 70275 - mxs-kbd&lt;BR /&gt;38: 0 - fb_irq&lt;BR /&gt;39: 0 - mxs-pxp&lt;BR /&gt;41: 18295 - GPMI NFC BCH Interrupt&lt;BR /&gt;47: 159 - DebugUART&lt;BR /&gt;48: 3873 - i.MX/mxs Timer Tick&lt;BR /&gt;52: 0 - dcp&lt;BR /&gt;53: 6 - dcp&lt;BR /&gt;69: 44 - mxs-i2c&lt;BR /&gt;82: 13 - mxs-mmc dma&lt;BR /&gt;84: 0 - mxs-spi.0&lt;BR /&gt;88: 79539 - GPMI NFC DMA Interrupt&lt;BR /&gt;92: 0 - fsl ehci pre interrupt, ehci_hcd:usb2&lt;BR /&gt;93: 291 - fsl ehci pre interrupt, ehci_hcd:usb1&lt;BR /&gt;94: 0 - usb_wakeup&lt;BR /&gt;95: 0 - usb_wakeup&lt;BR /&gt;96: 12 - mxs-mmc error&lt;BR /&gt;98: 0 - mxs-spi.0&lt;BR /&gt;110: 66 - mxs-i2c&lt;BR /&gt;151: 0 - IRQ_ATMEL_TOUCH&lt;BR /&gt;FIQ: mxs-battery&lt;BR /&gt;Err: 0&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am not setting up a Resource for this GPIO pin. Is that possibly the problem. I could use some examples on how to configure the GPIO pins for interrupts and using them in a device driver.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 May 2011 17:07:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/GPIO-IRQ-Handler-crashing-kernel/m-p/153545#M1682</guid>
      <dc:creator>iMxGuy</dc:creator>
      <dc:date>2011-05-04T17:07:47Z</dc:date>
    </item>
    <item>
      <title>Re: GPIO IRQ Handler crashing kernel</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/GPIO-IRQ-Handler-crashing-kernel/m-p/153546#M1683</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;SOLVED. According to Freescale tech, you cannot use the GPIO in the first bank as an interrupt source. I switched to a different GPIO in a different bank, and it worked. As of now there is no patch for the BSP to fix this.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;"&lt;SPAN&gt;Root cause is that in order to get the best performance for interrupt processing, in the low level code, we will only check the HW_ICOLL_STAT register, but for BANK 0 IRQ_GPIO0=127, it is same as the default value of HW_ICOLL_STAT, so irq 127 will not be detected by Linux BSP. This leads to the system crash."&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 09 May 2011 12:48:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/GPIO-IRQ-Handler-crashing-kernel/m-p/153546#M1683</guid>
      <dc:creator>iMxGuy</dc:creator>
      <dc:date>2011-05-09T12:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: GPIO IRQ Handler crashing kernel</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/GPIO-IRQ-Handler-crashing-kernel/m-p/153547#M1684</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;hi,&lt;/P&gt;&lt;P&gt;it is possible to have GPIO interrupts from bank 0 but indeed it needs some modification in low level irq handling code.&lt;/P&gt;&lt;P&gt;As you describe, "interrupt pending" condition is interpreted from HW_ICOLL_STAT value, which causes the problem when this value is 127, ie. the same as the interrupt number for GPIO bank 0. The workaround is to read the "interrupt pending" condition from HW_ICOLL_DEBUG register instead, which has a read only bit "IRQ" that provides the state of the IRQ line to the CPU. So when you get an interrupt, and read 127 from HW_ICOLL_STAT, it is because you got an interrupt from GPIO bank 0 !&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 27 Feb 2012 10:54:03 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/GPIO-IRQ-Handler-crashing-kernel/m-p/153547#M1684</guid>
      <dc:creator>MarcosNodar</dc:creator>
      <dc:date>2012-02-27T10:54:03Z</dc:date>
    </item>
    <item>
      <title>Re: GPIO IRQ Handler crashing kernel</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/GPIO-IRQ-Handler-crashing-kernel/m-p/153548#M1685</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I just encountered same issue and come across this article. It was very helpful to pull me out from wasting my time to investigate GPIO group0. Thank you.&lt;/P&gt;&lt;P&gt;I solved this issue by adding 2 lines in kernel interrupt dispatcher macro to check ISR bit 31 in HW_ICOLL_RAW3 to tell false interrupt from IRQ #127. The file is arch/arm/plat-mxs/include/mach/entry-macro.S.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; .macro&amp;nbsp;&amp;nbsp; &amp;nbsp;get_irqnr_and_base, irqnr, irqstat, base, tmp&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ldr \base, =g_icoll_base&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ldr \base, [\base]&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ldr \irqnr, [\base, #0x70]&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;cmp \irqnr, #0x7F&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;bne 2f&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;ldr \tmp, [\base, #0xD0]&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;tst \tmp, #0x80000000&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;moveqs \irqnr, #0&lt;BR /&gt;2:&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;.endm&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I confirmed I could use GPIO IRQ0 on Linux with this modification.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 27 Jun 2012 00:54:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/GPIO-IRQ-Handler-crashing-kernel/m-p/153548#M1685</guid>
      <dc:creator>YS</dc:creator>
      <dc:date>2012-06-27T00:54:27Z</dc:date>
    </item>
    <item>
      <title>Re: GPIO IRQ Handler crashing kernel</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/GPIO-IRQ-Handler-crashing-kernel/m-p/153549#M1686</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I should mention that the GPIO0 IRQ issue is already addressed by Freescale patch 588 (included in "Linux patches for i.MX28 SDK 2010.12"). Their implementation is slightly different from mine but essentially the same type of fix.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 19 Jul 2012 18:15:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/GPIO-IRQ-Handler-crashing-kernel/m-p/153549#M1686</guid>
      <dc:creator>YS</dc:creator>
      <dc:date>2012-07-19T18:15:52Z</dc:date>
    </item>
    <item>
      <title>Re: GPIO IRQ Handler crashing kernel</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/GPIO-IRQ-Handler-crashing-kernel/m-p/153550#M1687</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Actually it's in Freescale patch 581.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I came across this bug too, and appreciated your post--saved me a lot of debug time. Thanks very much for explaining the situation.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 13 Mar 2013 04:30:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/GPIO-IRQ-Handler-crashing-kernel/m-p/153550#M1687</guid>
      <dc:creator>CraigMcQueen</dc:creator>
      <dc:date>2013-03-13T04:30:41Z</dc:date>
    </item>
    <item>
      <title>Re: GPIO IRQ Handler crashing kernel</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/GPIO-IRQ-Handler-crashing-kernel/m-p/153551#M1688</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Does the problem exists in current Mainline Kernel 3.10?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I just ask because the file to patch doesn't exist. I think it moved all to irqchip/irq-mxs.c.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 28 Jul 2013 09:30:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/GPIO-IRQ-Handler-crashing-kernel/m-p/153551#M1688</guid>
      <dc:creator>lategoodbye</dc:creator>
      <dc:date>2013-07-28T09:30:39Z</dc:date>
    </item>
  </channel>
</rss>

