diff mbox series

[linux,dev-5.10,26/35] fsi: scom: Handle FSI2PIB timeout

Message ID 20210308225419.46530-27-eajames@linux.ibm.com
State New
Headers show
Series Rainier and Everest system updates | expand

Commit Message

Eddie James March 8, 2021, 10:54 p.m. UTC
From: Joel Stanley <joel@jms.id.au>

When the scom engine indicates a FSI2PIB timeout we can recover by
writing any value to the the reset register.

Signed-off-by: Joel Stanley <joel@jms.id.au>
---
 drivers/fsi/fsi-scom.c | 18 ++++++++++++++++++
 1 file changed, 18 insertions(+)

Comments

Joel Stanley March 12, 2021, 12:20 a.m. UTC | #1
On Mon, 8 Mar 2021 at 22:54, Eddie James <eajames@linux.ibm.com> wrote:
>
> From: Joel Stanley <joel@jms.id.au>
>
> When the scom engine indicates a FSI2PIB timeout we can recover by
> writing any value to the the reset register.
>
> Signed-off-by: Joel Stanley <joel@jms.id.au>

This change is incorrect; the logic to do a recovery is already in the
driver. The code needs reworking to run the recovery when a PIB
timeout occurs.

> ---
>  drivers/fsi/fsi-scom.c | 18 ++++++++++++++++++
>  1 file changed, 18 insertions(+)
>
> diff --git a/drivers/fsi/fsi-scom.c b/drivers/fsi/fsi-scom.c
> index b45bfab7b7f5..2356a80f7f04 100644
> --- a/drivers/fsi/fsi-scom.c
> +++ b/drivers/fsi/fsi-scom.c
> @@ -38,6 +38,15 @@
>  #define SCOM_STATUS_PIB_RESP_MASK      0x00007000
>  #define SCOM_STATUS_PIB_RESP_SHIFT     12
>
> +/* Values the SCOM_STATUS_PIB_RESP_MASK can take */
> +#define SCOM_PIB_ERR_XSCOM_BLOCKED     0x00004000
> +#define SCOM_PIB_ERR_CHIPLET_OFFLINE   0x00002000
> +#define SCOM_PIB_ERR_PARTIAL_GOOD      0x00006000
> +#define SCOM_PIB_ERR_INVALID_ADDR      0x00001000
> +#define SCOM_PIB_ERR_CLOCK             0x00005000
> +#define SCOM_PIB_ERR_HANDSHAKE         0x00003000
> +#define SCOM_PIB_ERR_TIMEOUT           0x00007000
> +
>  #define SCOM_STATUS_ANY_ERR            (SCOM_STATUS_PROTECTION | \
>                                          SCOM_STATUS_PARITY |     \
>                                          SCOM_STATUS_PIB_ABORT | \
> @@ -250,6 +259,15 @@ static int handle_fsi2pib_status(struct scom_device *scom, uint32_t status)
>         /* Return -EBUSY on PIB abort to force a retry */
>         if (status & SCOM_STATUS_PIB_ABORT)
>                 return -EBUSY;
> +
> +       if (status & SCOM_PIB_ERR_TIMEOUT) {
> +               dev_dbg(&scom->dev, "PIB timeout, recovering\n");
> +               fsi_device_write(scom->fsi_dev, SCOM_FSI2PIB_RESET_REG,
> +                                &dummy, sizeof(uint32_t));
> +               /* Return -EBUSY to force a retry */
> +               return -EBUSY;
> +       }
> +
>         return 0;
>  }
>
> --
> 2.27.0
>
diff mbox series

Patch

diff --git a/drivers/fsi/fsi-scom.c b/drivers/fsi/fsi-scom.c
index b45bfab7b7f5..2356a80f7f04 100644
--- a/drivers/fsi/fsi-scom.c
+++ b/drivers/fsi/fsi-scom.c
@@ -38,6 +38,15 @@ 
 #define SCOM_STATUS_PIB_RESP_MASK	0x00007000
 #define SCOM_STATUS_PIB_RESP_SHIFT	12
 
+/* Values the SCOM_STATUS_PIB_RESP_MASK can take */
+#define SCOM_PIB_ERR_XSCOM_BLOCKED	0x00004000
+#define SCOM_PIB_ERR_CHIPLET_OFFLINE	0x00002000
+#define SCOM_PIB_ERR_PARTIAL_GOOD	0x00006000
+#define SCOM_PIB_ERR_INVALID_ADDR	0x00001000
+#define SCOM_PIB_ERR_CLOCK		0x00005000
+#define SCOM_PIB_ERR_HANDSHAKE		0x00003000
+#define SCOM_PIB_ERR_TIMEOUT		0x00007000
+
 #define SCOM_STATUS_ANY_ERR		(SCOM_STATUS_PROTECTION | \
 					 SCOM_STATUS_PARITY |	  \
 					 SCOM_STATUS_PIB_ABORT | \
@@ -250,6 +259,15 @@  static int handle_fsi2pib_status(struct scom_device *scom, uint32_t status)
 	/* Return -EBUSY on PIB abort to force a retry */
 	if (status & SCOM_STATUS_PIB_ABORT)
 		return -EBUSY;
+
+	if (status & SCOM_PIB_ERR_TIMEOUT) {
+		dev_dbg(&scom->dev, "PIB timeout, recovering\n");
+		fsi_device_write(scom->fsi_dev, SCOM_FSI2PIB_RESET_REG,
+				 &dummy, sizeof(uint32_t));
+		/* Return -EBUSY to force a retry */
+		return -EBUSY;
+	}
+
 	return 0;
 }