u-boot.lists.denx.de archive mirror
 help / color / mirror / Atom feed
* [PATCH] drivers: mmc: Reset watchdog when accessing mmc device
@ 2022-07-13  7:32 qianfanguijin
       [not found] ` <CGME20220726083134epcas1p1da8e13a4364d556e820f3d45b1686b8a@epcas1p1.samsung.com>
  0 siblings, 1 reply; 6+ messages in thread
From: qianfanguijin @ 2022-07-13  7:32 UTC (permalink / raw)
  To: u-boot; +Cc: Peng Fan, Jaehoon Chung, qianfan Zhao

From: qianfan Zhao <qianfanguijin@163.com>

watchdog will reset when 'mmc read' or 'ext4load' a large file from mmc
device. Reset watchdog when accessing mmc device.

Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
---
 drivers/mmc/mmc.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
index 4d9871d69f..27ffdb7fa7 100644
--- a/drivers/mmc/mmc.c
+++ b/drivers/mmc/mmc.c
@@ -24,6 +24,7 @@
 #include <memalign.h>
 #include <linux/list.h>
 #include <div64.h>
+#include <watchdog.h>
 #include "mmc_private.h"
 
 #define DEFAULT_CMD6_TIMEOUT_MS  500
@@ -297,6 +298,7 @@ int mmc_poll_for_busy(struct mmc *mmc, int timeout_ms)
 		if (timeout_ms-- <= 0)
 			break;
 
+		WATCHDOG_RESET();
 		udelay(1000);
 	}
 
@@ -500,6 +502,8 @@ ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
 		blocks_todo -= cur;
 		start += cur;
 		dst += cur * mmc->read_bl_len;
+
+		WATCHDOG_RESET();
 	} while (blocks_todo > 0);
 
 	return blkcnt;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 6+ messages in thread

* Re: [PATCH] drivers: mmc: Reset watchdog when accessing mmc device
       [not found] ` <CGME20220726083134epcas1p1da8e13a4364d556e820f3d45b1686b8a@epcas1p1.samsung.com>
@ 2022-07-26  8:31   ` Jaehoon Chung
  2022-08-30  3:43     ` qianfan
  0 siblings, 1 reply; 6+ messages in thread
From: Jaehoon Chung @ 2022-07-26  8:31 UTC (permalink / raw)
  To: qianfanguijin, u-boot; +Cc: Peng Fan

On 7/13/22 16:32, qianfanguijin@163.com wrote:
> From: qianfan Zhao <qianfanguijin@163.com>
> 
> watchdog will reset when 'mmc read' or 'ext4load' a large file from mmc
> device. Reset watchdog when accessing mmc device.

I don't know why this patch is need.

Best Regards,
Jaehoon Chung

