Reduce OneNAND IPL code size
PATCH 1/1 Reduce OneNAND IPL code size
To give more code at lowlevel_init at each boards
---
cpu/arm1136/start.S +2 -23
@@ -33,23 +33,7 @@ .globl _start _start: b reset #ifdef CONFIG_ONENAND_IPL - ldr pc, _hang - ldr pc, _hang - ldr pc, _hang - ldr pc, _hang - ldr pc, _hang - ldr pc, _hang - ldr pc, _hang - -_hang: - .word do_hang - .word 0x12345678 - .word 0x12345678 - .word 0x12345678 - .word 0x12345678 - .word 0x12345678 - .word 0x12345678 - .word 0x12345678 /* now 16*4=64 */ + . = _start + 64 /* now 16*4=64 */ #else ldr pc, _undefined_instruction ldr pc, _software_interrupt
@@ -362,12 +346,7 @@ cpu_init_crit: /* * exception handlers */ -#ifdef CONFIG_ONENAND_IPL - .align 5 -do_hang: - ldr sp, _TEXT_BASE /* use 32 words about stack */ - bl hang /* hang and never return */ -#else /* !CONFIG_ONENAND IPL */ +#ifndef CONFIG_ONENAND_IPL .align 5 undefined_instruction: get_bad_stack
onenand_ipl/onenand_boot.c +8 -6
@@ -39,6 +39,7 @@ int print_info(void)typedef int (init_fnc_t )(void ); +#ifdef CONFIG_USE_ONENAND_INIT init_fnc_t *init_sequence[] = { board_init,/* basic board dependent setup */ #ifdef CONFIG_SYS_PRINTF
@@ -47,24 +48,23 @@ init_fnc_t *init_sequence[] = {#endif NULL, }; +#endif void start_oneboot (void ) { -init_fnc_t **init_fnc_ptr;uchar *buf; +#ifdef CONFIG_USE_ONENAND_INIT +init_fnc_t **init_fnc_ptr;for (init_fnc_ptr = init_sequence; *init_fnc_ptr; ++init_fnc_ptr) {if ((*init_fnc_ptr)() !=0 )hang (); } +#endif buf = (uchar *)CONFIG_SYS_LOAD_ADDR ; -if (!onenand_read_block0 (buf)) - buf +=ONENAND_BLOCK_SIZE ; - -if (buf == (uchar *)CONFIG_SYS_LOAD_ADDR ) -hang (); +onenand_read_block0 (buf);/* go run U-Boot and never return */ printf ("Starting OS Bootloader...\n" );
@@ -73,9 +73,11 @@ void start_oneboot(void)/* should never come here */ } +#ifdef CONFIG_USE_ONENAND_INIT void hang (void ) {/* if board_hang() returns, hange here */ printf ("X-Loader hangs\n" );for (;;); } +#endif
onenand_ipl/onenand_ipl.h +2 -2
@@ -23,7 +23,7 @@#include <linux/mtd/onenand_regs.h> -#define ONENAND_BLOCK_SIZE 2048 +#define ONENAND_BLOCK_SIZE 0x20000#ifndef CONFIG_SYS_PRINTF #define printf(format, args...)
@@ -39,5 +39,5 @@#define ONENAND_PAGE_SIZE 2048 -extern int onenand_read_block0 (unsigned char *buf); +extern void onenand_read_block0 (unsigned char *buf);#endif
onenand_ipl/onenand_read.c +13 -11
@@ -1,5 +1,5 @@/* -* (C) Copyright 2005-2008 Samsung Electronis +* (C) Copyright 2005-2008 Samsung Electronics * Kyungmin Park <[email protected]> * * See file CREDITS for list of people who contributed to this
@@ -87,14 +87,16 @@ static inline int onenand_read_page(ulong block, ulong page,#define ONENAND_START_PAGE 1#define ONENAND_PAGES_PER_BLOCK 64 +#ifndef CONFIG_ONENAND_END_BLOCK +#define CONFIG_ONENAND_END_BLOCK 1 +#endif /** * onenand_read_block - Read a block data to buf -* @return 0 on success */ -int onenand_read_block0 (unsigned char *buf) +void onenand_read_block0 (unsigned char *buf) { -int page, offset =0 ; +int block, page, offset =0 ;int pagesize =ONENAND_PAGE_SIZE ;/* MLC OneNAND has 4KiB page size */
@@ -103,12 +105,12 @@ int onenand_read_block0(unsigned char *buf)/* NOTE: you must read page from page 1 of block 0 */ /* read the block page by page*/ -for (page =ONENAND_START_PAGE ; - page <ONENAND_PAGES_PER_BLOCK ; page++) { - -onenand_read_page (0 , page, buf + offset, pagesize); - offset += pagesize; + page =ONENAND_START_PAGE ; +for (block =0 ; block <CONFIG_ONENAND_END_BLOCK ; block++) { +for (; page <ONENAND_PAGES_PER_BLOCK ; page++) { +onenand_read_page (block, page, buf + offset, pagesize); + offset += pagesize; + } + page =0 ; } - -return 0 ; }
PATCH 1/1 Reduce OneNAND IPL code size
Dear Kyungmin Park,
Quoted 1 line · In message <20081023005452.GA13453@july> you wrote:
To give more code at
lowlevel_initat each boards
Can you please describe exactly what thgis patch is supposed to do and what problem it is supposed to fix?
I cannot make heads nor tails from your descritpion, sorry.
Best regards,
Wolfgang Denk
Signature · 4 lines
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 Due to lack of disk space, this fortune database has been discontinued.
PATCH 1/1 Reduce OneNAND IPL code size
Quoted 9 lines · Wolfgang Denk
Dear Kyungmin Park,
Quoted 1 line · In message <20081023005452.GA13453@july> you wrote:
To give more code at
lowlevel_initat each boardsCan you please describe exactly what thgis patch is supposed to do and what problem it is supposed to fix?
I cannot make heads nor tails from your descritpion, sorry.
OneNAND IPL has common codes for RAM init, load data, and jump to 2nd bootloader, but it's common code used about 300~400 bytes. So board specific codes, such as lowlevel_init, can't has enough code. It make a difficult to implement OneNAND IPL.
This patch make this common code as small as possible. and give lowlevel_init can have more codes.
Thank you,
Kyungmin Park
PATCH 1/1 Reduce OneNAND IPL code size
Dear "Kyungmin Park",
Quoted 11 lines · In message <[email protected]> you…
Quoted 9 lines · Wolfgang Denk
Dear Kyungmin Park,
Quoted 1 line · In message <20081023005452.GA13453@july> you wrote:
To give more code at
lowlevel_initat each boardsCan you please describe exactly what thgis patch is supposed to do and what problem it is supposed to fix?
I cannot make heads nor tails from your descritpion, sorry.
Quoted 7 lines
OneNAND IPL has common codes for RAM init, load data, and jump to 2nd bootloader, but it's common code used about 300~400 bytes. So board specific codes, such as
lowlevel_init, can't has enough code. It make a difficult to implement OneNAND IPL.This patch make this common code as small as possible. and give
lowlevel_initcan have more codes.
Please add this explanation to the commit message, then. Otherwise it is not possible to understand the rationale for the change.
Best regards,
Wolfgang Denk
Signature · 5 lines
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 No man knows what true happiness is until he gets married. By then, of course, its too late.