From: swarren@nvidia.com (Stephen Warren)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH] pinctrl/nomadik: allocate IRQ descriptors dynamically
Date: Wed, 26 Sep 2012 23:13:14 -0600 [thread overview]
Message-ID: <5063E06A.6000205@nvidia.com> (raw)
In-Reply-To: <1348679887-2135-1-git-send-email-linus.walleij@stericsson.com>
On 09/26/2012 11:18 AM, Linus Walleij wrote:
> From: Linus Walleij <linus.walleij@linaro.org>
>
> This allocates the IRQ descriptors for the Nomadik pin controller
> dynamically so that we don't have to rely on some other mechanism
> doing it, and moving a step closer to a linear IRQ domain.
>
> Cc: Rob Herring <rob.herring@calxeda.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> drivers/pinctrl/pinctrl-nomadik.c | 19 +++++++++++++++++--
> 1 file changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c
> index 3dde653..29921d1 100644
> --- a/drivers/pinctrl/pinctrl-nomadik.c
> +++ b/drivers/pinctrl/pinctrl-nomadik.c
> @@ -1185,6 +1185,8 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev)
> struct clk *clk;
> int secondary_irq;
> void __iomem *base;
> + int irq_start;
> + int irq_base;
> int irq;
> int ret;
>
> @@ -1288,9 +1290,22 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev)
>
> platform_set_drvdata(dev, nmk_chip);
>
> + /*
> + * Allocate descriptors and IRQ domain using the legacy model, this
> + * should eventually be replaced with a linear IRQ domain as we get
> + * independent from the irq numbers with the switch to device tree.
> + */
> + irq_start = NOMADIK_GPIO_TO_IRQ(pdata->first_gpio);
Presumably that's a 1:1 mapping...
> + irq_base = irq_alloc_descs(irq_start, 0, NMK_GPIO_PER_CHIP,
> + numa_node_id());
> + if (IS_ERR_VALUE(irq_base)) {
> + WARN(1, "Cannot allocate irq_descs @ IRQ%d, assuming pre-allocated\n",
> + irq_start);
> + irq_base = irq_start;
> + }
Hmmm. Is this code targetting the DT case or the non-DT case or both? I
think typically you'd call irq_domain_add_linear without forcing a
particular IRQ base for the DT case, and only call irq_alloc_descs() for
the non-DT case, right?
> nmk_chip->domain = irq_domain_add_legacy(np, NMK_GPIO_PER_CHIP,
> - NOMADIK_GPIO_TO_IRQ(pdata->first_gpio),
> - 0, &nmk_gpio_irq_simple_ops, nmk_chip);
> + irq_base, 0,
> + &nmk_gpio_irq_simple_ops, nmk_chip);
> if (!nmk_chip->domain) {
> dev_err(&dev->dev, "failed to create irqdomain\n");
> ret = -ENOSYS;
WARNING: multiple messages have this Message-ID (diff)
From: Stephen Warren <swarren@nvidia.com>
To: Linus Walleij <linus.walleij@stericsson.com>
Cc: linux-kernel@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Anmar Oueja <anmar.oueja@linaro.org>,
Linus Walleij <linus.walleij@linaro.org>,
Rob Herring <rob.herring@calxeda.com>
Subject: Re: [PATCH] pinctrl/nomadik: allocate IRQ descriptors dynamically
Date: Wed, 26 Sep 2012 23:13:14 -0600 [thread overview]
Message-ID: <5063E06A.6000205@nvidia.com> (raw)
In-Reply-To: <1348679887-2135-1-git-send-email-linus.walleij@stericsson.com>
On 09/26/2012 11:18 AM, Linus Walleij wrote:
> From: Linus Walleij <linus.walleij@linaro.org>
>
> This allocates the IRQ descriptors for the Nomadik pin controller
> dynamically so that we don't have to rely on some other mechanism
> doing it, and moving a step closer to a linear IRQ domain.
>
> Cc: Rob Herring <rob.herring@calxeda.com>
> Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
> ---
> drivers/pinctrl/pinctrl-nomadik.c | 19 +++++++++++++++++--
> 1 file changed, 17 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/pinctrl/pinctrl-nomadik.c b/drivers/pinctrl/pinctrl-nomadik.c
> index 3dde653..29921d1 100644
> --- a/drivers/pinctrl/pinctrl-nomadik.c
> +++ b/drivers/pinctrl/pinctrl-nomadik.c
> @@ -1185,6 +1185,8 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev)
> struct clk *clk;
> int secondary_irq;
> void __iomem *base;
> + int irq_start;
> + int irq_base;
> int irq;
> int ret;
>
> @@ -1288,9 +1290,22 @@ static int __devinit nmk_gpio_probe(struct platform_device *dev)
>
> platform_set_drvdata(dev, nmk_chip);
>
> + /*
> + * Allocate descriptors and IRQ domain using the legacy model, this
> + * should eventually be replaced with a linear IRQ domain as we get
> + * independent from the irq numbers with the switch to device tree.
> + */
> + irq_start = NOMADIK_GPIO_TO_IRQ(pdata->first_gpio);
Presumably that's a 1:1 mapping...
> + irq_base = irq_alloc_descs(irq_start, 0, NMK_GPIO_PER_CHIP,
> + numa_node_id());
> + if (IS_ERR_VALUE(irq_base)) {
> + WARN(1, "Cannot allocate irq_descs @ IRQ%d, assuming pre-allocated\n",
> + irq_start);
> + irq_base = irq_start;
> + }
Hmmm. Is this code targetting the DT case or the non-DT case or both? I
think typically you'd call irq_domain_add_linear without forcing a
particular IRQ base for the DT case, and only call irq_alloc_descs() for
the non-DT case, right?
> nmk_chip->domain = irq_domain_add_legacy(np, NMK_GPIO_PER_CHIP,
> - NOMADIK_GPIO_TO_IRQ(pdata->first_gpio),
> - 0, &nmk_gpio_irq_simple_ops, nmk_chip);
> + irq_base, 0,
> + &nmk_gpio_irq_simple_ops, nmk_chip);
> if (!nmk_chip->domain) {
> dev_err(&dev->dev, "failed to create irqdomain\n");
> ret = -ENOSYS;
next prev parent reply other threads:[~2012-09-27 5:13 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-09-26 17:18 [PATCH] pinctrl/nomadik: allocate IRQ descriptors dynamically Linus Walleij
2012-09-26 17:18 ` Linus Walleij
2012-09-27 5:13 ` Stephen Warren [this message]
2012-09-27 5:13 ` Stephen Warren
2012-09-27 11:59 ` Linus Walleij
2012-09-27 11:59 ` Linus Walleij
2012-09-27 12:37 ` Rob Herring
2012-09-27 12:37 ` Rob Herring
2012-09-27 12:48 ` Linus Walleij
2012-09-27 12:48 ` Linus Walleij
2012-09-27 12:53 ` Russell King - ARM Linux
2012-09-27 12:53 ` Russell King - ARM Linux
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=5063E06A.6000205@nvidia.com \
--to=swarren@nvidia.com \
--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.