Skip to contentSkip to conversation

arm64: a37xx: pinctrl: Fix definitions for MPP pins 20-22

PATCH In review Pali Rohár 2 participants 9 messages Aug 4, 2022 – Aug 9, 2022

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/3 arm64: a37xx: pinctrl: Fix definitions for MPP pins 20-22

All 3 MPP pins (20, 21 and 22) can be configured individually and also can be configured to GPIO functions. Fix definitions for these MPP pins in existing pin groups. After this change GPIO function can be enabled just for one of these 3 pins.

---
 drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +5 -3
index bb7a76baed1f..a5407a16ee36 100644
@@ -200,9 +200,11 @@ static struct armada_37xx_pin_group armada_37xx_sb_groups[] = {
 	PIN_GRP_GPIO("pcie1", 3, 1, BIT(5), "pcie"), /* this actually controls "pcie1_reset" */
 	PIN_GRP_GPIO("pcie1_clkreq", 4, 1, BIT(9), "pcie"),
 	PIN_GRP_GPIO("pcie1_wakeup", 5, 1, BIT(10), "pcie"),
-	PIN_GRP_GPIO("ptp", 20, 3, BIT(11) | BIT(12) | BIT(13), "ptp"),
-	PIN_GRP("ptp_clk", 21, 1, BIT(6), "ptp", "mii"),
-	PIN_GRP("ptp_trig", 22, 1, BIT(7), "ptp", "mii"),
+	PIN_GRP_GPIO("ptp", 20, 1, BIT(11), "ptp"),
+	PIN_GRP_GPIO_3("ptp_clk", 21, 1, BIT(6) | BIT(12), 0, BIT(6), BIT(12),
+		       "ptp", "mii"),
+	PIN_GRP_GPIO_3("ptp_trig", 22, 1, BIT(7) | BIT(13), 0, BIT(7), BIT(13),
+		       "ptp", "mii"),
 	PIN_GRP_GPIO_3("mii_col", 23, 1, BIT(8) | BIT(14), 0, BIT(8), BIT(14),
 		       "mii", "mii_err"),
 };
Signature · 1 line
2.20.1
#4 lore raw

PATCH 3/3 arm64: a37xx: pinctrl: Improve description for pinmux command

In more cases group name consist of function name followed by function number. So if function name is just prefix of group name, show group name.

So in 'pinmux status -a' command output would be visible also extended function number, which is useful for debugging.

---
 drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +11 -1
