Skip to contentSkip to conversation

pinctrl: nuvoton: ma35d1: fix MFP register offset and pin table

PATCH In review Joey Lu 2 participants 3 messages May 11 – May 27

Subsystems (3)
lore
Share & tools
lore

Joey Lu

author
#0 lore raw

cover pinctrl: nuvoton: ma35d1: fix MFP register offset and pin table

Fix two bugs in the MA35D1 pin controller driver: an incorrect MFP register address for pins 8-15 per bank, and several issues in the pin descriptor table (wrong numbering scheme, missing pins, duplicate entries).

Signature · 1 line
2.49.0
author
#1 lore raw

PATCH 1/1 pinctrl: nuvoton: ma35d1: fix MFP register offset and pin table

Each GPIO bank has two 32-bit MFP registers: MFPL covering pins 0-7 at the bank base offset, and MFPH covering pins 8-15 at base offset+4. ma35_pinctrl_parse_groups() computed the register address without accounting for this split, so any pin with an index >= 8 within its bank was written to the wrong register.

Also fix the pin descriptor table in pinctrl-ma35d1.c: switch from sequential to 16-per-bank pin numbering, add missing PC8-PC11 pins and their mux options, and remove the duplicate PN10-PN15 entries.

Fixes f805e356313b ("pinctrl: nuvoton: Add ma35d1 pinctrl and GPIO driver")
---
 drivers/pinctrl/nuvoton/pinctrl-ma35.c   |   3 +-
 drivers/pinctrl/nuvoton/pinctrl-ma35d1.c | 470 +++++++++++++++++--------------
 2 files changed, 263 insertions(+), 210 deletions(-)
drivers/pinctrl/nuvoton/pinctrl-ma35.c +2 -1
index f01344201628..dafa85c105a1 100644
@@ -1014,7 +1014,8 @@ static int ma35_pinctrl_parse_groups(struct fwnode_handle *fwnode, struct group_
 	grp->data = pin;
 
 	for (i = 0, j = 0; i < count; i += 3, j++) {
-		pin->offset = elems[i] * MA35_MFP_REG_SZ_PER_BANK + MA35_MFP_REG_BASE;
+		pin->offset = elems[i] * MA35_MFP_REG_SZ_PER_BANK + MA35_MFP_REG_BASE +
+			      (elems[i + 1] >= 8 ? 4 : 0);
 		pin->shift = (elems[i + 1] * MA35_MFP_BITS_PER_PORT) % 32;
 		pin->muxval = elems[i + 2];
 		pin->configs = configs;
drivers/pinctrl/nuvoton/pinctrl-ma35d1.c +261 -209

1,510 lines not on this page · raw message

---
2.49.0

maintainer
#2 lore raw
Quoted 6 lines · Joey Lu

Each GPIO bank has two 32-bit MFP registers: MFPL covering pins 0-7 at the bank base offset, and MFPH covering pins 8-15 at base offset+4. ma35_pinctrl_parse_groups() computed the register address without accounting for this split, so any pin with an index >= 8 within its bank was written to the wrong register.

Quoted 6 lines

Also fix the pin descriptor table in pinctrl-ma35d1.c: switch from sequential to 16-per-bank pin numbering, add missing PC8-PC11 pins and their mux options, and remove the duplicate PN10-PN15 entries.

Fixes f805e356313b ("pinctrl: nuvoton: Add ma35d1 pinctrl and GPIO driver")

No reaction from reviewers so patch applied!

Yours,
Linus Walleij