[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240704111624.1583460-5-akshay.gupta@amd.com>
Date: Thu, 4 Jul 2024 11:16:22 +0000
From: Akshay Gupta <akshay.gupta@....com>
To: <linux-hwmon@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux@...ck-us.net>, <gregkh@...uxfoundation.org>, <arnd@...db.de>
CC: <naveenkrishna.chatradhi@....com>, Akshay Gupta <akshay.gupta@....com>
Subject: [PATCH 4/6] misc: sbrmi: Clear sbrmi status register bit SwAlertSts
- SBRMI register status b1' SwAlertSts sets in below conditions
- Completion of Mailbox command
- syncflood event
If the bit is set for syncfllod event, it may be interpretted as
mailbox command compleition. This patch clears the bit before
start of mailbox protocol.
Signed-off-by: Akshay Gupta <akshay.gupta@....com>
Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@....com>
---
drivers/misc/amd-sb/sbrmi-core.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/misc/amd-sb/sbrmi-core.c b/drivers/misc/amd-sb/sbrmi-core.c
index b2437a4044ac..e528b7314447 100644
--- a/drivers/misc/amd-sb/sbrmi-core.c
+++ b/drivers/misc/amd-sb/sbrmi-core.c
@@ -42,6 +42,22 @@ enum sbrmi_reg {
SBRMI_SW_INTERRUPT,
};
+static int sbrmi_clear_status_alert(struct sbrmi_data *data)
+{
+ int sw_status, ret;
+
+ ret = regmap_read(data->regmap, SBRMI_STATUS,
+ &sw_status);
+ if (ret < 0)
+ return ret;
+
+ if (!(sw_status & SW_ALERT_MASK))
+ return 0;
+
+ return regmap_write(data->regmap, SBRMI_STATUS,
+ SW_ALERT_MASK);
+}
+
int rmi_mailbox_xfer(struct sbrmi_data *data,
struct sbrmi_mailbox_msg *msg)
{
@@ -52,6 +68,10 @@ int rmi_mailbox_xfer(struct sbrmi_data *data,
mutex_lock(&data->lock);
+ ret = sbrmi_clear_status_alert(data);
+ if (ret < 0)
+ goto exit_unlock;
+
/* Indicate firmware a command is to be serviced */
ret = regmap_write(data->regmap, SBRMI_INBNDMSG7, START_CMD);
if (ret < 0)
--
2.25.1
Powered by blists - more mailing lists