All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Yan <andy.yan@rock-chips.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH v2 0/5] rockchip: back-to-bootrom: replace assembly-implementation with C-code
Date: Tue, 19 Sep 2017 15:19:45 +0800	[thread overview]
Message-ID: <d0cd87b7-a556-8a45-cb06-2a81593dadde@rock-chips.com> (raw)
In-Reply-To: <55b57a24-fb49-5a6b-6881-51c15d52fa3f@rock-chips.com>

Hi Philipp:


On 2017年09月19日 10:06, Andy Yan wrote:
> Hi Philipp:
>
>
> On 2017年09月19日 02:18, Philipp Tomsich wrote:
>> Recent discussions confirmed (what the code always assumed): the
>> Rockchip BROM always enters U-Boot with the stack-pointer valid
>> (i.e. the U-Boot startup code is running off the BROM stack).
>>
>> We can thus replace the back-to-bootrom code (i.e. both the
>> save_boot_params and back_to_bootrom implementations) using C-code
>> based on setjmp/longjmp.  The new implementation is already structured
>> to allow an easy drop-in of Andy's changes to enter download-mode when
>> returning to the BROM.
>>
>> This entails one minor tweak to asm/system.h, which only exported
>> the save_boot_params_ret prototype for ARMv7, but not for AArch64.
>>
>> For v2, we force bootrom.o to alway be emitted as A32 (not T32), so we
>> can safely call save_boot_params_ret().
>
>     This still have a problem, because the setjmp  implementation for 
> ARM32 platform  has humb code when CONFIG_SYS_THUMB_BUILD is
> enabled, this is a default setting for most ARMv7 boards.
> #if CONFIG_IS_ENABLED(SYS_THUMB_BUILD)
>  ".align 2\n"
>  "adr r0, jmp_target\n"
>  "add r0, r0, $1\n"  // r0 stored the jump target address and with 
> bit[0] = 1, this will trigger a thumb switch in longjmp with code "bx r0"
> #endif
>
> When I force the setjmp code go arm code path, I can back to bootrom 
> successfully, But I got a data abort exception in later. it seems it 
> happens when bootrom finished the uboot code
> copy, when jump to sdram, I need a further debug.

I found that r9 also need to be preserved, it seems that it hold the 
sdram base.
>>
>> It also turned out that I had not caught the RK3188 in my earlier
>> series... and my luck being what it is, the RK3188 needed some extra
>> handholding to adapt to the new regime: instead of passing the context
>> address (for returning to the BROM) from the TPL to the SPL, the SPL
>> now returns to the TPL and the TPL then returns to the BROM.
>>
>> Changes in v2:
>> - [added in v2] chain back_to_bootrom calls for SPL, first returning
>>    to the TPL (using the same mechanism) and further calling through
>>    to the BROM from the TPL by invoking back_to_bootrom again
>> - adapt the RK3188 spl support file (that I had originally missed)
>>
>> Philipp Tomsich (5):
>>    arm: make save_boot_params_ret prototype visible for AArch64
>>    rockchip: back-to-bootrom: replace assembly-implementation with 
>> C-code
>>    rockchip: back-to-bootrom: rk3188: chain from SPL via TPL to the BROM
>>    rockchip: back-to-bootrom: allow passing a cmd to the bootrom
>>    rockchip: back-to-bootrom: do not compile bootrom.o in thumb mode
>>
>>   arch/arm/include/asm/arch-rockchip/bootrom.h | 30 +++++++++---
>>   arch/arm/include/asm/system.h                | 62 
>> ++++++++++++-------------
>>   arch/arm/mach-rockchip/Makefile              | 10 +++-
>>   arch/arm/mach-rockchip/bootrom.c             | 54 
>> +++++++++++++++++++++-
>>   arch/arm/mach-rockchip/rk3036-board-spl.c    |  2 +-
>>   arch/arm/mach-rockchip/rk3188-board-spl.c    | 14 +-----
>>   arch/arm/mach-rockchip/rk3188-board-tpl.c    | 19 ++++----
>>   arch/arm/mach-rockchip/rk322x-board-spl.c    |  2 +-
>>   arch/arm/mach-rockchip/rk3288-board-spl.c    |  4 +-
>>   arch/arm/mach-rockchip/rk3368-board-tpl.c    |  2 +-
>>   arch/arm/mach-rockchip/rk3399-board-spl.c    |  2 +-
>>   arch/arm/mach-rockchip/save_boot_param.S     | 69 
>> ----------------------------
>>   12 files changed, 133 insertions(+), 137 deletions(-)
>>   delete mode 100644 arch/arm/mach-rockchip/save_boot_param.S
>>
>

  reply	other threads:[~2017-09-19  7:19 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-09-18 18:18 [U-Boot] [PATCH v2 0/5] rockchip: back-to-bootrom: replace assembly-implementation with C-code Philipp Tomsich
2017-09-18 18:18 ` [U-Boot] [PATCH v2 1/5] arm: make save_boot_params_ret prototype visible for AArch64 Philipp Tomsich
2017-09-18 18:18 ` [U-Boot] [PATCH v2 2/5] rockchip: back-to-bootrom: replace assembly-implementation with C-code Philipp Tomsich
2017-09-18 18:18 ` [U-Boot] [PATCH v2 3/5] rockchip: back-to-bootrom: rk3188: chain from SPL via TPL to the BROM Philipp Tomsich
2017-09-25  2:12   ` Simon Glass
2017-09-18 18:18 ` [U-Boot] [PATCH v2 4/5] rockchip: back-to-bootrom: allow passing a cmd to the bootrom Philipp Tomsich
2017-09-25  2:12   ` Simon Glass
2017-09-18 18:18 ` [U-Boot] [PATCH v2 5/5] rockchip: back-to-bootrom: do not compile bootrom.o in thumb mode Philipp Tomsich
2017-09-19  2:06 ` [U-Boot] [PATCH v2 0/5] rockchip: back-to-bootrom: replace assembly-implementation with C-code Andy Yan
2017-09-19  7:19   ` Andy Yan [this message]
2017-09-19  9:10     ` Dr. Philipp Tomsich
2017-09-19  9:12       ` Heiko Stübner
2017-09-19 10:16         ` Dr. Philipp Tomsich
2017-09-21  8:26           ` Dr. Philipp Tomsich
2017-09-21  8:51             ` Heiko Stuebner
2017-09-19 12:45       ` Dr. Philipp Tomsich
2017-09-20  1:51         ` Andy Yan

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d0cd87b7-a556-8a45-cb06-2a81593dadde@rock-chips.com \
    --to=andy.yan@rock-chips.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.