diff mbox

[U-Boot,RFC] ARM: mx31pdk: Use the new relocation scheme

Message ID 4D4E8E11.2010906@gmail.com
State Superseded
Headers show

Commit Message

Magnus Lilja Feb. 6, 2011, 12:03 p.m. UTC
Hi all

On 01/14/2011 07:33 PM, Fabio Estevam wrote:
> Hi Stefano,
> 
> On 1/13/2011 11:38 AM, Stefano Babic wrote:
>> On 01/12/2011 01:49 PM, Fabio Estevam wrote:
>>> Hi,
>>
>> Hi Fabio,
>>
>>>
>>> I am trying to make the new relocation scheme to work on the mx31pdk board.
>>>
>>> With this patch applied the mx31pdk build works, but not able to get a U-boot prompt yet.
>>
>> I have tried to imagine some issues, but I cannot find a clear reason.
>> Building with your patch I checked that nand_spl is still less than 2KB
>> code, and that matches the NAND page, as required by i.MX31 - so it is
>> not a problem.
>>
>> Have you tried to disable the relocation, just to check if the
>> relocation is an issue with CONFIG_SKIP_RELOCATE_UBOOT ? This is not a
>> solution, but only to check what happens.

I've done some testing now and ended up comparing start.S for ARM1136 with ARM926EJS since
the latter is used on the Karo TX25 board which seems to have been updated and
also boots from NAND.

The result is that applying the following patch on top of Fabios patch makes the i.MX31 PDK
boot from NAND. Booting Linux from TFTP works nicely. However the first few lines of output
from U-boot is missing, only the "NAND: 256 MB" line is shown. I haven't tried to understand
how booting works nowadays and why these changes work, perhaps someone with more insight
in the mechanisms can figure out the correct assembler code.

I have no idea if this breaks other boards but at least it's start for further work. I tried
it on the imx31 litekit (which boots from NOR) but that board doesn't seem to boot even before applying Fabios patch,
I'll see if I can figure out why that board is broken now. Don't know when though.

Regards, Magnus Lilja

Comments

Albert ARIBAUD Feb. 6, 2011, 3:07 p.m. UTC | #1
Le 06/02/2011 13:03, Magnus Lilja a écrit :
> Hi all
>
> On 01/14/2011 07:33 PM, Fabio Estevam wrote:
>> Hi Stefano,
>>
>> On 1/13/2011 11:38 AM, Stefano Babic wrote:
>>> On 01/12/2011 01:49 PM, Fabio Estevam wrote:
>>>> Hi,
>>>
>>> Hi Fabio,
>>>
>>>>
>>>> I am trying to make the new relocation scheme to work on the mx31pdk board.
>>>>
>>>> With this patch applied the mx31pdk build works, but not able to get a U-boot prompt yet.
>>>
>>> I have tried to imagine some issues, but I cannot find a clear reason.
>>> Building with your patch I checked that nand_spl is still less than 2KB
>>> code, and that matches the NAND page, as required by i.MX31 - so it is
>>> not a problem.
>>>
>>> Have you tried to disable the relocation, just to check if the
>>> relocation is an issue with CONFIG_SKIP_RELOCATE_UBOOT ? This is not a
>>> solution, but only to check what happens.
>
> I've done some testing now and ended up comparing start.S for ARM1136 with ARM926EJS since
> the latter is used on the Karo TX25 board which seems to have been updated and
> also boots from NAND.
>
> The result is that applying the following patch on top of Fabios patch makes the i.MX31 PDK
> boot from NAND. Booting Linux from TFTP works nicely. However the first few lines of output
> from U-boot is missing, only the "NAND: 256 MB" line is shown. I haven't tried to understand
> how booting works nowadays and why these changes work, perhaps someone with more insight
> in the mechanisms can figure out the correct assembler code.
>
> I have no idea if this breaks other boards but at least it's start for further work. I tried
> it on the imx31 litekit (which boots from NOR) but that board doesn't seem to boot even before applying Fabios patch,
> I'll see if I can figure out why that board is broken now. Don't know when though.
>
> Regards, Magnus Lilja
>
> diff --git a/arch/arm/cpu/arm1136/start.S b/arch/arm/cpu/arm1136/start.S
> index 12545c2..7d75ecf 100644
> --- a/arch/arm/cpu/arm1136/start.S
> +++ b/arch/arm/cpu/arm1136/start.S
> @@ -163,6 +163,9 @@ call_board_init_f:
>          bic     sp, sp, #7 /* 8-byte alignment for ABI compliance */
>          ldr     r0,=0x00000000
>
> +#if 1
> +       bl      board_init_f
> +#else
>   #ifdef CONFIG_NAND_SPL
>          bl      nand_boot
>   #else
> @@ -172,6 +175,7 @@ call_board_init_f:
>          bl      board_init_f
>   #endif /* CONFIG_ONENAND_IPL */
>   #endif /* CONFIG_NAND_SPL */
> +#endif
>
>   /*------------------------------------------------------------------------------*/
>
> @@ -266,11 +270,19 @@ clbss_l:str       r2, [r0]                /* clear loop...                    */
>    * initialization, now running from RAM.
>    */
>   #ifdef CONFIG_NAND_SPL
> +#if 1
> +       ldr     r0, _nand_boot_ofs
> +       mov     pc, r0
> +
> +_nand_boot_ofs:
> +       .word nand_boot
> +#else
>          ldr     r0, _nand_boot_ofs
>          adr     r1, _start
>          add     pc, r0, r1
>   _nand_boot_ofs:
>          .word nand_boot - _start
> +#endif
>   #else
>   jump_2_ram:
>          ldr     r0, _board_init_r_ofs
> _______________________________________________
> U-Boot mailing list
> U-Boot@lists.denx.de
> http://lists.denx.de/mailman/listinfo/u-boot

