I need a periodic timer interrupt on i.mx6. For that I developed a LKM: The EPIT Timer counts and every second the output compare interrupt flag is set. But its not possible to make Interrupts hapen because I don't know the Interrupt number:
request_irq(88, &timer_interrupt, IRQF_TIMER| IRQF_IRQPOLL, "EPIT Interrupt", NULL);
doesn't work. the function "timer_interrupt" is called all the time, although I switch off the EPIT timer and clear the compare interrupt flag. It seems that 88 is just the hardware interrupt address and I have to type in something different instead. Where I can find the correct interrupt number for the irq?
thanks,
Matthias
Hi,
thanks for the quick response.
I use EPIT because its actually not used. Would it be an advantage to use GPT?
I solved the problem with your help. Its not a smart solution because there are some warnings (initialisation makes integer from pointer without cast...), but it works:
int np = of_find_node_by_name(NULL,"epit");
int virq = irq_of_parse_and_map(np,0);
ret=request_irq(0x118, &timer_interrupt,__IRQF_TIMER | IRQF_IRQPOLL, "EPIT Interrupt", NULL);
thanks again for your help
Hi,
thanks for the hint.
epit.c is just a reference code and there are lot of undefined symbols ("#include <asm/mach/time.h>": Unresolved inklusion, "#include "common.h"": no such file ore directory, "#include "hardware.h": Unresolved inklusion, "CLOCK_EVT_MODE_UNUSED" could not be resolved, "CLOCK_EVT_MODE_PERIODIC" could not be resolved ...". So its not easy to test the code. But I think that the interrupt part is mostly the same:
static void epit_irq_acknowledge(void)
{
__raw_writel(EPITSR_OCIF, timer_base + EPITSR);
}
static irqreturn_t epit_timer_interrupt(int irq, void *dev_id)
{
struct clock_event_device *evt = &clockevent_epit;
epit_irq_acknowledge();
evt->event_handler(evt);
return IRQ_HANDLED;
}
static struct irqaction epit_timer_irq = {
.name = "i.MX EPIT Timer Tick",
.flags = IRQF_TIMER | IRQF_IRQPOLL,
.handler = timer_interrupt,
};
...
setup_irq(irq, &epit_timer_irq);
but I dont understand from where this code gets the irq number in "setup_irq(irq, &epit_timer_irq);".
In arch/arm/boot/dts/imx6qdl.dtsi I can see, that the number is 56. But if I use 56 as the interrupt number in my code instead of 88, the interrupt is never executed. Any idea?
Hi Matthias,
The reference manual states that 88 is the interrupt number for EPIT1.
In the dtsi the irq numbers have a 32 offset, so 88 - 32 = 56 is the number you will see in the dtsi.
You should be able to get the irq number by doing platform_get_irq()
By the way, why do you need EPIT1? Can't you just use GPT instead?
Regards,
Fabio Estevam
Actually you should use irq_of_parse_and_map() to retrieve the irq, just like it is done inside drivers/clocksource/timer-imx-gpt.c
Regards,
Fabio Estevam
What about using arch/arm/mach-imx/epit.c instead?
Regards,
Fabio Estevam