> 
> Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
> ---
>  drivers/mmc/mmc.c | 4 ++++
>  1 file changed, 4 insertions(+)
> 
> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
> index 4d9871d69f..27ffdb7fa7 100644
> --- a/drivers/mmc/mmc.c
> +++ b/drivers/mmc/mmc.c
> @@ -24,6 +24,7 @@
>  #include <memalign.h>
>  #include <linux/list.h>
>  #include <div64.h>
> +#include <watchdog.h>
>  #include "mmc_private.h"
>  
>  #define DEFAULT_CMD6_TIMEOUT_MS  500
> @@ -297,6 +298,7 @@ int mmc_poll_for_busy(struct mmc *mmc, int timeout_ms)
>  		if (timeout_ms-- <= 0)
>  			break;
>  
> +		WATCHDOG_RESET();
>  		udelay(1000);
>  	}
>  
> @@ -500,6 +502,8 @@ ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
>  		blocks_todo -= cur;
>  		start += cur;
>  		dst += cur * mmc->read_bl_len;
> +
> +		WATCHDOG_RESET();
>  	} while (blocks_todo > 0);
>  
>  	return blkcnt;


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drivers: mmc: Reset watchdog when accessing mmc device
  2022-07-26  8:31   ` Jaehoon Chung
@ 2022-08-30  3:43     ` qianfan
  2022-10-26  9:18       ` Jaehoon Chung
  0 siblings, 1 reply; 6+ messages in thread
From: qianfan @ 2022-08-30  3:43 UTC (permalink / raw)
  To: Jaehoon Chung, u-boot; +Cc: Peng Fan



在 2022/7/26 16:31, Jaehoon Chung 写道:
> On 7/13/22 16:32, qianfanguijin@163.com wrote:
>> From: qianfan Zhao <qianfanguijin@163.com>
>>
>> watchdog will reset when 'mmc read' or 'ext4load' a large file from mmc
>> device. Reset watchdog when accessing mmc device.
> I don't know why this patch is need.
Hi:

maybe your's board doesn't have a hardware watchdog.
on my board there has a gpio watchdog and we should trigger it no more 
than 1.2 second.
otherwise it will reset CPU.

But 'mmc read' command doesn't trigger watchdog, it's ok if we load a 
smaller
imges, but if we load a very bigger image which more than 100MiB, the 
watchdog will
dead and trigger a system reset.

So I make this patch to make sure we can trigger watchdog while loading
mmc.
>
> Best Regards,
> Jaehoon Chung
>
>> Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
>> ---
>>   drivers/mmc/mmc.c | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c
>> index 4d9871d69f..27ffdb7fa7 100644
>> --- a/drivers/mmc/mmc.c
>> +++ b/drivers/mmc/mmc.c
>> @@ -24,6 +24,7 @@
>>   #include <memalign.h>
>>   #include <linux/list.h>
>>   #include <div64.h>
>> +#include <watchdog.h>
>>   #include "mmc_private.h"
>>   
>>   #define DEFAULT_CMD6_TIMEOUT_MS  500
>> @@ -297,6 +298,7 @@ int mmc_poll_for_busy(struct mmc *mmc, int timeout_ms)
>>   		if (timeout_ms-- <= 0)
>>   			break;
>>   
>> +		WATCHDOG_RESET();
>>   		udelay(1000);
>>   	}
>>   
>> @@ -500,6 +502,8 @@ ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
>>   		blocks_todo -= cur;
>>   		start += cur;
>>   		dst += cur * mmc->read_bl_len;
>> +
>> +		WATCHDOG_RESET();
>>   	} while (blocks_todo > 0);
>>   
>>   	return blkcnt;


^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: [PATCH] drivers: mmc: Reset watchdog when accessing mmc device
  2022-08-30  3:43     ` qianfan
@ 2022-10-26  9:18       ` Jaehoon Chung
  2022-10-27  6:49         ` qianfan
  0 siblings, 1 reply; 6+ messages in thread
From: Jaehoon Chung @ 2022-10-26  9:18 UTC (permalink / raw)
  To: 'qianfan', u-boot; +Cc: 'Peng Fan'

Hi,

> -----Original Message-----
> From: qianfan [mailto:qianfanguijin@163.com]
> Sent: Tuesday, August 30, 2022 12:43 PM
> To: Jaehoon Chung <jh80.chung@samsung.com>; u-boot@lists.denx.de
> Cc: Peng Fan <peng.fan@nxp.com>
> Subject: Re: [PATCH] drivers: mmc: Reset watchdog when accessing mmc device
> 
> 
> 
> 在 2022/7/26 16:31, Jaehoon Chung 写道:
> > On 7/13/22 16:32, qianfanguijin@163.com wrote:
> >> From: qianfan Zhao <qianfanguijin@163.com>
> >>
> >> watchdog will reset when 'mmc read' or 'ext4load' a large file from
> >> mmc device. Reset watchdog when accessing mmc device.
> > I don't know why this patch is need.
> Hi:
> 
> maybe your's board doesn't have a hardware watchdog.
> on my board there has a gpio watchdog and we should trigger it no more than 1.2 second.
> otherwise it will reset CPU.
> 
> But 'mmc read' command doesn't trigger watchdog, it's ok if we load a smaller imges, but if we
> load a very bigger image which more than 100MiB, the watchdog will dead and trigger a system reset.

Sorry for too late. I had missed your email.
Is there a case to load more bigger image than 100MiB?

Best Regards,
Jaehoon Chung


> 
> So I make this patch to make sure we can trigger watchdog while loading mmc.
> >
> > Best Regards,
> > Jaehoon Chung
> >
> >> Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
> >> ---
> >>   drivers/mmc/mmc.c | 4 ++++
> >>   1 file changed, 4 insertions(+)
> >>
> >> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index
> >> 4d9871d69f..27ffdb7fa7 100644
> >> --- a/drivers/mmc/mmc.c
> >> +++ b/drivers/mmc/mmc.c
> >> @@ -24,6 +24,7 @@
> >>   #include <memalign.h>
> >>   #include <linux/list.h>
> >>   #include <div64.h>
> >> +#include <watchdog.h>
> >>   #include "mmc_private.h"
> >>
> >>   #define DEFAULT_CMD6_TIMEOUT_MS  500 @@ -297,6 +298,7 @@ int
> >> mmc_poll_for_busy(struct mmc *mmc, int timeout_ms)
> >>   		if (timeout_ms-- <= 0)
> >>   			break;
> >>
> >> +		WATCHDOG_RESET();
> >>   		udelay(1000);
> >>   	}
> >>
> >> @@ -500,6 +502,8 @@ ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
> >>   		blocks_todo -= cur;
> >>   		start += cur;
> >>   		dst += cur * mmc->read_bl_len;
> >> +
> >> +		WATCHDOG_RESET();
> >>   	} while (blocks_todo > 0);
> >>
> >>   	return blkcnt;




