Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 144743
b: refs/heads/master
c: cd1a6de
h: refs/heads/master
i:
  144741: 336211a
  144739: 623e655
  144735: 1b57bf3
v: v3
  • Loading branch information
Peter Horton authored and David Woodhouse committed May 8, 2009
1 parent b0d9061 commit 368e437
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 3f33b0aaac4e208579fe5aa2964857d4e9ba10c5
refs/heads/master: cd1a6de7d4a492bf3405a6c070075a4cb8c90262
16 changes: 8 additions & 8 deletions trunk/drivers/mtd/devices/m25p80.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 1000000
#define MAX_READY_WAIT_JIFFIES (10 * HZ) /* eg. M25P128 specs 6s max sector erase */
#define CMD_SIZE 4

#ifdef CONFIG_M25PXX_USE_FAST_READ
Expand Down Expand Up @@ -139,20 +139,20 @@ static inline int write_enable(struct m25p *flash)
*/
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.
*/
for (count = 0; count < MAX_READY_WAIT_COUNT; count++) {
deadline = jiffies + MAX_READY_WAIT_JIFFIES;

do {
if ((sr = read_sr(flash)) < 0)
break;
else if (!(sr & SR_WIP))
return 0;

/* REVISIT sometimes sleeping would be best */
}
cond_resched();

} while (!time_after_eq(jiffies, deadline));

return 1;
}
Expand Down

0 comments on commit 368e437

Please sign in to comment.