Skip to contentSkip to conversation

rk3288: tinker/vyasa: Fixes for TPL/SPL boot

PATCH New Jagan Teki 2 participants 21 messages Sep 17, 2019 – Sep 19, 2019

Subsystems (3)
lore
Share & tools
lore

Jagan Teki

author
#0 lore raw

cover 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(-)
Signature · 1 line
2.18.0.321.gffc6fa0e3
author
#1 lore raw

PATCH 1/7 rockchip: rk3288: vyasa: Drop ROCKCHIP_BROM_HELPER selection

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.

---
 arch/arm/mach-rockchip/rk3288/Kconfig | 1 -
 1 file changed, 1 deletion(-)
arch/arm/mach-rockchip/rk3288/Kconfig +0 -1
index 87e3d342f6..4ebc0792d5 100644
@@ -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,
Signature · 1 line
2.18.0.321.gffc6fa0e3
#2 lore raw

PATCH 1/7 rockchip: rk3288: vyasa: Drop ROCKCHIP_BROM_HELPER selection

Quoted 7 lines · Jagan Teki

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.

Thanks,
- Kever

Quoted 16 lines
---
  arch/arm/mach-rockchip/rk3288/Kconfig | 1 -
  1 file changed, 1 deletion(-)
arch/arm/mach-rockchip/rk3288/Kconfig +0 -1
index 87e3d342f6..4ebc0792d5 100644
@@ -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,
author
#3 lore raw

PATCH 2/7 configs: vyasa-rk3288: Fix SPL_TEXT_BASE

In reply to Jagan Teki

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.

---
 configs/vyasa-rk3288_defconfig | 1 -
 1 file changed, 1 deletion(-)
configs/vyasa-rk3288_defconfig +0 -1
index c74c1457a7..89921e6836 100644
@@ -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
Signature · 1 line
2.18.0.321.gffc6fa0e3
#4 lore raw

PATCH 2/7 configs: vyasa-rk3288: Fix SPL_TEXT_BASE

Quoted 9 lines · Jagan Teki

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)

Quoted 5 lines

So, fix by dropping the legacy SPL_TEXT_BASE and it will reassign 0x0 by default based on Kconfig definition.

Thanks,
- Kever

Quoted 16 lines
---
  configs/vyasa-rk3288_defconfig | 1 -
  1 file changed, 1 deletion(-)
configs/vyasa-rk3288_defconfig +0 -1
index c74c1457a7..89921e6836 100644
@@ -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
#5 lore raw

PATCH 2/7 configs: vyasa-rk3288: Fix SPL_TEXT_BASE

In reply to Jagan Teki
Quoted 9 lines · Jagan Teki

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)

Quoted 4 lines

So, fix by dropping the legacy SPL_TEXT_BASE and it will reassign 0x0 by default based on Kconfig definition.

Why this tag is needed for yourself?

Thanks,

- Kever

Quoted 17 lines
---
  configs/vyasa-rk3288_defconfig | 1 -
  1 file changed, 1 deletion(-)
configs/vyasa-rk3288_defconfig +0 -1
index c74c1457a7..89921e6836 100644
@@ -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
author
#6 lore raw

PATCH 2/7 configs: vyasa-rk3288: Fix SPL_TEXT_BASE

Quoted 12 lines · Kever Yang
Quoted 9 lines · Jagan Teki

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)

Quoted 6 lines
Quoted 4 lines

So, fix by dropping the legacy SPL_TEXT_BASE and it will reassign 0x0 by default based on Kconfig definition.

Why this tag is needed for yourself?

Since, I have posted the bug on the mailing list.

author
#7 lore raw

PATCH 3/7 ram: rk3288: Initialize dram for TPL builds

In reply to Jagan Teki

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.

---
 drivers/ram/rockchip/sdram_rk3288.c | 15 ++++++++++-----
 1 file changed, 10 insertions(+), 5 deletions(-)
drivers/ram/rockchip/sdram_rk3288.c +10 -5
index 6bb025a851..5775254007 100644
@@ -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
 };
Signature · 1 line
2.18.0.321.gffc6fa0e3
#8 lore raw

PATCH 3/7 ram: rk3288: Initialize dram for TPL builds

Quoted 9 lines · Jagan Teki

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.

Thanks,
- Kever

Quoted 55 lines
---
  drivers/ram/rockchip/sdram_rk3288.c | 15 ++++++++++-----
  1 file changed, 10 insertions(+), 5 deletions(-)
drivers/ram/rockchip/sdram_rk3288.c +10 -5
index 6bb025a851..5775254007 100644
@@ -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
  };
author
#9 lore raw

PATCH 4/7 rockchip: spi-boot-order: Trival fix to newline missing

In reply to Jagan Teki

newline \n was missed in fdt_path_offset, error loop.

---
 arch/arm/mach-rockchip/spl-boot-order.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/spl-boot-order.c +1 -1
index c19c285c07..fa8e096426 100644
@@ -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;
 		}
 
Signature · 1 line
2.18.0.321.gffc6fa0e3
#10 lore raw

PATCH 4/7 rockchip: spi-boot-order: Trival fix to newline missing

Quoted 3 lines · Jagan Teki

