summaryrefslogtreecommitdiff
path: root/drivers
diff options
context:
space:
mode:
authorAshok Reddy Soma <ashok.reddy.soma@xilinx.com>2022-02-23 17:36:03 +0300
committerMichal Simek <michal.simek@xilinx.com>2022-03-09 14:34:47 +0300
commit7d9ee4667240070407bf2612c36d82bfab8840ba (patch)
tree44884334f1840417d56e35f36e7566e5ff94e794 /drivers
parentde5358a82cc3bbfe9a93b9d1e4c7405b19a42a3c (diff)
downloadu-boot-7d9ee4667240070407bf2612c36d82bfab8840ba.tar.xz
firmware: zynqmp: Add support for set sd config and is function supported
Add firmware API's to set SD configuration and to check if a purticular function is supported. Signed-off-by: Ashok Reddy Soma <ashok.reddy.soma@xilinx.com> Signed-off-by: Michal Simek <michal.simek@xilinx.com> Link: https://lore.kernel.org/r/f64fa2f73e4775e9ad2f4d91339d6c74b43116a3.1645626962.git.michal.simek@xilinx.com
Diffstat (limited to 'drivers')
-rw-r--r--drivers/firmware/firmware-zynqmp.c51
1 files changed, 51 insertions, 0 deletions
diff --git a/drivers/firmware/firmware-zynqmp.c b/drivers/firmware/firmware-zynqmp.c
index 8d8492d99f..8916c55896 100644
--- a/drivers/firmware/firmware-zynqmp.c
+++ b/drivers/firmware/firmware-zynqmp.c
@@ -140,6 +140,57 @@ unsigned int zynqmp_firmware_version(void)
return pm_api_version;
};
+int zynqmp_pm_set_sd_config(u32 node, enum pm_sd_config_type config, u32 value)
+{
+ int ret;
+
+ ret = xilinx_pm_request(PM_IOCTL, node, IOCTL_SET_SD_CONFIG,
+ config, value, NULL);
+ if (ret)
+ printf("%s: node %d: set_sd_config %d failed\n",
+ __func__, node, config);
+
+ return ret;
+}
+
+int zynqmp_pm_is_function_supported(const u32 api_id, const u32 id)
+{
+ int ret;
+ u32 *bit_mask;
+ u32 ret_payload[PAYLOAD_ARG_CNT];
+
+ /* Input arguments validation */
+ if (id >= 64 || (api_id != PM_IOCTL && api_id != PM_QUERY_DATA))
+ return -EINVAL;
+
+ /* Check feature check API version */
+ ret = xilinx_pm_request(PM_FEATURE_CHECK, PM_FEATURE_CHECK, 0, 0, 0,
+ ret_payload);
+ if (ret)
+ return ret;
+
+ /* Check if feature check version 2 is supported or not */
+ if ((ret_payload[1] & FIRMWARE_VERSION_MASK) == PM_API_VERSION_2) {
+ /*
+ * Call feature check for IOCTL/QUERY API to get IOCTL ID or
+ * QUERY ID feature status.
+ */
+
+ ret = xilinx_pm_request(PM_FEATURE_CHECK, api_id, 0, 0, 0,
+ ret_payload);
+ if (ret)
+ return ret;
+
+ bit_mask = &ret_payload[2];
+ if ((bit_mask[(id / 32)] & BIT((id % 32))) == 0)
+ return -EOPNOTSUPP;
+ } else {
+ return -ENODATA;
+ }
+
+ return 0;
+}
+
/**
* Send a configuration object to the PMU firmware.
*