Linux GPIO subsystem development
 help / color / mirror / Atom feed
From: Tomer Maimon <tmaimon77@gmail.com>
To: andrew@codeconstruct.com.au, linusw@kernel.org, brgl@kernel.org
Cc: openbmc@lists.ozlabs.org, linux-gpio@vger.kernel.org,
	linux-kernel@vger.kernel.org, avifishman70@gmail.com,
	tmaimon77@gmail.com, tali.perry1@gmail.com, venture@google.com,
	yuenn@google.com, benjaminfair@google.com
Subject: [PATCH v1 8/8] pinctrl: npcm8xx: fix debounce register selection
Date: Wed, 15 Jul 2026 15:29:23 +0300	[thread overview]
Message-ID: <20260715122923.1938327-9-tmaimon77@gmail.com> (raw)
In-Reply-To: <20260715122923.1938327-1-tmaimon77@gmail.com>

Each DBNCS register programs debounce source selection for 16 GPIOs.
The current offset calculation advances the register address every four
GPIOs, so offsets 4-15 and 20-31 end up touching the wrong selector
register.

Advance the DBNCS offset per 16 GPIOs so each line uses the debounce
selector bank that matches the hardware layout.

Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
---
 drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
index f94494b67..f9107f819 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
@@ -2211,7 +2211,8 @@ static const struct pinmux_ops npcm8xx_pinmux_ops = {
 static int debounce_timing_setting(struct npcm8xx_gpio *bank, u32 gpio,
 				   u32 nanosecs)
 {
-	void __iomem *DBNCS_offset = bank->base + NPCM8XX_GP_N_DBNCS0 + (gpio / 4);
+	void __iomem *DBNCS_offset = bank->base + NPCM8XX_GP_N_DBNCS0 +
+				     (gpio / 16) * 4;
 	int gpio_debounce = (gpio % 16) * 2, debounce_select, i;
 	u32 dbncp_val, dbncp_val_mod;
 
-- 
2.34.1


      parent reply	other threads:[~2026-07-15 12:29 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-15 12:29 [PATCH v1 0/8] pinctrl: npcm8xx: fix pinmuxing and configuration handling Tomer Maimon
2026-07-15 12:29 ` [PATCH v1 1/8] pinctrl: npcm8xx: drop RTS/CTS pins from bmcuart1 Tomer Maimon
2026-07-15 12:29 ` [PATCH v1 2/8] pinctrl: npcm8xx: enable RMII outputs from RMII groups Tomer Maimon
2026-07-15 12:29 ` [PATCH v1 3/8] pinctrl: npcm8xx: support RG2 drive strength selection Tomer Maimon
2026-07-15 12:29 ` [PATCH v1 4/8] pinctrl: npcm8xx: clear pending GPIO events during init Tomer Maimon
2026-07-15 12:29 ` [PATCH v1 5/8] pinctrl: npcm8xx: rename GPIO7 IOX2 signal to DO Tomer Maimon
2026-07-15 12:29 ` [PATCH v1 6/8] pinctrl: npcm8xx: move GPIO IRQ setup into request_resources Tomer Maimon
2026-07-15 12:29 ` [PATCH v1 7/8] pinctrl: npcm8xx: correct JM1 and SMB7 pin flags Tomer Maimon
2026-07-15 12:29 ` Tomer Maimon [this message]

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=20260715122923.1938327-9-tmaimon77@gmail.com \
    --to=tmaimon77@gmail.com \
    --cc=andrew@codeconstruct.com.au \
    --cc=avifishman70@gmail.com \
    --cc=benjaminfair@google.com \
    --cc=brgl@kernel.org \
    --cc=linusw@kernel.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=openbmc@lists.ozlabs.org \
    --cc=tali.perry1@gmail.com \
    --cc=venture@google.com \
    --cc=yuenn@google.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