[PATCH] drivers: mmc: Reset watchdog when accessing mmc device

qianfan qianfanguijin at 163.com
Tue Aug 30 05:43:02 CEST 2022



在 2022/7/26 16:31, Jaehoon Chung 写道:
> On 7/13/22 16:32, qianfanguijin at 163.com wrote:
>> From: qianfan Zhao <qianfanguijin at 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 at 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;



More information about the U-Boot mailing list