]> rtime.felk.cvut.cz Git - zynq/linux.git/commitdiff
drivers: firmware: Add Pdi load API support
authorJolly Shah <jolly.shah@xilinx.com>
Fri, 22 Mar 2019 14:21:35 +0000 (07:21 -0700)
committerMichal Simek <michal.simek@xilinx.com>
Thu, 28 Mar 2019 14:32:19 +0000 (15:32 +0100)
This patch adds load pdi api support to enable pdi/partial loading from
linux. Programmable Device Image (PDI) is combination of headers, images
and bitstream files to be loaded. Partial PDI is partial set of image/
images to be loaded.

Signed-off-by: Jolly Shah <jolly.shah@xilinx.com>
Signed-off-by: Michal Simek <michal.simek@xilinx.com>
drivers/firmware/xilinx/zynqmp.c
include/linux/firmware/xlnx-zynqmp.h

index a24ba7e2d881ab9706d3bfd63ecc1413a55b25de..47cc9b5ce7c18611868827d7aa5a44c83d91ed8f 100644 (file)
@@ -679,6 +679,22 @@ static int zynqmp_pm_set_requirement(const u32 node, const u32 capabilities,
                                   qos, ack, NULL);
 }
 
+/**
+ * zynqmp_pm_load_pdi - Load and process pdi
+ * @src:       Source device where PDI is located
+ * @address:   Pdi src address
+ *
+ * This function provides support to load pdi from linux
+ *
+ * Return: Returns status, either success or error+reason
+ */
+static int zynqmp_pm_load_pdi(const u32 src, const u64 address)
+{
+       return zynqmp_pm_invoke_fn(PM_LOAD_PDI, src,
+                                  lower_32_bits(address),
+                                  upper_32_bits(address), 0, NULL);
+}
+
 /**
  * zynqmp_pm_fpga_load - Perform the fpga load
  * @address:   Address to write to
@@ -1219,6 +1235,7 @@ static const struct zynqmp_eemi_ops eemi_ops = {
        .aes = zynqmp_pm_aes_engine,
        .efuse_access = zynqmp_pm_efuse_access,
        .secure_image = zynqmp_pm_secure_load,
+       .pdi_load = zynqmp_pm_load_pdi,
 };
 
 /**
index 47e2bc2d6433d95d8e542fe8847316e289638342..48bdc7b61937bda281cacda4e485825338dc938c 100644 (file)
 
 /* SMC SIP service Call Function Identifier Prefix */
 #define PM_SIP_SVC                     0xC2000000
+
+/* ATF only commands */
 #define PM_GET_TRUSTZONE_VERSION       0xa03
 #define PM_SET_SUSPEND_MODE            0xa02
 #define GET_CALLBACK_DATA              0xa01
 
+/* Loader commands */
+#define PM_LOAD_PDI                    0x701
+
 /* Number of 32bits values in payload */
 #define PAYLOAD_ARG_CNT        4U
 
@@ -595,6 +600,7 @@ struct zynqmp_eemi_ops {
        int (*aes)(const u64 address, u32 *out);
        int (*efuse_access)(const u64 address, u32 *out);
        int (*secure_image)(const u64 src_addr, u64 key_addr, u64 *dst);
+       int (*pdi_load)(const u32 src, const u64 address);
 };
 
 int zynqmp_pm_invoke_fn(u32 pm_api_id, u32 arg0, u32 arg1,