[U-Boot] [PATCH] README: Add new NAND env features

CONFIG_ENV_SIZE only needs page alignment, not block
Document CONFIG_ENV_RANGE and CONFIG_ENV_OFFSET_OOB.
Signed-off-by: Scott Wood scottwood@freescale.com --- README | 22 +++++++++++++++++++--- 1 files changed, 19 insertions(+), 3 deletions(-)
diff --git a/README b/README index aa11c37..4d95a8b 100644 --- a/README +++ b/README @@ -2551,16 +2551,32 @@ to save the current settings. These two #defines specify the offset and size of the environment area within the first NAND device.
- - CONFIG_ENV_OFFSET_REDUND + - CONFIG_ENV_OFFSET_REDUND (optional):
This setting describes a second storage area of CONFIG_ENV_SIZE size used to hold a redundant copy of the environment data, so that there is a valid backup copy in case there is a power failure during a "saveenv" operation.
+ - CONFIG_ENV_RANGE (optional): + + Specifies the length of the region in which the environment + can be written. This should be a multiple of the NAND device's + block size. Specifying a range with more erase blocks than + are needed to hold CONFIG_ENV_SIZE allows bad blocks within + the range to be avoided. + + - CONFIG_ENV_OFFSET_OOB (optional): + + Enables support for dynamically retrieving the offset of the + environment from block zero's out-of-band data. The + "nand env.oob" command can be used to record this offset. + Currently, CONFIG_ENV_OFFSET_REDUND is not supported when + using CONFIG_ENV_OFFSET_OOB. + Note: CONFIG_ENV_OFFSET and CONFIG_ENV_OFFSET_REDUND must be aligned - to a block boundary, and CONFIG_ENV_SIZE must be a multiple of - the NAND devices block size. + to an erase block boundary, and CONFIG_ENV_SIZE must be a multiple + of the NAND device's page size.
- CONFIG_NAND_ENV_DST

On Fri, Sep 17, 2010 at 3:43 PM, Scott Wood scottwood@freescale.com wrote:
CONFIG_ENV_SIZE only needs page alignment, not block
Document CONFIG_ENV_RANGE and CONFIG_ENV_OFFSET_OOB.
Signed-off-by: Scott Wood scottwood@freescale.com
- - CONFIG_ENV_OFFSET_OOB (optional):
- Enables support for dynamically retrieving the offset of the
- environment from block zero's out-of-band data. The
- "nand env.oob" command can be used to record this offset.
- Currently, CONFIG_ENV_OFFSET_REDUND is not supported when
- using CONFIG_ENV_OFFSET_OOB.
Looks good (CONFIG_ENV_OFFSET_REDUND + CONFIG_ENV_OFFSET_OOB is on my TODO-list still).
Reviewed-by: Ben Gardiner bengardiner@nanometrics.ca
Best Regards, Ben Gardiner
--- Nanometrics Inc. http://www.nanometrics.ca

Dear Scott Wood,
In message 20100917194327.GA17192@udp111988uds.am.freescale.net you wrote:
CONFIG_ENV_SIZE only needs page alignment, not block
Document CONFIG_ENV_RANGE and CONFIG_ENV_OFFSET_OOB.
I appreciate your efforts, but I think we should also fix the code.
For me it seems important to keep concepts identical no matter which kind of storage device is used. The first implementations of the envrionment used either NOR flash or EEPROMs (I2C or SPI attached) for storage.
Here, CONFIG_ENV_SIZE defines the actually used part of the available storage medium.
For example, on NOR flash we might see an erase block size of 256 KiB (resulting in a "#define CONFIG_ENV_SECT_SIZE (256 << 10)" or similar). But normally we don't need so much space for the environment, so we set CONFIG_ENV_SIZE to (for example) 16 KiB. The advantage is that with this setting the checksum calculation includes only CONFIG_ENV_SIZE, which can be a measurable difference in boot time.
So CONFIG_ENV_SIZE is supposed to mean the actually available size for the envrionment, and there are no alignment or other requirements for it. It is perfectly legal to "#define CONFIG_ENV_SIZE 12345" or similar.
I would like to keep this meaning consistent for other storage types, including NAND. If the current code (mis-) uses CONFIG_ENV_SIZE in a way that needs any form of alignment to the NAND device geometry, this code is broken and should be fixed.
Best regards,
Wolfgang Denk

On Fri, 17 Sep 2010 22:47:04 +0200 Wolfgang Denk wd@denx.de wrote:
For example, on NOR flash we might see an erase block size of 256 KiB (resulting in a "#define CONFIG_ENV_SECT_SIZE (256 << 10)" or similar). But normally we don't need so much space for the environment, so we set CONFIG_ENV_SIZE to (for example) 16 KiB. The advantage is that with this setting the checksum calculation includes only CONFIG_ENV_SIZE, which can be a measurable difference in boot time.
The largest NAND page size that I'm aware of is 8 KiB (with 2 or 4 KiB currently being more common), so it's not as burdensome a restriction -- and NOR flash doesn't have the concept of a NAND-style page; you can write a word at a time.
However, I was looking at the master branch when I wrote that. I forgot that in my next branch, I have a patch that removes this requirement (there was existing read-modify-write code, but it was blocked by an unnecessary check in nand_do_write_ops). :-)
I'll respin the README patch.
-Scott
participants (3)
-
Ben Gardiner
-
Scott Wood
-
Wolfgang Denk