From: computersforpeace@gmail.com (Brian Norris)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 2/6] gpio: brcmstb: Add interrupt support
Date: Fri, 29 May 2015 17:10:33 -0700 [thread overview]
Message-ID: <20150530001033.GV27753@ld-irv-0074> (raw)
In-Reply-To: <1432865650-4062-3-git-send-email-gregory.0xf0@gmail.com>
A few small comments:
On Thu, May 28, 2015 at 07:14:06PM -0700, Gregory Fong wrote:
> v2:
> - since imask member of bank struct was removed, just read and write from mask
> reg and don't maintain a shadow
^^ this comment may be addressing what I'm going to ask about below? Not
sure why this was changed, actually.
> - warn on invalid IRQs
> - move some irq setup to a separate function since probe is getting unwieldy
>
> drivers/gpio/Kconfig | 1 +
> drivers/gpio/gpio-brcmstb.c | 276 ++++++++++++++++++++++++++++++++++++++++++++
> 2 files changed, 277 insertions(+)
>
...
> diff --git a/drivers/gpio/gpio-brcmstb.c b/drivers/gpio/gpio-brcmstb.c
> index 7a3cb1f..b9962ff 100644
> --- a/drivers/gpio/gpio-brcmstb.c
> +++ b/drivers/gpio/gpio-brcmstb.c
...
> @@ -63,6 +69,231 @@ brcmstb_gpio_gc_to_priv(struct gpio_chip *gc)
...
> +static void brcmstb_gpio_irq_bank_handler(int irq,
> + struct brcmstb_gpio_bank *bank)
> +{
> + struct brcmstb_gpio_priv *priv = bank->parent_priv;
> + void __iomem *reg_base = priv->reg_base;
> + unsigned long status;
> + unsigned long flags;
> +
> + spin_lock_irqsave(&bank->bgc.lock, flags);
> + while ((status = bank->bgc.read_reg(reg_base + GIO_STAT(bank->id)) &
> + bank->bgc.read_reg(reg_base + GIO_MASK(bank->id)))) {
In case you do run this loop multiple times (multiple interrupts in
progress?), wouldn't it make sense to stash the mask exactly once,
outside the loop? It's probably not a real big deal in practice, I
guess.
> + int bit;
> + for_each_set_bit(bit, &status, 32) {
> + int hwirq = bank->bgc.gc.base -
> + priv->gpio_base + bit;
> + int child_irq =
> + irq_find_mapping(priv->irq_domain,
> + hwirq);
> + u32 stat = bank->bgc.read_reg(reg_base +
> + GIO_STAT(bank->id));
> + if (bit >= bank->width)
> + dev_warn(&priv->pdev->dev,
> + "IRQ for invalid GPIO (bank=%d, offset=%d)\n",
> + bank->id, bit);
> + bank->bgc.write_reg(reg_base + GIO_STAT(bank->id),
> + stat | BIT(bit));
> + generic_handle_irq(child_irq);
> + }
> + }
> + spin_unlock_irqrestore(&bank->bgc.lock, flags);
> +}
...
> @@ -153,6 +410,16 @@ static int brcmstb_gpio_probe(struct platform_device *pdev)
> priv->reg_base = reg_base;
> priv->pdev = pdev;
>
> + if (of_find_property(np, "interrupt-controller", NULL)) {
of_property_read_bool()?
> + priv->parent_irq = platform_get_irq(pdev, 0);
> + if (priv->parent_irq < 0) {
> + dev_err(dev, "Couldn't get IRQ");
> + return -ENOENT;
> + }
> + } else {
> + priv->parent_irq = -ENOENT;
> + }
> +
> INIT_LIST_HEAD(&priv->bank_list);
> if (brcmstb_gpio_sanity_check_banks(dev, np, res))
> return -EINVAL;
Otherwise, looks OK to my inexpert eyes.
Reviewed-by: Brian Norris <computersforpeace@gmail.com>
next prev parent reply other threads:[~2015-05-30 0:10 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-05-29 2:14 [PATCH v2 0/6] GPIO support for BRCMSTB Gregory Fong
2015-05-29 2:14 ` [PATCH v2 1/6] gpio: Add GPIO support for Broadcom STB SoCs Gregory Fong
2015-06-02 13:40 ` Linus Walleij
2015-05-29 2:14 ` [PATCH v2 2/6] gpio: brcmstb: Add interrupt support Gregory Fong
2015-05-30 0:10 ` Brian Norris [this message]
2015-05-30 1:30 ` Gregory Fong
2015-06-02 13:33 ` Linus Walleij
2015-05-29 2:14 ` [PATCH v2 3/6] dt-bindings: brcmstb-gpio: document properties for wakeup Gregory Fong
2015-05-30 0:36 ` Brian Norris
2015-05-30 0:57 ` Gregory Fong
2015-05-30 1:37 ` Brian Norris
2015-05-30 1:51 ` Gregory Fong
2015-05-29 2:14 ` [PATCH v2 4/6] gpio: brcmstb: Allow GPIOs to be wakeup sources Gregory Fong
2015-05-30 0:43 ` Brian Norris
2015-06-02 17:27 ` Gregory Fong
2015-06-02 13:45 ` Linus Walleij
2015-06-02 17:27 ` Gregory Fong
2015-05-29 2:14 ` [PATCH v2 5/6] ARM: brcmstb: Select ARCH_WANT_OPTIONAL_GPIOLIB Gregory Fong
2015-05-29 21:53 ` Florian Fainelli
2015-06-02 13:42 ` Linus Walleij
2015-05-29 2:14 ` [PATCH v2 6/6] ARM: brcmstb: Add default gpio number Gregory Fong
2015-05-29 21:54 ` Florian Fainelli
2015-06-02 13:41 ` Linus Walleij
2015-05-29 16:26 ` [PATCH v2 0/6] GPIO support for BRCMSTB Florian Fainelli
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=20150530001033.GV27753@ld-irv-0074 \
--to=computersforpeace@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox