All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] rockchip: fit_spl_optee: get text and optee base from build
@ 2019-12-05 10:11 Kever Yang
  2019-12-05 10:11 ` [PATCH 2/4] rockchip: rk3288-evb: update SPL_STACK/MALLOC_LEN config with rk3399 Kever Yang
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Kever Yang @ 2019-12-05 10:11 UTC (permalink / raw)
  To: u-boot

Instead of hardcode the base address, we can get them from the build
output, eg. get the SYS_TEXT_BASE from .config and get optee base from
DRAM_BASE.
We can use this script for SoCs with DRAM base not from 0x60000000(rk3229
and many other 32bit Rockchip SoCs), eg. rk3288 DRAM base is 0.

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

 arch/arm/mach-rockchip/fit_spl_optee.sh | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/arch/arm/mach-rockchip/fit_spl_optee.sh b/arch/arm/mach-rockchip/fit_spl_optee.sh
index 89ef04312c..4118472d9f 100755
--- a/arch/arm/mach-rockchip/fit_spl_optee.sh
+++ b/arch/arm/mach-rockchip/fit_spl_optee.sh
@@ -17,6 +17,12 @@ if [ ! -f $TEE ]; then
 fi
 
 dtname=$1
+text_base=`sed -n "/SYS_TEXT_BASE=/s/CONFIG_SYS_TEXT_BASE=//p" .config \
+	   |tr -d '\r'`
+dram_base=`sed -n "/SYS_SDRAM_BASE=/s/CONFIG_SYS_SDRAM_BASE=//p" \
+	   include/autoconf.mk|tr -d '\r'`
+tee_base=`echo "obase=16;$(($dram_base+0x8400000))"|bc`
+tee_base='0x'$tee_base
 
 cat << __HEADER_EOF
 /*
@@ -39,7 +45,7 @@ cat << __HEADER_EOF
 			os = "U-Boot";
 			arch = "arm";
 			compression = "none";
-			load = <0x61000000>;
+			load = <$text_base>;
 		};
 		optee {
 			description = "OP-TEE";
@@ -48,8 +54,8 @@ cat << __HEADER_EOF
 			arch = "arm";
 			os = "tee";
 			compression = "none";
-			load = <0x68400000>;
-			entry = <0x68400000>;
+			load = <$tee_base>;
+			entry = <$tee_base>;
 		};
 		fdt {
 			description = "$(basename $dtname .dtb)";
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/4] rockchip: rk3288-evb: update SPL_STACK/MALLOC_LEN config with rk3399
  2019-12-05 10:11 [PATCH 1/4] rockchip: fit_spl_optee: get text and optee base from build Kever Yang
@ 2019-12-05 10:11 ` Kever Yang
  2019-12-05 10:11 ` [PATCH 3/4] rockchip: rk3288-evb: update CONFIG_NR_DRAM_BANKS to 2 Kever Yang
  2019-12-05 10:11 ` [PATCH 4/4] rockchip: rk3288-evb: update config to support OPTEE Kever Yang
  2 siblings, 0 replies; 4+ messages in thread
From: Kever Yang @ 2019-12-05 10:11 UTC (permalink / raw)
  To: u-boot

Update the SPL_STACK_R_MALLOC_SIMPLE_LEN which also including space for
STACK and the size may not enough when loding FIT image in SPL.

If the size is not enough, you can see log like this when loding FIT:

U-Boot TPL 2020.01-rc3-00082-g4b19b89ca4-dirty (Dec 05 2019 - 11:52:53)
Trying to boot from BOOTROM
Returning to boot ROM...
U-Boot SPL 2020.01-rc3-00082-g4b19b89ca4-dirty (Dec 05 2019 - 11:52:53 +0800)
Trying to boot from MMC2

And if enable the DEBUG for everyting in SPL, the log will hang at dwmmc
sending CMD16 for 'uboot' loadables binary because this step need a
large stack cost(about 0x2d00).

External data: dst=8400000, offset=72638, size=b3580
Image OS is Trusted Execution Environment
board_fit_config_name_match: rk3288-evb
Selecting config 'rk3288-evb'loadables: 'uboot'
blk_find_device: if_type=6, devnum=1: dwmmc at ff0c0000.blk, 6, 0
blk_find_device: if_type=6, devnum=1: dwmmc at ff0f0000.blk, 6, 1
Sending CMD16

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

 configs/evb-rk3288_defconfig | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/configs/evb-rk3288_defconfig b/configs/evb-rk3288_defconfig
index 36f6d4a18e..685120cd78 100644
--- a/configs/evb-rk3288_defconfig
+++ b/configs/evb-rk3288_defconfig
@@ -4,7 +4,7 @@ CONFIG_SYS_TEXT_BASE=0x01000000
 CONFIG_ROCKCHIP_RK3288=y
 CONFIG_TARGET_EVB_RK3288=y
 CONFIG_ENV_OFFSET=0x3F8000
-CONFIG_SPL_STACK_R_ADDR=0x80000
+CONFIG_SPL_STACK_R_ADDR=0x04000000
 CONFIG_NR_DRAM_BANKS=1
 CONFIG_SPL_SIZE_LIMIT=0x4b000
 CONFIG_DEBUG_UART_BASE=0xff690000
