diff mbox series

[3/4] mtd: nand: Add WATCHDOG_RESET() in nanddev_mtd_erase()

Message ID 20210120134205.30488-4-patrice.chotard@foss.st.com
State New
Delegated to: Patrick Delaunay
Headers show
Series Add WATCHDOG_RESET() in MTD framework and STM32 QSPI driver | expand

Commit Message

Patrice Chotard Jan. 20, 2021, 1:42 p.m. UTC
In case of big area erased on nand, watchdog timeout may occurs.
To fix that, add WATCHDOG_RESET() in nanddev_mtd_erase() to ensure that
watchdog is reset.

Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
---

 drivers/mtd/nand/core.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Patrick DELAUNAY Jan. 27, 2021, 3:15 p.m. UTC | #1
Hi Patrice,

On 1/20/21 2:42 PM, Patrice Chotard wrote:
> In case of big area erased on nand, watchdog timeout may occurs.
> To fix that, add WATCHDOG_RESET() in nanddev_mtd_erase() to ensure that
> watchdog is reset.
>
> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
> ---
>
>   drivers/mtd/nand/core.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/mtd/nand/core.c b/drivers/mtd/nand/core.c
> index 3abaef23c5..ec11bf44f8 100644
> --- a/drivers/mtd/nand/core.c
> +++ b/drivers/mtd/nand/core.c
> @@ -10,6 +10,7 @@
>   #define pr_fmt(fmt)	"nand: " fmt
>   
>   #include <common.h>
> +#include <watchdog.h>
>   #ifndef __UBOOT__
>   #include <linux/module.h>
>   #endif
> @@ -162,6 +163,7 @@ int nanddev_mtd_erase(struct mtd_info *mtd, struct erase_info *einfo)
>   	nanddev_offs_to_pos(nand, einfo->addr, &pos);
>   	nanddev_offs_to_pos(nand, einfo->addr + einfo->len - 1, &last);
>   	while (nanddev_pos_cmp(&pos, &last) <= 0) {
> +		WATCHDOG_RESET();
>   		ret = nanddev_erase(nand, &pos);
>   		if (ret) {
>   			einfo->fail_addr = nanddev_pos_to_offs(nand, &pos);


Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>

Thanks

Patrick
diff mbox series

Patch

diff --git a/drivers/mtd/nand/core.c b/drivers/mtd/nand/core.c
index 3abaef23c5..ec11bf44f8 100644
--- a/drivers/mtd/nand/core.c
+++ b/drivers/mtd/nand/core.c
@@ -10,6 +10,7 @@ 
 #define pr_fmt(fmt)	"nand: " fmt
 
 #include <common.h>
+#include <watchdog.h>
 #ifndef __UBOOT__
 #include <linux/module.h>
 #endif
@@ -162,6 +163,7 @@  int nanddev_mtd_erase(struct mtd_info *mtd, struct erase_info *einfo)
 	nanddev_offs_to_pos(nand, einfo->addr, &pos);
 	nanddev_offs_to_pos(nand, einfo->addr + einfo->len - 1, &last);
 	while (nanddev_pos_cmp(&pos, &last) <= 0) {
+		WATCHDOG_RESET();
 		ret = nanddev_erase(nand, &pos);
 		if (ret) {
 			einfo->fail_addr = nanddev_pos_to_offs(nand, &pos);