Anyone can help me about do_write_buffer at cfi_cmdset_0002
Qi Zhang
qzhan2009 at gmail.com
Tue Sep 7 21:18:51 EDT 2010
Hello:
In functions
do_write_buffer @ drivers/mtd/chips/cfi_cmdset_0002.c.
...
map_write(map, CMD(0x29), cmd_adr);
/* send buffer program command */
chip->state = FL_WRITING;
/* change chip state */
INVALIDATE_CACHE_UDELAY(map, chip, adr, map_bankwidth(map),
chip->word_write_time);
/* why word_write_time? */
...
Struct flchip already have "buffer_write_time",
seems it should replace the "word_write_time".
Both of thems come from the cfi_ident's
"WordWriteTimeoutTyp" and "BufWriteTimeoutTyp",
which indicate the real flash performance on word program
and buffer program and usually they are quite different.
Further more, the cfi_ident also have
"WordWriteTimeoutMax", "BufWriteTimeoutMax",
but the real implementation igore them as below
......
unsigned long uWriteTimeout = ( HZ / 1000 ) + 1;
....
INVALIDATE_CACHE_UDELAY(map, chip, adr, map_bankwidth(map),
chip->word_write_time);
timeo = jiffies + uWriteTimeout;
for (;;) {
......
if (time_after(jiffies, timeo) && !chip_ready(map, adr))
break;
......
}
The max time out will be "word_write_time" + "uWriteTimeOut"
Let's look at Intel M29EW flash's CFI spec.
WordWriteTimeoutTyp : 512us
BufWriteTimeoutTyp : 1024us
WordWriteTimeoutMax: 1024us
BufWriteTimeoutMax: 4096us
for HZ = 100, that will be ok since 1 tick 10ms
But for HZ = 1000, we got only 2.5ms ( 512us + 2 ticks),
and 3ms (1024us + 2 ticks)
(when replaced word_write_time with buf_write_time).
Both are not met 4096us spec.
Does anybody can help on that?
Thanks
Zhang Qi
More information about the linux-mtd
mailing list