From: Jolly Shah Date: Fri, 22 Mar 2019 14:21:35 +0000 (-0700) Subject: drivers: firmware: Add Pdi load API support X-Git-Tag: xilinx-v2019.1~94 X-Git-Url: https://rtime.felk.cvut.cz/gitweb/zynq/linux.git/commitdiff_plain/f7b1bb60649ca46372776f59f3319da3a53ec6d5 drivers: firmware: Add Pdi load API support 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 Signed-off-by: Michal Simek --- diff --git a/drivers/firmware/xilinx/zynqmp.c b/drivers/firmware/xilinx/zynqmp.c index a24ba7e2d881..47cc9b5ce7c1 100644 --- a/drivers/firmware/xilinx/zynqmp.c +++ b/drivers/firmware/xilinx/zynqmp.c @@ -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, }; /** diff --git a/include/linux/firmware/xlnx-zynqmp.h b/include/linux/firmware/xlnx-zynqmp.h index 47e2bc2d6433..48bdc7b61937 100644 --- a/include/linux/firmware/xlnx-zynqmp.h +++ b/include/linux/firmware/xlnx-zynqmp.h @@ -29,10 +29,15 @@ /* 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,