flash write, erase & timeouts

David Woodhouse dwmw2 at infradead.org
Mon Jul 31 03:38:51 EDT 2000

nick at auriga.ru said:
>  Could anyone please explain the following thing which I see in
> cfi_cmdset_0001.c.

> After writing a Program command and data we are do udelay(chip->
> word_write_time), but when erasing a sector we instead call
> schedule_timeout(HZ) as the Erase command is written. Is it just
> ocassionally or there is a point in doing that way?

We expect the Program command to take around 128 µs, and we don't want to 
schedule() for that period of time because we wouldn't get the CPU back 
quickly enough - so we just drop all the locks and use udelay(). 

What you're looking at is roughly the form of the final implementation of 
the Program command.

The Erase command, on the other hand, is expected to take around a second, 
so we're happy to schedule() and wait for it. In fact, the intention is 
that the erase() function call should return immediately, and that the 
completion should be detected by a timer call, which calls the callback 
function in the erase instruction structure. 


To unsubscribe, send "unsubscribe mtd" to majordomo at infradead.org

More information about the linux-mtd mailing list