Skip to contentSkip to conversation

ARM: socfpga: stratix10: Return valid error code from FPGA driver

PATCH New chee.hong.ang at intel.com 2 participants 2 messages Feb 18, 2019 FPGA manager framework

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 ARM: socfpga: stratix10: Return valid error code from FPGA driver

From: "Ang, Chee Hong" <[email protected]>

This patch prevent the Stratix 10 FPGA driver incorrectly return the transaction ID as the mailbox error code. It should always return the actual mailbox error code from SDM firmware.

---
 drivers/fpga/stratix10.c | 17 ++++++-----------
 1 file changed, 6 insertions(+), 11 deletions(-)
drivers/fpga/stratix10.c +6 -11
index aae0521..d8e3250 100644
@@ -172,7 +172,7 @@ static int send_reconfig_data(const void *rbf_data, size_t rbf_size,
 	u32 resp_windex = 0;
 	u32 resp_count = 0;
 	u32 xfer_count = 0;
-	u8 resp_err = 0;
+	int resp_err = 0;
 	u8 cmd_id = 1;
 	u32 args[3];
 	int ret;
@@ -195,11 +195,9 @@ static int send_reconfig_data(const void *rbf_data, size_t rbf_size,
 				rbf_size = 0;
 			}
 
-			ret = mbox_send_cmd_only(cmd_id, MBOX_RECONFIG_DATA,
+			resp_err = mbox_send_cmd_only(cmd_id, MBOX_RECONFIG_DATA,
 						 MBOX_CMD_INDIRECT, 3, args);
-			if (ret) {
-				resp_err = 1;
-			} else {
+			if (!resp_err) {
 				xfer_count++;
 				cmd_id = add_transfer(xfer_pending,
 						      MBOX_RESP_BUFFER_SIZE,
@@ -222,11 +220,8 @@ static int send_reconfig_data(const void *rbf_data, size_t rbf_size,
 
 			/* Check for response's status */
 			if (!resp_err) {
-				ret = MBOX_RESP_ERR_GET(resp_hdr);
-				debug("Response error code: %08x\n", ret);
-				/* Error in response */
-				if (ret)
-					resp_err = 1;
+				resp_err = MBOX_RESP_ERR_GET(resp_hdr);
+				debug("Response error code: %08x\n", resp_err);
 			}
 
 			ret = get_and_clr_transfer(xfer_pending,
@@ -239,7 +234,7 @@ static int send_reconfig_data(const void *rbf_data, size_t rbf_size,
 			}
 
 			if (resp_err && !xfer_count)
-				return ret;
+				return resp_err;
 		}
 	}
 
Signature · 1 line
2.7.4
Applied
#1 lore raw

PATCH 1/1 ARM: socfpga: stratix10: Return valid error code from FPGA driver

Quoted 7 lines · chee.hong.ang at intel.com

From: "Ang, Chee Hong" <[email protected]>

This patch prevent the Stratix 10 FPGA driver incorrectly return the transaction ID as the mailbox error code. It should always return the actual mailbox error code from SDM firmware.

[...]

Applied, thanks

Signature · 2 lines
Best regards,
Marek Vasut