From mboxrd@z Thu Jan 1 00:00:00 1970 From: Derek Ou Date: Tue, 23 Dec 2008 14:44:54 -0700 Subject: [U-Boot] nand sector size is zero in jffs2 cmds In-Reply-To: <495038A4.5000509@siconix.com> References: <495038A4.5000509@siconix.com> Message-ID: <49515BD6.9030606@siconix.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de The "### ERROR ### Please RESET the board ###" error and the zero NAND sector size problem can be fixed by the following patch. However, the jffs2 scanning routine does not skip the bad blocks in NAND though. Derek ************* patch ************** index 7866c80..f6966f3 100644 --- a/common/cmd_jffs2.c +++ b/common/cmd_jffs2.c @@ -1853,6 +1853,8 @@ int mtdparts_init(void) if (part->size == SIZE_REMAINING) part->size = id->size - part->offset; + part->sector_size = nand_info[id->num].erasesize; + DEBUGF("part : name = %s, size = 0x%08lx, offset = 0x%08lx\n", part->name, part->size, part->offset); Derek Ou wrote: > Hi, all, > > When I tested jffs2 command for NAND, I found that jffs2_1pass.c:: > jffs2_1pass_build_lists() fails at > u32 nr_sectors = part->size/part->sector_size; > because part->sector_size is zero. And cause the "### ERROR ### > Please RESET the board ###" error when entering the for loop (i < > nr_sectors), I think. > > It looks like the sector_size was not updated in mtdparts_init(). > According to cmd_jffs2.c, the mtdparts_init in the #ifdef > CONFIG_JFFS2_CMDLINE section calls the parse_mtdparts() and eventually > reach the following lines in part_validate_nand(): > nand = &nand_info[id->num]; > part->sector_size = nand->erasesize; > However, the other mtdparts_init(), which is not in the #ifdef > CONFIG_JFFS2_CMDLINE section, does not call parse_mtdparts() and it > may lead to the part->sector_size not initialized. > > I am not totally familiar with this jffs2 and nand code. Can someone > review this? Thanks. > Derek >