From: Sahaj Chaudhari <sahaj123.sc@gmail.com>
To: linusw@kernel.org, brgl@kernel.org
Cc: linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org,
j-keerthy@ti.com, nsekhar@ti.com, prabhakar.csengg@gmail.com,
avinashphilip@ti.com, sujithkv@ti.com
Subject: [PATCH v2 1/2] gpio: davinci: use controller-specific MMIO for BINTEN
Date: Tue, 24 Nov 2026 19:06:53 +0530 [thread overview]
Message-ID: <20261124121500.2cd5cbf30f89-2-sahaj123.sc@gmail.com> (raw)
In-Reply-To: <20261124121500.2cd5cbf30f89-1-sahaj123.sc@gmail.com>
The file-global gpio_base can be overwritten when probes for multiple
DaVinci GPIO controllers overlap. The later IRQ setup can then write the
BINTEN register of a different controller.
Derive the BINTEN address from the current controller's mapped bank
instead of shared global state.
Fixes: 118150f22d6b ("gpio: davinci: move to platform device")
Reviewed-by: Linus Walleij <linusw@kernel.org>
Signed-off-by: Sahaj Chaudhari <sahaj123.sc@gmail.com>
---
Changes in v2:
- Rebase onto GPIO gpio/for-next after the devm_kzalloc_obj() conversion.
The fix itself is unchanged.
- Add Linus Walleij's Reviewed-by.
Previous version:
https://lore.kernel.org/all/20261109194910.2282454-2-sahaj123.sc@gmail.com/
Testing:
- ARM64 W=1 driver build and mocked nested-probe regression passed.
- Instrumented AM642 baseline selected two wrong BINTEN targets during
forced probe interleaving; the fixed series selected all three correctly.
See the cover letter for test scope and limitations.
drivers/gpio/gpio-davinci.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/gpio/gpio-davinci.c b/drivers/gpio/gpio-davinci.c
index b80c1a27d591..7961ddee9f40 100644
--- a/drivers/gpio/gpio-davinci.c
+++ b/drivers/gpio/gpio-davinci.c
@@ -43,7 +43,6 @@ typedef struct irq_chip *(*gpio_get_irq_chip_cb_t)(unsigned int irq);
#define BINTEN 0x8 /* GPIO Interrupt Per-Bank Enable Register */
-static void __iomem *gpio_base;
static unsigned int offset_array[5] = {0x10, 0x38, 0x60, 0x88, 0xb0};
struct davinci_gpio_irq_data {
@@ -168,6 +167,7 @@ static int davinci_gpio_probe(struct platform_device *pdev)
unsigned int ngpio, nbank, nirq, gpio_unbanked;
struct davinci_gpio_controller *chips;
struct device *dev = &pdev->dev;
+ void __iomem *gpio_base;
/*
* The gpio banks conceptually expose a segmented bitmap,
@@ -586,7 +586,7 @@ static int davinci_gpio_irq_setup(struct platform_device *pdev)
* BINTEN -- per-bank interrupt enable. genirq would also let these
* bits be set/cleared dynamically.
*/
- writel_relaxed(binten, gpio_base + BINTEN);
+ writel_relaxed(binten, chips->regs[0] - offset_array[0] + BINTEN);
return 0;
}
--
2.43.0
next prev parent reply other threads:[~2026-11-24 13:37 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-11-24 13:36 [PATCH v2 0/2] gpio: davinci: fix probe-time IRQ setup Sahaj Chaudhari
2026-11-24 13:36 ` Sahaj Chaudhari [this message]
2026-11-24 13:36 ` [PATCH v2 2/2] gpio: davinci: allocate bank IRQ data before installing handlers Sahaj Chaudhari
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=20261124121500.2cd5cbf30f89-2-sahaj123.sc@gmail.com \
--to=sahaj123.sc@gmail.com \
--cc=avinashphilip@ti.com \
--cc=brgl@kernel.org \
--cc=j-keerthy@ti.com \
--cc=linusw@kernel.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=nsekhar@ti.com \
--cc=prabhakar.csengg@gmail.com \
--cc=sujithkv@ti.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
all inboxes | Powered by JetHome®