[PATCH] drivers: cadence_qspi_apb: Add watchdog_reset to prevent timeout

Jit Loon Lim jit.loon.lim at intel.com
Sun Sep 18 15:19:56 CEST 2022


From: Yau Wai Gan <yau.wai.gan at .intel.com>

Reset the watchdog within functions that require long processing
time to prevent watchdog timeout.

Signed-off-by: Yau Wai Gan <yau.wai.gan at intel.com>
Signed-off-by: Jit Loon Lim <jit.loon.lim at intel.com>
---
 drivers/spi/cadence_qspi_apb.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/drivers/spi/cadence_qspi_apb.c b/drivers/spi/cadence_qspi_apb.c
index c00755050e..e7e0bb649f 100644
--- a/drivers/spi/cadence_qspi_apb.c
+++ b/drivers/spi/cadence_qspi_apb.c
@@ -149,6 +149,7 @@ static unsigned int cadence_qspi_wait_idle(void *reg_base)
 
 	start = get_timer(0);
 	for ( ; get_timer(start) < timeout ; ) {
+		WATCHDOG_RESET();
 		if (CQSPI_REG_IS_IDLE(reg_base))
 			count++;
 		else
@@ -356,6 +357,7 @@ int cadence_qspi_apb_exec_flash_cmd(void *reg_base, unsigned int reg)
 		if ((reg & CQSPI_REG_CMDCTRL_INPROGRESS) == 0)
 			break;
 		udelay(1);
+		WATCHDOG_RESET();
 	}
 
 	if (!retry) {
@@ -652,6 +654,7 @@ static int cadence_qspi_wait_for_data(struct cadence_spi_plat *plat)
 		if (reg)
 			return reg;
 		udelay(1);
+		WATCHDOG_RESET();
 	}
 
 	return -ETIMEDOUT;
@@ -696,6 +699,7 @@ cadence_qspi_apb_indirect_read_execute(struct cadence_spi_plat *plat,
 			rxbuf += bytes_to_read;
 			remaining -= bytes_to_read;
 			bytes_to_read = cadence_qspi_get_rd_sram_level(plat);
+			WATCHDOG_RESET();
 		}
 	}
 
@@ -863,6 +867,7 @@ cadence_qspi_apb_indirect_write_execute(struct cadence_spi_plat *plat,
 
 		bb_txbuf += write_bytes;
 		remaining -= write_bytes;
+		WATCHDOG_RESET();
 	}
 
 	/* Check indirect done status */
-- 
2.26.2



More information about the U-Boot mailing list