diff mbox series

[2/4] spi: stm32_qspi: Add WATCHDOG_RESET in _stm32_qspi_read_fifo()

Message ID 20210120134205.30488-3-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 reading large area and memory-map mode is misconfigured
(memory-map size declared lower than the real size of the memory chip)
watchdog can be triggered.

Add WATCHDOG_RESET() in _stm32_qspi_read_fifo to fix it.

Issue reproduced with stm32mp157c-ev1 board and memory map size set to
1, with following command:
sf read 0xC0000000 0 0x4000000

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

 drivers/spi/stm32_qspi.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 reading large area and memory-map mode is misconfigured
> (memory-map size declared lower than the real size of the memory chip)
> watchdog can be triggered.
>
> Add WATCHDOG_RESET() in _stm32_qspi_read_fifo to fix it.
>
> Issue reproduced with stm32mp157c-ev1 board and memory map size set to
> 1, with following command:
> sf read 0xC0000000 0 0x4000000
>
> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
> ---
>
>   drivers/spi/stm32_qspi.c | 2 ++
>   1 file changed, 2 insertions(+)
>
> diff --git a/drivers/spi/stm32_qspi.c b/drivers/spi/stm32_qspi.c
> index 958c394a1a..c3da17f991 100644
> --- a/drivers/spi/stm32_qspi.c
> +++ b/drivers/spi/stm32_qspi.c
> @@ -11,6 +11,7 @@
>   #include <clk.h>
>   #include <reset.h>
>   #include <spi-mem.h>
> +#include <watchdog.h>
>   #include <linux/iopoll.h>
>   #include <linux/ioport.h>
>   #include <linux/sizes.h>
> @@ -163,6 +164,7 @@ static int _stm32_qspi_wait_cmd(struct stm32_qspi_priv *priv,
>   static void _stm32_qspi_read_fifo(u8 *val, void __iomem *addr)
>   {
>   	*val = readb(addr);
> +	WATCHDOG_RESET();
>   }
>   
>   static void _stm32_qspi_write_fifo(u8 *val, void __iomem *addr)


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

Thanks

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

On 1/27/21 4:15 PM, Patrick DELAUNAY wrote:
> Hi Patrice
> 
> On 1/20/21 2:42 PM, Patrice Chotard wrote:
>> In case of reading large area and memory-map mode is misconfigured
>> (memory-map size declared lower than the real size of the memory chip)
>> watchdog can be triggered.
>>
>> Add WATCHDOG_RESET() in _stm32_qspi_read_fifo to fix it.
>>
>> Issue reproduced with stm32mp157c-ev1 board and memory map size set to
>> 1, with following command:
>> sf read 0xC0000000 0 0x4000000
>>
>> Signed-off-by: Patrice Chotard <patrice.chotard@foss.st.com>
>> ---
>>
>>   drivers/spi/stm32_qspi.c | 2 ++
>>   1 file changed, 2 insertions(+)
>>
>> diff --git a/drivers/spi/stm32_qspi.c b/drivers/spi/stm32_qspi.c
>> index 958c394a1a..c3da17f991 100644
>> --- a/drivers/spi/stm32_qspi.c
>> +++ b/drivers/spi/stm32_qspi.c
>> @@ -11,6 +11,7 @@
>>   #include <clk.h>
>>   #include <reset.h>
>>   #include <spi-mem.h>
>> +#include <watchdog.h>
>>   #include <linux/iopoll.h>
>>   #include <linux/ioport.h>
>>   #include <linux/sizes.h>
>> @@ -163,6 +164,7 @@ static int _stm32_qspi_wait_cmd(struct stm32_qspi_priv *priv,
>>   static void _stm32_qspi_read_fifo(u8 *val, void __iomem *addr)
>>   {
>>       *val = readb(addr);
>> +    WATCHDOG_RESET();
>>   }
>>     static void _stm32_qspi_write_fifo(u8 *val, void __iomem *addr)
> 
> 
> 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/spi/stm32_qspi.c b/drivers/spi/stm32_qspi.c
index 958c394a1a..c3da17f991 100644
--- a/drivers/spi/stm32_qspi.c
+++ b/drivers/spi/stm32_qspi.c
@@ -11,6 +11,7 @@ 
 #include <clk.h>
 #include <reset.h>
 #include <spi-mem.h>
+#include <watchdog.h>
 #include <linux/iopoll.h>
 #include <linux/ioport.h>
 #include <linux/sizes.h>
@@ -163,6 +164,7 @@  static int _stm32_qspi_wait_cmd(struct stm32_qspi_priv *priv,
 static void _stm32_qspi_read_fifo(u8 *val, void __iomem *addr)
 {
 	*val = readb(addr);
+	WATCHDOG_RESET();
 }
 
 static void _stm32_qspi_write_fifo(u8 *val, void __iomem *addr)