newline \n was missed in fdt_path_offset, error loop.

Thanks,
- Kever

Quoted 17 lines
---
  arch/arm/mach-rockchip/spl-boot-order.c | 2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)
arch/arm/mach-rockchip/spl-boot-order.c +1 -1
index c19c285c07..fa8e096426 100644
@@ -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;
  		}
 
author
#11 lore raw

PATCH 5/7 configs: tinker: Drop explicit SPL_TEXT

In reply to Jagan Teki

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.

---
 configs/tinker-rk3288_defconfig | 1 -
 1 file changed, 1 deletion(-)
configs/tinker-rk3288_defconfig +0 -1
index 443f4d88b9..adab1cba42 100644
@@ -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
Signature · 1 line
2.18.0.321.gffc6fa0e3
#12 lore raw

PATCH 5/7 configs: tinker: Drop explicit SPL_TEXT

Quoted 9 lines · Jagan Teki

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.

Thanks,
- Kever

Quoted 16 lines
---
  configs/tinker-rk3288_defconfig | 1 -
  1 file changed, 1 deletion(-)
configs/tinker-rk3288_defconfig +0 -1
index 443f4d88b9..adab1cba42 100644
@@ -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
author
#13 lore raw

PATCH 6/7 configs: tinker: Enable SDRAM, SPL stack

In reply to Jagan Teki

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.

---
 configs/tinker-rk3288_defconfig | 3 +++
 1 file changed, 3 insertions(+)
configs/tinker-rk3288_defconfig +3 -0
index adab1cba42..359be078ac 100644
@@ -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
Signature · 1 line
2.18.0.321.gffc6fa0e3
#14 lore raw

PATCH 6/7 configs: tinker: Enable SDRAM, SPL stack

Quoted 11 lines · Jagan Teki

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

Quoted 37 lines

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.

---
  configs/tinker-rk3288_defconfig | 3 +++
  1 file changed, 3 insertions(+)
configs/tinker-rk3288_defconfig +3 -0
index adab1cba42..359be078ac 100644
@@ -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
author
#15 lore raw

PATCH 6/7 configs: tinker: Enable SDRAM, SPL stack

Quoted 11 lines · Kever Yang
Quoted 8 lines · Jagan Teki

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.

Quoted 6 lines
Quoted 3 lines

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.

Quoted 3 lines

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.

#16 lore raw

PATCH 6/7 configs: tinker: Enable SDRAM, SPL stack

Quoted 22 lines · Jagan Teki
Quoted 10 lines · Kever Yang
Quoted 8 lines · Jagan Teki

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.

Quoted 5 lines
Quoted 3 lines

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.

Quoted 5 lines

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

Quoted 6 lines
Quoted 3 lines

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.

author
#17 lore raw

PATCH 6/7 configs: tinker: Enable SDRAM, SPL stack

Quoted 31 lines · Kever Yang
Quoted 22 lines · Jagan Teki
Quoted 10 lines · Kever Yang
Quoted 8 lines · Jagan Teki

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.

Quoted 5 lines
Quoted 3 lines

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.

Quoted 5 lines

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.

Quoted 7 lines

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.

#18 lore raw

PATCH 6/7 configs: tinker: Enable SDRAM, SPL stack

In reply to Jagan Teki
Quoted 18 lines · Jagan Teki

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 ###

Quoted 5 lines

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

Thanks,
- Kever

Quoted 25 lines
---
  configs/tinker-rk3288_defconfig | 3 +++
  1 file changed, 3 insertions(+)
configs/tinker-rk3288_defconfig +3 -0
index adab1cba42..359be078ac 100644
@@ -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
author
#19 lore raw

PATCH 7/7 rockchip: rk3288-tinker: Attach missing peripherals at SPL

In reply to Jagan Teki

From: Michael Trimarchi <[email protected]>

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.

---
 arch/arm/dts/rk3288-tinker-u-boot.dtsi | 26 +++++++++++++++++++-------
 configs/tinker-rk3288_defconfig        |  5 +++++
 2 files changed, 24 insertions(+), 7 deletions(-)
arch/arm/dts/rk3288-tinker-u-boot.dtsi +19 -7
index 2efb309d6b..f7f9d6dc72 100644
@@ -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;
 };
configs/tinker-rk3288_defconfig +5 -0
index 359be078ac..afee09819d 100644
@@ -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
Signature · 1 line
2.18.0.321.gffc6fa0e3
#20 lore raw

PATCH 7/7 rockchip: rk3288-tinker: Attach missing peripherals at SPL

Quoted 1 line · Jagan Teki

From: Michael Trimarchi <[email protected]>

Thanks,
- Kever

Quoted 93 lines

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.

---
  arch/arm/dts/rk3288-tinker-u-boot.dtsi | 26 +++++++++++++++++++-------
  configs/tinker-rk3288_defconfig        |  5 +++++
  2 files changed, 24 insertions(+), 7 deletions(-)
arch/arm/dts/rk3288-tinker-u-boot.dtsi +19 -7
index 2efb309d6b..f7f9d6dc72 100644
@@ -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;
  };
configs/tinker-rk3288_defconfig +5 -0
index 359be078ac..afee09819d 100644
@@ -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