[U-Boot] JFFS2 Loading Error on non 8k blocksize NAND [DEMO PATCH 1/1]

Hunter Cobbs hunter.cobbs at gmail.com
Tue Dec 15 22:41:31 CET 2009


Hello everyone.  Well, this is my first post on the list and its to announce
a small bug that I've found when using JFFS2 on NAND in UBoot.

This issue was seen only once volume production was started on a new device.
 However, its a simple fix and I'm including my temporary patch for it at
the end

Basically, when using the "fsload" command to read our kernel from NAND
flash in preparation for boot, a small percentage of our partitions were
displaying a CRC error on boot.  Upon investigation, I noticed the fsload
application skipping over bad erase blocks of 8k in size.  This is to be
expected, except that our NAND flash has 128k block sizes.  In certain
cases, we get a bad eraseblock in just the wrong location that then causes
us to read invalid information for a kernel image.

Upon tracking this down, it appears that the jffs2_1pass.c is using older
system configuration variables instead of the newer CONFIG_SYS_ prefixed
variables.  It also had the Page size hard coded to 512.  Included is my
patch that makes the code functional for properly-configured boards with new
code, but its a demo only as this code probably needs a little bit of
refactoring and cleanup so that its more generic in nature.

---------------------  Patch Snip ---------------------
diff -ruN u-boot/fs/jffs2/jffs2_1pass.c uboot/fs/jffs2/jffs2_1pass.c
--- u-boot/fs/jffs2/jffs2_1pass.c 2009-12-15 14:20:33.000000000 -0600
+++ uboot/fs/jffs2/jffs2_1pass.c 2009-12-15 14:19:27.000000000 -0600
@@ -158,12 +158,12 @@
  *
  */

-#define NAND_PAGE_SIZE 512
+#define NAND_PAGE_SIZE CONFIG_SYS_NAND_PAGE_SIZE
 #define NAND_PAGE_SHIFT 9
 #define NAND_PAGE_MASK (~(NAND_PAGE_SIZE-1))

 #ifndef NAND_CACHE_PAGES
-#define NAND_CACHE_PAGES 16
+#define NAND_CACHE_PAGES CONFIG_SYS_NAND_PAGE_COUNT
 #endif
 #define NAND_CACHE_SIZE (NAND_CACHE_PAGES*NAND_PAGE_SIZE)

----------------------------------------------------------

-- 
Hunter Cobbs


More information about the U-Boot mailing list