* [PATCH v1 1/8] pinctrl: npcm8xx: drop RTS/CTS pins from bmcuart1
2026-07-15 12:29 [PATCH v1 0/8] pinctrl: npcm8xx: fix pinmuxing and configuration handling Tomer Maimon
@ 2026-07-15 12:29 ` Tomer Maimon
2026-07-15 12:29 ` [PATCH v1 2/8] pinctrl: npcm8xx: enable RMII outputs from RMII groups Tomer Maimon
` (6 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Tomer Maimon @ 2026-07-15 12:29 UTC (permalink / raw)
To: andrew, linusw, brgl
Cc: openbmc, linux-gpio, linux-kernel, avifishman70, tmaimon77,
tali.perry1, venture, yuenn, benjaminfair
The bmcuart1 group currently claims BU1_RTS and BU1_CTS in addition
to TXD and RXD. That prevents boards from using the modem-control
pins independently through the dedicated nbu1crts function.
Limit bmcuart1 to the TXD/RXD pair and let users opt into BU1_RTS
and BU1_CTS explicitly through the nbu1crts group when those signals
are needed.
Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
---
drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
index 0aae1a253..c859dca4b 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
@@ -538,7 +538,7 @@ static const int wdog2_pins[] = { 219 };
static const int bmcuart0a_pins[] = { 41, 42 };
static const int bmcuart0b_pins[] = { 48, 49 };
-static const int bmcuart1_pins[] = { 43, 44, 62, 63 };
+static const int bmcuart1_pins[] = { 43, 63 };
static const int scipme_pins[] = { 169 };
static const int smi_pins[] = { 170 };
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v1 2/8] pinctrl: npcm8xx: enable RMII outputs from RMII groups
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 ` Tomer Maimon
2026-07-15 12:29 ` [PATCH v1 3/8] pinctrl: npcm8xx: support RG2 drive strength selection Tomer Maimon
` (5 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Tomer Maimon @ 2026-07-15 12:29 UTC (permalink / raw)
To: andrew, linusw, brgl
Cc: openbmc, linux-gpio, linux-kernel, avifishman70, tmaimon77,
tali.perry1, venture, yuenn, benjaminfair
NPCM8xx uses GCR_INTCR4 bits to release the R1, R2 and RMII3
transmit outputs from Hi-Z.
Those bits need to follow the mandatory r1, r2 and rmii3 pin
groups. The R1_OEn, R2_OEn and R3_OEn side groups are optional and
should not be required just to enable RMII transmit outputs.
Program the INTCR4 bits when the corresponding RMII groups are
selected and clear them again when those pins switch back to GPIO or
another shared function.
Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
---
drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c | 61 +++++++++++++++++++++++
1 file changed, 61 insertions(+)
diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
index c859dca4b..1d5b3c648 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
@@ -26,6 +26,7 @@
#define NPCM8XX_GCR_SRCNT 0x068
#define NPCM8XX_GCR_FLOCKR1 0x074
#define NPCM8XX_GCR_DSCNT 0x078
+#define NPCM8XX_GCR_INTCR4 0x0c0
#define NPCM8XX_GCR_I2CSEGSEL 0x0e0
#define NPCM8XX_GCR_MFSEL1 0x260
#define NPCM8XX_GCR_MFSEL2 0x264
@@ -78,6 +79,9 @@
#define NPCM8XX_GPIO_PER_BANK 32
#define NPCM8XX_GPIO_BANK_NUM 8
#define NPCM8XX_GCR_NONE 0
+#define NPCM8XX_INTCR4_R1_RMII_EN BIT(12)
+#define NPCM8XX_INTCR4_R2_RMII_EN BIT(13)
+#define NPCM8XX_INTCR4_RMII3_EN BIT(14)
#define NPCM8XX_DEBOUNCE_MAX 4
#define NPCM8XX_DEBOUNCE_NSEC 40
@@ -1796,6 +1800,61 @@ static const struct pinctrl_pin_desc npcm8xx_pins[] = {
PINCTRL_PIN(251, "JM2/CP1_GPIO"),
};
+static u32 npcm8xx_rmii_output_enable_mask(unsigned int pin)
+{
+ switch (pin) {
+ case 178:
+ case 179:
+ case 180:
+ case 181:
+ case 182:
+ case 193:
+ case 201:
+ return NPCM8XX_INTCR4_R1_RMII_EN;
+ case 84:
+ case 85:
+ case 86:
+ case 87:
+ case 88:
+ case 89:
+ case 200:
+ return NPCM8XX_INTCR4_R2_RMII_EN;
+ case 110:
+ case 111:
+ case 209:
+ case 210:
+ case 211:
+ case 214:
+ case 215:
+ return NPCM8XX_INTCR4_RMII3_EN;
+ default:
+ return 0;
+ }
+}
+
+static void npcm8xx_set_rmii_output_enable(struct regmap *gcr_regmap,
+ const unsigned int *pin,
+ int pin_number, int mode)
+{
+ u32 mask = 0;
+ u32 val = 0;
+ u32 bit;
+ int i;
+
+ for (i = 0; i < pin_number; i++) {
+ bit = npcm8xx_rmii_output_enable_mask(pin[i]);
+ mask |= bit;
+
+ if ((mode == fn_r1 && bit == NPCM8XX_INTCR4_R1_RMII_EN) ||
+ (mode == fn_r2 && bit == NPCM8XX_INTCR4_R2_RMII_EN) ||
+ (mode == fn_rmii3 && bit == NPCM8XX_INTCR4_RMII3_EN))
+ val |= bit;
+ }
+
+ if (mask)
+ regmap_update_bits(gcr_regmap, NPCM8XX_GCR_INTCR4, mask, val);
+}
+
/* Enable mode in pin group */
static void npcm8xx_setfunc(struct regmap *gcr_regmap, const unsigned int *pin,
int pin_number, int mode)
@@ -1834,6 +1893,8 @@ static void npcm8xx_setfunc(struct regmap *gcr_regmap, const unsigned int *pin,
BIT(cfg->bit4) : 0);
}
}
+
+ npcm8xx_set_rmii_output_enable(gcr_regmap, pin, pin_number, mode);
}
static int npcm8xx_get_slew_rate(struct npcm8xx_gpio *bank,
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v1 3/8] pinctrl: npcm8xx: support RG2 drive strength selection
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 ` Tomer Maimon
2026-07-15 12:29 ` [PATCH v1 4/8] pinctrl: npcm8xx: clear pending GPIO events during init Tomer Maimon
` (4 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Tomer Maimon @ 2026-07-15 12:29 UTC (permalink / raw)
To: andrew, linusw, brgl
Cc: openbmc, linux-gpio, linux-kernel, avifishman70, tmaimon77,
tali.perry1, venture, yuenn, benjaminfair
RG2 pins 110-113 and 208-209 do not use the per-bank ODSC bit that the
driver relies on for the rest of the drive-strength handling. Their
strength is encoded in GCR_DSCNT[7:6] and supports four values: 8, 12,
16 and 24mA.
Mark those pins as a dedicated drive-strength class and translate the
pinconf get/set operations to the shared GCR_DSCNT field so the full
hardware range becomes available.
Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
---
drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c | 75 ++++++++++++++++++++---
1 file changed, 67 insertions(+), 8 deletions(-)
diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
index 1d5b3c648..8d7dfb326 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
@@ -82,6 +82,8 @@
#define NPCM8XX_INTCR4_R1_RMII_EN BIT(12)
#define NPCM8XX_INTCR4_R2_RMII_EN BIT(13)
#define NPCM8XX_INTCR4_RMII3_EN BIT(14)
+#define NPCM8XX_GCR_DSCNT_RG2DS_SHIFT 6
+#define NPCM8XX_GCR_DSCNT_RG2DS_MASK GENMASK(7, 6)
#define NPCM8XX_DEBOUNCE_MAX 4
#define NPCM8XX_DEBOUNCE_NSEC 40
@@ -1287,6 +1289,7 @@ static struct pinfunction npcm8xx_funcs[] = {
#define DRIVE_STRENGTH_LO_SHIFT 8
#define DRIVE_STRENGTH_HI_SHIFT 12
#define DRIVE_STRENGTH_MASK GENMASK(15, 8)
+#define DSTR_RG2 BIT(16)
#define DSTR(lo, hi) (((lo) << DRIVE_STRENGTH_LO_SHIFT) | \
((hi) << DRIVE_STRENGTH_HI_SHIFT))
@@ -1419,10 +1422,10 @@ static const struct npcm8xx_pincfg pincfg[] = {
NPCM8XX_PINCFG(107, i3c5, MFSEL3, 22, none, NONE, 0, none, NONE, 0, none, NONE, 0, none, NONE, 0, SLEW),
NPCM8XX_PINCFG(108, sg1mdio, MFSEL4, 21, none, NONE, 0, none, NONE, 0, none, NONE, 0, none, NONE, 0, SLEW),
NPCM8XX_PINCFG(109, sg1mdio, MFSEL4, 21, none, NONE, 0, none, NONE, 0, none, NONE, 0, none, NONE, 0, SLEW),
- NPCM8XX_PINCFG(110, rg2, MFSEL4, 24, ddr, MFSEL3, 26, rmii3, MFSEL5, 11, none, NONE, 0, none, NONE, 0, SLEW),
- NPCM8XX_PINCFG(111, rg2, MFSEL4, 24, ddr, MFSEL3, 26, rmii3, MFSEL5, 11, none, NONE, 0, none, NONE, 0, SLEW),
- NPCM8XX_PINCFG(112, rg2, MFSEL4, 24, ddr, MFSEL3, 26, none, NONE, 0, none, NONE, 0, none, NONE, 0, SLEW),
- NPCM8XX_PINCFG(113, rg2, MFSEL4, 24, ddr, MFSEL3, 26, none, NONE, 0, none, NONE, 0, none, NONE, 0, SLEW),
+ NPCM8XX_PINCFG(110, rg2, MFSEL4, 24, ddr, MFSEL3, 26, rmii3, MFSEL5, 11, none, NONE, 0, none, NONE, 0, DSTR_RG2 | SLEW),
+ NPCM8XX_PINCFG(111, rg2, MFSEL4, 24, ddr, MFSEL3, 26, rmii3, MFSEL5, 11, none, NONE, 0, none, NONE, 0, DSTR_RG2 | SLEW),
+ NPCM8XX_PINCFG(112, rg2, MFSEL4, 24, ddr, MFSEL3, 26, none, NONE, 0, none, NONE, 0, none, NONE, 0, DSTR_RG2 | SLEW),
+ NPCM8XX_PINCFG(113, rg2, MFSEL4, 24, ddr, MFSEL3, 26, none, NONE, 0, none, NONE, 0, none, NONE, 0, DSTR_RG2 | SLEW),
NPCM8XX_PINCFG(114, smb0, MFSEL1, 6, none, NONE, 0, none, NONE, 0, none, NONE, 0, none, NONE, 0, 0),
NPCM8XX_PINCFG(115, smb0, MFSEL1, 6, none, NONE, 0, none, NONE, 0, none, NONE, 0, none, NONE, 0, 0),
NPCM8XX_PINCFG(116, smb1, MFSEL1, 7, none, NONE, 0, none, NONE, 0, none, NONE, 0, none, NONE, 0, 0),
@@ -1513,8 +1516,8 @@ static const struct npcm8xx_pincfg pincfg[] = {
NPCM8XX_PINCFG(201, r1, MFSEL3, 9, none, NONE, 0, none, NONE, 0, none, NONE, 0, none, NONE, 0, GPO),
NPCM8XX_PINCFG(202, smb0c, I2CSEGSEL, 1, fm0, MFSEL6, 16, none, NONE, 0, none, NONE, 0, none, NONE, 0, SLEW),
NPCM8XX_PINCFG(203, faninx, MFSEL3, 3, spi1cs0, MFSEL3, 4, fm1, MFSEL6, 17, none, NONE, 0, none, NONE, 0, DSTR(8, 12)),
- NPCM8XX_PINCFG(208, rg2, MFSEL4, 24, ddr, MFSEL3, 26, none, NONE, 0, none, NONE, 0, none, NONE, 0, SLEW), /* DSCNT */
- NPCM8XX_PINCFG(209, rg2, MFSEL4, 24, ddr, MFSEL3, 26, rmii3, MFSEL5, 11, none, NONE, 0, none, NONE, 0, SLEW), /* DSCNT */
+ NPCM8XX_PINCFG(208, rg2, MFSEL4, 24, ddr, MFSEL3, 26, none, NONE, 0, none, NONE, 0, none, NONE, 0, DSTR_RG2 | SLEW),
+ NPCM8XX_PINCFG(209, rg2, MFSEL4, 24, ddr, MFSEL3, 26, rmii3, MFSEL5, 11, none, NONE, 0, none, NONE, 0, DSTR_RG2 | SLEW),
NPCM8XX_PINCFG(210, rg2, MFSEL4, 24, ddr, MFSEL3, 26, rmii3, MFSEL5, 11, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW),
NPCM8XX_PINCFG(211, rg2, MFSEL4, 24, ddr, MFSEL3, 26, rmii3, MFSEL5, 11, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW),
NPCM8XX_PINCFG(212, rg2, MFSEL4, 24, ddr, MFSEL3, 26, r3rxer, MFSEL6, 30, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW),
@@ -1954,6 +1957,56 @@ static int npcm8xx_set_slew_rate(struct npcm8xx_gpio *bank,
return 0;
}
+static int npcm8xx_get_rg2_drive_strength(struct npcm8xx_pinctrl *npcm)
+{
+ u32 val;
+ int ret;
+
+ ret = regmap_read(npcm->gcr_regmap, NPCM8XX_GCR_DSCNT, &val);
+ if (ret)
+ return ret;
+
+ switch ((val & NPCM8XX_GCR_DSCNT_RG2DS_MASK) >>
+ NPCM8XX_GCR_DSCNT_RG2DS_SHIFT) {
+ case 0:
+ return 8;
+ case 1:
+ return 12;
+ case 2:
+ return 16;
+ case 3:
+ return 24;
+ default:
+ return -EINVAL;
+ }
+}
+
+static int npcm8xx_set_rg2_drive_strength(struct npcm8xx_pinctrl *npcm, int nval)
+{
+ u32 val;
+
+ switch (nval) {
+ case 8:
+ val = 0;
+ break;
+ case 12:
+ val = 1;
+ break;
+ case 16:
+ val = 2;
+ break;
+ case 24:
+ val = 3;
+ break;
+ default:
+ return -EOPNOTSUPP;
+ }
+
+ return regmap_update_bits(npcm->gcr_regmap, NPCM8XX_GCR_DSCNT,
+ NPCM8XX_GCR_DSCNT_RG2DS_MASK,
+ val << NPCM8XX_GCR_DSCNT_RG2DS_SHIFT);
+}
+
static int npcm8xx_get_drive_strength(struct pinctrl_dev *pctldev,
unsigned int pin)
{
@@ -1962,10 +2015,13 @@ static int npcm8xx_get_drive_strength(struct pinctrl_dev *pctldev,
&npcm->gpio_bank[pin / NPCM8XX_GPIO_PER_BANK];
int gpio = pin % bank->chip.gc.ngpio;
unsigned long pinmask = BIT(gpio);
- int flg, val;
- u32 ds = 0;
+ int flg, ds;
+ u32 val;
flg = pincfg[pin].flag;
+ if (flg & DSTR_RG2)
+ return npcm8xx_get_rg2_drive_strength(npcm);
+
if (!(flg & DRIVE_STRENGTH_MASK))
return -EINVAL;
@@ -1984,6 +2040,9 @@ static int npcm8xx_set_drive_strength(struct npcm8xx_pinctrl *npcm,
int gpio = BIT(pin % bank->chip.gc.ngpio);
int v;
+ if (pincfg[pin].flag & DSTR_RG2)
+ return npcm8xx_set_rg2_drive_strength(npcm, nval);
+
v = pincfg[pin].flag & DRIVE_STRENGTH_MASK;
if (DSLO(v) == nval)
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v1 4/8] pinctrl: npcm8xx: clear pending GPIO events during init
2026-07-15 12:29 [PATCH v1 0/8] pinctrl: npcm8xx: fix pinmuxing and configuration handling Tomer Maimon
` (2 preceding siblings ...)
2026-07-15 12:29 ` [PATCH v1 3/8] pinctrl: npcm8xx: support RG2 drive strength selection Tomer Maimon
@ 2026-07-15 12:29 ` Tomer Maimon
2026-07-15 12:29 ` [PATCH v1 5/8] pinctrl: npcm8xx: rename GPIO7 IOX2 signal to DO Tomer Maimon
` (3 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Tomer Maimon @ 2026-07-15 12:29 UTC (permalink / raw)
To: andrew, linusw, brgl
Cc: openbmc, linux-gpio, linux-kernel, avifishman70, tmaimon77,
tali.perry1, venture, yuenn, benjaminfair
A bank may retain pending event status across resets of the GPIO block.
If probe leaves the old state in place, the chained IRQ handler can see
spurious events as soon as the irqchip is registered.
Disable event generation and clear EVST before wiring each GPIO bank
into gpiolib so the driver starts from a known state.
Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
---
drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
index 8d7dfb326..5dcb01923 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
@@ -2471,6 +2471,9 @@ static int npcm8xx_gpio_fw(struct npcm8xx_pinctrl *pctrl)
if (ret < 0)
return dev_err_probe(dev, ret, "Failed to retrieve IRQ for bank %u\n", id);
+ iowrite32(0, pctrl->gpio_bank[id].base + NPCM8XX_GP_N_EVEN);
+ iowrite32(0xffffffff, pctrl->gpio_bank[id].base + NPCM8XX_GP_N_EVST);
+
pctrl->gpio_bank[id].irq = ret;
pctrl->gpio_bank[id].irq_chip = npcmgpio_irqchip;
pctrl->gpio_bank[id].irqbase = id * NPCM8XX_GPIO_PER_BANK;
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v1 5/8] pinctrl: npcm8xx: rename GPIO7 IOX2 signal to DO
2026-07-15 12:29 [PATCH v1 0/8] pinctrl: npcm8xx: fix pinmuxing and configuration handling Tomer Maimon
` (3 preceding siblings ...)
2026-07-15 12:29 ` [PATCH v1 4/8] pinctrl: npcm8xx: clear pending GPIO events during init Tomer Maimon
@ 2026-07-15 12:29 ` Tomer Maimon
2026-07-15 12:29 ` [PATCH v1 6/8] pinctrl: npcm8xx: move GPIO IRQ setup into request_resources Tomer Maimon
` (2 subsequent siblings)
7 siblings, 0 replies; 9+ messages in thread
From: Tomer Maimon @ 2026-07-15 12:29 UTC (permalink / raw)
To: andrew, linusw, brgl
Cc: openbmc, linux-gpio, linux-kernel, avifishman70, tmaimon77,
tali.perry1, venture, yuenn, benjaminfair
The pin description for GPIO7 spells the IOX2 output signal as D0.
The datasheet names that signal IOX2_DO, matching the rest of the IOX
naming scheme.
Rename the pin description accordingly.
Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
---
drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
index 5dcb01923..1c95d7cbd 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
@@ -1567,7 +1567,7 @@ static const struct pinctrl_pin_desc npcm8xx_pins[] = {
PINCTRL_PIN(4, "GPIO4/IOX2_DI/SMB1D_SDA"),
PINCTRL_PIN(5, "GPIO5/IOX2_LD/SMB1D_SCL"),
PINCTRL_PIN(6, "GPIO6/IOX2_CK/SMB2D_SDA"),
- PINCTRL_PIN(7, "GPIO7/IOX2_D0/SMB2D_SCL"),
+ PINCTRL_PIN(7, "GPIO7/IOX2_DO/SMB2D_SCL"),
PINCTRL_PIN(8, "GPIO8/LKGPO1/TP_GPIO0"),
PINCTRL_PIN(9, "GPIO9/LKGPO2/TP_GPIO1"),
PINCTRL_PIN(10, "GPIO10/IOXH_LD/SMB6D_SCL/SMB16_SCL"),
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v1 6/8] pinctrl: npcm8xx: move GPIO IRQ setup into request_resources
2026-07-15 12:29 [PATCH v1 0/8] pinctrl: npcm8xx: fix pinmuxing and configuration handling Tomer Maimon
` (4 preceding siblings ...)
2026-07-15 12:29 ` [PATCH v1 5/8] pinctrl: npcm8xx: rename GPIO7 IOX2 signal to DO Tomer Maimon
@ 2026-07-15 12:29 ` 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 ` [PATCH v1 8/8] pinctrl: npcm8xx: fix debounce register selection Tomer Maimon
7 siblings, 0 replies; 9+ messages in thread
From: Tomer Maimon @ 2026-07-15 12:29 UTC (permalink / raw)
To: andrew, linusw, brgl
Cc: openbmc, linux-gpio, linux-kernel, avifishman70, tmaimon77,
tali.perry1, venture, yuenn, benjaminfair
npcmgpio_irq_startup() calls pinctrl_gpio_direction_input(), which may
sleep while taking the pinctrl core mutex. That makes IRQ startup trip
lockdep when CONFIG_PROVE_LOCKING is enabled.
Move the direction change into irq_request_resources() and keep startup
limited to the ack and unmask operations that are safe in atomic
context.
Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
---
drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c | 29 ++++++++++++++++++-----
1 file changed, 23 insertions(+), 6 deletions(-)
diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
index 1c95d7cbd..e21ccdb5d 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
@@ -297,17 +297,33 @@ static void npcmgpio_irq_unmask(struct irq_data *d)
static unsigned int npcmgpio_irq_startup(struct irq_data *d)
{
- struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
- unsigned int gpio = irqd_to_hwirq(d);
-
- /* active-high, input, clear interrupt, enable interrupt */
- npcmgpio_direction_input(gc, gpio);
npcmgpio_irq_ack(d);
npcmgpio_irq_unmask(d);
return 0;
}
+static int npcmgpio_irq_request_resources(struct irq_data *d)
+{
+ struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
+ unsigned int gpio = irqd_to_hwirq(d);
+ int ret;
+
+ ret = npcmgpio_direction_input(gc, gpio);
+ if (ret)
+ return ret;
+
+ return gpiochip_reqres_irq(gc, gpio);
+}
+
+static void npcmgpio_irq_release_resources(struct irq_data *d)
+{
+ struct gpio_chip *gc = irq_data_get_irq_chip_data(d);
+ unsigned int gpio = irqd_to_hwirq(d);
+
+ gpiochip_relres_irq(gc, gpio);
+}
+
static struct irq_chip npcmgpio_irqchip = {
.name = "NPCM8XX-GPIO-IRQ",
.irq_ack = npcmgpio_irq_ack,
@@ -315,8 +331,9 @@ static struct irq_chip npcmgpio_irqchip = {
.irq_mask = npcmgpio_irq_mask,
.irq_set_type = npcmgpio_set_irq_type,
.irq_startup = npcmgpio_irq_startup,
+ .irq_request_resources = npcmgpio_irq_request_resources,
+ .irq_release_resources = npcmgpio_irq_release_resources,
.flags = IRQCHIP_MASK_ON_SUSPEND | IRQCHIP_IMMUTABLE,
- GPIOCHIP_IRQ_RESOURCE_HELPERS,
};
static const int gpi36_pins[] = { 36 };
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v1 7/8] pinctrl: npcm8xx: correct JM1 and SMB7 pin flags
2026-07-15 12:29 [PATCH v1 0/8] pinctrl: npcm8xx: fix pinmuxing and configuration handling Tomer Maimon
` (5 preceding siblings ...)
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 ` Tomer Maimon
2026-07-15 12:29 ` [PATCH v1 8/8] pinctrl: npcm8xx: fix debounce register selection Tomer Maimon
7 siblings, 0 replies; 9+ messages in thread
From: Tomer Maimon @ 2026-07-15 12:29 UTC (permalink / raw)
To: andrew, linusw, brgl
Cc: openbmc, linux-gpio, linux-kernel, avifishman70, tmaimon77,
tali.perry1, venture, yuenn, benjaminfair
Pins 136-140 and 142 are currently advertised as having both drive-
strength and slew-rate controls, while pins 141 and 143 expose no slew
control at all.
According to the hardware description, those pins only support slew-rate
configuration. Update the pin flags accordingly so pinconf exposes the
capabilities that the hardware actually implements.
Signed-off-by: Tomer Maimon <tmaimon77@gmail.com>
---
drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
index e21ccdb5d..f94494b67 100644
--- a/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
+++ b/drivers/pinctrl/nuvoton/pinctrl-npcm8xx.c
@@ -1465,14 +1465,14 @@ static const struct npcm8xx_pincfg pincfg[] = {
NPCM8XX_PINCFG(133, smb10, MFSEL4, 13, none, NONE, 0, none, NONE, 0, none, NONE, 0, none, NONE, 0, 0),
NPCM8XX_PINCFG(134, smb11, MFSEL4, 14, smb23b, MFSEL6, 0, none, NONE, 0, none, NONE, 0, none, NONE, 0, 0),
NPCM8XX_PINCFG(135, smb11, MFSEL4, 14, smb23b, MFSEL6, 0, none, NONE, 0, none, NONE, 0, none, NONE, 0, 0),
- NPCM8XX_PINCFG(136, jm1, MFSEL5, 15, none, NONE, 0, none, NONE, 0, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW),
- NPCM8XX_PINCFG(137, jm1, MFSEL5, 15, none, NONE, 0, none, NONE, 0, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW),
- NPCM8XX_PINCFG(138, jm1, MFSEL5, 15, none, NONE, 0, none, NONE, 0, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW),
- NPCM8XX_PINCFG(139, jm1, MFSEL5, 15, none, NONE, 0, none, NONE, 0, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW),
- NPCM8XX_PINCFG(140, jm1, MFSEL5, 15, none, NONE, 0, none, NONE, 0, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW),
- NPCM8XX_PINCFG(141, smb7b, I2CSEGSEL, 27, none, NONE, 0, none, NONE, 0, none, NONE, 0, none, NONE, 0, 0),
- NPCM8XX_PINCFG(142, smb7d, I2CSEGSEL, 29, tp_smb1, MFSEL7, 11, none, NONE, 0, none, NONE, 0, none, NONE, 0, DSTR(8, 12) | SLEW),
- NPCM8XX_PINCFG(143, smb7d, I2CSEGSEL, 29, tp_smb1, MFSEL7, 11, none, NONE, 0, none, NONE, 0, none, NONE, 0, 0),
+ NPCM8XX_PINCFG(136, jm1, MFSEL5, 15, none, NONE, 0, none, NONE, 0, none, NONE, 0, none, NONE, 0, SLEW),
+ NPCM8XX_PINCFG(137, jm1, MFSEL5, 15, none, NONE, 0, none, NONE, 0, none, NONE, 0, none, NONE, 0, SLEW),
+ NPCM8XX_PINCFG(138, jm1, MFSEL5, 15, none, NONE, 0, none, NONE, 0, none, NONE, 0, none, NONE, 0, SLEW),
+ NPCM8XX_PINCFG(139, jm1, MFSEL5, 15, none, NONE, 0, none, NONE, 0, none, NONE, 0, none, NONE, 0, SLEW),
+ NPCM8XX_PINCFG(140, jm1, MFSEL5, 15, none, NONE, 0, none, NONE, 0, none, NONE, 0, none, NONE, 0, SLEW),
+ NPCM8XX_PINCFG(141, smb7b, I2CSEGSEL, 27, none, NONE, 0, none, NONE, 0, none, NONE, 0, none, NONE, 0, SLEW),
+ NPCM8XX_PINCFG(142, smb7d, I2CSEGSEL, 29, tp_smb1, MFSEL7, 11, none, NONE, 0, none, NONE, 0, none, NONE, 0, SLEW),
+ NPCM8XX_PINCFG(143, smb7d, I2CSEGSEL, 29, tp_smb1, MFSEL7, 11, none, NONE, 0, none, NONE, 0, none, NONE, 0, SLEW),
NPCM8XX_PINCFG(144, pwm4, MFSEL2, 20, none, NONE, 0, none, NONE, 0, none, NONE, 0, none, NONE, 0, DSTR(4, 8)),
NPCM8XX_PINCFG(145, pwm5, MFSEL2, 21, none, NONE, 0, none, NONE, 0, none, NONE, 0, none, NONE, 0, DSTR(4, 8)),
NPCM8XX_PINCFG(146, pwm6, MFSEL2, 22, none, NONE, 0, none, NONE, 0, none, NONE, 0, none, NONE, 0, DSTR(4, 8)),
--
2.34.1
^ permalink raw reply related [flat|nested] 9+ messages in thread* [PATCH v1 8/8] pinctrl: npcm8xx: fix debounce register selection
2026-07-15 12:29 [PATCH v1 0/8] pinctrl: npcm8xx: fix pinmuxing and configuration handling Tomer Maimon
` (6 preceding siblings ...)
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
7 siblings, 0 replies; 9+ messages in thread
From: Tomer Maimon @ 2026-07-15 12:29 UTC (permalink / raw)
To: andrew, linusw, brgl
Cc: openbmc, linux-gpio, linux-kernel, avifishman70, tmaimon77,
tali.perry1, venture, yuenn, benjaminfair
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
^ permalink raw reply related [flat|nested] 9+ messages in thread