Subject: Re: irq

From: Benjamin Herrenschmidt <[email-masked]>
Date: Thu, 04 Sep 2008 13:02:46 +1000

On Wed, 2008-09-03 at 23:02 +0200, Sébastien Chrétien wrote:

> irq_of_parse_and_map is equivalent to ioremap in the MMU case ?

On the powerpc architecture, we use virtualized IRQ numbers in order to
deal with the wide range of interrupt controllers around and multiple
of them cascaded.

The base function to "map" a physical interrupt to a virtual interrupt
is irq_create_mapping(). It takes an irq_host argument which represent
the IRQ "domain" (typically irq controller) off which the interrupt you
are trying to map hangs.

If you pass NULL, it will use the "default" controller, which doesn't
always exist, it depends on the platform. Usually, platforms set that
to the toplevel PIC.

However, normally, that function shouldn't be used directly. Instead,
you should create a representation of your device in the device-tree
along with the appropriate interrupt mapping, and then use the
irq_of_parse_and_map() function to obtain a mapped virtual irq based
on the device-tree information. This will take care of finding the
right irq_host but will also properly setup the polarity of the
interrupt etc...

Now, as to how you should represent the interrupt in the device-tree,
this should be explained in Documentation/booting-without-of.txt

Cheers,
Ben.