[U-Boot] JFFS2 Loading Error on non 8k blocksize NAND [DEMO PATCH 1/1]
Scott Wood
scottwood at freescale.com
Mon Jan 4 19:21:06 CET 2010
On Mon, Dec 21, 2009 at 09:37:02PM +0100, Wolfgang Denk wrote:
> > --- 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
>
> If you change the definition of NAND_PAGE_SIZE, then the value of
> NAND_PAGE_SHIFT makes no longer sense. Having a close look it is not
> used anywhere in the code, so I recommend to simply delete this line.
> While doing this, please also delete the (likewise unsued) definition
> of ONENAND_PAGE_SHIFT.
Also note that the page size is sometimes determined dynamically -- not all
boards define CONFIG_SYS_NAND_PAGE_SIZE, and it's only used by some NAND
boot code.
If this code really needs to know the page size, it should use
mtd->writesize -- but it looks like it doesn't use it for anything other
than calculating the size of the cache.
> > #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)
>
> I think here we should remove the "#ifndef NAND_CACHE_PAGES" /
> "#endif" lines and change all remaining definitions of
> NAND_CACHE_PAGES in old board config files
> (include/configs/CATcenter.h,
> include/configs/PPChameleonEVB.h,
> include/configs/NC650.h, and
> include/configs/SIMPC8313.h) into CONFIG_SYS_NAND_PAGE_COUNT.
This doesn't seem to be CONFIG_SYS material, but rather a software choice of
how large a cache for JFFS2 to create.
It should perhaps be renamed something like CONFIG_JFFS2_NAND_CACHE_SIZE --
and maybe specified in terms of bytes rather than number of pages? If it
even needs to be tunable at all...
-Scott
More information about the U-Boot
mailing list