Blob Blame History Raw
From: Chester Lin <clin@suse.com>
Date: Tue, 17 Jan 2023 17:32:45 +0800
Subject: [PATCH] ipmi:ssif: Add 60ms time internal between write retries
Patch-mainline: Not yet, backport for sovling issue reported by hardware partner
References: bsc#1206459

IPMI spec v2.0 rev1.1 suggests that each request retry via SSIF should
wait at least 60ms.

Signed-off-by: Chester Lin <clin@suse.com>
---
 drivers/char/ipmi/ipmi_ssif.c |   10 ++++++++--
 1 file changed, 8 insertions(+), 2 deletions(-)

--- a/drivers/char/ipmi/ipmi_ssif.c
+++ b/drivers/char/ipmi/ipmi_ssif.c
@@ -909,6 +909,7 @@ static void msg_written_handler(struct s
 	if (result < 0) {
 		ssif_info->retries_left--;
 		if (ssif_info->retries_left > 0) {
+			msleep(SSIF_MSG_MSEC);
 			if (!start_resend(ssif_info)) {
 				ssif_inc_stat(ssif_info, send_retries);
 				return;
@@ -1336,8 +1337,11 @@ static int do_cmd(struct i2c_client *cli
 	ret = i2c_smbus_write_block_data(client, SSIF_IPMI_REQUEST, len, msg);
 	if (ret) {
 		retry_cnt--;
-		if (retry_cnt > 0)
+		if (retry_cnt > 0) {
+			msleep(SSIF_MSG_MSEC);
 			goto retry1;
+		}
+
 		return -ENODEV;
 	}
 
@@ -1478,8 +1482,10 @@ retry_write:
 					 32, msg);
 	if (ret) {
 		retry_cnt--;
-		if (retry_cnt > 0)
+		if (retry_cnt > 0) {
+			msleep(SSIF_MSG_MSEC);
 			goto retry_write;
+		}
 		dev_err(&client->dev, "Could not write multi-part start, though the BMC said it could handle it.  Just limit sends to one part.\n");
 		return ret;
 	}