[PATCH] mtd: spi-nor-core: call WATCHDOG_RESET() in spi_nor_ready()

Vignesh Raghavendra vigneshr at ti.com
Thu Mar 19 12:25:16 CET 2020


Hi,

On 17/03/20 1:48 am, Rasmus Villemoes wrote:
> I have a board for which doing "sf erase 0x100000 0x80000"
> consistently causes the external watchdog circuit to reset the
> board. Make sure to pet the watchdog during slow operations such as
> erasing or writing large areas of a spi nor flash.
> 
> Signed-off-by: Rasmus Villemoes <rasmus.villemoes at prevas.dk>
> ---
>  drivers/mtd/spi/spi-nor-core.c | 2 ++
>  1 file changed, 2 insertions(+)
> 
> diff --git a/drivers/mtd/spi/spi-nor-core.c b/drivers/mtd/spi/spi-nor-core.c
> index 4076646225..b7f7aa7b28 100644
> --- a/drivers/mtd/spi/spi-nor-core.c
> +++ b/drivers/mtd/spi/spi-nor-core.c
> @@ -20,6 +20,7 @@
>  #include <linux/mtd/spi-nor.h>
>  #include <spi-mem.h>
>  #include <spi.h>
> +#include <watchdog.h>
>  
>  #include "sf_internal.h"
>  
> @@ -399,6 +400,7 @@ static int spi_nor_ready(struct spi_nor *nor)
>  {
>  	int sr, fsr;
>  
> +	WATCHDOG_RESET();

Is it necessary to reset watchdog for every status register read? How
small is the timeout? Resetting too often will impact performance
depending on overhead of this call.

Is it not sufficient to reset watchdog once per page write (in
spi_nor_write()) and once per sector erase (in spi_nor_erase())?


>  	sr = spi_nor_sr_ready(nor);
>  	if (sr < 0)
>  		return sr;
> 

Regards
Vignesh


More information about the U-Boot mailing list