From: Thierry Reding <thierry.reding@gmail.com>
To: Prathamesh Shete <pshete@nvidia.com>
Cc: linus.walleij@linaro.org, bgolaszewski@baylibre.com,
jonathanh@nvidia.com, linux-gpio@vger.kernel.org,
linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org,
smangipudi@nvidia.com
Subject: Re: [PATCH v3 1/2] gpio: tegra: add multiple interrupt support
Date: Fri, 17 Sep 2021 12:47:12 +0200 [thread overview]
Message-ID: <YURyMAsWVYH+/0UI@orome.fritz.box> (raw)
In-Reply-To: <20210907073224.3070-2-pshete@nvidia.com>
[-- Attachment #1: Type: text/plain, Size: 2785 bytes --]
On Tue, Sep 07, 2021 at 01:02:23PM +0530, Prathamesh Shete wrote:
> From: pshete <pshete@nvidia.com>
>
> T19x GPIO controller's support multiple interrupts. The GPIO
> controller is capable to route 8 interrupts per controller in
> case of NON-AON GPIO's and 4 interrupts per controller in AON GPIO.
> This is new feature starting Tegra194
> The interrupt route map determines which interrupt line is to be used.
>
> Signed-off-by: Prathamesh Shete <pshete@nvidia.com>
> ---
> drivers/gpio/gpio-tegra186.c | 27 ++++++++++++++++++++++-----
> 1 file changed, 22 insertions(+), 5 deletions(-)
>
> diff --git a/drivers/gpio/gpio-tegra186.c b/drivers/gpio/gpio-tegra186.c
> index d38980b9923a..c1172da9aebf 100644
> --- a/drivers/gpio/gpio-tegra186.c
> +++ b/drivers/gpio/gpio-tegra186.c
> @@ -1,6 +1,6 @@
> // SPDX-License-Identifier: GPL-2.0-only
> /*
> - * Copyright (c) 2016-2017 NVIDIA Corporation
> + * Copyright (c) 2016-2021 NVIDIA Corporation
> *
> * Author: Thierry Reding <treding@nvidia.com>
> */
> @@ -68,6 +68,7 @@ struct tegra_gpio_soc {
> unsigned int num_ports;
> const char *name;
> unsigned int instance;
> + bool multi_ints;
>
> const struct tegra186_pin_range *pin_ranges;
> unsigned int num_pin_ranges;
> @@ -450,7 +451,8 @@ static void tegra186_gpio_irq(struct irq_desc *desc)
> struct irq_domain *domain = gpio->gpio.irq.domain;
> struct irq_chip *chip = irq_desc_get_chip(desc);
> unsigned int parent = irq_desc_get_irq(desc);
> - unsigned int i, offset = 0;
> + unsigned int i, j, offset = 0;
> + int intr_cntr;
>
> chained_irq_enter(chip, desc);
>
> @@ -462,9 +464,20 @@ static void tegra186_gpio_irq(struct irq_desc *desc)
>
> base = gpio->base + port->bank * 0x1000 + port->port * 0x200;
>
> - /* skip ports that are not associated with this bank */
> - if (parent != gpio->irq[port->bank])
> - goto skip;
> + if (!gpio->soc->multi_ints) {
> + /* skip ports that are not associated with this bank */
> + if (parent != gpio->irq[port->bank])
> + goto skip;
> +
> + } else {
> + intr_cntr = 0;
> + for (j = 0; j < 8; j++) {
> + if (parent != gpio->irq[(port->bank * 8) + j])
Again, I don't see how this would work. Currently the DT for Tegra194
(where you set multi_ints = true) lists 6 interrupts. So as soon as j
goes beyond 5, this will end up accessing data beyond the bounds of
the gpio->irq array.
I've revised the patches that I created to support this a while ago and
which I had sent earlier as a counter-proposal that keeps compatibility
with earlier device trees. I've now tested it and found a few issues I
had not run into earlier, but it should now work correctly with older
and updated device trees.
Thierry
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 833 bytes --]
next prev parent reply other threads:[~2021-09-17 10:47 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-09-03 10:15 [PATCH v2 0/2] gpio: tegra: add multiple interrupt support Prathamesh Shete
2021-09-03 10:15 ` [PATCH v2 1/2] " Prathamesh Shete
2021-09-06 4:51 ` Thierry Reding
2021-09-07 7:23 ` Prathamesh Shete
2021-09-07 7:30 ` [PATCH v2 0/2] " Prathamesh Shete
2021-09-07 7:30 ` [PATCH v2 1/2] " Prathamesh Shete
2021-09-07 7:30 ` [PATCH v2 2/2] arm64: tegra: GPIO Interrupt entries Prathamesh Shete
2021-09-07 7:32 ` [PATCH v3 0/2] gpio: tegra: add multiple interrupt support Prathamesh Shete
2021-09-07 7:32 ` [PATCH v3 1/2] " Prathamesh Shete
2021-09-17 10:47 ` Thierry Reding [this message]
2021-09-07 7:32 ` [PATCH v3 2/2] arm64: tegra: GPIO Interrupt entries Prathamesh Shete
2021-09-22 9:29 ` Bartosz Golaszewski
2021-09-22 13:25 ` Thierry Reding
2021-09-24 14:37 ` Thierry Reding
2021-09-03 10:15 ` [PATCH v2 " Prathamesh Shete
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=YURyMAsWVYH+/0UI@orome.fritz.box \
--to=thierry.reding@gmail.com \
--cc=bgolaszewski@baylibre.com \
--cc=jonathanh@nvidia.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tegra@vger.kernel.org \
--cc=pshete@nvidia.com \
--cc=smangipudi@nvidia.com \
/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).