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 2/8] pinctrl: npcm8xx: enable RMII outputs from RMII groups
Date: Wed, 15 Jul 2026 15:29:17 +0300 [thread overview]
Message-ID: <20260715122923.1938327-3-tmaimon77@gmail.com> (raw)
In-Reply-To: <20260715122923.1938327-1-tmaimon77@gmail.com>
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
next prev 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 ` Tomer Maimon [this message]
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 ` [PATCH v1 8/8] pinctrl: npcm8xx: fix debounce register selection Tomer Maimon
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-3-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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.