From b64ad931b33e59b12b0e0af10258a18172920424 Mon Sep 17 00:00:00 2001
From: Vignesh Raghavendra <vigneshr@ti.com>
Date: Wed, 17 Nov 2021 20:27:53 +0530
Subject: [PATCH] net: ti: icssg_qos: Fix IET Frame Preemption disable path

Don't wait for ICSSG_IETFPE_STATE_SUCCEEDED state when disabling IET
FPE. This state applies only on when enabling Frame Preemption

Signed-off-by: Vignesh Raghavendra <vigneshr@ti.com>
---
 drivers/net/ethernet/ti/icssg_qos.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/net/ethernet/ti/icssg_qos.c b/drivers/net/ethernet/ti/icssg_qos.c
index 32e99186829d..4c341d777184 100644
--- a/drivers/net/ethernet/ti/icssg_qos.c
+++ b/drivers/net/ethernet/ti/icssg_qos.c
@@ -370,7 +370,7 @@ static int icssg_config_ietfpe(struct prueth_qos_iet *iet, bool enable)
 	 */
 	writeb(enable ? 1 : 0, config + PRE_EMPTION_ENABLE_TX);
 
-	if (iet->mac_verify_configured) {
+	if (enable && iet->mac_verify_configured) {
 		ret = readb_poll_timeout(config + PRE_EMPTION_VERIFY_STATUS, val,
 					 (val == ICSSG_IETFPE_STATE_SUCCEEDED),
 					 USEC_PER_MSEC, 5 * USEC_PER_SEC);
@@ -393,6 +393,8 @@ static int icssg_config_ietfpe(struct prueth_qos_iet *iet, bool enable)
 			writeb(0, config + PRE_EMPTION_ENABLE_TX);
 			return -ENODEV;
 		}
+	} else {
+		return ret;
 	}
 
 	/* Configure highest queue as express. Set Bit 4 for FPE,
