[U-Boot] [PATCH] [ONENAND] Reduce OneNAND IPL code size v2

Kyungmin Park kmpark at infradead.org
Wed Dec 10 01:05:00 CET 2008


On Wed, Dec 10, 2008 at 5:50 AM, Scott Wood <scottwood at freescale.com> wrote:
> On Mon, Nov 10, 2008 at 01:53:46PM +0900, Kyungmin Park wrote:
>> 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.
>
> Sorry for the delay; I missed this patch earlier.
>
>> Signed-off-by: Kyungmin Park <kyungmin.park at samsung.com>
>> ---
>> diff --git a/cpu/arm1136/start.S b/cpu/arm1136/start.S
>> index e622338..132cc4a 100644
>> --- a/cpu/arm1136/start.S
>> +++ b/cpu/arm1136/start.S
>> @@ -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
>
> Can you do a branch-to-self here that will accomplish the same thing,
> without needing do_hang later?

So I don't understand the meaning. In general in restricted
environment, 1KiB bootloader.
There's no room to handle exception.

>
>> diff --git a/onenand_ipl/onenand_boot.c b/onenand_ipl/onenand_boot.c
>> index aff62d2..2440d8b 100644
>> --- a/onenand_ipl/onenand_boot.c
>> +++ b/onenand_ipl/onenand_boot.c
>> @@ -39,6 +39,7 @@ int print_info(void)
>>
>>  typedef int (init_fnc_t)(void);
>>
>> +#ifdef CONFIG_USE_ONENAND_INIT
>>  init_fnc_t *init_sequence[] = {
>
> Is there anything that's going to use this?  If not, just remove the
> code.

I just wonder if there are some user to use. If not no problem to remove.

>
>> +#ifdef CONFIG_USE_ONENAND_INIT
>>  void hang(void)
>>  {
>>       /* if board_hang() returns, hange here */
>>       printf("X-Loader hangs\n");
>>       for (;;);
>>  }
>> +#endif
>
> X-Loader?

It's code used at x-loader (cross nand bootloader).

>
>> diff --git a/onenand_ipl/onenand_ipl.h b/onenand_ipl/onenand_ipl.h
>> index 3387998..438e58c 100644
>> --- a/onenand_ipl/onenand_ipl.h
>> +++ b/onenand_ipl/onenand_ipl.h
>> @@ -23,7 +23,7 @@
>>
>>  #include <linux/mtd/onenand_regs.h>
>>
>> -#define ONENAND_BLOCK_SIZE              2048
>> +#define ONENAND_BLOCK_SIZE              0x20000
>
> This doesn't seem to be referenced at all any more.  Was the old value
> simply wrong?

It's used at onenand_boot.c but now it's not. It's also no problem to remove.

Thank you,
Kyungmin Park


More information about the U-Boot mailing list