public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* Are erase suspends possible?
@ 2002-04-01 22:44 Derek Ross
  2002-04-02  0:14 ` David Woodhouse
  0 siblings, 1 reply; 6+ messages in thread
From: Derek Ross @ 2002-04-01 22:44 UTC (permalink / raw)
  To: linux-mtd

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Are erase suspends possible?
  2002-04-01 22:44 Are erase suspends possible? Derek Ross
@ 2002-04-02  0:14 ` David Woodhouse
  2002-04-02 17:59   ` Derek Ross
  0 siblings, 1 reply; 6+ messages in thread
From: David Woodhouse @ 2002-04-02  0:14 UTC (permalink / raw)
  To: Derek Ross; +Cc: linux-mtd

dross@iders.ca 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Are erase suspends possible?
  2002-04-02  0:14 ` David Woodhouse
@ 2002-04-02 17:59   ` Derek Ross
  2002-04-03  0:38     ` David Woodhouse
  0 siblings, 1 reply; 6+ messages in thread
From: Derek Ross @ 2002-04-02 17:59 UTC (permalink / raw)
  To: linux-mtd

> dross@iders.ca 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?

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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Are erase suspends possible?
  2002-04-02 17:59   ` Derek Ross
@ 2002-04-03  0:38     ` David Woodhouse
  2002-04-03 15:35       ` Derek Ross
  0 siblings, 1 reply; 6+ messages in thread
From: David Woodhouse @ 2002-04-03  0:38 UTC (permalink / raw)
  To: Derek Ross; +Cc: linux-mtd

dross@iders.ca said:
> I'm looking at a recent version, and it has the function
> "cfi_intelext_suspend". 

That's for power management.


> "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

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: Are erase suspends possible?
  2002-04-03  0:38     ` David Woodhouse
@ 2002-04-03 15:35       ` Derek Ross
  2002-04-03 16:07         ` Joakim Tjernlund
  0 siblings, 1 reply; 6+ messages in thread
From: Derek Ross @ 2002-04-03 15:35 UTC (permalink / raw)
  To: linux-mtd

> dross said:
> > "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 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.

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.

> 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.

^ permalink raw reply	[flat|nested] 6+ messages in thread

* RE: Are erase suspends possible?
  2002-04-03 15:35       ` Derek Ross
@ 2002-04-03 16:07         ` Joakim Tjernlund
  0 siblings, 0 replies; 6+ messages in thread
From: Joakim Tjernlund @ 2002-04-03 16:07 UTC (permalink / raw)
  To: Derek Ross, linux-mtd

> 
> 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

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2002-04-03 16:08 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-01 22:44 Are erase suspends possible? Derek Ross
2002-04-02  0:14 ` David Woodhouse
2002-04-02 17:59   ` Derek Ross
2002-04-03  0:38     ` David Woodhouse
2002-04-03 15:35       ` Derek Ross
2002-04-03 16:07         ` Joakim Tjernlund

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox