Confused about assigning interrupt to GPIO pin in Linux 4.1.6

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 

Confused about assigning interrupt to GPIO pin in Linux 4.1.6

3,224件の閲覧回数
andrejakostic
Contributor II

Hello dear NXP community members!

I have an I2C touchscreen controller which uses open drain line to notify the OS that it wants to be serviced by the driver. I connected the line to the PAD_KEY_COL1__GPIO4_IO08 pin on the iMX6DL and I can see that the pull-up resistors and the open drain are working fine.

What is causing confusion is how to properly register the interrupt in the deice tree.

Platform:

My platform is an iMX6DualLite on a TQMa6U-AA module on a MBa6x development board and am running Linux 4.1.6 from TQ's BSP.

What I did:

In the reference manual for iMX6DL (I'm using IMX6SDLRM Rev. 3, 09/2017, this is the newest version, as far as I can see), I can see on the page 221 that I should expect IRQ 104, because I'm using GPIO4 pin 8 and IRQ 104 is for pins 0-15.

Next, on page 1526, I can see that the base address for GPIO4 is 0x20A_80000. Looking into my decompiled device tree (decompiled from the actual dtb which is in use), I can see that gpio3 in device tree uses the address 0x20A_80000, so I selected gpio3 as my interrupt parent.

Next, looking at the dtsi files, I can see that the gpio port that I need to use has the following line:

compatible = "fsl,imx6q-gpio", "fsl,imx35-gpio";

So I went and checked documentation for Freescale i.MX/MXC GPIO controller, on https://www.kernel.org/doc/Documentation/devicetree/bindings/gpio/fsl-imx-gpio.txt and there is says the following:

- #interrupt-cells : Should be 2.  The first cell is the GPIO number.
  The second cell bits[3:0] is used to specify trigger type and level flags:
      1 = low-to-high edge triggered.
      2 = high-to-low edge triggered.
      4 = active high level-sensitive.
      8 = active low level-sensitive.

Given the above, I wrote the following in my device tree:

interrupt-parent = <&gpio3>;

interrupts = <8 8>;//IRQ_TYPE_LEVEL_LOW

Problem:

When I start my system with the above settings, my touchscreen controller receives IRQ 111, instead of the expected 104. If I change the interrupts to:

interrupts = <1 8>;//IRQ_TYPE_LEVEL_LOW

The touchscreen then receives the expected IRQ 104.

Given the above, I'm confused on what is the correct way to assign the interrupt to the pin I want to use. Should I follow the instructions from the GPIO driver documentation and use the pin number, or should I try to match the IRQ number, even though it does not match what the driver documentation says.

ラベル(2)
0 件の賞賛
返信
4 返答(返信)

2,072件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

Hi Andreja

one needs to follow GPIO interrupt Reference Manual documentation, also

Linux 4.1.6 is not supported by NXP, one can try with official releases described on

https://www.nxp.com/support/developer-resources/run-time-software/i.mx-developer-resources/i.mx-6ser...

Best regards
igor
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 件の賞賛
返信

2,072件の閲覧回数
andrejakostic
Contributor II

Hi Igor and thanks for your reply!

Is there any chance of getting a bit more info on the "follow GPIO interrupt Reference Manual documentation" topic?

What do you mean exactly with "follow"?

Is there another reference manual only for GPIO? 

As posted in my original question, I am using information provided by IMX6SDLRM Rev. 3, 09/2017, which, to me at least, appears to be the newest version of the reference manual for i.MX6DL.

I'll see what I can do about switching back to 4.1.5 or moving up to 4.9.11.

0 件の賞賛
返信

2,072件の閲覧回数
igorpadykov
NXP Employee
NXP Employee

Hi Andreja

>Is there any chance of getting a bit more info on the "follow GPIO interrupt Reference Manual documentation" topic?

I meant that description in Reference Manual (IMX6SDLRM Rev. 3, 09/2017) is correct:

GPIO4 pin 8 and IRQ 104 is for pins 0-15

Best regards
igor

2,072件の閲覧回数
andrejakostic
Contributor II

OK, thanks for the info, that helps!

0 件の賞賛
返信