[PATCH] pinctrl: zynqmp: Display the tristate configuration for all pins

Michal Simek michal.simek at amd.com
Fri Sep 15 13:51:45 CEST 2023



On 9/14/23 12:06, Venkatesh Yadav Abbarapu wrote:
> 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
> 
> Signed-off-by: Venkatesh Yadav Abbarapu <venkatesh.abbarapu at amd.com>
> ---
>   drivers/pinctrl/pinctrl-zynqmp.c | 8 ++++++--
>   1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/pinctrl/pinctrl-zynqmp.c b/drivers/pinctrl/pinctrl-zynqmp.c
> index 02626a7561..d98834b1aa 100644
> --- a/drivers/pinctrl/pinctrl-zynqmp.c
> +++ b/drivers/pinctrl/pinctrl-zynqmp.c
> @@ -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;
>   }

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



More information about the U-Boot mailing list