Skip to contentSkip to conversation

pinctrl: zynqmp: Display the tristate configuration for all pins

PATCH In review Venkatesh Yadav Abbarapu 2 participants 3 messages Sep 14, 2023 – Oct 2, 2023

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

PATCH 1/1 pinctrl: zynqmp: Display the tristate configuration for all pins

Read the tristate config for all the pins and display it.

ZynqMP> pinmux status MIO1
MIO1: slew:fast bias:enabled pull:up input:cmos drive:12mA

      volt:1.8	tri_state:enabled
---
 drivers/pinctrl/pinctrl-zynqmp.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
drivers/pinctrl/pinctrl-zynqmp.c +6 -2
index 02626a7561..d98834b1aa 100644
@@ -533,6 +533,8 @@ static int zynqmp_pinctrl_get_pin_muxing(struct udevice *dev,
 				     &pinmux.drive_strength);
 	zynqmp_pm_pinctrl_get_config(selector, PM_PINCTRL_CONFIG_VOLTAGE_STATUS,
 				     &pinmux.volt_sts);
+	zynqmp_pm_pinctrl_get_config(selector, PM_PINCTRL_CONFIG_TRI_STATE,
+				     &pinmux.tri_state);
 
 	switch (pinmux.drive_strength) {
 	case PM_PINCTRL_DRIVE_STRENGTH_2MA:
@@ -553,13 +555,15 @@ static int zynqmp_pinctrl_get_pin_muxing(struct udevice *dev,
 		return -EINVAL;
 	}
 
-	snprintf(buf, size, "slew:%s\tbias:%s\tpull:%s\tinput:%s\tdrive:%dmA\tvolt:%s",
+	snprintf(buf, size,
+		 "slew:%s\tbias:%s\tpull:%s\tinput:%s\tdrive:%dmA\tvolt:%s\ttri_state:%s",
 		 pinmux.slew ? "slow" : "fast",
 		 pinmux.bias ? "enabled" : "disabled",
 		 pinmux.pull_ctrl ? "up" : "down",
 		 pinmux.input_type ? "schmitt" : "cmos",
 		 pinmux.drive_strength,
-		 pinmux.volt_sts ? "1.8" : "3.3");
+		 pinmux.volt_sts ? "1.8" : "3.3",
+		 pinmux.tri_state ? "enabled" : "disabled");
 
 	return 0;
 }
Signature · 1 line
2.17.1
maintainer
#1 lore raw
Quoted 32 lines · Venkatesh Yadav Abbarapu

Read the tristate config for all the pins and display it.

ZynqMP> pinmux status MIO1
MIO1: slew:fast bias:enabled pull:up input:cmos drive:12mA

       volt:1.8	tri_state:enabled
---
  drivers/pinctrl/pinctrl-zynqmp.c | 8 ++++++--
  1 file changed, 6 insertions(+), 2 deletions(-)
drivers/pinctrl/pinctrl-zynqmp.c +4 -1
index 02626a7561..d98834b1aa 100644
@@ -533,6 +533,8 @@ static int zynqmp_pinctrl_get_pin_muxing(struct udevice *dev,
  				     &pinmux.drive_strength);
  	zynqmp_pm_pinctrl_get_config(selector, PM_PINCTRL_CONFIG_VOLTAGE_STATUS,
  				     &pinmux.volt_sts);
