About GPIO interruption in i.MX6SL.

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

About GPIO interruption in i.MX6SL.

Jump to solution
1,500 Views
keitanagashima
Senior Contributor I

Dear All,

Hello. I would like to know the relation of GPIOx_DR and GPIOx_IMR in i.MX6SL.

GPIOx_IMR was all cleared by GPIOx_DR register.

[Steps]

1. Set GPIO5_IMR = 0x000000c0     // To use the GPIO5[6] & GPIO5[7]

2. Set GPIO5_DR =0x0000f000     // Set the 12 to 15 bit

--> As a result, GPIO5_IMR = 0x00000000 (All cleared! masked.)

[Question]

Why is GPIOx_IMR cleared by setting GPIOx_DR?

BSP:L3.14.28_1.0.0

Best Regards,

Keita

Labels (3)
0 Kudos
1 Solution
1,192 Views
christophertele
Contributor III

in this version you can try to request the irq directly.
all hw-irq number are maped as the same linux numbers.

request_irq(106,...,....,...,...)

watch out for the result. you have to care about flags and dev_id

View solution in original post

0 Kudos
7 Replies
1,192 Views
christophertele
Contributor III

hy! i dont know why GPIOx_DR clears GPIOx_IMR. In my code its not like that. here are the steps i do to setup the GPIOs for IRQ

1. Mux the pad to GPIO

2. Set direction as input "GPIO direction register (GPIOx_GDIR)"

3. configure "GPIO interrupt configuration registery (GPIOx_ICRy)"

4. maybe the "GPIO edge select register (GPIOx_EDGE_SEL)"

5. request_irq()

6. Enable irq on "GPIO interrupt mask register (GPIO1_IMR)"

maybe its nor the DR (Data Register) that sets your IMR. its better to read the register before writing to make safe that nothing in it is overwritten

0 Kudos
1,192 Views
keitanagashima
Senior Contributor I

Dear Christopher, All,

Hello. Thank you for your reply.

We could get the interrupt by using gpio_to_irq value.

Refer to below link.

GPIO in the kernel: an introduction [LWN.net]

"gpio_to_irq" got the interrupt number (= No. 294). 

And, "gpio_to_irq" passed the interrupt number to request_irq().

[Question]

The "gpio_to_irq" got the interrupt number (No.294).

On the other hand, IRQ number from reference manual was No.106!

Could you tell me the mechanism of GPIO interruption?

(Ex, GPIO driver get the interrupt number "294", and convert from "294" to "106" to pass to interrupt controller.)

Best Regards,

Keita

0 Kudos
1,192 Views
christophertele
Contributor III

hy.

i had the same problem. it wasnt possible for me to to request the "Combined interrupt indication" as mentioned in the reference manual.

maybe this irq is requested "none shared" by the gpio-mxc driver. i dont know. i have chosen a different pin that was not used by gpio-mxc.

there is a difference between irqs that come direct from the gic "hardware irq" and the irqs from gpio-mxc "software-irqs"

what kernel are you using?

something usefull:

cat /proc/interrupts (shows the used irg lines)

cat /sys/kernel/debug/irq_domain_mapping

- maybe you have to enable this in menuconfig

- its a mapping of hw-irw numbers to the linux-irq numbers

after getting the linux-irq-number from your hardware-irq-number you can use request_irq() directly.

- enable_irq()

- request_irq() (shared)

i thing i could request the irq but i never got my irq handler func called this way.

0 Kudos
1,192 Views
keitanagashima
Senior Contributor I

Dear Christopher,

Thank you for your reply.

> what kernel are you using?

We use the L3.14.28_1.0.0 for i.MX6SL.

Best Regards,

Keita

0 Kudos
1,193 Views
christophertele
Contributor III

in this version you can try to request the irq directly.
all hw-irq number are maped as the same linux numbers.

request_irq(106,...,....,...,...)

watch out for the result. you have to care about flags and dev_id

0 Kudos
1,192 Views
keitanagashima
Senior Contributor I

We couldn't get the interruption by irq directly number(106).

Best Regards,

keiita

0 Kudos
1,192 Views
christophertele
Contributor III

have you checked the irq mapping?

what are your flags set in request_irq()?

0 Kudos