Project

General

Profile

NAND memory map question

Added by Anonymous over 10 years ago

Hi,
We are currently running the AM3352 cpu module and was hoping for some clarification on where everything sits in
NAND as certain comments in files don't seem to line up with TI's wiki pages or the mityarm335x.h file
in /include/configs. Let me clarify what I'm seeing.

mityarm335x.h

/* NAND boot config /
/
MityARM-335X NAND is MT29F2G08ABAEAWP

- Page size x8: 2112 bytes (2048 + 64 bytes)
- Block size: 64 pages (128K + 4K bytes)
- Plane size: 2 planes x 1024 blocks per plane
- Device size: 2Gb: 2048 blocks
Block Offset Description
0 0 uBoot-MLO
1 20000 uBoot-MLO (copy 1)
2 40000 uBoot-MLO (copy 2)
3 60000 uBoot-MLO (copy 3)
4 80000 uBoot Environment
5 A0000 uBoot Environment (copy) <<-- Comments suggest Uboot env follows the MLO copies.
6 C0000 uBoot Image
9 F0000 uBoot Image (copy)
12 120000 ubifs root filesystem (64MB)
524 4180000 ubifs user filesystem (190MB)
*/

#define CONFIG_SYS_NAND_U_BOOT_OFFS 0x80000 <<-- This is where we currently put our Uboot image.

#define MNAND_ENV_OFFSET (0x260000) /* environment starts here */
#define CONFIG_ENV_ADDR MNAND_ENV_OFFSET <<-- CONFIG_ENV_ADDR appears to be used by the saveenv() function in env_onenand.c
-- which would indicate that the uBoot Env is save to 0x260000.

So is this the real memory map?
0x0 MLO
0x80000 uBoot image
0x260000 uBoot env

Also does Uboot automatically handle if a NAND block goes bad (say block 0 goes bad so primary MLO is kaput, will the processor go to the next NAND block 1
(0x20000) to try the next MLO?

Thanks,
John C.


Replies (7)

RE: NAND memory map question - Added by Jonathan Cormier over 10 years ago

Could you please provide a reference to these TI wiki pages?

What git repo did you locate the referenced mityarm335x.h file?

Does this wiki page help? http://support.criticallink.com/redmine/projects/armc8-platforms/wiki/UBIFS_Nand_Boot#NAND-Partition-Table

The TI processor bootcode will check the first 4 blocks for a valid MLO and use the first one found. If a block goes bad and the MLO in that block no longer passes the checksum then the bootcode will skip it and check the next one.

-Jonathan

RE: NAND memory map question - Added by Anonymous over 10 years ago

Hi Jonathan,
Here is the wiki for the AM335x Uboot users guide:
http://processors.wiki.ti.com/index.php/AM335x_U-Boot_User%27s_Guide#SPI_2

The mityarm335x.h is from the latest git repo as described on your wiki:
http://support.criticallink.com/redmine/projects/armc8-platforms/wiki/Das_U-Boot_Port

The wiki link you gave does clarify that the processor does check the NAND block
for errors. But I do notice that there is only one uboot image put into NAND. This
suggests that MLO does not do the same type of check to verify that uboot is
good (uboot is built as an image.) So when I see the mityarm335x.h comments the
environment seems to be in the wrong location, but the there are/could be multiple
uboot images. It seems to make sense that if there backups of MLO, then there should
be at least one backup of uboot as they are both stored in NAND flash.

So is the .h file correct and MLO does check for more than one uboot or was it
referring to a different memory map?

Thanks,
John C.

RE: NAND memory map question - Added by Jonathan Cormier over 10 years ago

John,

Thanks for the clarification, I was looking in the kernel repository not the U-boot one.

I am not too familiar with the u-boot mlo implementation. I'm not sure what it would take to have the MLO support two locations for the u-boot image.

My guess though is that its not as vital as both the MLO and U-boot image has the nand driver which can auto skip marked bad blocks when reading and writing. We use the "nand.i write" specifically to make sure we don't write data to any known bad blocks and since the u-boot partition is effectively read-only (only writes when programming partition) a block shouldn't go bad. The nand driver also uses BCH-8 error correction which should allow 8-bits of error correction per block.

Ok I see where you were referencing. http://support.criticallink.com/gitweb/?p=u-boot-mityarm-335x.git;a=blob;f=include/configs/mityarm335x.h;h=9f0fddb73dff9620959a3860acd62ad76b1c59b4;hb=HEAD#l196. The comment you mentioned appears to be out of date. Possibly copied from TIs u-boot support or our L138 module.

The MTDPARTS_DEFAULT value more accurately references the partition scheme we've been using.
http://support.criticallink.com/gitweb/?p=u-boot-mityarm-335x.git;a=blob;f=include/configs/mityarm335x.h;h=9f0fddb73dff9620959a3860acd62ad76b1c59b4;hb=HEAD#l367

RE: NAND memory map question - Added by Jonathan Cormier over 10 years ago

So looking in the following file you can see that there is support in the MLO for having a redundant environment partition, although we don't use it. It would probably not be difficult for someone to also add a redundant u-boot partition in the same file.

arch/arm/cpu/armv7/omap-common/spl_nand.c
http://support.criticallink.com/gitweb/?p=u-boot-mityarm-335x.git;a=blob;f=arch/arm/cpu/armv7/omap-common/spl_nand.c;h=af02a595571c4eea509abefde84a6ab72bb06cc2;hb=HEAD

Note that you can look through the README in the repo to get information on various supported #defines.
http://support.criticallink.com/gitweb/?p=u-boot-mityarm-335x.git;a=blob;f=README;h=a43da97a4149db3bf9cea0a1b9e02ef69eee9802;hb=HEAD#l2780

RE: NAND memory map question - Added by Anonymous over 10 years ago

Jonathan,
Thanks much as your last two posts help tremendously. Our biggest concern with using NAND for both the u-boot images
(and our own) was having a block go bad. We did not want our units to end up dying in the field because a block had gone bad
and wiped our image. I had looked at the s_init() code hoping to track how MLO got to the code to load u-boot, but did not
get far, so your link for spl_nand.c was nice. We have done slight modifications to u-boot to support out spi flash, so I
could look into what it would take to add a redundant u-boot.
Thanks again for all the help.
John C.

RE: NAND memory map question - Added by Jonathan Cormier over 10 years ago

Thanks for the status update. Let us know how it turns out.

-Jonathan

    (1-7/7)
    Go to top
    Add picture from clipboard (Maximum size: 1 GB)