+	zynqmp_pm_pinctrl_get_config(selector, PM_PINCTRL_CONFIG_TRI_STATE,
+				     &pinmux.tri_state);
 
  	switch (pinmux.drive_strength) {
  	case PM_PINCTRL_DRIVE_STRENGTH_2MA:
@@ -553,13 +555,15 @@ static int zynqmp_pinctrl_get_pin_muxing(struct udevice *dev,
  		return -EINVAL;
  	}
 
-	snprintf(buf, size, "slew:%s\tbias:%s\tpull:%s\tinput:%s\tdrive:%dmA\tvolt:%s",
+	snprintf(buf, size,
+		 "slew:%s\tbias:%s\tpull:%s\tinput:%s\tdrive:%dmA\tvolt:%s\ttri_state:%s",
  		 pinmux.slew ? "slow" : "fast",

drivers/pinctrl/pinctrl-zynqmp.c static int zynqmp_pinctrl_get_pin_muxing(struct udevice *dev, · line 569

Quoted 10 lines
drivers/pinctrl/pinctrl-zynqmp.c +2 -1
  		 pinmux.bias ? "enabled" : "disabled",
  		 pinmux.pull_ctrl ? "up" : "down",
  		 pinmux.input_type ? "schmitt" : "cmos",
  		 pinmux.drive_strength,
-		 pinmux.volt_sts ? "1.8" : "3.3");
+		 pinmux.volt_sts ? "1.8" : "3.3",
+		 pinmux.tri_state ? "enabled" : "disabled");
 
  	return 0;
  }

When I run it on SOM I get some lines truncated.

MIO12 : slew:slow bias:enabled pull:up input:cmos drive:4mA volt:1.8 tri_state:disabled
MIO13 : slew:slow bias:disabled pull:up input:cmos drive:4mA volt:1.8 tri_state:disable
MIO14 : slew:slow bias:disabled pull:up input:cmos drive:4mA volt:1.8 tri_state:disable

it is because of buf limit is 80 chars (PINMUX_SIZE)

It means we have 2 options.
1. keep this patch as it is and send one more which extend PINMUX_SIZE limit
2. change enabled/disabled to something shorter

The longest line is slew:show\tbias:disabled\tpull:down\tinput:schmitt\tdriver:12mA\tvolt:1.8\ttri_state:disabled\0 which is based on my calculation 88 chars.

It means if you want to increase that macro 90 chars should be enough. Please let me know which way you want to go.

Thanks,
Michal

maintainer
#2 lore raw
In reply to Venkatesh Yadav Abbarapu
Quoted 32 lines · Venkatesh Yadav Abbarapu

Read the tristate config for all the pins and display it.

ZynqMP> pinmux status MIO1
MIO1: slew:fast bias:enabled pull:up input:cmos drive:12mA

       volt:1.8	tri_state:enabled
---
  drivers/pinctrl/pinctrl-zynqmp.c | 8 ++++++--
  1 file changed, 6 insertions(+), 2 deletions(-)
drivers/pinctrl/pinctrl-zynqmp.c +4 -1
index 02626a7561..d98834b1aa 100644
@@ -533,6 +533,8 @@ static int zynqmp_pinctrl_get_pin_muxing(struct udevice *dev,
  				     &pinmux.drive_strength);
  	zynqmp_pm_pinctrl_get_config(selector, PM_PINCTRL_CONFIG_VOLTAGE_STATUS,
  				     &pinmux.volt_sts);
+	zynqmp_pm_pinctrl_get_config(selector, PM_PINCTRL_CONFIG_TRI_STATE,
+				     &pinmux.tri_state);
 
  	switch (pinmux.drive_strength) {
  	case PM_PINCTRL_DRIVE_STRENGTH_2MA:
@@ -553,13 +555,15 @@ static int zynqmp_pinctrl_get_pin_muxing(struct udevice *dev,
  		return -EINVAL;
  	}
 
-	snprintf(buf, size, "slew:%s\tbias:%s\tpull:%s\tinput:%s\tdrive:%dmA\tvolt:%s",
+	snprintf(buf, size,
+		 "slew:%s\tbias:%s\tpull:%s\tinput:%s\tdrive:%dmA\tvolt:%s\ttri_state:%s",
  		 pinmux.slew ? "slow" : "fast",

drivers/pinctrl/pinctrl-zynqmp.c static int zynqmp_pinctrl_get_pin_muxing(struct udevice *dev, · line 569

Quoted 10 lines
drivers/pinctrl/pinctrl-zynqmp.c +2 -1
  		 pinmux.bias ? "enabled" : "disabled",
  		 pinmux.pull_ctrl ? "up" : "down",
  		 pinmux.input_type ? "schmitt" : "cmos",
  		 pinmux.drive_strength,
-		 pinmux.volt_sts ? "1.8" : "3.3");
+		 pinmux.volt_sts ? "1.8" : "3.3",
+		 pinmux.tri_state ? "enabled" : "disabled");
 
  	return 0;
  }

The patch fixes reported issue
https://lore.kernel.org/all/[email protected]/
that's why I applied also this patch.

Thanks,
Michal