diff mbox series

[U-Boot,6/7] configs: tinker: Enable SDRAM, SPL stack

Message ID 20190917061042.32053-7-jagan@amarulasolutions.com
State Accepted
Commit 4bd143b57dc0cb07b553c989cc16a785642e2d0f
Delegated to: Kever Yang
Headers show
Series rk3288: tinker/vyasa: Fixes for TPL/SPL boot | expand

Commit Message

Jagan Teki Sept. 17, 2019, 6:10 a.m. UTC
SPL sets up SDRAM while in its board_init_f()
function, it is possible for the stack to move
there before board_init_r() is reached.

So it is required to reserve the stack for SDRAM,
with a proper location and size otherwise any
operations during SPL handoff would leads to failure.

On, this particular context tinker-rk3288 SPL is
failing to launch U-Boot proper on SDRAM due to
lack of stack.

 U-Boot SPL 2019.10-rc3-00297-g5ba8b12543 (Sep 12 2019 - 08:50:36 +0530)
 Trying to boot from MMC1
 spl: mmc init failed with error: -110
 SPL: failed to boot from all boot devices
 ### ERROR ### Please RESET the board ###

So, enable SPL_STACK_R_ADDR and it's related-config
items for SDRAM, SPL stack to setup properly.

Reported-by: Jagan Teki <jagan@amarulasolutions.com>
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
 configs/tinker-rk3288_defconfig | 3 +++
 1 file changed, 3 insertions(+)

Comments

Kever Yang Sept. 18, 2019, 5:05 a.m. UTC | #1
On 2019/9/17 下午2:10, Jagan Teki wrote:
> SPL sets up SDRAM while in its board_init_f()
> function, it is possible for the stack to move
> there before board_init_r() is reached.
>
> So it is required to reserve the stack for SDRAM,
> with a proper location and size otherwise any
> operations during SPL handoff would leads to failure.
>
> On, this particular context tinker-rk3288 SPL is
> failing to launch U-Boot proper on SDRAM due to
> lack of stack.

If no SPL_STACK_R, it should still use CONFIG_SPL_STACK when system 
init, right?

It sounds like this should not cause failure if there no one touch the 
CONFIG_SPL_STACK area.

Thanks,

- Kever

>
>   U-Boot SPL 2019.10-rc3-00297-g5ba8b12543 (Sep 12 2019 - 08:50:36 +0530)
>   Trying to boot from MMC1
>   spl: mmc init failed with error: -110
>   SPL: failed to boot from all boot devices
>   ### ERROR ### Please RESET the board ###
>
> So, enable SPL_STACK_R_ADDR and it's related-config
> items for SDRAM, SPL stack to setup properly.
>
> Reported-by: Jagan Teki <jagan@amarulasolutions.com>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
> ---
>   configs/tinker-rk3288_defconfig | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/configs/tinker-rk3288_defconfig b/configs/tinker-rk3288_defconfig
> index adab1cba42..359be078ac 100644
> --- a/configs/tinker-rk3288_defconfig
> +++ b/configs/tinker-rk3288_defconfig
> @@ -4,6 +4,7 @@ CONFIG_SYS_TEXT_BASE=0x01000000
>   CONFIG_ROCKCHIP_RK3288=y
>   CONFIG_TARGET_TINKER_RK3288=y
>   CONFIG_NR_DRAM_BANKS=1
> +CONFIG_SPL_STACK_R_ADDR=0x80000
>   CONFIG_SPL_SIZE_LIMIT=307200
>   CONFIG_DEBUG_UART_BASE=0xff690000
>   CONFIG_DEBUG_UART_CLOCK=24000000
> @@ -15,6 +16,8 @@ CONFIG_CONSOLE_MUX=y
>   CONFIG_DEFAULT_FDT_FILE="rk3288-tinker.dtb"
>   # CONFIG_DISPLAY_CPUINFO is not set
>   CONFIG_DISPLAY_BOARDINFO_LATE=y
> +CONFIG_SPL_STACK_R=y
> +CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
>   CONFIG_CMD_GPIO=y
>   CONFIG_CMD_GPT=y
>   CONFIG_CMD_I2C=y
Jagan Teki Sept. 18, 2019, 5:25 a.m. UTC | #2
On Wed, Sep 18, 2019 at 10:36 AM Kever Yang <kever.yang@rock-chips.com> wrote:
>
>
> On 2019/9/17 下午2:10, Jagan Teki wrote:
> > SPL sets up SDRAM while in its board_init_f()
> > function, it is possible for the stack to move
> > there before board_init_r() is reached.
> >
> > So it is required to reserve the stack for SDRAM,
> > with a proper location and size otherwise any
> > operations during SPL handoff would leads to failure.
> >
> > On, this particular context tinker-rk3288 SPL is
> > failing to launch U-Boot proper on SDRAM due to
> > lack of stack.
>
> If no SPL_STACK_R, it should still use CONFIG_SPL_STACK when system
> init, right?

