Are erase suspends possible?
Hello,
I was looking through the code in cfi_cmdset_0001.c, and it appears that erase suspends are not implemented. Is this correct?
Suspends are needed by my logging routine, in which I'll be writing several bytes per second to flash in a circular buffer of blocks. I will have to erase the next block in the sequence while writing to the current block, to keep the logging as continuous as possible.
Thanks,
Derek Ross.
Quoted 2 lines · [email protected] said:
I was looking through the code in
cfi_cmdset_0001.c, and it appears that erase suspends are not implemented. Is this correct?
No. Erase suspend has been working for ages. What version of cfi_cmdset_0001.c are you looking at?
--
dwmw2
Quoted 6 lines
Quoted 2 lines · [email protected] said:
I was looking through the code in
cfi_cmdset_0001.c, and it appears that erase suspends are not implemented. Is this correct?No. Erase suspend has been working for ages. What version of
cfi_cmdset_0001.care you looking at?
Sorry, I'm still wrapping my brain around mtd.
I'm looking at a recent version, and it has
the function "cfi_intelext_suspend".
I was also looking at the function "do_write_oneword", and internally, it seems to halt if an erase is in progress.
Also, the function, do_erase_oneblock seems to
block during the erase.
What would be good for my application is if there
were two more functions:
"do_erase_oneblock_dont_wait",
which doesn't wait for the erase to finish, and
returns immediately,
and
"do_write_oneword_suspend_if_needed",
which will always write without delay, even
if it has to suspend an erase that's in progress.
I'm sure it wouldn't be difficult to write these
extra functions (especially "do_write_oneword_suspend_if_needed", which would just need an call to "cfi_intelext_suspend"), but I'm worried that it would
be impossible to call using /dev/mtd and ioctl calls.
Also, my app will effective deactivate any other
flash interaction during this phase, so I'm not
worried about JFFS interference.
Thanks,
Derek Ross.
Quoted 2 lines · [email protected] said:
I'm looking at a recent version, and it has the function "
cfi_intelext_suspend".
That's for power management.
Quoted 2 lines
"
do_erase_oneblock_dont_wait", which doesn't wait for the erase to finish, and returns immediately,
You should not be looking in there. You should be calling the mtd->read(), mtd->write() and mtd->erase() functions. The latter is already permitted to return immediately, calling a caller-provided callback later on completion.
The read function already suspends active erases to fulfil the read request. You can easily make the write function do the same, on chips that support it.
--
dwmw2
Quoted 7 lines
Quoted 2 lines · dross
"
do_erase_oneblock_dont_wait", which doesn't wait for the erase to finish, and returns immediately,dwmw2 replied:
You should not be looking in there. You should be calling themtd->read(),mtd->write()andmtd->erase()functions. The latter is already permitted to return immediately, calling a caller-provided callback later on completion.
Is that callback capability available in userspace? I'm looking in the file "util/erase.c" and it calls an ioctl with an erase_info_t, which is a typedef of erase_info_user, which doesn't have that callback function pointer.
Quoted 3 lines
The read function already suspends active erases to fulfil the read request. You can easily make the write function do the same, on chips that support it.
If I modified cfi_intelext_write_* to suspend erases in progress, would that screw up the operation of the JFFS2? Or would I have to supply a flag to turn that feature on and off depending on if JFFS is running?
Thanks,
Derek Ross.
Quoted 8 lines
If I modified cfi_intelext_write_* to suspend erases in progress, would that screw up the operation of the JFFS2? Or would I have to supply a flag to turn that feature on and off depending on if JFFS is running?
Thanks,
Derek Ross.
No, that would not screw up JFFS2. I submitted a patch a while ago that added that capability. Unfortnatly the patch was against an older cfi_cmdset0001.c than current CVS and it did not apply cleanly and I don't have the time to clean it up ATM.
see http://lists.infradead.org/pipermail/linux-mtd/2002-February/004117.html
Jocke