[PATCH] powerpc/shared/flash/flash.c: Erase required only if changing 0 to 1

Thomas Doerfler Thomas.Doerfler at embedded-brains.de
Fri Jan 17 08:12:32 UTC 2014

Hi Nick,

without looking into the details of this patch: According to your
description, I see two possible issues, depending on the real flash
device used:

1.) Some devices data sheets explicitly allow only ONE program cycle per
byte/word after an erase cycle.
- Even when programming a '1' into a cell, some charge may trickle and
if that happens multiple times, a '1' may come closer to the '1'->'0'
boundary. Charge leakage over the years may then loose the intended
content of the cell much earlier than the data rentention time mentioned
in the data sheet specifies. -> You may see data loss already after e.g.
2 years, and not only after 10 years.
- When a '0' is programmed into a cell multiple times without erasing it
first, it may get overcharged and therefore hold a voltage outside the
intended voltage band. This may overstress the device, reducing the
lifetime of the device.

2.) Some devices store a hidden ECC signature together with the user
data. For these devices, a flash line (e.g. 64 bit) can only be
programmed once without an intermediate erase, because even if only some
user data bits flips from 1 to 0, the new data pattern may end in a ECC
signature that switches some bits from 0 to 1.

Since your patch is shared code, it should only be applied if you made
sure that its behaviour is allowed for ALL devices that are handled with
this code.



Am 17.01.2014 02:50, schrieb Nick Withers:
> Hi all,
> The attached patch makes a (n admittedly not very pretty, but minimal)
> change to powerpc/shared/flash/flash.c so that it won't try to erase a
> flash segment just because the existing contents aren't all-1s. Now, so
> long as no bits would have to be changed from a 0 to a 1 an erase is not
> necessarily required.
> With this change I've been able to use the spansionFlash driver to bring
> up a JFFS2 file-system, reading and writing files, which failed without.
> _______________________________________________
> rtems-devel mailing list
> rtems-devel at rtems.org
> http://www.rtems.org/mailman/listinfo/rtems-devel

embedded brains GmbH
Thomas Doerfler
Dornierstr. 4
D-82178 Puchheim
email: Thomas.Doerfler at embedded-brains.de
Phone: +49-89-18 94 741-12
Fax: +49-89-18 94 741-09
PGP: Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

More information about the devel mailing list