diff mbox series

[4/4] mtd: spinand: Add WATCHDOG_RESET() in spinand_mtd_read/write()

Message ID 20210120134205.30488-5-patrice.chotard@foss.st.com
State Accepted
Delegated to: Patrice Chotard
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 read/write on spi nand, watchdog timeout may occurs.
To fix that, add WATCHDOG_RESET() in spinand_mtd_read() and
spinand_mtd_write() to ensure that watchdog is reset.

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

---

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

Comments

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

On 1/20/21 2:42 PM, Patrice Chotard wrote:
> In case of big area read/write on spi nand, watchdog timeout may occurs.
> To fix that, add WATCHDOG_RESET() in spinand_mtd_read() and
> spinand_mtd_write() to ensure that watchdog is reset.
>
> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
>
> ---
>
>   drivers/mtd/nand/spi/core.c | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
> index cb8ffa3fa9..7f54422c93 100644
> --- a/drivers/mtd/nand/spi/core.c
> +++ b/drivers/mtd/nand/spi/core.c
> @@ -24,6 +24,7 @@
>   #include <errno.h>
>   #include <spi.h>
>   #include <spi-mem.h>
> +#include <watchdog.h>
>   #include <linux/mtd/spinand.h>
>   #endif
>   
> @@ -574,6 +575,7 @@ static int spinand_mtd_read(struct mtd_info *mtd, loff_t from,
>   #endif
>   
>   	nanddev_io_for_each_page(nand, from, ops, &iter) {
> +		WATCHDOG_RESET();
>   		ret = spinand_select_target(spinand, iter.req.pos.target);
>   		if (ret)
>   			break;
> @@ -625,6 +627,7 @@ static int spinand_mtd_write(struct mtd_info *mtd, loff_t to,
>   #endif
>   
>   	nanddev_io_for_each_page(nand, to, ops, &iter) {
> +		WATCHDOG_RESET();
>   		ret = spinand_select_target(spinand, iter.req.pos.target);
>   		if (ret)
>   			break;


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

Thanks

Patrick
Patrice CHOTARD March 12, 2021, 12:19 p.m. UTC | #2
Hi

On 1/27/21 4:19 PM, Patrick DELAUNAY wrote:
> Hi,
> 
> On 1/20/21 2:42 PM, Patrice Chotard wrote:
>> In case of big area read/write on spi nand, watchdog timeout may occurs.
>> To fix that, add WATCHDOG_RESET() in spinand_mtd_read() and
>> spinand_mtd_write() to ensure that watchdog is reset.
>>
>> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
>>
>> ---
>>
>>   drivers/mtd/nand/spi/core.c | 3 +++
>>   1 file changed, 3 insertions(+)
>>
>> diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
>> index cb8ffa3fa9..7f54422c93 100644
>> --- a/drivers/mtd/nand/spi/core.c
>> +++ b/drivers/mtd/nand/spi/core.c
>> @@ -24,6 +24,7 @@
>>   #include <errno.h>
>>   #include <spi.h>
>>   #include <spi-mem.h>
>> +#include <watchdog.h>
>>   #include <linux/mtd/spinand.h>
>>   #endif
>>   @@ -574,6 +575,7 @@ static int spinand_mtd_read(struct mtd_info *mtd, loff_t from,
>>   #endif
>>         nanddev_io_for_each_page(nand, from, ops, &iter) {
>> +        WATCHDOG_RESET();
>>           ret = spinand_select_target(spinand, iter.req.pos.target);
>>           if (ret)
>>               break;
>> @@ -625,6 +627,7 @@ static int spinand_mtd_write(struct mtd_info *mtd, loff_t to,
>>   #endif
>>         nanddev_io_for_each_page(nand, to, ops, &iter) {
>> +        WATCHDOG_RESET();
>>           ret = spinand_select_target(spinand, iter.req.pos.target);
>>           if (ret)
>>               break;
> 
> 
> Reviewed-by: Patrick Delaunay <patrick.delaunay@foss.st.com>
> 
> Thanks
> 
> Patrick
> 
> 
Applied to u-boot-stm/next

Thanks

Patrice
diff mbox series

Patch

diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
index cb8ffa3fa9..7f54422c93 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -24,6 +24,7 @@ 
 #include <errno.h>
 #include <spi.h>
 #include <spi-mem.h>
+#include <watchdog.h>
 #include <linux/mtd/spinand.h>
 #endif
 
@@ -574,6 +575,7 @@  static int spinand_mtd_read(struct mtd_info *mtd, loff_t from,
 #endif
 
 	nanddev_io_for_each_page(nand, from, ops, &iter) {
+		WATCHDOG_RESET();
 		ret = spinand_select_target(spinand, iter.req.pos.target);
 		if (ret)
 			break;
@@ -625,6 +627,7 @@  static int spinand_mtd_write(struct mtd_info *mtd, loff_t to,
 #endif
 
 	nanddev_io_for_each_page(nand, to, ops, &iter) {
+		WATCHDOG_RESET();
 		ret = spinand_select_target(spinand, iter.req.pos.target);
 		if (ret)
 			break;