SPL_STACK vs SPL_STTACK_R would be different in their usage former is
used to setup the stack during early while calling board_init_f but
the later used to setup the stack (with DRAM base) while calling
board_init_r. if CONFIG_SPL_STACK_R is defined, then at this point the
stack and global_data are relocated to below CONFIG_SPL_STACK_R_ADDR.

CONFIG_SPL_STACK_R_ADDR - 0x80000 (this would be as part of sdram map)
CONFIG_SPL_STACK  - 0xff718000 (this address where SDRAM not been used)

Since the issue, is due to launch U-Boot proper from mmc, the stack
that SPL during that time was not set it up.

>
> It sounds like this should not cause failure if there no one touch the
> CONFIG_SPL_STACK area.

I remember while implementing TPL, on vyasa I do take care of this
STACK_R, so same been reused it for tinker.
Kever Yang Sept. 18, 2019, 9:38 a.m. UTC | #3
On 2019/9/17 下午2:10, Jagan Teki wrote:
> SPL sets up SDRAM while in its board_init_f()
> function, it is possible for the stack to move
> there before board_init_r() is reached.
>
> So it is required to reserve the stack for SDRAM,
> with a proper location and size otherwise any
> operations during SPL handoff would leads to failure.
>
> On, this particular context tinker-rk3288 SPL is
> failing to launch U-Boot proper on SDRAM due to
> lack of stack.
>
>   U-Boot SPL 2019.10-rc3-00297-g5ba8b12543 (Sep 12 2019 - 08:50:36 +0530)
>   Trying to boot from MMC1
>   spl: mmc init failed with error: -110
>   SPL: failed to boot from all boot devices
>   ### ERROR ### Please RESET the board ###
>
> So, enable SPL_STACK_R_ADDR and it's related-config
> items for SDRAM, SPL stack to setup properly.
>
> Reported-by: Jagan Teki <jagan@amarulasolutions.com>
> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>

Reviewed-by: Kever Yang<kever.yang@rock-chips.com>

Thanks,
- Kever
> ---
>   configs/tinker-rk3288_defconfig | 3 +++
>   1 file changed, 3 insertions(+)
>
> diff --git a/configs/tinker-rk3288_defconfig b/configs/tinker-rk3288_defconfig
> index adab1cba42..359be078ac 100644
> --- a/configs/tinker-rk3288_defconfig
> +++ b/configs/tinker-rk3288_defconfig
> @@ -4,6 +4,7 @@ CONFIG_SYS_TEXT_BASE=0x01000000
>   CONFIG_ROCKCHIP_RK3288=y
>   CONFIG_TARGET_TINKER_RK3288=y
>   CONFIG_NR_DRAM_BANKS=1
> +CONFIG_SPL_STACK_R_ADDR=0x80000
>   CONFIG_SPL_SIZE_LIMIT=307200
>   CONFIG_DEBUG_UART_BASE=0xff690000
>   CONFIG_DEBUG_UART_CLOCK=24000000
> @@ -15,6 +16,8 @@ CONFIG_CONSOLE_MUX=y
>   CONFIG_DEFAULT_FDT_FILE="rk3288-tinker.dtb"
>   # CONFIG_DISPLAY_CPUINFO is not set
>   CONFIG_DISPLAY_BOARDINFO_LATE=y
> +CONFIG_SPL_STACK_R=y
> +CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
>   CONFIG_CMD_GPIO=y
>   CONFIG_CMD_GPT=y
>   CONFIG_CMD_I2C=y
Kever Yang Sept. 18, 2019, 9:53 a.m. UTC | #4
On 2019/9/18 下午1:25, Jagan Teki wrote:
> On Wed, Sep 18, 2019 at 10:36 AM Kever Yang <kever.yang@rock-chips.com> wrote:
>>
>> On 2019/9/17 下午2:10, Jagan Teki wrote:
>>> SPL sets up SDRAM while in its board_init_f()
>>> function, it is possible for the stack to move
>>> there before board_init_r() is reached.
>>>
>>> So it is required to reserve the stack for SDRAM,
>>> with a proper location and size otherwise any
>>> operations during SPL handoff would leads to failure.
>>>
>>> On, this particular context tinker-rk3288 SPL is
>>> failing to launch U-Boot proper on SDRAM due to
>>> lack of stack.
>> If no SPL_STACK_R, it should still use CONFIG_SPL_STACK when system
>> init, right?
> SPL_STACK vs SPL_STTACK_R would be different in their usage former is
> used to setup the stack during early while calling board_init_f but
> the later used to setup the stack (with DRAM base) while calling
> board_init_r. if CONFIG_SPL_STACK_R is defined, then at this point the
> stack and global_data are relocated to below CONFIG_SPL_STACK_R_ADDR.
>
> CONFIG_SPL_STACK_R_ADDR - 0x80000 (this would be as part of sdram map)
> CONFIG_SPL_STACK  - 0xff718000 (this address where SDRAM not been used)
>
> Since the issue, is due to launch U-Boot proper from mmc, the stack
> that SPL during that time was not set it up.

