public inbox for linux-mtd@lists.infradead.org
 help / color / mirror / Atom feed
* curious questions
@ 2008-05-21  9:16 Markus Schiltknecht
  2008-05-21  9:38 ` Jörn Engel
  0 siblings, 1 reply; 4+ messages in thread
From: Markus Schiltknecht @ 2008-05-21  9:16 UTC (permalink / raw)
  To: linux-mtd

Hi,

I'm new to the list - and having lots of questions. Feel free to simply 
point me to earlier discussions or other resources. Even simple Yes or 
No answers might also do it ;-)

Having read through most of the infradead.org website (and others), I 
today realized, that erase blocks span *multiple* pages, which explains 
the huge difference in 'block size' sometimes cited (around 2K vs around 
128K).

Now, if I understand correctly, a flash chip supports reading and 
(limited) writing to pages, and erasing erase-blocks. But the MTD FAQ 
states:

 > (The mtd device) maintains 3 main operations: read from eraseblock,
 > write to eraseblock, and erase eraseblock

Am I understanding correctly, that I can't write to the a single page 
with MTD (after having erased the according erase-block)? Even if I'm 
writing the single pages in the block sequentially?


Can I repeatedly write to a NAND flash page, to set its bits to 1 
(without resetting any bit to 0) (or vice-versa for XOR)?


I've followed the 'hardware devices' cited on the website, but it seems 
a little out-dated. What's an inexpensive way to get a device with 
accessible NAND chips on it to play with? It looks to me like you only 
get to purchase stuff with embedded FTL, which isn't suitable as an mtd.


Looking forward to your answers, hints and pointers.

Markus

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

* Re: curious questions
  2008-05-21  9:16 curious questions Markus Schiltknecht
@ 2008-05-21  9:38 ` Jörn Engel
  2008-05-21  9:52   ` Markus Schiltknecht
  0 siblings, 1 reply; 4+ messages in thread
From: Jörn Engel @ 2008-05-21  9:38 UTC (permalink / raw)
  To: Markus Schiltknecht; +Cc: linux-mtd

On Wed, 21 May 2008 11:16:45 +0200, Markus Schiltknecht wrote:
> 
> Am I understanding correctly, that I can't write to the a single page 
> with MTD (after having erased the according erase-block)? Even if I'm 
> writing the single pages in the block sequentially?

You can erase no less than one erase-block.  For NAND, you cannot easily
write less than one page.  Sometimes subpage writes work, sometimes they
don't, they have strange limitations and are best ignored in the
beginning.

> Can I repeatedly write to a NAND flash page, to set its bits to 1 
> (without resetting any bit to 0) (or vice-versa for XOR)?

Erase sets bits to 1, writes sets them to 0.

With old NOR flashes, you can repeatedly write the same area to flip
single bits.  Writes with all 1's are essentially noops, so to set a
single bit write a word will all but one bit set to 1.  With ECC you'd
have to flip bits on the ECC backwards, which doesn't work.  NAND has
ECC, so ordinarily this trick won't work.

Theoretically you could still use it, since ECC can be done in software
- using any algorithm you like including none.  But practically many
chips seem to misbehave if you violate the spec and repeatedly write to
the same area.  So don't.

Jörn

-- 
People will accept your ideas much more readily if you tell them
that Benjamin Franklin said it first.
-- unknown

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

* Re: curious questions
  2008-05-21  9:38 ` Jörn Engel
@ 2008-05-21  9:52   ` Markus Schiltknecht
  2008-05-21 10:01     ` Jörn Engel
  0 siblings, 1 reply; 4+ messages in thread
From: Markus Schiltknecht @ 2008-05-21  9:52 UTC (permalink / raw)
  To: Jörn Engel; +Cc: linux-mtd

Hi,

thanks for your quick answer!

Jörn Engel wrote:
> You can erase no less than one erase-block.  For NAND, you cannot easily
> write less than one page.  Sometimes subpage writes work, sometimes they
> don't, they have strange limitations and are best ignored in the
> beginning.

So, with mtd, I can erase the erase-block spanning pages 0 to 63, and 
then, write to page 0, wait for more data and only then write page 1, right?

>> Can I repeatedly write to a NAND flash page, to set its bits to 1 
>> (without resetting any bit to 0) (or vice-versa for XOR)?
> 
> Erase sets bits to 1, writes sets them to 0.

Ah, that applies to NAND as well as NOR, good.

> With old NOR flashes, you can repeatedly write the same area to flip
> single bits.  Writes with all 1's are essentially noops, so to set a
> single bit write a word will all but one bit set to 1.  With ECC you'd
> have to flip bits on the ECC backwards, which doesn't work.  NAND has
> ECC, so ordinarily this trick won't work.

Yeah, ECC certainly wouldn't work for that. Good explanation, thanks.

Markus

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

* Re: curious questions
  2008-05-21  9:52   ` Markus Schiltknecht
@ 2008-05-21 10:01     ` Jörn Engel
  0 siblings, 0 replies; 4+ messages in thread
From: Jörn Engel @ 2008-05-21 10:01 UTC (permalink / raw)
  To: Markus Schiltknecht; +Cc: linux-mtd

On Wed, 21 May 2008 11:52:14 +0200, Markus Schiltknecht wrote:
> 
> So, with mtd, I can erase the erase-block spanning pages 0 to 63, and
> then, write to page 0, wait for more data and only then write page 1, right?

You can also erase/write other blocks in the meantime.

Jörn

-- 
Time? What's that? Time is only worth what you do with it.
-- Theo de Raadt

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

end of thread, other threads:[~2008-05-21 10:01 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-05-21  9:16 curious questions Markus Schiltknecht
2008-05-21  9:38 ` Jörn Engel
2008-05-21  9:52   ` Markus Schiltknecht
2008-05-21 10:01     ` Jörn Engel

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