^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drivers: mmc: Reset watchdog when accessing mmc device
  2022-10-26  9:18       ` Jaehoon Chung
@ 2022-10-27  6:49         ` qianfan
  2022-10-27  7:03           ` Stefan Roese
  0 siblings, 1 reply; 6+ messages in thread
From: qianfan @ 2022-10-27  6:49 UTC (permalink / raw)
  To: Jaehoon Chung, u-boot; +Cc: 'Peng Fan'



在 2022/10/26 17:18, Jaehoon Chung 写道:
> Hi,
>
>> -----Original Message-----
>> From: qianfan [mailto:qianfanguijin@163.com]
>> Sent: Tuesday, August 30, 2022 12:43 PM
>> To: Jaehoon Chung <jh80.chung@samsung.com>; u-boot@lists.denx.de
>> Cc: Peng Fan <peng.fan@nxp.com>
>> Subject: Re: [PATCH] drivers: mmc: Reset watchdog when accessing mmc device
>>
>>
>>
>> 在 2022/7/26 16:31, Jaehoon Chung 写道:
>>> On 7/13/22 16:32, qianfanguijin@163.com wrote:
>>>> From: qianfan Zhao <qianfanguijin@163.com>
>>>>
>>>> watchdog will reset when 'mmc read' or 'ext4load' a large file from
>>>> mmc device. Reset watchdog when accessing mmc device.
>>> I don't know why this patch is need.
>> Hi:
>>
>> maybe your's board doesn't have a hardware watchdog.
>> on my board there has a gpio watchdog and we should trigger it no more than 1.2 second.
>> otherwise it will reset CPU.
>>
>> But 'mmc read' command doesn't trigger watchdog, it's ok if we load a smaller imges, but if we
>> load a very bigger image which more than 100MiB, the watchdog will dead and trigger a system reset.
> Sorry for too late. I had missed your email.
> Is there a case to load more bigger image than 100MiB?
The case is loading rootfs.img from mmc and upgrade. The rootfs based on 
debian or ubuntu
is very bigger.
>
> Best Regards,
> Jaehoon Chung
>
>
>> So I make this patch to make sure we can trigger watchdog while loading mmc.
>>> Best Regards,
>>> Jaehoon Chung
>>>
>>>> Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
>>>> ---
>>>>    drivers/mmc/mmc.c | 4 ++++
>>>>    1 file changed, 4 insertions(+)
>>>>
>>>> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index
>>>> 4d9871d69f..27ffdb7fa7 100644
>>>> --- a/drivers/mmc/mmc.c
>>>> +++ b/drivers/mmc/mmc.c
>>>> @@ -24,6 +24,7 @@
>>>>    #include <memalign.h>
>>>>    #include <linux/list.h>
>>>>    #include <div64.h>
>>>> +#include <watchdog.h>
>>>>    #include "mmc_private.h"
>>>>
>>>>    #define DEFAULT_CMD6_TIMEOUT_MS  500 @@ -297,6 +298,7 @@ int
>>>> mmc_poll_for_busy(struct mmc *mmc, int timeout_ms)
>>>>    		if (timeout_ms-- <= 0)
>>>>    			break;
>>>>
>>>> +		WATCHDOG_RESET();
>>>>    		udelay(1000);
>>>>    	}
>>>>
>>>> @@ -500,6 +502,8 @@ ulong mmc_bread(struct blk_desc *block_dev, lbaint_t start, lbaint_t blkcnt,
>>>>    		blocks_todo -= cur;
>>>>    		start += cur;
>>>>    		dst += cur * mmc->read_bl_len;
>>>> +
>>>> +		WATCHDOG_RESET();
>>>>    	} while (blocks_todo > 0);
>>>>
>>>>    	return blkcnt;
>
>


^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [PATCH] drivers: mmc: Reset watchdog when accessing mmc device
  2022-10-27  6:49         ` qianfan
