RE: Open Firmware and interrupt trigger
From: Robert Thorhuus <hidden>
Date: 2011-02-25 07:29:22
Thank you Benjamin! Sorry for not using your qouting schema :( Benjamin, you are right about the IRQ flags. Those interrupt.h flags seems = to differ from my processor reference manual. None the less. Antov, I saw that the code snippet I refer to below:
ret =3D of_irq_to_resource(dn, 0, &irq_res); if (ret =3D=3D NO_IRQ) irq_res.start =3D irq_res.end =3D 0; else irq_res.flags =3D 0;
, originates from the first version of the file pata_of_platform.c and you = are the creator :) Could you explain the hardcoded ".flags =3D 0" part?=20 Looking amatuer-vise in the code it seems that the only thing one is able t= o control (through Device Tree) regarding interrupts and pata, is the actua= l IRQ number. Is this a correct assumption? Thanks BR Robert -----Original Message----- From: Benjamin Herrenschmidt [mailto:benh@kernel.crashing.org]=20 Sent: den 24 februari 2011 21:47 To: Robert Thorhuus Cc: linuxppc-dev@lists.ozlabs.org Subject: Re: Open Firmware and interrupt trigger On Wed, 2011-02-23 at 22:18 +0100, Robert Thorhuus wrote:
Hello! =20 I'm quite new to linux and Open Firmware. =20 I have a PPC processor. To this I have a Compact Flash connected. The Com=
pact Flash is using external interrupt 0 of the processor.
In my DTS file I have specified a Compact Flash node and within it I have=
an interrupt element:
interrupt =3D <0 2 0 0>; =20 Here I thought the first number was the ID of the interrupt and the secon=
d one should be a number indicating how the interrupt is triggered (high, l= ow, raising, falling).
=20 The interrupt is active low. =20 But I could not get it to work which ever value I chose. =20 Looking in the code I found this in function __devinit pata_of_platform_p=
robe in file pata_of_platform.c:
=20 ret =3D of_irq_to_resource(dn, 0, &irq_res); if (ret =3D=3D NO_IRQ) irq_res.start =3D irq_res.end =3D 0; else irq_res.flags =3D 0; =20 Here "flags" will be zero whatever I do in the DTS. As far as I can under=
stand the flags are defined in interrupts.h:
#define IRQF_TRIGGER_NONE 0x00000000 #define IRQF_TRIGGER_RISING 0x00000001 #define IRQF_TRIGGER_FALLING 0x00000002 #define IRQF_TRIGGER_HIGH 0x00000004 #define IRQF_TRIGGER_LOW 0x00000008
Actually, the .dts flags depend on the specific interrupt controller you ar= e using. For example, MPIC uses a different mapping scheme (for historical = reasons). Check booting-without-of.txt.
So modifying the code to: else irq_res.flags =3D 2; =20 I get it to work. =20 Could someone please explain to me why the "flags" parameter is hardcoded=
zero or just point in a good direction. That does indeed look odd. Might be worth trying to figure out with the git= history who came up with that code in the first place and ask that person.= Without answer, I think it's valid to patch that out. Cheers, Ben.
Thank you =20 BR Robert _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev