lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Fri, 17 Apr 2009 09:22:21 +0100
From:	Peter Horton <phorton@...box.co.uk>
To:	dedekind@...radead.org
Cc:	Peter Horton <zero@...onel-panic.org>, dwmw2@...radead.org,
	linux-mtd@...ts.infradead.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH] mtd: fix timeout in M25P80 driver

Artem Bityutskiy wrote:
> On Mon, 2009-04-13 at 15:26 +0100, Peter Horton wrote:
>> Extend erase timeout in M25P80 SPI Flash driver.
>>
>> The M25P80 drivers fails erasing sectors on a M25P128 because the ready
>> wait timeout is too short. Change the timeout from a simple loop count to a
>> suitable number of seconds.
>>
>> Signed-off-by: Peter Horton <zero@...onel-panic.org>
>> ---
>> Index: linux-2.6.29-git12/drivers/mtd/devices/m25p80.c
>> ===================================================================
>> --- linux-2.6.29-git12.orig/drivers/mtd/devices/m25p80.c	2009-04-12 21:41:16.000000000 +0000
>> +++ linux-2.6.29-git12/drivers/mtd/devices/m25p80.c	2009-04-12 21:43:01.000000000 +0000
>> @@ -54,7 +54,7 @@
>>  #define	SR_SRWD			0x80	/* SR write protect */
>>  
>>  /* Define max times to check status register before we give up. */
>> -#define	MAX_READY_WAIT_COUNT	100000
>> +#define	MAX_READY_WAIT_JIFFIES	(10 * HZ)	/* eg. M25P128 specs 6s max sector erase */
>>  #define	CMD_SIZE		4
>>  
>>  #ifdef CONFIG_M25PXX_USE_FAST_READ
>> @@ -145,20 +145,20 @@
>>   */
>>  static int wait_till_ready(struct m25p *flash)
>>  {
>> -	int count;
>> +	unsigned long deadline;
>>  	int sr;
>>  
>> -	/* one chip guarantees max 5 msec wait here after page writes,
>> -	 * but potentially three seconds (!) after page erase.
>> -	 */
> Why did you remove the comment? Is it wrong or useless?
> 

I moved the comment up to the definition of MAX_READY_WAIT_JIFFIES. 
Looking through the code I missed the fact the driver can generate "chip 
erase", on the M25P128 the maximum ready timeout for this is 250s !!!

P.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