@ 2022-10-27  7:03           ` Stefan Roese
  0 siblings, 0 replies; 6+ messages in thread
From: Stefan Roese @ 2022-10-27  7:03 UTC (permalink / raw)
  To: qianfan, Jaehoon Chung, u-boot; +Cc: 'Peng Fan'

On 27.10.22 08:49, qianfan wrote:
> 
> 
> 在 2022/10/26 17:18, Jaehoon Chung 写道:
>> Hi,
>>
>>> -----Original Message-----
>>> From: qianfan [mailto:qianfanguijin@163.com]
>>> Sent: Tuesday, August 30, 2022 12:43 PM
>>> To: Jaehoon Chung <jh80.chung@samsung.com>; u-boot@lists.denx.de
>>> Cc: Peng Fan <peng.fan@nxp.com>
>>> Subject: Re: [PATCH] drivers: mmc: Reset watchdog when accessing mmc 
>>> device
>>>
>>>
>>>
>>> 在 2022/7/26 16:31, Jaehoon Chung 写道:
>>>> On 7/13/22 16:32, qianfanguijin@163.com wrote:
>>>>> From: qianfan Zhao <qianfanguijin@163.com>
>>>>>
>>>>> watchdog will reset when 'mmc read' or 'ext4load' a large file from
>>>>> mmc device. Reset watchdog when accessing mmc device.
>>>> I don't know why this patch is need.
>>> Hi:
>>>
>>> maybe your's board doesn't have a hardware watchdog.
>>> on my board there has a gpio watchdog and we should trigger it no 
>>> more than 1.2 second.
>>> otherwise it will reset CPU.
>>>
>>> But 'mmc read' command doesn't trigger watchdog, it's ok if we load a 
>>> smaller imges, but if we
>>> load a very bigger image which more than 100MiB, the watchdog will 
>>> dead and trigger a system reset.
>> Sorry for too late. I had missed your email.
>> Is there a case to load more bigger image than 100MiB?
> The case is loading rootfs.img from mmc and upgrade. The rootfs based on 
> debian or ubuntu
> is very bigger.
>>
>> Best Regards,
>> Jaehoon Chung
>>
>>
>>> So I make this patch to make sure we can trigger watchdog while 
>>> loading mmc.
>>>> Best Regards,
>>>> Jaehoon Chung
>>>>
>>>>> Signed-off-by: qianfan Zhao <qianfanguijin@163.com>
>>>>> ---
>>>>>    drivers/mmc/mmc.c | 4 ++++
>>>>>    1 file changed, 4 insertions(+)
>>>>>
>>>>> diff --git a/drivers/mmc/mmc.c b/drivers/mmc/mmc.c index
>>>>> 4d9871d69f..27ffdb7fa7 100644
>>>>> --- a/drivers/mmc/mmc.c
>>>>> +++ b/drivers/mmc/mmc.c
>>>>> @@ -24,6 +24,7 @@
>>>>>    #include <memalign.h>
>>>>>    #include <linux/list.h>
>>>>>    #include <div64.h>
>>>>> +#include <watchdog.h>

Please include cyclic.h now.

>>>>>    #include "mmc_private.h"
>>>>>
>>>>>    #define DEFAULT_CMD6_TIMEOUT_MS  500 @@ -297,6 +298,7 @@ int
>>>>> mmc_poll_for_busy(struct mmc *mmc, int timeout_ms)
>>>>>            if (timeout_ms-- <= 0)
>>>>>                break;
>>>>>
>>>>> +        WATCHDOG_RESET();

And please use schedule() here now instead of WATCHDOG_RESET().

Thanks,
Stefan

>>>>>            udelay(1000);
>>>>>        }
>>>>>
>>>>> @@ -500,6 +502,8 @@ ulong mmc_bread(struct blk_desc *block_dev, 
>>>>> lbaint_t start, lbaint_t blkcnt,
>>>>>            blocks_todo -= cur;
>>>>>            start += cur;
>>>>>            dst += cur * mmc->read_bl_len;
>>>>> +
>>>>> +        WATCHDOG_RESET();
>>>>>        } while (blocks_todo > 0);
>>>>>
>>>>>        return blkcnt;
>>
>>
> 

Viele Grüße,
Stefan Roese

-- 
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-51 Fax: (+49)-8142-66989-80 Email: sr@denx.de

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2022-10-27  7:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-07-13  7:32 [PATCH] drivers: mmc: Reset watchdog when accessing mmc device qianfanguijin
     [not found] ` <CGME20220726083134epcas1p1da8e13a4364d556e820f3d45b1686b8a@epcas1p1.samsung.com>
2022-07-26  8:31   ` Jaehoon Chung
2022-08-30  3:43     ` qianfan
2022-10-26  9:18       ` Jaehoon Chung
2022-10-27  6:49         ` qianfan
2022-10-27  7:03           ` Stefan Roese

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).