I think the root cause is: the master of emmc controller can no access 
SRAM, and the emmc init
driver needs to use memory based on CONFIG_SPL_STACK, if this is in 
SRAM, then the emmc driver
will init fail, and 'fifo-mode' can work around this issue. So the 
CONFIG_SPL_STACK_R is needed
for emmc/sd controller driver.

Thanks,
- Kever
>
>> It sounds like this should not cause failure if there no one touch the
>> CONFIG_SPL_STACK area.
> I remember while implementing TPL, on vyasa I do take care of this
> STACK_R, so same been reused it for tinker.
>
Jagan Teki Sept. 19, 2019, 5:42 a.m. UTC | #5
On Wed, Sep 18, 2019 at 3:24 PM Kever Yang <kever.yang@rock-chips.com> wrote:
>
>
> On 2019/9/18 下午1:25, Jagan Teki wrote:
> > On Wed, Sep 18, 2019 at 10:36 AM Kever Yang <kever.yang@rock-chips.com> wrote:
> >>
> >> On 2019/9/17 下午2:10, Jagan Teki wrote:
> >>> SPL sets up SDRAM while in its board_init_f()
> >>> function, it is possible for the stack to move
> >>> there before board_init_r() is reached.
> >>>
> >>> So it is required to reserve the stack for SDRAM,
> >>> with a proper location and size otherwise any
> >>> operations during SPL handoff would leads to failure.
> >>>
> >>> On, this particular context tinker-rk3288 SPL is
> >>> failing to launch U-Boot proper on SDRAM due to
> >>> lack of stack.
> >> If no SPL_STACK_R, it should still use CONFIG_SPL_STACK when system
> >> init, right?
> > SPL_STACK vs SPL_STTACK_R would be different in their usage former is
> > used to setup the stack during early while calling board_init_f but
> > the later used to setup the stack (with DRAM base) while calling
> > board_init_r. if CONFIG_SPL_STACK_R is defined, then at this point the
> > stack and global_data are relocated to below CONFIG_SPL_STACK_R_ADDR.
> >
> > CONFIG_SPL_STACK_R_ADDR - 0x80000 (this would be as part of sdram map)
> > CONFIG_SPL_STACK  - 0xff718000 (this address where SDRAM not been used)
> >
> > Since the issue, is due to launch U-Boot proper from mmc, the stack
> > that SPL during that time was not set it up.
>
> I think the root cause is: the master of emmc controller can no access
> SRAM, and the emmc init
> driver needs to use memory based on CONFIG_SPL_STACK, if this is in
> SRAM, then the emmc driver
> will init fail, and 'fifo-mode' can work around this issue. So the
> CONFIG_SPL_STACK_R is needed
> for emmc/sd controller driver.

Not sure, because tinker-rk3288 doesn't have eMMC.
diff mbox series

Patch

diff --git a/configs/tinker-rk3288_defconfig b/configs/tinker-rk3288_defconfig
index adab1cba42..359be078ac 100644
--- a/configs/tinker-rk3288_defconfig
+++ b/configs/tinker-rk3288_defconfig
@@ -4,6 +4,7 @@  CONFIG_SYS_TEXT_BASE=0x01000000
 CONFIG_ROCKCHIP_RK3288=y
 CONFIG_TARGET_TINKER_RK3288=y
 CONFIG_NR_DRAM_BANKS=1
+CONFIG_SPL_STACK_R_ADDR=0x80000
 CONFIG_SPL_SIZE_LIMIT=307200
 CONFIG_DEBUG_UART_BASE=0xff690000
 CONFIG_DEBUG_UART_CLOCK=24000000
@@ -15,6 +16,8 @@  CONFIG_CONSOLE_MUX=y
 CONFIG_DEFAULT_FDT_FILE="rk3288-tinker.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
+CONFIG_SPL_STACK_R=y
+CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y