[v3,4/4] pinctrl: pinctrl-zynqmp: Add support for output-enable and bias-high impedance

Message ID 20230731095026.3766675-5-sai.krishna.potthuri@amd.com
State New
Headers
Series pinctrl: pinctrl-zynqmp: Add tri-state configuration support |

Commit Message

Sai Krishna Potthuri July 31, 2023, 9:50 a.m. UTC
  Add support to handle 'output-enable' and 'bias-high-impedance'
configurations.

Using these pinctrl properties observed hang issues with older PMUFW(Xilinx
ZynqMP Platform Management Firmware), hence reverted the patch.
Commit 9989bc33c4894e075167 ("Revert "pinctrl: pinctrl-zynqmp: Add support
for output-enable and bias-high-impedance"").

Support for configuring these properties added in PMUFW Configuration Set
version 2.0. When there is a request for these configurations from pinctrl
driver for ZynqMP platform, xilinx firmware driver checks for this version
before configuring these properties to avoid the hang issue and proceeds
further only when firmware version is >=2 otherwise it returns error.

Signed-off-by: Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>
---
 drivers/pinctrl/pinctrl-zynqmp.c | 9 +++++++++
 1 file changed, 9 insertions(+)
  

Comments

Michal Simek July 31, 2023, 10:06 a.m. UTC | #1
On 7/31/23 11:50, Sai Krishna Potthuri wrote:
> Add support to handle 'output-enable' and 'bias-high-impedance'
> configurations.
> 
> Using these pinctrl properties observed hang issues with older PMUFW(Xilinx
> ZynqMP Platform Management Firmware), hence reverted the patch.
> Commit 9989bc33c4894e075167 ("Revert "pinctrl: pinctrl-zynqmp: Add support
> for output-enable and bias-high-impedance"").
> 
> Support for configuring these properties added in PMUFW Configuration Set
> version 2.0. When there is a request for these configurations from pinctrl
> driver for ZynqMP platform, xilinx firmware driver checks for this version
> before configuring these properties to avoid the hang issue and proceeds
> further only when firmware version is >=2 otherwise it returns error.
> 
> Signed-off-by: Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>
> ---
>   drivers/pinctrl/pinctrl-zynqmp.c | 9 +++++++++
>   1 file changed, 9 insertions(+)
> 
> diff --git a/drivers/pinctrl/pinctrl-zynqmp.c b/drivers/pinctrl/pinctrl-zynqmp.c
> index 8d2cb0999f2f..f2be341f73e1 100644
> --- a/drivers/pinctrl/pinctrl-zynqmp.c
> +++ b/drivers/pinctrl/pinctrl-zynqmp.c
> @@ -415,6 +415,10 @@ static int zynqmp_pinconf_cfg_set(struct pinctrl_dev *pctldev,
>   
>   			break;
>   		case PIN_CONFIG_BIAS_HIGH_IMPEDANCE:
> +			param = PM_PINCTRL_CONFIG_TRI_STATE;
> +			arg = PM_PINCTRL_TRI_STATE_ENABLE;
> +			ret = zynqmp_pm_pinctrl_set_config(pin, param, arg);
> +			break;
>   		case PIN_CONFIG_MODE_LOW_POWER:
>   			/*
>   			 * These cases are mentioned in dts but configurable
> @@ -423,6 +427,11 @@ static int zynqmp_pinconf_cfg_set(struct pinctrl_dev *pctldev,
>   			 */
>   			ret = 0;
>   			break;
> +		case PIN_CONFIG_OUTPUT_ENABLE:
> +			param = PM_PINCTRL_CONFIG_TRI_STATE;
> +			arg = PM_PINCTRL_TRI_STATE_DISABLE;
> +			ret = zynqmp_pm_pinctrl_set_config(pin, param, arg);
> +			break;
>   		default:
>   			dev_warn(pctldev->dev,
>   				 "unsupported configuration parameter '%u'\n",

Reviewed-by: Michal Simek <michal.simek@amd.com>

Thanks,
Michal
  

Patch

diff --git a/drivers/pinctrl/pinctrl-zynqmp.c b/drivers/pinctrl/pinctrl-zynqmp.c
index 8d2cb0999f2f..f2be341f73e1 100644
--- a/drivers/pinctrl/pinctrl-zynqmp.c
+++ b/drivers/pinctrl/pinctrl-zynqmp.c
@@ -415,6 +415,10 @@  static int zynqmp_pinconf_cfg_set(struct pinctrl_dev *pctldev,
 
 			break;
 		case PIN_CONFIG_BIAS_HIGH_IMPEDANCE:
+			param = PM_PINCTRL_CONFIG_TRI_STATE;
+			arg = PM_PINCTRL_TRI_STATE_ENABLE;
+			ret = zynqmp_pm_pinctrl_set_config(pin, param, arg);
+			break;
 		case PIN_CONFIG_MODE_LOW_POWER:
 			/*
 			 * These cases are mentioned in dts but configurable
@@ -423,6 +427,11 @@  static int zynqmp_pinconf_cfg_set(struct pinctrl_dev *pctldev,
 			 */
 			ret = 0;
 			break;
+		case PIN_CONFIG_OUTPUT_ENABLE:
+			param = PM_PINCTRL_CONFIG_TRI_STATE;
+			arg = PM_PINCTRL_TRI_STATE_DISABLE;
+			ret = zynqmp_pm_pinctrl_set_config(pin, param, arg);
+			break;
 		default:
 			dev_warn(pctldev->dev,
 				 "unsupported configuration parameter '%u'\n",