From: grant.likely@secretlab.ca (Grant Likely)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v4 1/6] ARM: at91/aic: add irq domain and device tree support
Date: Thu, 5 Jan 2012 11:02:18 -0700 [thread overview]
Message-ID: <20120105180218.GC22653@ponder.secretlab.ca> (raw)
In-Reply-To: <4F05CF48.5050007@atmel.com>
On Thu, Jan 05, 2012 at 05:26:48PM +0100, Nicolas Ferre wrote:
> Hi Grant,
>
> Thanks for your review.
>
> Some answer following...
>
> On 01/04/2012 08:40 PM, Grant Likely :
>
> [..]
>
> >> --- a/arch/arm/mach-at91/irq.c
> >> +++ b/arch/arm/mach-at91/irq.c
> >> @@ -24,6 +24,10 @@
> >> #include <linux/module.h>
> >> #include <linux/mm.h>
> >> #include <linux/types.h>
> >> +#include <linux/of_address.h>
> >> +#include <linux/of_irq.h>
> >> +#include <linux/irqdomain.h>
> >> +#include <linux/err.h>
> >>
> >> #include <mach/hardware.h>
> >> #include <asm/irq.h>
> >> @@ -34,22 +38,28 @@
> >> #include <asm/mach/map.h>
> >>
> >> void __iomem *at91_aic_base;
> >> +static struct irq_domain at91_aic_domain;
> >> +
> >> +static inline unsigned int aic_irq(struct irq_data *d)
> >> +{
> >> + return d->hwirq;
> >> +}
> >
> > This is a useless macro. Drop it.
>
> Ok. That was overkill ;-)
>
> [..]
>
> >> @@ -90,13 +100,13 @@ static u32 backups;
> >>
> >> static int at91_aic_set_wake(struct irq_data *d, unsigned value)
> >> {
> >> - if (unlikely(d->irq >= 32))
> >> + if (unlikely(aic_irq(d) >= at91_aic_domain.nr_irq))
> > I don't think you need to derefernce the irq_domain.nr_irq here. Just
> > keep the test for >= 32.
>
> Well I would like to keep it referring to this value as we may increase
> the number of irq handled by this controller in the future...
>
> [..]
>
> >> +#if defined(CONFIG_OF)
> >> +static int __init __at91_aic_of_init(struct device_node *node,
> >> + struct device_node *parent)
> >> +{
> >> + at91_aic_base = of_iomap(node, 0);
> >> + at91_aic_domain.of_node = of_node_get(node);
> >> +
> >> + return 0;
> >> +}
> >> +
> >> +static const struct of_device_id aic_ids[] __initconst = {
> >> + { .compatible = "atmel,at91rm9200-aic", .data = __at91_aic_of_init },
> >> + { /*sentinel*/ }
> >> +};
> >> +
> >> +static void __init at91_aic_of_init(void)
> >> +{
> >> + of_irq_init(aic_ids);
> >> +}
> >> +#else
> >> +static void __init at91_aic_of_init(void) {}
> >> +#endif
> >> +
> >> /*
> >> * Initialize the AIC interrupt controller.
> >> */
> >> void __init at91_aic_init(unsigned int priority[NR_AIC_IRQS])
> >> {
> >> unsigned int i;
> >> + int hwirq, irq;
> >>
> >> - at91_aic_base = ioremap(AT91_AIC, 512);
> >> + if(of_have_populated_dt())
> >> + at91_aic_of_init();
> >> + else
> >> + at91_aic_base = ioremap(AT91_AIC, 512);
> >>
> >> if (!at91_aic_base)
> >> - panic("Impossible to ioremap AT91_AIC\n");
> >> + panic("Unable to ioremap AIC registers\n");
> >> +
> >> + /* Add irq domain for AIC */
> >> + at91_aic_domain.nr_irq = NR_AIC_IRQS;
> >> + at91_aic_domain.irq_base = irq_alloc_descs(-1, AIC_BASE_IRQ,
> >> + at91_aic_domain.nr_irq, 0);
> >> + if (IS_ERR_VALUE(at91_aic_domain.irq_base)) {
> >> + WARN(1, "Cannot allocate irq_descs, assuming pre-allocated\n");
> >> + at91_aic_domain.irq_base = AIC_BASE_IRQ;
> >> + }
> >> + at91_aic_domain.ops = &irq_domain_simple_ops;
> >> + irq_domain_add(&at91_aic_domain);
> >
> > Nothing special is being done with the irq domain. Please use
> > irq_domain_add_simple(). It will make things easier for the next
> > round of irq_domain patches that I'm getting ready to post.
>
> Fair enough, but I have one question: how do I specify "nr_irq" in the
> domain created by irq_domain_add_simple()? Maybe it is not needed?
Fix the irq_domain_add_simple() helper to accept a nr_irq parameter. :-)
g.
WARNING: multiple messages have this Message-ID (diff)
From: Grant Likely <grant.likely-s3s/WqlpOiPyB63q8FvJNQ@public.gmane.org>
To: Nicolas Ferre <nicolas.ferre-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
Cc: devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org,
tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org,
linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org
Subject: Re: [PATCH v4 1/6] ARM: at91/aic: add irq domain and device tree support
Date: Thu, 5 Jan 2012 11:02:18 -0700 [thread overview]
Message-ID: <20120105180218.GC22653@ponder.secretlab.ca> (raw)
In-Reply-To: <4F05CF48.5050007-AIFe0yeh4nAAvxtiuMwx3w@public.gmane.org>
On Thu, Jan 05, 2012 at 05:26:48PM +0100, Nicolas Ferre wrote:
> Hi Grant,
>
> Thanks for your review.
>
> Some answer following...
>
> On 01/04/2012 08:40 PM, Grant Likely :
>
> [..]
>
> >> --- a/arch/arm/mach-at91/irq.c
> >> +++ b/arch/arm/mach-at91/irq.c
> >> @@ -24,6 +24,10 @@
> >> #include <linux/module.h>
> >> #include <linux/mm.h>
> >> #include <linux/types.h>
> >> +#include <linux/of_address.h>
> >> +#include <linux/of_irq.h>
> >> +#include <linux/irqdomain.h>
> >> +#include <linux/err.h>
> >>
> >> #include <mach/hardware.h>
> >> #include <asm/irq.h>
> >> @@ -34,22 +38,28 @@
> >> #include <asm/mach/map.h>
> >>
> >> void __iomem *at91_aic_base;
> >> +static struct irq_domain at91_aic_domain;
> >> +
> >> +static inline unsigned int aic_irq(struct irq_data *d)
> >> +{
> >> + return d->hwirq;
> >> +}
> >
> > This is a useless macro. Drop it.
>
> Ok. That was overkill ;-)
>
> [..]
>
> >> @@ -90,13 +100,13 @@ static u32 backups;
> >>
> >> static int at91_aic_set_wake(struct irq_data *d, unsigned value)
> >> {
> >> - if (unlikely(d->irq >= 32))
> >> + if (unlikely(aic_irq(d) >= at91_aic_domain.nr_irq))
> > I don't think you need to derefernce the irq_domain.nr_irq here. Just
> > keep the test for >= 32.
>
> Well I would like to keep it referring to this value as we may increase
> the number of irq handled by this controller in the future...
>
> [..]
>
> >> +#if defined(CONFIG_OF)
> >> +static int __init __at91_aic_of_init(struct device_node *node,
> >> + struct device_node *parent)
> >> +{
> >> + at91_aic_base = of_iomap(node, 0);
> >> + at91_aic_domain.of_node = of_node_get(node);
> >> +
> >> + return 0;
> >> +}
> >> +
> >> +static const struct of_device_id aic_ids[] __initconst = {
> >> + { .compatible = "atmel,at91rm9200-aic", .data = __at91_aic_of_init },
> >> + { /*sentinel*/ }
> >> +};
> >> +
> >> +static void __init at91_aic_of_init(void)
> >> +{
> >> + of_irq_init(aic_ids);
> >> +}
> >> +#else
> >> +static void __init at91_aic_of_init(void) {}
> >> +#endif
> >> +
> >> /*
> >> * Initialize the AIC interrupt controller.
> >> */
> >> void __init at91_aic_init(unsigned int priority[NR_AIC_IRQS])
> >> {
> >> unsigned int i;
> >> + int hwirq, irq;
> >>
> >> - at91_aic_base = ioremap(AT91_AIC, 512);
> >> + if(of_have_populated_dt())
> >> + at91_aic_of_init();
> >> + else
> >> + at91_aic_base = ioremap(AT91_AIC, 512);
> >>
> >> if (!at91_aic_base)
> >> - panic("Impossible to ioremap AT91_AIC\n");
> >> + panic("Unable to ioremap AIC registers\n");
> >> +
> >> + /* Add irq domain for AIC */
> >> + at91_aic_domain.nr_irq = NR_AIC_IRQS;
> >> + at91_aic_domain.irq_base = irq_alloc_descs(-1, AIC_BASE_IRQ,
> >> + at91_aic_domain.nr_irq, 0);
> >> + if (IS_ERR_VALUE(at91_aic_domain.irq_base)) {
> >> + WARN(1, "Cannot allocate irq_descs, assuming pre-allocated\n");
> >> + at91_aic_domain.irq_base = AIC_BASE_IRQ;
> >> + }
> >> + at91_aic_domain.ops = &irq_domain_simple_ops;
> >> + irq_domain_add(&at91_aic_domain);
> >
> > Nothing special is being done with the irq domain. Please use
> > irq_domain_add_simple(). It will make things easier for the next
> > round of irq_domain patches that I'm getting ready to post.
>
> Fair enough, but I have one question: how do I specify "nr_irq" in the
> domain created by irq_domain_add_simple()? Maybe it is not needed?
Fix the irq_domain_add_simple() helper to accept a nr_irq parameter. :-)
g.
next prev parent reply other threads:[~2012-01-05 18:02 UTC|newest]
Thread overview: 48+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-12-15 19:16 [PATCH 0/6] ARM: at91: irqdomain and device tree for AIC and GPIO Nicolas Ferre
2011-12-15 19:16 ` Nicolas Ferre
2011-12-15 19:16 ` [PATCH v4 1/6] ARM: at91/aic: add irq domain and device tree support Nicolas Ferre
2011-12-15 19:16 ` Nicolas Ferre
2012-01-04 19:40 ` Grant Likely
2012-01-04 19:40 ` Grant Likely
2012-01-05 16:26 ` Nicolas Ferre
2012-01-05 16:26 ` Nicolas Ferre
2012-01-05 18:02 ` Grant Likely [this message]
2012-01-05 18:02 ` Grant Likely
2011-12-15 19:16 ` [PATCH 2/6] ARM: at91/gpio: add irqdomain to gpio interrupts Nicolas Ferre
2011-12-15 19:16 ` Nicolas Ferre
2012-01-04 19:42 ` Grant Likely
2012-01-04 19:42 ` Grant Likely
2011-12-15 19:16 ` [PATCH 3/6] ARM: at91/gpio: add DT support Nicolas Ferre
2011-12-15 19:16 ` Nicolas Ferre
2011-12-16 10:11 ` Jamie Iles
2011-12-16 10:11 ` Jamie Iles
2012-01-03 16:25 ` Nicolas Ferre
2012-01-03 16:25 ` Nicolas Ferre
2012-01-03 18:34 ` [PATCH v2 " Nicolas Ferre
2012-01-03 18:34 ` Nicolas Ferre
2012-01-04 19:45 ` Grant Likely
2012-01-04 19:45 ` Grant Likely
2012-01-04 22:04 ` Russell King - ARM Linux
2012-01-04 22:04 ` Russell King - ARM Linux
2012-01-05 19:42 ` [PATCH v3 " Nicolas Ferre
2012-01-05 19:42 ` Nicolas Ferre
2012-01-05 17:50 ` Nicolas Ferre
2012-01-05 17:50 ` Nicolas Ferre
2012-01-05 20:03 ` [PATCH v4 " Nicolas Ferre
2012-01-05 20:03 ` Nicolas Ferre
2011-12-15 19:16 ` [PATCH 4/6] ARM: at91/gpio: add .to_irq gpio_chip handler and rework irq_to_gpio Nicolas Ferre
2011-12-15 19:16 ` Nicolas Ferre
2012-01-04 19:47 ` Grant Likely
2012-01-04 19:47 ` Grant Likely
2011-12-15 19:16 ` [PATCH 5/6] ARM: at91/gpio: remove the static specification of gpio_chip.base Nicolas Ferre
2011-12-15 19:16 ` Nicolas Ferre
2012-01-04 19:47 ` Grant Likely
2012-01-04 19:47 ` Grant Likely
2011-12-15 19:16 ` [PATCH 6/6] ARM: at91/board-dt: remove AIC irq domain from board file Nicolas Ferre
2011-12-15 19:16 ` Nicolas Ferre
2012-01-04 19:48 ` Grant Likely
2012-01-04 19:48 ` Grant Likely
2011-12-16 1:53 ` [PATCH 0/6] ARM: at91: irqdomain and device tree for AIC and GPIO Rob Herring
2011-12-16 1:53 ` Rob Herring
2011-12-16 16:29 ` Nicolas Ferre
2011-12-16 16:29 ` Nicolas Ferre
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=20120105180218.GC22653@ponder.secretlab.ca \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.