firmware: xilinx: Add version check for TRISTATE configuration
authorSai Krishna Potthuri <sai.krishna.potthuri@amd.com>
Mon, 31 Jul 2023 09:50:24 +0000 (15:20 +0530)
committerLinus Walleij <linus.walleij@linaro.org>
Mon, 7 Aug 2023 08:48:03 +0000 (10:48 +0200)
Support for configuring TRISTATE parameter is added in ZYNQMP PMUFW(Xilinx
ZynqMP Platform Management Firmware) Configuration Param Set version 2.0.
If the requested configuration is TRISTATE and platform is ZYNQMP then
check the version before requesting Xilinx firmware to set the
configuration.

Signed-off-by: Sai Krishna Potthuri <sai.krishna.potthuri@amd.com>
Reviewed-by: Michal Simek <michal.simek@amd.com>
Link: https://lore.kernel.org/r/20230731095026.3766675-3-sai.krishna.potthuri@amd.com
Signed-off-by: Linus Walleij <linus.walleij@linaro.org>
drivers/firmware/xilinx/zynqmp.c
include/linux/firmware/xlnx-zynqmp.h

index 45c73cb864772fa52af18bde8b03eae7fbb3600e..4382884a5da51be9a97e1faf223f1d74885f7685 100644 (file)
@@ -1156,6 +1156,15 @@ EXPORT_SYMBOL_GPL(zynqmp_pm_pinctrl_get_config);
 int zynqmp_pm_pinctrl_set_config(const u32 pin, const u32 param,
                                 u32 value)
 {
+       int ret;
+
+       if (pm_family_code == ZYNQMP_FAMILY_CODE &&
+           param == PM_PINCTRL_CONFIG_TRI_STATE) {
+               ret = zynqmp_pm_feature(PM_PINCTRL_CONFIG_PARAM_SET);
+               if (ret < PM_PINCTRL_PARAM_SET_VERSION)
+                       return -EOPNOTSUPP;
+       }
+
        return zynqmp_pm_invoke_fn(PM_PINCTRL_CONFIG_PARAM_SET, pin,
                                   param, value, 0, NULL);
 }
index f0b341c1c8473a357203df709604c285beddf11c..e8b12ec8b060543e8f0f86efeeb757436f0452b6 100644 (file)
@@ -34,6 +34,8 @@
 /* PM API versions */
 #define PM_API_VERSION_2       2
 
+#define PM_PINCTRL_PARAM_SET_VERSION   2
+
 #define ZYNQMP_FAMILY_CODE 0x23
 #define VERSAL_FAMILY_CODE 0x26