This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

IRQ Flags for NNMI interrupt (EXTINTn pin)

Other Parts Discussed in Thread: AM3352

Hi all,

I am trying to handle the NNMI interrupt (EXTINTn pin, AM3352 board) in linux as an irq button. I modified gpio_keys.c and I was able to hook the interrupt but I noticed that it seems the processor stops as soon as I hook up the interrupt and continues whenever I press the button connected to the EXTINTn pin. Here's a sample log:

[ 2.264022] Inside gpio_keys_get_devtree_pdata.
[ 2.290336] gpio-keys gpio_buttons.6: gpio_keys_setup_key: Setting up button button0 as IRQ button no.: 23
[ 2.309258] gpio-keys gpio_buttons.6: gpio_keys_setup_key: now calling request_any_context_irq: irq[23] irqflags[0x4]  <-- here the processor stops
[ 8.875182] gpio-keys gpio_buttons.6: gpio_keys_setup_key: done calling request_any_context_irq. <-- processor continues from here on when I press the button 
[ 8.884556] [sched_delayed] sched: RT throttling activated
[ 8.898326] gpio-keys gpio_buttons.6: gpio_keys_setup_key: IRQ[23] for button[button0] has been claimed
[ 8.909148] input: gpio_buttons.6 as /devices/gpio_buttons.6/input/input0
[ 8.917840] omap_rtc 44e3e000.rtc: setting system clock to 2000-01-01 00:00:08 UTC (946684808)

So it seems I was able to setup the interrupt hook but I am not passing the correct irq flags. I tried every combination but the output is the same.

Regards,

Marlon

  • Hi Marlon,

    Marlon Hacla said:
    So it seems I was able to setup the interrupt hook but I am not passing the correct irq flags. I tried every combination but the output is the same

    Can you share the changes you've made? gpio_keys, dts, etc. 

    As per device TRM, NMI irq number is 7, see Table 6-1. ARM Cortex-A8 Interrupts. 

    Best Regards, 

    Yordan

  • See attached zip file below. Basically I applied the patch from this link and I modified the DTS by adding the button:

    gpio_buttons: gpio_buttons@0 {
    compatible = "gpio-keys";
    #address-cells = <1>;
    #size-cells = <0>;

    switch@1 {
    label = "button0";
    linux,code = <0x100>;
    interrupt-parent = <&intc>;
    interrupts = <7>; // interrupt number of NNMI
    };

    };

    I also added a quick printf and return statements in the irq handlers just to see if the handler is being called. I tried harcdoding irq no.7 in gpio_keys.c but that doesn't work but the irq number (23) returned by irq_of_parse_and_map for interrupt number 7 seems to work.

    button-tests.zip

  • I found I modified the wrong interrupt handler function. So I edited gpio_keys_irq_isr by doing a quick printkn and return and I found that the I receive the interrupt every time and it only stops when I press the button. I saw on this thread that I might need to change the polarity, but how do I do that in the software?