From: apgmoorthy Date: Wed, 25 Mar 2009 21:19:21 +0530 Subject: [U-Boot] [PATCH 1/2] Fix OneNAND ipl to read CONFIG_SYS_MONITOR_LEN In-Reply-To: <20090323212514.GA30976@ld0162-tx32.am.freescale.net> References: <20090323212514.GA30976@ld0162-tx32.am.freescale.net> Message-ID: <3EDD04259A5F47CCB62BA3AEEC39C06D@sisodomain.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Hi Scott, On Tuesday, March 24, 2009 2:55 AM , Scott Wood wrote >> Please do find the updated patch below. >It's easier if updated patches are sent separately from the reply (both to avoid getting lost, >and to avoid having to manually strip discussion from the changelog). >> Signed-off-by: Gangheyamoorthy >> Signed-off-by: Rohit Hagargundgi > The signed-off-by lines should go in chronological order of handling; > thus, yours should be at the bottom (as the most recent one to touch or forward the patch). - Thanks, Will take care. >> + /* Check for invalid block mark */ >> + if (page < 2 && (onenand_readw(ONENAND_SPARERAM) != 0xffff)) >> + return 1; >Unnecessary parens. - I think , parens make it more readable. >> - * onenand_read_block - Read a block data to buf >> + * onenand_read_block - Read First 'n' consecutive Good blocks holding >> + * data to buf > "Read SYS_MONITOR_LEN from beginning of OneNAND, skipping bad blocks" - Changed it in Function Header. >> + int block = 0, page = ONENAND_START_PAGE, offset = 0; >> + int pagesize = 0, erase_shift =0; >> + int erasesize = 0, nblocks = 0; >s/=0/= 0/ >> + if(onenand_readw(ONENAND_REG_TECHNOLOGY)) { > Space after "if". - Corrected them. >> + } else { >> + pagesize = 2048; >> + erase_shift = 17; >> + } >> + erasesize = ONENAND_PAGES_PER_BLOCK * pagesize; >> + nblocks = (CONFIG_SYS_MONITOR_LEN + erasesize -1) >> erase_shift; >Blank line after the closing brace at the end of a block (except with a hanging else, or similar). >s/-1/- 1/ - Changed them. >> + for (; block < nblocks; block++) { >> + for (; page < ONENAND_PAGES_PER_BLOCK; page++) { > Why not do block = 0 and page = 0 here, rather than at the beginning > of the function and (in the case of page) at the end of the loop? - Initialized block in the for. With 'page' we need to start with page 1 in Block 0. >> + if (onenand_read_page(block, page, buf + offset, pagesize)) { >> + /* This block is bad. Skip it and read next block */ >Line length. - Resolved. With Regards Moorthy