]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
zynqmp: firmware: provides support to access efuse
authorDurga Challa <vnsl.durga.challa@xilinx.com>
Thu, 11 Oct 2018 10:52:52 +0000 (16:22 +0530)
committerMichal Simek <michal.simek@xilinx.com>
Wed, 7 Nov 2018 10:05:56 +0000 (11:05 +0100)
This patch adds support for accessing efuse memory
from Linux.

Signed-off-by: Durga Challa <vnsl.durga.challa@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/firmware/xilinx/zynqmp/firmware.c
include/linux/firmware/xilinx/zynqmp/firmware.h

index 6b8f53ddf7f5f2c4d88eeab76deb4e435c5f5c7b..b049d2c55ecb40d33a7c11b04c50880ed7ad3de4 100644 (file)
@@ -1018,6 +1018,28 @@ static int zynqmp_pm_clock_getparent(u32 clock_id, u32 *parent_id)
        return ret;
 }
 
+/**
+ * zynqmp_pm_efuse_access - Provides access to efuse memory.
+ * @address:   Address of the efuse params structure
+ * @out:               Returned output value
+ *
+ * Return:     Returns status, either success or error code.
+ */
+static int zynqmp_pm_efuse_access(const u64 address, u32 *out)
+{
+       u32 ret_payload[PAYLOAD_ARG_CNT];
+       int ret;
+
+       if (!out)
+               return -EINVAL;
+
+       ret = zynqmp_pm_invoke_fn(PM_EFUSE_ACCESS, upper_32_bits(address),
+                                 lower_32_bits(address), 0, 0, ret_payload);
+       *out = ret_payload[1];
+
+       return ret;
+}
+
 static const struct zynqmp_eemi_ops eemi_ops = {
        .get_api_version = zynqmp_pm_get_api_version,
        .get_chipid = zynqmp_pm_get_chipid,
@@ -1061,6 +1083,7 @@ static const struct zynqmp_eemi_ops eemi_ops = {
        .clock_getparent = zynqmp_pm_clock_getparent,
        .register_access = zynqmp_pm_config_reg_access,
        .aes = zynqmp_pm_aes_engine,
+       .efuse_access = zynqmp_pm_efuse_access,
 };
 
 /**
index c9ccdbf74bb2b14acfb707201bd390d3b92cfa3b..ba048ad7b5a53140729f0fb5a13ebc99808778cf 100644 (file)
@@ -130,6 +130,7 @@ enum pm_api_id {
        PM_SECURE_AES,
        /* PM_REGISTER_ACCESS API */
        PM_REGISTER_ACCESS = 52,
+       PM_EFUSE_ACCESS,
 };
 
 /* PMU-FW return status codes */
@@ -605,6 +606,7 @@ struct zynqmp_eemi_ops {
        int (*register_access)(u32 register_access_id, u32 address,
                               u32 mask, u32 value, u32 *out);
        int (*aes)(const u64 address, u32 *out);
+       int (*efuse_access)(const u64 address, u32 *out);
 };
 
 /*