firmware: xilinx: Update the zynqmp_pm_fpga_load() API
authorNava kishore Manne <nava.kishore.manne@amd.com>
Wed, 3 May 2023 05:01:58 +0000 (10:31 +0530)
committerMichal Simek <michal.simek@amd.com>
Fri, 12 May 2023 11:11:09 +0000 (13:11 +0200)
Update the zynqmp_pm_fpga_load() API to handle the firmware error’s
properly.

Signed-off-by: Nava kishore Manne <nava.kishore.manne@amd.com>
Link: https://lore.kernel.org/r/20230503050158.1936467-1-nava.kishore.manne@amd.com
Signed-off-by: Michal Simek <michal.simek@amd.com>
drivers/firmware/xilinx/zynqmp.c

index a736db4a582574c315585996c2d54cc8fcf80cbb..9e585b5646dfe6eb0b6c1111cd7613d8a3ca742c 100644 (file)
@@ -942,8 +942,16 @@ EXPORT_SYMBOL_GPL(zynqmp_pm_reset_get_status);
  */
 int zynqmp_pm_fpga_load(const u64 address, const u32 size, const u32 flags)
 {
-       return zynqmp_pm_invoke_fn(PM_FPGA_LOAD, lower_32_bits(address),
-                                  upper_32_bits(address), size, flags, NULL);
+       u32 ret_payload[PAYLOAD_ARG_CNT];
+       int ret;
+
+       ret = zynqmp_pm_invoke_fn(PM_FPGA_LOAD, lower_32_bits(address),
+                                 upper_32_bits(address), size, flags,
+                                 ret_payload);
+       if (ret_payload[0])
+               return -ret_payload[0];
+
+       return ret;
 }
 EXPORT_SYMBOL_GPL(zynqmp_pm_fpga_load);