[U-Boot] [PATCH 0/7] rk3288: tinker/vyasa: Fixes for TPL/SPL boot

These boot failure as encounter even from v2019.07 release, I have seen them now due to some requirement on feature additions.
All these patches are fixing the respective TPL/SPL boot failures on tinker and vyasa rk3288 boards.
patch 3/7 make dram init available for TPL build, if TPL/SPL bootchain boards, so it is better to test this for SPL-alone rk3288 board before merging.
Any inputs? Jagan.
Jagan Teki (6): rockchip: rk3288: vyasa: Drop ROCKCHIP_BROM_HELPER selection configs: vyasa-rk3288: Fix SPL_TEXT_BASE ram: rk3288: Initialize dram for TPL builds rockchip: spi-boot-order: Trival fix to newline missing configs: tinker: Drop explicit SPL_TEXT configs: tinker: Enable SDRAM, SPL stack
Michael Trimarchi (1): rockchip: rk3288-tinker: Attach missing peripherals at SPL
arch/arm/dts/rk3288-tinker-u-boot.dtsi | 26 ++++++++++++++++++------- arch/arm/mach-rockchip/rk3288/Kconfig | 1 - arch/arm/mach-rockchip/spl-boot-order.c | 2 +- configs/tinker-rk3288_defconfig | 9 ++++++++- configs/vyasa-rk3288_defconfig | 1 - drivers/ram/rockchip/sdram_rk3288.c | 15 +++++++++----- 6 files changed, 38 insertions(+), 16 deletions(-)

ROCKCHIP_BROM_HELPER is selected as if TPL/SPL ROCKCHIP_BACK_TO_BROM has been defined, so drop the explicit enablement for vyasa board.
This change is supposed to missed during config move to other locations, and missed to drop the same.
Signed-off-by: Jagan Teki jagan@amarulasolutions.com --- arch/arm/mach-rockchip/rk3288/Kconfig | 1 - 1 file changed, 1 deletion(-)
diff --git a/arch/arm/mach-rockchip/rk3288/Kconfig b/arch/arm/mach-rockchip/rk3288/Kconfig index 87e3d342f6..4ebc0792d5 100644 --- a/arch/arm/mach-rockchip/rk3288/Kconfig +++ b/arch/arm/mach-rockchip/rk3288/Kconfig @@ -104,7 +104,6 @@ config TARGET_POPMETAL_RK3288 config TARGET_VYASA_RK3288 bool "Vyasa-RK3288" select BOARD_LATE_INIT - select ROCKCHIP_BROM_HELPER select TPL help Vyasa is a RK3288-based development board with 2 USB ports,

On 2019/9/17 下午2:10, Jagan Teki wrote:
ROCKCHIP_BROM_HELPER is selected as if TPL/SPL ROCKCHIP_BACK_TO_BROM has been defined, so drop the explicit enablement for vyasa board.
This change is supposed to missed during config move to other locations, and missed to drop the same.
Signed-off-by: Jagan Teki jagan@amarulasolutions.com
Reviewed-by: Kever Yangkever.yang@rock-chips.com
Thanks, - Kever
arch/arm/mach-rockchip/rk3288/Kconfig | 1 - 1 file changed, 1 deletion(-)
diff --git a/arch/arm/mach-rockchip/rk3288/Kconfig b/arch/arm/mach-rockchip/rk3288/Kconfig index 87e3d342f6..4ebc0792d5 100644 --- a/arch/arm/mach-rockchip/rk3288/Kconfig +++ b/arch/arm/mach-rockchip/rk3288/Kconfig @@ -104,7 +104,6 @@ config TARGET_POPMETAL_RK3288 config TARGET_VYASA_RK3288 bool "Vyasa-RK3288" select BOARD_LATE_INIT
- select ROCKCHIP_BROM_HELPER select TPL help Vyasa is a RK3288-based development board with 2 USB ports,