Can you repost the diff without those pesky '#if 1...#else...#endif' 
additions? Just take the current master code, do the changes needed to 
make it work without trying to keep the old lines around, then do the 
diff. I'll be easier for all to see the changes.

Amicalement,
Fabio Estevam Feb. 7, 2011, 11:32 a.m. UTC | #2
Hi Magnus,

On 2/6/2011 10:03 AM, Magnus Lilja wrote:
...

> I've done some testing now and ended up comparing start.S for ARM1136 with ARM926EJS since
> the latter is used on the Karo TX25 board which seems to have been updated and
> also boots from NAND.

Thanks for looking into this.
 
> The result is that applying the following patch on top of Fabios patch makes the i.MX31 PDK
> boot from NAND. Booting Linux from TFTP works nicely. However the first few lines of output
> from U-boot is missing, only the "NAND: 256 MB" line is shown. I haven't tried to understand
> how booting works nowadays and why these changes work, perhaps someone with more insight
> in the mechanisms can figure out the correct assembler code.

I think that the missing lines can be fixed by using a similar approach as to this patch:
http://git.denx.de/?p=u-boot.git;a=commitdiff;h=877eb0f91543dc5bca385bb6d22454b1d43f3e2d


> I have no idea if this breaks other boards but at least it's start for further work. I tried
> it on the imx31 litekit (which boots from NOR) but that board doesn't seem to boot even before applying Fabios patch,
> I'll see if I can figure out why that board is broken now. Don't know when though.

I will let others comment about the changes you did in arch/arm/cpu/arm1136/start.S
Will also try it later today.

Thanks,

Fabio Estevam
 
