- 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@xxxxxxx> Reviewed-by: Naveen Krishna Chatradhi <naveenkrishna.chatradhi@xxxxxxx> --- 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