mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Sahaj Chaudhari <sahaj123.sc@gmail.com>
To: linusw@kernel.org, brgl@kernel.org
Cc: Sahaj Chaudhari <sahaj123.sc@gmail.com>,
	j-keerthy@ti.com, nsekhar@ti.com, prabhakar.csengg@gmail.com,
	avinashphilip@ti.com, sujithkv@ti.com,
	linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH 1/2] gpio: davinci: use controller-specific MMIO for BINTEN
Date: Tue, 10 Nov 2026 01:19:09 +0530	[thread overview]
Message-ID: <20261109194910.2282454-2-sahaj123.sc@gmail.com> (raw)
In-Reply-To: <20261109194910.2282454-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")
Signed-off-by: Sahaj Chaudhari <sahaj123.sc@gmail.com>
---
 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 f7c3b644e0e3..caeecfc3df20 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,
@@ -588,7 +588,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


  reply	other threads:[~2026-11-09 19:48 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-09 19:49 [PATCH 0/2] gpio: davinci: fix probe-time IRQ setup Sahaj Chaudhari
2026-11-09 19:49 ` Sahaj Chaudhari [this message]
2026-11-17 21:19   ` [PATCH 1/2] gpio: davinci: use controller-specific MMIO for BINTEN Linus Walleij
2026-11-09 19:49 ` [PATCH 2/2] gpio: davinci: allocate bank IRQ data before installing handlers Sahaj Chaudhari
2026-11-17 21:20   ` Linus Walleij
2026-11-17  8:22 ` [PATCH 0/2] gpio: davinci: fix probe-time IRQ setup Bartosz Golaszewski

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=20261109194910.2282454-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®