From: grant.likely@secretlab.ca (Grant Likely)
To: linux-arm-kernel@lists.infradead.org
Subject: [RFC PATCH 3/4] ARM: dt: add GIC bindings and driver support
Date: Mon, 27 Jun 2011 09:02:07 -0600 [thread overview]
Message-ID: <BANLkTin5q7uVCAobvoaBqsUHHn7zJs-x_Q@mail.gmail.com> (raw)
In-Reply-To: <4E085B2E.5030605@arm.com>
On Mon, Jun 27, 2011 at 4:27 AM, Marc Zyngier <marc.zyngier@arm.com> wrote:
> On 26/06/11 09:01, Grant Likely wrote:
>> I see what you're doing here, but I don't think it is the best
>> approach in the long run. ?Rather than walking all the
>> interrupt-controller nodes looking for primary and secondary gics
>> while ignoring all others, I think there needs to be a function that
>> finds all the interrupt controller nodes, sorts them based on
>> dependencies, and calls their initialization hook in order. ?Other
>> architectures will use such a thing. ?I've been intending to do it for
>> powerpc for quite a while node.
>>
>> Would you be willing to tackle such a beast? ?I've got a fairly good
>> idea what it needs to look like, but I just haven't had the time to do
>> it.
>
> I can give it a go.
Awesome, thanks.
Okay, here is the general description of what needs to happen in ugly
pseudo code:
typedef void (*irq_init_cb_t)(struct intc_desc *intc_desc);
of_irq_init(struct of_device_id *irq_init)
{
struct device_node *np;
struct intc_desc *intc_desc;
for_each_matching_node(np, match_table) {
if (!of_find_property(np, "interrupt-controller"))
continue;
/* Here, we allocate and populate an intc_desc with
the node pointer, interrupt-parent device_node etc. */
intc_desc = of_alloc_intc_desc(np);
list_add(&intc_desc->list, intc_desc_list);
}
/* The root irq controller is the one without an
interrupt-parent. That one
* goes first, followed by the controllers that reference it,
followed by the
* ones that reference the 2nd level controllers, etc
*/
of_irq_sort_descs();
list_for_each_entry(intc_desc, intc_desc_list, list) {
irq_init_cb_t *irq_init_cb;
match = of_match_node(matches, desc->np);
irq_init_cb = match->data;
irq_init_cp(intc_desc);
}
}
There's some ugliness in there with using of_device_id to get the
callback pointer because there is no typechecking when doing it that
way, but that just reflects the current infrastructure in
include/linux/of.h. It doesn't have to be that way.
This doesn't work for all irq controllers, nor does it have to.
Anything on GPIO lines for instance can probably be deferred to
regular platform devices. The main thing that is interesting here is
to get the core interrupt controllers bootstrapped so that other core
hardware, like timers, can use it immediately.
g.
next prev parent reply other threads:[~2011-06-27 15:02 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-24 14:10 [RFC PATCH 0/4] DT support for ARM GIC and TWD Marc Zyngier
2011-06-24 14:10 ` [RFC PATCH 1/4] dt: early platform devices support Marc Zyngier
2011-06-25 4:49 ` Grant Likely
2011-06-25 11:11 ` Marc Zyngier
2011-06-25 20:44 ` Grant Likely
2011-06-27 9:54 ` Marc Zyngier
2011-06-24 14:10 ` [RFC PATCH 2/4] ARM: dt: register local timers as early platform devices Marc Zyngier
2011-06-25 20:47 ` Grant Likely
2011-06-25 21:20 ` Rob Herring
2011-06-26 7:00 ` Grant Likely
[not found] ` <4E0786FF.9010002@firmworks.com>
2011-06-26 21:24 ` "Early" devices and the DT glikely@secretlab.ca
2011-06-24 14:10 ` [RFC PATCH 3/4] ARM: dt: add GIC bindings and driver support Marc Zyngier
2011-06-26 8:01 ` Grant Likely
2011-06-27 10:27 ` Marc Zyngier
2011-06-27 15:02 ` Grant Likely [this message]
2011-06-24 14:10 ` [RFC PATCH 4/4] ARM: dt: Add TWD " Marc Zyngier
2011-06-26 8:09 ` Grant Likely
2011-06-27 10:39 ` Marc Zyngier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=BANLkTin5q7uVCAobvoaBqsUHHn7zJs-x_Q@mail.gmail.com \
--to=grant.likely@secretlab.ca \
--cc=linux-arm-kernel@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).