The initial Vyasa-rk3288 TPL implementation is to reuse the SPL_TEXT_BASE for TPL and SPL as 0x0 and 0xff704000 respectively.
But the below commit implements the reverse way of using TEXT_BASE's like 0xff704000 for TPL and 0x0 for SPL and which indeed update the SPL_TEXT_BASE for vyasa-rk3288 board. "rockchip: Kconfig: enable TPL support for rk3328" (sha1: 3f47db0275e0f1c1e89d8f13f8b4cdc86b1038ca)
So, fix by dropping the legacy SPL_TEXT_BASE and it will reassign 0x0 by default based on Kconfig definition.
Reported-by: Jagan Teki jagan@amarulasolutions.com Signed-off-by: Jagan Teki jagan@amarulasolutions.com --- configs/vyasa-rk3288_defconfig | 1 - 1 file changed, 1 deletion(-)
diff --git a/configs/vyasa-rk3288_defconfig b/configs/vyasa-rk3288_defconfig index c74c1457a7..89921e6836 100644 --- a/configs/vyasa-rk3288_defconfig +++ b/configs/vyasa-rk3288_defconfig @@ -15,7 +15,6 @@ CONFIG_SILENT_CONSOLE=y CONFIG_DEFAULT_FDT_FILE="rk3288-vyasa.dtb" # CONFIG_DISPLAY_CPUINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_SPL_TEXT_BASE=0xff704000 CONFIG_SPL_STACK_R=y CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000 CONFIG_CMD_GPIO=y

On 2019/9/17 下午2:10, Jagan Teki wrote:
The initial Vyasa-rk3288 TPL implementation is to reuse the SPL_TEXT_BASE for TPL and SPL as 0x0 and 0xff704000 respectively.
But the below commit implements the reverse way of using TEXT_BASE's like 0xff704000 for TPL and 0x0 for SPL and which indeed update the SPL_TEXT_BASE for vyasa-rk3288 board. "rockchip: Kconfig: enable TPL support for rk3328" (sha1: 3f47db0275e0f1c1e89d8f13f8b4cdc86b1038ca)
So, fix by dropping the legacy SPL_TEXT_BASE and it will reassign 0x0 by default based on Kconfig definition.
Reported-by: Jagan Teki jagan@amarulasolutions.com Signed-off-by: Jagan Teki jagan@amarulasolutions.com
Reviewed-by: Kever Yangkever.yang@rock-chips.com
Thanks, - Kever
configs/vyasa-rk3288_defconfig | 1 - 1 file changed, 1 deletion(-)
diff --git a/configs/vyasa-rk3288_defconfig b/configs/vyasa-rk3288_defconfig index c74c1457a7..89921e6836 100644 --- a/configs/vyasa-rk3288_defconfig +++ b/configs/vyasa-rk3288_defconfig @@ -15,7 +15,6 @@ CONFIG_SILENT_CONSOLE=y CONFIG_DEFAULT_FDT_FILE="rk3288-vyasa.dtb" # CONFIG_DISPLAY_CPUINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_SPL_TEXT_BASE=0xff704000 CONFIG_SPL_STACK_R=y CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000 CONFIG_CMD_GPIO=y

On 2019/9/17 下午2:10, Jagan Teki wrote:
The initial Vyasa-rk3288 TPL implementation is to reuse the SPL_TEXT_BASE for TPL and SPL as 0x0 and 0xff704000 respectively.
But the below commit implements the reverse way of using TEXT_BASE's like 0xff704000 for TPL and 0x0 for SPL and which indeed update the SPL_TEXT_BASE for vyasa-rk3288 board. "rockchip: Kconfig: enable TPL support for rk3328" (sha1: 3f47db0275e0f1c1e89d8f13f8b4cdc86b1038ca)
So, fix by dropping the legacy SPL_TEXT_BASE and it will reassign 0x0 by default based on Kconfig definition.
Reported-by: Jagan Teki jagan@amarulasolutions.com
Why this tag is needed for yourself?
Thanks,
- Kever
Signed-off-by: Jagan Teki jagan@amarulasolutions.com
configs/vyasa-rk3288_defconfig | 1 - 1 file changed, 1 deletion(-)
diff --git a/configs/vyasa-rk3288_defconfig b/configs/vyasa-rk3288_defconfig index c74c1457a7..89921e6836 100644 --- a/configs/vyasa-rk3288_defconfig +++ b/configs/vyasa-rk3288_defconfig @@ -15,7 +15,6 @@ CONFIG_SILENT_CONSOLE=y CONFIG_DEFAULT_FDT_FILE="rk3288-vyasa.dtb" # CONFIG_DISPLAY_CPUINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_SPL_TEXT_BASE=0xff704000 CONFIG_SPL_STACK_R=y CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000 CONFIG_CMD_GPIO=y