> Regards, Magnus Lilja
> 
> diff --git a/arch/arm/cpu/arm1136/start.S b/arch/arm/cpu/arm1136/start.S
> index 12545c2..7d75ecf 100644
> --- a/arch/arm/cpu/arm1136/start.S
> +++ b/arch/arm/cpu/arm1136/start.S
> @@ -163,6 +163,9 @@ call_board_init_f:
>         bic     sp, sp, #7 /* 8-byte alignment for ABI compliance */
>         ldr     r0,=0x00000000
> 
> +#if 1
> +       bl      board_init_f
> +#else
>  #ifdef CONFIG_NAND_SPL
>         bl      nand_boot
>  #else
> @@ -172,6 +175,7 @@ call_board_init_f:
>         bl      board_init_f
>  #endif /* CONFIG_ONENAND_IPL */
>  #endif /* CONFIG_NAND_SPL */
> +#endif
> 
>  /*------------------------------------------------------------------------------*/
> 
> @@ -266,11 +270,19 @@ clbss_l:str       r2, [r0]                /* clear loop...                    */
>   * initialization, now running from RAM.
>   */
>  #ifdef CONFIG_NAND_SPL
> +#if 1
> +       ldr     r0, _nand_boot_ofs
> +       mov     pc, r0
> +
> +_nand_boot_ofs:
> +       .word nand_boot
> +#else
>         ldr     r0, _nand_boot_ofs
>         adr     r1, _start
>         add     pc, r0, r1
>  _nand_boot_ofs:
>         .word nand_boot - _start
> +#endif
>  #else
>  jump_2_ram:
>         ldr     r0, _board_init_r_ofs
>
Stefano Babic Feb. 7, 2011, 2:13 p.m. UTC | #3
On 02/07/2011 12:32 PM, Fabio Estevam wrote:
> Hi Magnus,
> 
> On 2/6/2011 10:03 AM, Magnus Lilja wrote: ...
> 

Hi,

>> I have no idea if this breaks other boards but at least it's start
>> for further work. I tried it on the imx31 litekit (which boots from
>> NOR) but that board doesn't seem to boot even before applying
>> Fabios patch, I'll see if I can figure out why that board is broken
>> now. Don't know when though.
> 
> I will let others comment about the changes you did in
> arch/arm/cpu/arm1136/start.S Will also try it later today.

Anyway, arch/arm/cpu/arm1136/start.S cannot be compiled without the
changes suggested by Magnus due to the following lines:

_nand_boot_ofs
       : .word nand_boot - _start

":" seems to me wrong in any case and should be fixed. Is this syntax
accepted by newer compiler releases ?

IMHO board_init_f must be called absolutely before nand_boot. I have
tested the changes suggested by Magnus on a i.MX35 and the board boots
from NAND. However, I do not see the problems with the console, and I
can think they are not related to this issue.

Best regards,
Stefano Babic
diff mbox

Patch

diff --git a/arch/arm/cpu/arm1136/start.S b/arch/arm/cpu/arm1136/start.S
index 12545c2..7d75ecf 100644
--- a/arch/arm/cpu/arm1136/start.S
+++ b/arch/arm/cpu/arm1136/start.S
@@ -163,6 +163,9 @@  call_board_init_f:
        bic     sp, sp, #7 /* 8-byte alignment for ABI compliance */
        ldr     r0,=0x00000000

+#if 1
+       bl      board_init_f
+#else
 #ifdef CONFIG_NAND_SPL
        bl      nand_boot
 #else
@@ -172,6 +175,7 @@  call_board_init_f:
        bl      board_init_f
 #endif /* CONFIG_ONENAND_IPL */
 #endif /* CONFIG_NAND_SPL */
+#endif

 /*------------------------------------------------------------------------------*/

@@ -266,11 +270,19 @@  clbss_l:str       r2, [r0]                /* clear loop...                    */
  * initialization, now running from RAM.
  */
 #ifdef CONFIG_NAND_SPL
+#if 1
+       ldr     r0, _nand_boot_ofs
+       mov     pc, r0
+
+_nand_boot_ofs:
+       .word nand_boot
+#else
        ldr     r0, _nand_boot_ofs
        adr     r1, _start
        add     pc, r0, r1
 _nand_boot_ofs:
        .word nand_boot - _start
+#endif
 #else
 jump_2_ram:
        ldr     r0, _board_init_r_ofs