Skip to contentSkip to conversation

MPC5200b external interrupt registration problem

DISCUSSION Nick 4 participants 4 messages May 9, 2008 – May 12, 2008

lore
Share & tools
lore

Nick

author
#0 lore raw

Hi,

I am writing a driver to service an interrupt from our fpga. I am calling request_irq in the open function of my driver. The fpga is connected to external interrupt 1. I am using interrupt number 65 in the request_irq but the function is failing. I traced to a function called setup_irq in file /kernel/irq/manage.c. It fails because at this line: if (desc->chip == &no_irq_chip) . Is 65 the wrong interrupt number? What do I need to do to properly setup for external interrupts?

Thanks for any help,

Nick

#1 lore raw
Quoted 3 lines · Nick

I am writing a driver to service an interrupt from our fpga. I am calling request_irq in the open function of my driver. The fpga is connected to external interrupt 1. I am using interrupt number 65 in the request_irq but the function is failing.

request_irq takes a virtual IRQ number, not a hardware IRQ number. You need to get the virtual IRQ number from irq_of_parse_and_map(), or from irq_create_mapping().

This would probably confuse far fewer people if we used pointers in the API rather than virtual IRQ numbers...

-Scott

#2 lore raw
Quoted 11 lines · Scott Wood
Quoted 3 lines · Nick

I am writing a driver to service an interrupt from our fpga. I am calling request_irq in the open function of my driver. The fpga is connected to external interrupt 1. I am using interrupt number 65 in the request_irq but the function is failing.

request_irq takes a virtual IRQ number, not a hardware IRQ number. You need to get the virtual IRQ number from irq_of_parse_and_map(), or from irq_create_mapping().

This would probably confuse far fewer people if we used pointers in the API rather than virtual IRQ numbers...

I'll do the core changes if you fix all the drivers .. ;)

cheers

Signature · 8 lines
Michael Ellerman
OzLabs, IBM Australia Development Lab

wwweb: http://michael.ellerman.id.au
phone: +61 2 6212 1183 (tie line 70 21183)

We do not inherit the earth from our ancestors,
we borrow it from our children. - S.M.A.R.T Person
#3 lore raw
In reply to Nick
Quoted 7 lines · Nick

Hi,

I am writing a driver to service an interrupt from our fpga. I am calling request_irq in the open function of my driver. The fpga is connected to external interrupt 1. I am using interrupt number 65 in the request_irq but the function is failing. I traced to a function called setup_irq in file /kernel/irq/manage.c. It fails because at this line: if (desc->chip == &no_irq_chip) . Is 65 the wrong interrupt number? What do I need to do to properly setup for external interrupts?

What kernel version are you using?
Are you using arch/ppc or arch/powerpc?

There has been a major shift in embedded powerpc support in the last year. Now, instead of hard coding the peripheral list in the platform code, the devices are described in an OpenFirmware style device tree. (See arch/powerpc/boot/dts/lite5200b.dts).

You need to add a node to the tree for your device and specify the interrupt there. Then use either of_irq_map_one() or irq_of_parse_and_map() to get something that you can pass to request_irq().

Cheers,
g.

Signature · 2 lines
Grant Likely, B.Sc., P.Eng.
Secret Lab Technologies Ltd.