On Wed, Sep 18, 2019 at 10:32 AM Kever Yang kever.yang@rock-chips.com wrote:
On 2019/9/17 下午2:10, Jagan Teki wrote:
The initial Vyasa-rk3288 TPL implementation is to reuse the SPL_TEXT_BASE for TPL and SPL as 0x0 and 0xff704000 respectively.
But the below commit implements the reverse way of using TEXT_BASE's like 0xff704000 for TPL and 0x0 for SPL and which indeed update the SPL_TEXT_BASE for vyasa-rk3288 board. "rockchip: Kconfig: enable TPL support for rk3328" (sha1: 3f47db0275e0f1c1e89d8f13f8b4cdc86b1038ca)
So, fix by dropping the legacy SPL_TEXT_BASE and it will reassign 0x0 by default based on Kconfig definition.
Reported-by: Jagan Teki jagan@amarulasolutions.com
Why this tag is needed for yourself?
Since, I have posted the bug on the mailing list.

Few of the rk3288 boards like tinker, vyasa are using TPL, SPL bootchain so the dram initialization must needed during TPL stage. So add proper ifconstruct to satisfy both TPL, SPL and SPL-only bootchain boards.
This eventually fixing TPL to SPL handoff, otherwise missing dram initilaztion at TPL stage would leads to SPL hang.
Signed-off-by: Jagan Teki jagan@amarulasolutions.com --- drivers/ram/rockchip/sdram_rk3288.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/ram/rockchip/sdram_rk3288.c b/drivers/ram/rockchip/sdram_rk3288.c index 6bb025a851..5775254007 100644 --- a/drivers/ram/rockchip/sdram_rk3288.c +++ b/drivers/ram/rockchip/sdram_rk3288.c @@ -79,7 +79,8 @@ const int ddrconf_table[] = { #define DQS_GATE_TRAINING_ERROR_RANK0 (1 << 4) #define DQS_GATE_TRAINING_ERROR_RANK1 (2 << 4)
-#ifdef CONFIG_SPL_BUILD +#if defined(CONFIG_TPL_BUILD) || \ + (!defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD)) static void copy_to_reg(u32 *dest, const u32 *src, u32 n) { int i; @@ -1035,7 +1036,8 @@ static int conv_of_platdata(struct udevice *dev)
static int rk3288_dmc_probe(struct udevice *dev) { -#ifdef CONFIG_SPL_BUILD +#if defined(CONFIG_TPL_BUILD) || \ + (!defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD)) struct rk3288_sdram_params *plat = dev_get_platdata(dev); struct udevice *dev_clk; struct regmap *map; @@ -1044,7 +1046,8 @@ static int rk3288_dmc_probe(struct udevice *dev) struct dram_info *priv = dev_get_priv(dev);
priv->pmu = syscon_get_first_range(ROCKCHIP_SYSCON_PMU); -#ifdef CONFIG_SPL_BUILD +#if defined(CONFIG_TPL_BUILD) || \ + (!defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD)) #if CONFIG_IS_ENABLED(OF_PLATDATA) ret = conv_of_platdata(dev); if (ret) @@ -1111,12 +1114,14 @@ U_BOOT_DRIVER(dmc_rk3288) = { .id = UCLASS_RAM, .of_match = rk3288_dmc_ids, .ops = &rk3288_dmc_ops, -#ifdef CONFIG_SPL_BUILD +#if defined(CONFIG_TPL_BUILD) || \ + (!defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD)) .ofdata_to_platdata = rk3288_dmc_ofdata_to_platdata, #endif .probe = rk3288_dmc_probe, .priv_auto_alloc_size = sizeof(struct dram_info), -#ifdef CONFIG_SPL_BUILD +#if defined(CONFIG_TPL_BUILD) || \ + (!defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD)) .platdata_auto_alloc_size = sizeof(struct rk3288_sdram_params), #endif };

On 2019/9/17 下午2:10, Jagan Teki wrote:
Few of the rk3288 boards like tinker, vyasa are using TPL, SPL bootchain so the dram initialization must needed during TPL stage. So add proper ifconstruct to satisfy both TPL, SPL and SPL-only bootchain boards.
This eventually fixing TPL to SPL handoff, otherwise missing dram initilaztion at TPL stage would leads to SPL hang.
Signed-off-by: Jagan Teki jagan@amarulasolutions.com
Reviewed-by: Kever Yangkever.yang@rock-chips.com
Thanks, - Kever
drivers/ram/rockchip/sdram_rk3288.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/drivers/ram/rockchip/sdram_rk3288.c b/drivers/ram/rockchip/sdram_rk3288.c index 6bb025a851..5775254007 100644 --- a/drivers/ram/rockchip/sdram_rk3288.c +++ b/drivers/ram/rockchip/sdram_rk3288.c @@ -79,7 +79,8 @@ const int ddrconf_table[] = { #define DQS_GATE_TRAINING_ERROR_RANK0 (1 << 4) #define DQS_GATE_TRAINING_ERROR_RANK1 (2 << 4)
-#ifdef CONFIG_SPL_BUILD +#if defined(CONFIG_TPL_BUILD) || \
- (!defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD)) static void copy_to_reg(u32 *dest, const u32 *src, u32 n) { int i;
@@ -1035,7 +1036,8 @@ static int conv_of_platdata(struct udevice *dev)
static int rk3288_dmc_probe(struct udevice *dev) { -#ifdef CONFIG_SPL_BUILD +#if defined(CONFIG_TPL_BUILD) || \
- (!defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD)) struct rk3288_sdram_params *plat = dev_get_platdata(dev); struct udevice *dev_clk; struct regmap *map;
@@ -1044,7 +1046,8 @@ static int rk3288_dmc_probe(struct udevice *dev) struct dram_info *priv = dev_get_priv(dev);
priv->pmu = syscon_get_first_range(ROCKCHIP_SYSCON_PMU); -#ifdef CONFIG_SPL_BUILD +#if defined(CONFIG_TPL_BUILD) || \
- (!defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD)) #if CONFIG_IS_ENABLED(OF_PLATDATA) ret = conv_of_platdata(dev); if (ret)
@@ -1111,12 +1114,14 @@ U_BOOT_DRIVER(dmc_rk3288) = { .id = UCLASS_RAM, .of_match = rk3288_dmc_ids, .ops = &rk3288_dmc_ops, -#ifdef CONFIG_SPL_BUILD +#if defined(CONFIG_TPL_BUILD) || \
- (!defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD)) .ofdata_to_platdata = rk3288_dmc_ofdata_to_platdata, #endif .probe = rk3288_dmc_probe, .priv_auto_alloc_size = sizeof(struct dram_info),
-#ifdef CONFIG_SPL_BUILD +#if defined(CONFIG_TPL_BUILD) || \
- (!defined(CONFIG_TPL) && defined(CONFIG_SPL_BUILD)) .platdata_auto_alloc_size = sizeof(struct rk3288_sdram_params), #endif };

newline \n was missed in fdt_path_offset, error loop.
Signed-off-by: Jagan Teki jagan@amarulasolutions.com --- arch/arm/mach-rockchip/spl-boot-order.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-rockchip/spl-boot-order.c b/arch/arm/mach-rockchip/spl-boot-order.c index c19c285c07..fa8e096426 100644 --- a/arch/arm/mach-rockchip/spl-boot-order.c +++ b/arch/arm/mach-rockchip/spl-boot-order.c @@ -134,7 +134,7 @@ void board_boot_order(u32 *spl_boot_list) /* Try to resolve the config item (or alias) as a path */ node = fdt_path_offset(blob, conf); if (node < 0) { - debug("%s: could not find %s in FDT", __func__, conf); + debug("%s: could not find %s in FDT\n", __func__, conf); continue; }

On 2019/9/17 下午2:10, Jagan Teki wrote:
newline \n was missed in fdt_path_offset, error loop.
Signed-off-by: Jagan Teki jagan@amarulasolutions.com
Reviewed-by: Kever Yangkever.yang@rock-chips.com
Thanks, - Kever
arch/arm/mach-rockchip/spl-boot-order.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/mach-rockchip/spl-boot-order.c b/arch/arm/mach-rockchip/spl-boot-order.c index c19c285c07..fa8e096426 100644 --- a/arch/arm/mach-rockchip/spl-boot-order.c +++ b/arch/arm/mach-rockchip/spl-boot-order.c @@ -134,7 +134,7 @@ void board_boot_order(u32 *spl_boot_list) /* Try to resolve the config item (or alias) as a path */ node = fdt_path_offset(blob, conf); if (node < 0) {
debug("%s: could not find %s in FDT", __func__, conf);
}debug("%s: could not find %s in FDT\n", __func__, conf); continue;

SPL_TEXT_BASE is 0x0 by default, based on the kconfig definition move in below commit.
"configs: move CONFIG_SPL_TEXT_BASE to Kconfig" (sha1: f89d6133eef2e068f9c33853b6584d7fcbfa9d2e)
So, don't define it explicitly.
Signed-off-by: Jagan Teki jagan@amarulasolutions.com --- configs/tinker-rk3288_defconfig | 1 - 1 file changed, 1 deletion(-)
diff --git a/configs/tinker-rk3288_defconfig b/configs/tinker-rk3288_defconfig index 443f4d88b9..adab1cba42 100644 --- a/configs/tinker-rk3288_defconfig +++ b/configs/tinker-rk3288_defconfig @@ -15,7 +15,6 @@ CONFIG_CONSOLE_MUX=y CONFIG_DEFAULT_FDT_FILE="rk3288-tinker.dtb" # CONFIG_DISPLAY_CPUINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_SPL_TEXT_BASE=0 CONFIG_CMD_GPIO=y CONFIG_CMD_GPT=y CONFIG_CMD_I2C=y

On 2019/9/17 下午2:10, Jagan Teki wrote:
SPL_TEXT_BASE is 0x0 by default, based on the kconfig definition move in below commit.
"configs: move CONFIG_SPL_TEXT_BASE to Kconfig" (sha1: f89d6133eef2e068f9c33853b6584d7fcbfa9d2e)
So, don't define it explicitly.
Signed-off-by: Jagan Teki jagan@amarulasolutions.com
Reviewed-by: Kever Yangkever.yang@rock-chips.com
Thanks, - Kever
configs/tinker-rk3288_defconfig | 1 - 1 file changed, 1 deletion(-)
diff --git a/configs/tinker-rk3288_defconfig b/configs/tinker-rk3288_defconfig index 443f4d88b9..adab1cba42 100644 --- a/configs/tinker-rk3288_defconfig +++ b/configs/tinker-rk3288_defconfig @@ -15,7 +15,6 @@ CONFIG_CONSOLE_MUX=y CONFIG_DEFAULT_FDT_FILE="rk3288-tinker.dtb" # CONFIG_DISPLAY_CPUINFO is not set CONFIG_DISPLAY_BOARDINFO_LATE=y -CONFIG_SPL_TEXT_BASE=0 CONFIG_CMD_GPIO=y CONFIG_CMD_GPT=y CONFIG_CMD_I2C=y

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(+)
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

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

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.

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.

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.

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 Yangkever.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

From: Michael Trimarchi michael@amarulasolutions.com
Tinker board needs to mux all the sdmmc gpio and activate the regulator connected to bank 7. Remove all the bank that are not in use and mark them as dm,spl so-that it would initialize at SPL.
Signed-off-by: Michael Trimarchi michael@amarulasolutions.com Signed-off-by: Jagan Teki jagan@amarulasolutions.com --- arch/arm/dts/rk3288-tinker-u-boot.dtsi | 26 +++++++++++++++++++------- configs/tinker-rk3288_defconfig | 5 +++++ 2 files changed, 24 insertions(+), 7 deletions(-)
diff --git a/arch/arm/dts/rk3288-tinker-u-boot.dtsi b/arch/arm/dts/rk3288-tinker-u-boot.dtsi index 2efb309d6b..f7f9d6dc72 100644 --- a/arch/arm/dts/rk3288-tinker-u-boot.dtsi +++ b/arch/arm/dts/rk3288-tinker-u-boot.dtsi @@ -13,20 +13,20 @@ u-boot,dm-pre-reloc; };
-&sdmmc { +&uart2_xfer { u-boot,dm-pre-reloc; };
-&emmc { - u-boot,dm-pre-reloc; +&sdmmc { + u-boot,dm-spl; };
-&gpio3 { - u-boot,dm-pre-reloc; +&gpio7 { + u-boot,dm-spl; };
-&gpio8 { - u-boot,dm-pre-reloc; +&vcc_sd { + u-boot,dm-spl; };
&pcfg_pull_none_drv_8ma { @@ -37,10 +37,22 @@ u-boot,dm-spl; };
+&pcfg_pull_none { + u-boot,dm-spl; +}; + +&pcfg_pull_up { + u-boot,dm-spl; +}; + &sdmmc_bus4 { u-boot,dm-spl; };
+&sdmmc_cd { + u-boot,dm-spl; +}; + &sdmmc_clk { u-boot,dm-spl; }; diff --git a/configs/tinker-rk3288_defconfig b/configs/tinker-rk3288_defconfig index 359be078ac..afee09819d 100644 --- a/configs/tinker-rk3288_defconfig +++ b/configs/tinker-rk3288_defconfig @@ -49,7 +49,10 @@ CONFIG_FASTBOOT_FLASH=y CONFIG_FASTBOOT_FLASH_MMC_DEV=0 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y CONFIG_ROCKCHIP_GPIO=y +CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SYS_I2C_ROCKCHIP=y +CONFIG_SPL_I2C_SUPPORT=y +CONFIG_SPL_POWER_SUPPORT=y CONFIG_MISC=y CONFIG_I2C_EEPROM=y CONFIG_MMC_DW=y @@ -64,7 +67,9 @@ CONFIG_SPL_PINCTRL=y CONFIG_DM_PMIC=y CONFIG_PMIC_RK8XX=y CONFIG_DM_REGULATOR_FIXED=y +CONFIG_SPL_DM_REGULATOR=y CONFIG_REGULATOR_RK8XX=y +CONFIG_SPL_DM_REGULATOR_FIXED=y CONFIG_PWM_ROCKCHIP=y CONFIG_RAM=y CONFIG_SPL_RAM=y

On 2019/9/17 下午2:10, Jagan Teki wrote:
From: Michael Trimarchi michael@amarulasolutions.com
Reviewed-by: Kever Yangkever.yang@rock-chips.com
Thanks, - Kever
Tinker board needs to mux all the sdmmc gpio and activate the regulator connected to bank 7. Remove all the bank that are not in use and mark them as dm,spl so-that it would initialize at SPL.
Signed-off-by: Michael Trimarchi michael@amarulasolutions.com Signed-off-by: Jagan Teki jagan@amarulasolutions.com
arch/arm/dts/rk3288-tinker-u-boot.dtsi | 26 +++++++++++++++++++------- configs/tinker-rk3288_defconfig | 5 +++++ 2 files changed, 24 insertions(+), 7 deletions(-)
diff --git a/arch/arm/dts/rk3288-tinker-u-boot.dtsi b/arch/arm/dts/rk3288-tinker-u-boot.dtsi index 2efb309d6b..f7f9d6dc72 100644 --- a/arch/arm/dts/rk3288-tinker-u-boot.dtsi +++ b/arch/arm/dts/rk3288-tinker-u-boot.dtsi @@ -13,20 +13,20 @@ u-boot,dm-pre-reloc; };
-&sdmmc { +&uart2_xfer { u-boot,dm-pre-reloc; };
-&emmc {
- u-boot,dm-pre-reloc;
+&sdmmc {
- u-boot,dm-spl; };
-&gpio3 {
- u-boot,dm-pre-reloc;
+&gpio7 {
- u-boot,dm-spl; };
-&gpio8 {
- u-boot,dm-pre-reloc;
+&vcc_sd {
u-boot,dm-spl; };
&pcfg_pull_none_drv_8ma {
@@ -37,10 +37,22 @@ u-boot,dm-spl; };
+&pcfg_pull_none {
- u-boot,dm-spl;
+};
+&pcfg_pull_up {
- u-boot,dm-spl;
+};
- &sdmmc_bus4 { u-boot,dm-spl; };
+&sdmmc_cd {
- u-boot,dm-spl;
+};
- &sdmmc_clk { u-boot,dm-spl; };
diff --git a/configs/tinker-rk3288_defconfig b/configs/tinker-rk3288_defconfig index 359be078ac..afee09819d 100644 --- a/configs/tinker-rk3288_defconfig +++ b/configs/tinker-rk3288_defconfig @@ -49,7 +49,10 @@ CONFIG_FASTBOOT_FLASH=y CONFIG_FASTBOOT_FLASH_MMC_DEV=0 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y CONFIG_ROCKCHIP_GPIO=y +CONFIG_SPL_GPIO_SUPPORT=y CONFIG_SYS_I2C_ROCKCHIP=y +CONFIG_SPL_I2C_SUPPORT=y +CONFIG_SPL_POWER_SUPPORT=y CONFIG_MISC=y CONFIG_I2C_EEPROM=y CONFIG_MMC_DW=y @@ -64,7 +67,9 @@ CONFIG_SPL_PINCTRL=y CONFIG_DM_PMIC=y CONFIG_PMIC_RK8XX=y CONFIG_DM_REGULATOR_FIXED=y +CONFIG_SPL_DM_REGULATOR=y CONFIG_REGULATOR_RK8XX=y +CONFIG_SPL_DM_REGULATOR_FIXED=y CONFIG_PWM_ROCKCHIP=y CONFIG_RAM=y CONFIG_SPL_RAM=y
participants (2)
-
Jagan Teki
-
Kever Yang