index 32b49f167c66..25fbe39abd19 100644
@@ -406,7 +406,17 @@ static int armada_37xx_pmx_get_pin_muxing(struct udevice *dev, unsigned int sele
 
 			for (f = 0; f < NB_FUNCS && grp->funcs[f]; f++) {
 				if (grp->val[f] == val) {
-					strlcpy(buf, grp->funcs[f], size);
+					/*
+					 * In more cases group name consist of
+					 * function name followed by function
+					 * number. So if function name is just
+					 * prefix of group name, show group name.
+					 */
+					if (strncmp(grp->name, grp->funcs[f],
+						    strlen(grp->funcs[f])) == 0)
+						strlcpy(buf, grp->name, size);
+					else
+						strlcpy(buf, grp->funcs[f], size);
 					return 0;
 				}
 			}
Signature · 1 line
2.20.1
#1 lore raw

PATCH 2/3 arm64: a37xx: pinctrl: Remove unused macro PIN_GRP()

In reply to Pali Rohár

Macro PIN_GRP() is not used, remove it.

---
 drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 10 ----------
 1 file changed, 10 deletions(-)
drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +0 -10
index a5407a16ee36..32b49f167c66 100644
@@ -99,16 +99,6 @@ struct armada_37xx_pinctrl {
 	unsigned int			nfuncs;
 };
 
-#define PIN_GRP(_name, _start, _nr, _mask, _func1, _func2)	\
-	{					\
-		.name = _name,			\
-		.start_pin = _start,		\
-		.npins = _nr,			\
-		.reg_mask = _mask,		\
-		.val = {0, _mask},		\
-		.funcs = {_func1, _func2}	\
-	}
-
 #define PIN_GRP_GPIO_0(_name, _start, _nr)	\
 	{					\
 		.name = _name,			\
Signature · 1 line
2.20.1
Reviewed-by on v1 1/3
#7 lore raw
In reply to Pali Rohár
Quoted 6 lines · Pali Rohár

All 3 MPP pins (20, 21 and 22) can be configured individually and also can be configured to GPIO functions. Fix definitions for these MPP pins in existing pin groups. After this change GPIO function can be enabled just for one of these 3 pins.

Thanks,
Stefan

Quoted 13 lines
---
  drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)
drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +0 -1
index bb7a76baed1f..a5407a16ee36 100644
@@ -200,9 +200,11 @@ static struct armada_37xx_pin_group armada_37xx_sb_groups[] = {
  	PIN_GRP_GPIO("pcie1", 3, 1, BIT(5), "pcie"), /* this actually controls "pcie1_reset" */
  	PIN_GRP_GPIO("pcie1_clkreq", 4, 1, BIT(9), "pcie"),
  	PIN_GRP_GPIO("pcie1_wakeup", 5, 1, BIT(10), "pcie"),
-	PIN_GRP_GPIO("ptp", 20, 3, BIT(11) | BIT(12) | BIT(13), "ptp"),

drivers/pinctrl/mvebu/pinctrl-armada-37xx.c static struct armada_37xx_pin_group armada_37xx_sb_groups[] = { · line 210

Quoted 10 lines
drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +5 -2
-	PIN_GRP("ptp_clk", 21, 1, BIT(6), "ptp", "mii"),
-	PIN_GRP("ptp_trig", 22, 1, BIT(7), "ptp", "mii"),
+	PIN_GRP_GPIO("ptp", 20, 1, BIT(11), "ptp"),
+	PIN_GRP_GPIO_3("ptp_clk", 21, 1, BIT(6) | BIT(12), 0, BIT(6), BIT(12),
+		       "ptp", "mii"),
+	PIN_GRP_GPIO_3("ptp_trig", 22, 1, BIT(7) | BIT(13), 0, BIT(7), BIT(13),
+		       "ptp", "mii"),
  	PIN_GRP_GPIO_3("mii_col", 23, 1, BIT(8) | BIT(14), 0, BIT(8), BIT(14),
  		       "mii", "mii_err"),
  };

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
Reviewed-by on v1 2/3
#2 lore raw

Re: [PATCH u-boot-marvell 2/3] arm64: a37xx: pinctrl: Remove unused macro PIN_GRP()

In reply to Pali Rohár
Quoted 3 lines · Pali Rohár

Macro PIN_GRP() is not used, remove it.

Thanks,
Stefan

Quoted 15 lines
---
  drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 10 ----------
  1 file changed, 10 deletions(-)
drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +0 -3
index a5407a16ee36..32b49f167c66 100644
@@ -99,16 +99,6 @@ struct armada_37xx_pinctrl {
  	unsigned int			nfuncs;
  };
 
-#define PIN_GRP(_name, _start, _nr, _mask, _func1, _func2)	\
-	{					\
-		.name = _name,			\

drivers/pinctrl/mvebu/pinctrl-armada-37xx.c struct armada_37xx_pinctrl { · line 104

Quoted 10 lines
drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +0 -7
-		.start_pin = _start,		\
-		.npins = _nr,			\
-		.reg_mask = _mask,		\
-		.val = {0, _mask},		\
-		.funcs = {_func1, _func2}	\
-	}
-
  #define PIN_GRP_GPIO_0(_name, _start, _nr)	\
  	{					\
  		.name = _name,			\

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
Reviewed-by on v1 3/3
#5 lore raw

Re: [PATCH u-boot-marvell 3/3] arm64: a37xx: pinctrl: Improve description for pinmux command

In reply to Pali Rohár
Quoted 7 lines · Pali Rohár

In more cases group name consist of function name followed by function number. So if function name is just prefix of group name, show group name.

So in 'pinmux status -a' command output would be visible also extended function number, which is useful for debugging.

Thanks,
Stefan

Quoted 17 lines
---
  drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 12 +++++++++++-
  1 file changed, 11 insertions(+), 1 deletion(-)
drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +4 -1
index 32b49f167c66..25fbe39abd19 100644
@@ -406,7 +406,17 @@ static int armada_37xx_pmx_get_pin_muxing(struct udevice *dev, unsigned int sele
 
  			for (f = 0; f < NB_FUNCS && grp->funcs[f]; f++) {
  				if (grp->val[f] == val) {
-					strlcpy(buf, grp->funcs[f], size);
+					/*
+					 * In more cases group name consist of
+					 * function name followed by function
+					 * number. So if function name is just

drivers/pinctrl/mvebu/pinctrl-armada-37xx.c static int armada_37xx_pmx_get_pin_muxing(struct udevice *dev, unsigned int sele · line 422

Quoted 10 lines
drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +7 -0
+					 * prefix of group name, show group name.
+					 */
+					if (strncmp(grp->name, grp->funcs[f],
+						    strlen(grp->funcs[f])) == 0)
+						strlcpy(buf, grp->name, size);
+					else
+						strlcpy(buf, grp->funcs[f], size);
  					return 0;
  				}
  			}

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#8 lore raw
In reply to Pali Rohár
Quoted 6 lines · Pali Rohár

All 3 MPP pins (20, 21 and 22) can be configured individually and also can be configured to GPIO functions. Fix definitions for these MPP pins in existing pin groups. After this change GPIO function can be enabled just for one of these 3 pins.

Applied to u-boot-marvell/master

Thanks,
Stefan

Quoted 13 lines
---
  drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 8 +++++---
  1 file changed, 5 insertions(+), 3 deletions(-)
drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +0 -1
index bb7a76baed1f..a5407a16ee36 100644
@@ -200,9 +200,11 @@ static struct armada_37xx_pin_group armada_37xx_sb_groups[] = {
  	PIN_GRP_GPIO("pcie1", 3, 1, BIT(5), "pcie"), /* this actually controls "pcie1_reset" */
  	PIN_GRP_GPIO("pcie1_clkreq", 4, 1, BIT(9), "pcie"),
  	PIN_GRP_GPIO("pcie1_wakeup", 5, 1, BIT(10), "pcie"),
-	PIN_GRP_GPIO("ptp", 20, 3, BIT(11) | BIT(12) | BIT(13), "ptp"),

drivers/pinctrl/mvebu/pinctrl-armada-37xx.c static struct armada_37xx_pin_group armada_37xx_sb_groups[] = { · line 210

Quoted 10 lines
drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +5 -2
-	PIN_GRP("ptp_clk", 21, 1, BIT(6), "ptp", "mii"),
-	PIN_GRP("ptp_trig", 22, 1, BIT(7), "ptp", "mii"),
+	PIN_GRP_GPIO("ptp", 20, 1, BIT(11), "ptp"),
+	PIN_GRP_GPIO_3("ptp_clk", 21, 1, BIT(6) | BIT(12), 0, BIT(6), BIT(12),
+		       "ptp", "mii"),
+	PIN_GRP_GPIO_3("ptp_trig", 22, 1, BIT(7) | BIT(13), 0, BIT(7), BIT(13),
+		       "ptp", "mii"),
  	PIN_GRP_GPIO_3("mii_col", 23, 1, BIT(8) | BIT(14), 0, BIT(8), BIT(14),
  		       "mii", "mii_err"),
  };

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#3 lore raw

Re: [PATCH u-boot-marvell 2/3] arm64: a37xx: pinctrl: Remove unused macro PIN_GRP()

In reply to Pali Rohár
Quoted 3 lines · Pali Rohár

Macro PIN_GRP() is not used, remove it.

Applied to u-boot-marvell/master

Thanks,
Stefan

Quoted 15 lines
---
  drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 10 ----------
  1 file changed, 10 deletions(-)
drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +0 -3
index a5407a16ee36..32b49f167c66 100644
@@ -99,16 +99,6 @@ struct armada_37xx_pinctrl {
  	unsigned int			nfuncs;
  };
 
-#define PIN_GRP(_name, _start, _nr, _mask, _func1, _func2)	\
-	{					\
-		.name = _name,			\

drivers/pinctrl/mvebu/pinctrl-armada-37xx.c struct armada_37xx_pinctrl { · line 104

Quoted 10 lines
drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +0 -7
-		.start_pin = _start,		\
-		.npins = _nr,			\
-		.reg_mask = _mask,		\
-		.val = {0, _mask},		\
-		.funcs = {_func1, _func2}	\
-	}
-
  #define PIN_GRP_GPIO_0(_name, _start, _nr)	\
  	{					\
  		.name = _name,			\

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]
#6 lore raw

Re: [PATCH u-boot-marvell 3/3] arm64: a37xx: pinctrl: Improve description for pinmux command

In reply to Pali Rohár
Quoted 7 lines · Pali Rohár

In more cases group name consist of function name followed by function number. So if function name is just prefix of group name, show group name.

So in 'pinmux status -a' command output would be visible also extended function number, which is useful for debugging.

Applied to u-boot-marvell/master

Thanks,
Stefan

Quoted 17 lines
---
  drivers/pinctrl/mvebu/pinctrl-armada-37xx.c | 12 +++++++++++-
  1 file changed, 11 insertions(+), 1 deletion(-)
drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +4 -1
index 32b49f167c66..25fbe39abd19 100644
@@ -406,7 +406,17 @@ static int armada_37xx_pmx_get_pin_muxing(struct udevice *dev, unsigned int sele
 
  			for (f = 0; f < NB_FUNCS && grp->funcs[f]; f++) {
  				if (grp->val[f] == val) {
-					strlcpy(buf, grp->funcs[f], size);
+					/*
+					 * In more cases group name consist of
+					 * function name followed by function
+					 * number. So if function name is just

drivers/pinctrl/mvebu/pinctrl-armada-37xx.c static int armada_37xx_pmx_get_pin_muxing(struct udevice *dev, unsigned int sele · line 422

Quoted 10 lines
drivers/pinctrl/mvebu/pinctrl-armada-37xx.c +7 -0
+					 * prefix of group name, show group name.
+					 */
+					if (strncmp(grp->name, grp->funcs[f],
+						    strlen(grp->funcs[f])) == 0)
+						strlcpy(buf, grp->name, size);
+					else
+						strlcpy(buf, grp->funcs[f], size);
  					return 0;
  				}
  			}

Viele Grüße,
Stefan Roese

Signature · 3 lines
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: [email protected]