NAND OTP operations (preliminary patch)

Werner Almesberger werner at
Wed Apr 18 06:30:31 CEST 2007

Hi Harald,

my first version of the NAND OTP code is in SVN:

It allows arbitrary reads within any OTP page, and writes of entire
pages (enforced by nand_write_ecc), with "nand read.otp" and
"nand write.otp". 

Addresses are "linearized", so OTP is in the area 0-0xBFF.

By the way, the OTP can be updated incrementally, so it's not strictly
"one time". If we want to put data there that really ought to be hard
to change, e.g., a serial number, we could protect it with an MD5 hash
or similar.

We could store data in the form of strings "foo=bar", followed by a
checksum/CRC/hash. u-boot could then scan some or all of the OTP pages
for such strings, and load them into its environment.

A byte with value 0 at the place of the first character of a string
would be skipped, so entries could be "erased" by overwriting them
with zeroes. A 0xff byte would indicate the end of the strings in the
current page.

Ideally, I'd supporting writing only from under Linux, to keep that
somewhat complex code out of u-boot. (Writing should also allow the
page to be selected, in case we have a pattern we know to cause

- Werner

 / Werner Almesberger, Buenos Aires, Argentina     werner at /

More information about the openmoko-uboot mailing list