@@ -17,7 +17,7 @@ CONFIG_DEFAULT_FDT_FILE="rk3288-evb-rk808.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_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 3/4] rockchip: rk3288-evb: update CONFIG_NR_DRAM_BANKS to 2
  2019-12-05 10:11 [PATCH 1/4] rockchip: fit_spl_optee: get text and optee base from build Kever Yang
  2019-12-05 10:11 ` [PATCH 2/4] rockchip: rk3288-evb: update SPL_STACK/MALLOC_LEN config with rk3399 Kever Yang
@ 2019-12-05 10:11 ` Kever Yang
  2019-12-05 10:11 ` [PATCH 4/4] rockchip: rk3288-evb: update config to support OPTEE Kever Yang
  2 siblings, 0 replies; 4+ messages in thread
From: Kever Yang @ 2019-12-05 10:11 UTC (permalink / raw)
  To: u-boot

The OPTEE will use the ram start at 0x8400000 which make the DRAM be two
banks.

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

 configs/evb-rk3288_defconfig | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/configs/evb-rk3288_defconfig b/configs/evb-rk3288_defconfig
index 685120cd78..9391328bce 100644
--- a/configs/evb-rk3288_defconfig
+++ b/configs/evb-rk3288_defconfig
@@ -5,7 +5,7 @@ CONFIG_ROCKCHIP_RK3288=y
 CONFIG_TARGET_EVB_RK3288=y
 CONFIG_ENV_OFFSET=0x3F8000
 CONFIG_SPL_STACK_R_ADDR=0x04000000
-CONFIG_NR_DRAM_BANKS=1
+CONFIG_NR_DRAM_BANKS=2
 CONFIG_SPL_SIZE_LIMIT=0x4b000
 CONFIG_DEBUG_UART_BASE=0xff690000
 CONFIG_DEBUG_UART_CLOCK=24000000
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 4/4] rockchip: rk3288-evb: update config to support OPTEE
  2019-12-05 10:11 [PATCH 1/4] rockchip: fit_spl_optee: get text and optee base from build Kever Yang
  2019-12-05 10:11 ` [PATCH 2/4] rockchip: rk3288-evb: update SPL_STACK/MALLOC_LEN config with rk3399 Kever Yang
  2019-12-05 10:11 ` [PATCH 3/4] rockchip: rk3288-evb: update CONFIG_NR_DRAM_BANKS to 2 Kever Yang
@ 2019-12-05 10:11 ` Kever Yang
  2 siblings, 0 replies; 4+ messages in thread
From: Kever Yang @ 2019-12-05 10:11 UTC (permalink / raw)
  To: u-boot

Upstream kernel and rockchip kernel has default enable PSCI which needs
OPTEE in trust word, enable OPTEE support for evb by default and SPL_FIT
option to pack OPTEE with U-Boot proper.

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

 configs/evb-rk3288_defconfig | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/configs/evb-rk3288_defconfig b/configs/evb-rk3288_defconfig
index 9391328bce..ffa90127c7 100644
--- a/configs/evb-rk3288_defconfig
+++ b/configs/evb-rk3288_defconfig
@@ -11,6 +11,10 @@ CONFIG_DEBUG_UART_BASE=0xff690000
 CONFIG_DEBUG_UART_CLOCK=24000000
 CONFIG_DEBUG_UART=y
 # CONFIG_ANDROID_BOOT_IMAGE is not set
+CONFIG_FIT=y
+CONFIG_FIT_VERBOSE=y
+CONFIG_SPL_LOAD_FIT=y
+CONFIG_SPL_FIT_GENERATOR="arch/arm/mach-rockchip/fit_spl_optee.sh"
 CONFIG_USE_PREBOOT=y
 CONFIG_SILENT_CONSOLE=y
 CONFIG_DEFAULT_FDT_FILE="rk3288-evb-rk808.dtb"
@@ -18,6 +22,7 @@ CONFIG_DEFAULT_FDT_FILE="rk3288-evb-rk808.dtb"
 CONFIG_DISPLAY_BOARDINFO_LATE=y
 CONFIG_SPL_STACK_R=y
 CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x10000
+CONFIG_SPL_OPTEE=y
 CONFIG_CMD_GPIO=y
 CONFIG_CMD_GPT=y
 CONFIG_CMD_I2C=y
-- 
2.17.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2019-12-05 10:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-05 10:11 [PATCH 1/4] rockchip: fit_spl_optee: get text and optee base from build Kever Yang
2019-12-05 10:11 ` [PATCH 2/4] rockchip: rk3288-evb: update SPL_STACK/MALLOC_LEN config with rk3399 Kever Yang
2019-12-05 10:11 ` [PATCH 3/4] rockchip: rk3288-evb: update CONFIG_NR_DRAM_BANKS to 2 Kever Yang
2019-12-05 10:11 ` [PATCH 4/4] rockchip: rk3288-evb: update config to support OPTEE Kever Yang

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.