GPIO INTERRUPT

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

GPIO INTERRUPT

Jump to solution
8,068 Views
christophertele
Contributor III

Hy,

i´m working with an iMX6Q. I want to use a interrupt on a GPIO

I used gpio_to_irg() and request_irq() to set up my interrupt. it worked pretty well but its not that fast. Or not as fast as i want it to be.

     Q1: Is there a way to use the GIC for GPIO interrupt?

i tried to configure the necessary GPIO registers(Direction, ICR , IMR).

i used the irq number listed in the processor manual to request the irq but that dosnt work so far.

     Q2: what is the propper usage of request_irq() with the parameter IRQF_TRIGGER_???

          (If i use NONE i will get an irq all the time)

1 Solution
4,802 Views
christophertele
Contributor III

there is a mapping between linux irq numbers and hwirqs. listed in irq_domain.

you can have a look at irq_domain via debugfs.

just enable debugfs and "irq subsystem ->expose hardware/virtual irq mapping..." in menuconfig.

the mapping is shown in file /sys/kernel/debug/irq_domain_mapping

View solution in original post

10 Replies
4,803 Views
christophertele
Contributor III

there is a mapping between linux irq numbers and hwirqs. listed in irq_domain.

you can have a look at irq_domain via debugfs.

just enable debugfs and "irq subsystem ->expose hardware/virtual irq mapping..." in menuconfig.

the mapping is shown in file /sys/kernel/debug/irq_domain_mapping

4,802 Views
christophertele
Contributor III

the problem is: in older versions /proc/interrupts looks like this:

root@freescale /proc/irq$ cat /proc/interrupts

            CPU0       CPU1       CPU2       CPU3

  34:          1              0            0            0       GIC sdma

  35:          0              0            0            0       GIC VPU_JPG_IRQ

  37:          0              0            0            0       GIC imx-ipuv3

  38:          0              0            0            0       GIC imx-ipuv3

  39:          0              0            0            0       GIC imx-ipuv3

  40:          0              0            0            0       GIC imx-ipuv3

  44:          0              0            0            0       GIC VPU_CODEC_IRQ

  51:          0              0            0            0       GIC snvs_rtc

  56:         48             0            0            0       GIC mmc1

  57:          0              0            0            0       GIC mmc0

  59:       1832            0            0            0       GIC IMX-uart

  63:          4              0            0            0       GIC spi_imx

  68:        468            0            0            0       GIC imx-i2c

  69:          0              0            0            0       GIC imx-i2c

  70:          1              0            0            0       GIC imx-i2c

  72:         25              0            0            0       GIC usb_wakeup

  75:          0               0           0            0       GIC usb_wakeup

  82:          0              0            0            0       GIC asrc

  87:     248984           0           0            0       GIC i.MX Timer Tick

121:          0               0          0            0       GIC dvfs

150:      12449          0             0            0       GIC fec

292:          0              0           0             0      GPIO itest

294:          0              0            0            0      GPIO mmc0

448:          0             0             0            0      GPIO mmc1

on my board it lokks like this:

cat /proc/interrupts

              CPU0       CPU1      CPU2       CPU3      

16:        2313         1658       2361         878        GIC      29  twd

17:           0               0            0               0          GIC      87  i.MX Timer Tick

18:          35              0            0               0          GIC      45  mxs-dma

19:           5               0            0               0          GIC      47  bch

22:           2               0            0               0          GIC      65  2010000.ecspi

23:           0               0            0               0          GIC      79  202c000.ssi

38:           0               0            0               0      gpio-mxc   6  2198000.usdhc cd

75:          69              0            0               0      gpio-mxc   9  da9063-irq

147:          6               0            0               0      gpio-mxc  13  PS_irq_handler

150:        193             0            0               0      gpio-mxc  16  CLK_irq_handler

   ^linux irq number                                                            ^irq number from the documentation

in the older version is the linux irq nuber the same as the number in the documentation. on my board its not. so the problem is i cant simply request the interrupt using request_irq(). are there any known changes between the kernel versions? an api the request the irq number?

0 Kudos
4,802 Views
igorpadykov
NXP Employee
NXP Employee

you did not mention what version used, for example for NXP/FSL Linux

3.14.28 BSP one can look at attached Linux Manual sect.3.2.4 Interrupt Source Code Structure

0 Kudos
4,802 Views
christophertele
Contributor III

linux 3.19.5

0 Kudos
4,802 Views
igorpadykov
NXP Employee
NXP Employee

this kernel is not supported by NXP/FSL, I would suggest to

post this on kernel.org

Best regards

igor

0 Kudos
4,802 Views
igorpadykov
NXP Employee
NXP Employee

Hi Christopher

GIC is used during interrupt procedures, details can be found in attached

document from SDK Chapter 4 Configuring the GIC Driver.

Seems more proper second question to send on kernel.org.

Best regards

igor

4,802 Views
christophertele
Contributor III

thanks so far!

cat /proc/interrupts

              CPU0       CPU1      CPU2       CPU3      

16:        2313         1658       2361         878        GIC      29  twd

17:           0               0            0               0          GIC      87  i.MX Timer Tick

18:          35              0            0               0          GIC      45  mxs-dma

19:           5               0            0               0          GIC      47  bch

22:           2               0            0               0          GIC      65  2010000.ecspi

23:           0               0            0               0          GIC      79  202c000.ssi

38:           0               0            0               0      gpio-mxc   6  2198000.usdhc cd

75:          69              0            0               0      gpio-mxc   9  da9063-irq

147:          6               0            0               0      gpio-mxc  13  PS_irq_handler

150:        193             0            0               0      gpio-mxc  16  CLK_irq_handler

the interrupts with the numbers 147 and 150 are my interrupts using gpio_to_irq() and request_irq().
is the 16 in the last line the interrupt ID? does it mean its a software generated irq?                                                                                       

0 Kudos
4,802 Views
igorpadykov
NXP Employee
NXP Employee

right, first 32 interrupts are used for interrupts that are private to the CPUs interface.

4,802 Views
christophertele
Contributor III

ok.

according to "Table 3-1. ARM domain interrupt summary" of i.MX 6Dual/6Quad Applications Processor Reference Manual.

i want to use 104 but how do i get the interrupt number to request the interrupt line using request_irq()?

0 Kudos
4,802 Views
igorpadykov
NXP Employee
NXP Employee