[U-Boot] [PATCH] Fix OneNAND ipl to read 256KB
Wolfgang Denk
wd at denx.de
Sun Mar 8 23:44:57 CET 2009
Dear Rohit Hagargundgi,
In message <49AE99C0.9040400 at samsung.com> you wrote:
> Hi,
>
> Here is the updated patch.
>
> Thanks,
> Rohit
This is not an acceptable commit message.
Please include a reasonable commit message that explains what you are
doinbg and why.
> Signed-off-by: Rohit Hagargundgi <h.rohit at samsung.com>
> ---
Comments must go below this "---" line, not above.
> include/configs/apollon.h | 1 +
> onenand_ipl/onenand_read.c | 27 ++++++++++++++++++++-------
> 2 files changed, 21 insertions(+), 7 deletions(-)
>
> diff --git a/include/configs/apollon.h b/include/configs/apollon.h
> index dff47fc..2e8198f 100644
> --- a/include/configs/apollon.h
> +++ b/include/configs/apollon.h
> @@ -254,6 +254,7 @@
>
> /* OneNAND boot, OneNAND has CS0, NOR boot ONeNAND has CS2 */
> #define CONFIG_SYS_ONENAND_BASE 0x00000000
> +#define CONFIG_SYS_MONITOR_LEN SZ_256K /* U-Boot image size */
> #define CONFIG_ENV_IS_IN_ONENAND 1
> #define CONFIG_ENV_ADDR 0x00020000
Your patch is white-space corrupted. Please fix your mailer settings.
> int onenand_read_block0(unsigned char *buf)
> {
> - int page, offset = 0;
> + int block = 0, page, offset = 0;
Please don;t mix uninitialized and initialized variables on one line.
> int pagesize = ONENAND_PAGE_SIZE;
> + int nblocks = CONFIG_SYS_MONITOR_LEN / (ONENAND_PAGES_PER_BLOCK * ONENAND_PAGE_SIZE);
Line too long.
> + page = ONENAND_START_PAGE;
> + for (; block < nblocks; block++) {
-----------------------^^^^^^^^
> + for (; page < ONENAND_PAGES_PER_BLOCK; page++) {
> + if (onenand_read_page(block, page, buf + offset, pagesize)) {
> + /* This block is bad. Skip it and read next block */
> + nblocks++;
--------------------------------^^^^^^^^^^
> + break;
> + }
> + offset += pagesize;
> + }
> + page = 0;
I always consider it a design problem when the loop limits get changed
within the loop. While legal C, it always gives me the creeps.
Best regards,
Wolfgang Denk
--
DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de
Politics: A strife of interests masquerading as a contest of
principles. The conduct of public affairs for private advantage.
- Ambrose Bierce
More information about the U-Boot
mailing list