Adding an external interrupt controller

Laurent Pinchart laurent.pinchart at tbox.biz
Wed Jun 21 23:55:58 EST 2006


Hi,

> > I'm trying to write a driver for a custom extension bus
> > mapped in my MPC8248
> > memory space.
> >
> > The bus has 32 interrupt lines which are handled by an
> > interrupt controller
> > connected to a single external interrupt on the MPC8248.
> >
> > I've had a look at the Linux interrupt management code, but
> > haven't found any
> > easy API to add an external interrupt controller. Could
>
> No, the linux kernel has this feature.
>
> > someone give me a few
> > pointers regarding how to proceed ? I would like to
> > "register" the interrupt
> > controller with the interrupt management core, so that
> > request_irq()/free_irq() could be used with the extra interrupts.
>
> Need define the struct hw_interrupt_type <your_interrupt_controller>
> and the struct irqaction <your_irqaction>, and
> implement member function and hook your interrupt controller to
> The interrupt controller of MPC8248 with setup_irq.

I've had a deeper look at that approach and things are, if not entirely clear, 
at least clear enough to try coding a simple interrupt controller.

There is, though, something that bothers me. My interrupt controller has 32 
IRQ lines. If I hook up my interrupt controller using the ppc_md.init_IRQ and 
ppc_md.get_irq callbacks, only one interrupt will be processed at a time. The 
interrupt handler acks the interrupt at source, but other interrupts which 
are already flagged will reinterrupt the CPU as soon as the interrupt handler 
returns. This is clearly sub-optimal. I noticed that some people call 
__do_IRQ reintrantly (in arch/ppc/syslib/m82xx_pic.c for instance). Could I 
do that as well, or is that discouraged ? Any problem regarding the stack 
size ?

Thanks for your help.

Best regards,

Laurent Pinchart



More information about the Linuxppc-embedded mailing list