Skip to contentSkip to conversation

fsi: scom: Reset the FSI2PIB engine for any error

PATCH In review Eddie James 2 participants 2 messages Mar 29, 2021 – May 27, 2021 FSI

lore
Share & tools
lore

Eddie James

author maintainer
#0 lore raw

PATCH 1/1 fsi: scom: Reset the FSI2PIB engine for any error

The error bits in the FSI2PIB status are only cleared by a reset. So the driver needs to perform a reset after seeing any of the FSI2PIB errors, otherwise subsequent operations will also look like failures.

Fixes 6b293258cded ("fsi: scom: Major overhaul")
---
 drivers/fsi/fsi-scom.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/fsi/fsi-scom.c +9 -7
index b45bfab7b7f5..75d1389e2626 100644
@@ -38,9 +38,10 @@
 #define SCOM_STATUS_PIB_RESP_MASK	0x00007000
 #define SCOM_STATUS_PIB_RESP_SHIFT	12
 
-#define SCOM_STATUS_ANY_ERR		(SCOM_STATUS_PROTECTION | \
-					 SCOM_STATUS_PARITY |	  \
-					 SCOM_STATUS_PIB_ABORT | \
+#define SCOM_STATUS_FSI2PIB_ERROR	(SCOM_STATUS_PROTECTION |	\
+					 SCOM_STATUS_PARITY |		\
+					 SCOM_STATUS_PIB_ABORT)
+#define SCOM_STATUS_ANY_ERR		(SCOM_STATUS_FSI2PIB_ERROR |	\
 					 SCOM_STATUS_PIB_RESP_MASK)
 /* SCOM address encodings */
 #define XSCOM_ADDR_IND_FLAG		BIT_ULL(63)
@@ -240,13 +241,14 @@ static int handle_fsi2pib_status(struct scom_device *scom, uint32_t status)
 {
 	uint32_t dummy = -1;
 
-	if (status & SCOM_STATUS_PROTECTION)
-		return -EPERM;
-	if (status & SCOM_STATUS_PARITY) {
+	if (status & SCOM_STATUS_FSI2PIB_ERROR)
 		fsi_device_write(scom->fsi_dev, SCOM_FSI2PIB_RESET_REG, &dummy,
 				 sizeof(uint32_t));
+
+	if (status & SCOM_STATUS_PROTECTION)
+		return -EPERM;
+	if (status & SCOM_STATUS_PARITY)
 		return -EIO;
-	}
 	/* Return -EBUSY on PIB abort to force a retry */
 	if (status & SCOM_STATUS_PIB_ABORT)
 		return -EBUSY;
Signature · 1 line
2.27.0
Reviewed-by on v1 1/1
#1 lore raw
Quoted 7 lines · Eddie James

The error bits in the FSI2PIB status are only cleared by a reset. So the driver needs to perform a reset after seeing any of the FSI2PIB errors, otherwise subsequent operations will also look like failures.

Fixes 6b293258cded ("fsi: scom: Major overhaul")

I've got some other FSI fixes that I will send out shortly. I will include this one in that series to ensure it gets applied.

Quoted 44 lines
---
 drivers/fsi/fsi-scom.c | 16 +++++++++-------
 1 file changed, 9 insertions(+), 7 deletions(-)
drivers/fsi/fsi-scom.c +9 -8
index b45bfab7b7f5..75d1389e2626 100644
@@ -38,9 +38,10 @@
 #define SCOM_STATUS_PIB_RESP_MASK      0x00007000
 #define SCOM_STATUS_PIB_RESP_SHIFT     12
 
-#define SCOM_STATUS_ANY_ERR            (SCOM_STATUS_PROTECTION | \
-                                        SCOM_STATUS_PARITY |     \
-                                        SCOM_STATUS_PIB_ABORT | \
+#define SCOM_STATUS_FSI2PIB_ERROR      (SCOM_STATUS_PROTECTION |       \
+                                        SCOM_STATUS_PARITY |           \
+                                        SCOM_STATUS_PIB_ABORT)
+#define SCOM_STATUS_ANY_ERR            (SCOM_STATUS_FSI2PIB_ERROR |    \
                                         SCOM_STATUS_PIB_RESP_MASK)
 /* SCOM address encodings */
 #define XSCOM_ADDR_IND_FLAG            BIT_ULL(63)
@@ -240,13 +241,14 @@ static int handle_fsi2pib_status(struct scom_device *scom, uint32_t status)
 {
        uint32_t dummy = -1;
 
-       if (status & SCOM_STATUS_PROTECTION)
-               return -EPERM;
-       if (status & SCOM_STATUS_PARITY) {
+       if (status & SCOM_STATUS_FSI2PIB_ERROR)
                fsi_device_write(scom->fsi_dev, SCOM_FSI2PIB_RESET_REG, &dummy,
                                 sizeof(uint32_t));
+
+       if (status & SCOM_STATUS_PROTECTION)
+               return -EPERM;
+       if (status & SCOM_STATUS_PARITY)
                return -EIO;
-       }
        /* Return -EBUSY on PIB abort to force a retry */
        if (status & SCOM_STATUS_PIB_ABORT)
                return -EBUSY;
--

2.27.0