Skip to content
Snippets Groups Projects
Commit beedbc2e authored by Alexander Stein's avatar Alexander Stein Committed by York Sun
Browse files

fsl_qspi: Pet the watchdog while reading/writing


When reading a large blob. e.g. a linux kernel (several MiBs) a watchdog
timeout might occur meanwhile. So pet the watchdog while operating on
the flash.

Signed-off-by: default avatarAlexander Stein <alexander.stein@systec-electronic.com>
Reviewed-by: default avatarYork Sun <yorksun@freescale.com>
parent c0492141
No related branches found
No related tags found
No related merge requests found
...@@ -13,6 +13,7 @@ ...@@ -13,6 +13,7 @@
#include <linux/sizes.h> #include <linux/sizes.h>
#include <dm.h> #include <dm.h>
#include <errno.h> #include <errno.h>
#include <watchdog.h>
#include "fsl_qspi.h" #include "fsl_qspi.h"
DECLARE_GLOBAL_DATA_PTR; DECLARE_GLOBAL_DATA_PTR;
...@@ -527,6 +528,8 @@ static void qspi_op_read(struct fsl_qspi_priv *priv, u32 *rxbuf, u32 len) ...@@ -527,6 +528,8 @@ static void qspi_op_read(struct fsl_qspi_priv *priv, u32 *rxbuf, u32 len)
to_or_from = priv->sf_addr + priv->cur_amba_base; to_or_from = priv->sf_addr + priv->cur_amba_base;
while (len > 0) { while (len > 0) {
WATCHDOG_RESET();
qspi_write32(priv->flags, &regs->sfar, to_or_from); qspi_write32(priv->flags, &regs->sfar, to_or_from);
size = (len > RX_BUFFER_SIZE) ? size = (len > RX_BUFFER_SIZE) ?
...@@ -574,6 +577,8 @@ static void qspi_op_write(struct fsl_qspi_priv *priv, u8 *txbuf, u32 len) ...@@ -574,6 +577,8 @@ static void qspi_op_write(struct fsl_qspi_priv *priv, u8 *txbuf, u32 len)
status_reg = 0; status_reg = 0;
while ((status_reg & FLASH_STATUS_WEL) != FLASH_STATUS_WEL) { while ((status_reg & FLASH_STATUS_WEL) != FLASH_STATUS_WEL) {
WATCHDOG_RESET();
qspi_write32(priv->flags, &regs->ipcr, qspi_write32(priv->flags, &regs->ipcr,
(SEQID_WREN << QSPI_IPCR_SEQID_SHIFT) | 0); (SEQID_WREN << QSPI_IPCR_SEQID_SHIFT) | 0);
while (qspi_read32(priv->flags, &regs->sr) & QSPI_SR_BUSY_MASK) while (qspi_read32(priv->flags, &regs->sr) & QSPI_SR_BUSY_MASK)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment