Skip to contentSkip to conversation

rockchip: add tpl and OPTEE support for rk3229

PATCH New Kever Yang 1 participant 12 messages Apr 2, 2019

Subsystems (5)
lore
Share & tools
lore

Kever Yang

author
#0 lore raw

v6 cover rockchip: add tpl and OPTEE support for rk3229

Add some generic options for TPL support for arm 32bit, and then and TPL support for rk3229(cortex-A7), and then add OPTEE support in SPL.

Version 5 rebase on master branch with 'SYS_SOC name correct' patch set, remove the patches for OP-TEE which has been mergerd.

Version 6 fix travis build error cause by sysreset update.
https://travis-ci.org/keveryang/u-boot/builds/514475183

Changes in v6:
- update defconfig for stm32mp15_basic, am65x_evm_r5, mt7629_rfb, x86, sandbox... to enable SPL_SYSRESET.

Kever Yang (11):
Revert "rockchip: rk322x: ram: enable DRAM init in SPL instead of TPL"
arm: add option for TPL support in arm 32bit
arm: add a separate stack for TPL
rockchip: rk322x: add CLK_EMMC_SAMPLE clock support
rockchip: clk: rk322x: fix assert clock value
rockchip: rk322x: add tpl support
sysreset: enable driver support in SPL/TPL
rockchip: rk322x: dts: enable uart2 for SPL/TPL
rockchip: evb-rk3229: remove unnecessary defines
rockchip: evb-rk3229: add README file for OP-TEE support
rockchip: evb-rk322x: update defconfig with tpl and optee support

 arch/Kconfig                              |  1 +
 arch/arm/Kconfig                          | 30 ++++++++++
 arch/arm/dts/rk3229-evb.dts               |  1 +
 arch/arm/lib/crt0.S                       |  4 +-
 arch/arm/mach-rockchip/Kconfig            | 26 ++++++++
 arch/arm/mach-rockchip/Makefile           |  3 +-
 arch/arm/mach-rockchip/rk322x-board-spl.c | 46 ++++++---------
 arch/arm/mach-rockchip/rk322x-board-tpl.c | 53 +++++++++++++++++
 arch/arm/mach-rockchip/u-boot-tpl.lds     | 12 ++++
 board/rockchip/evb_rk3229/README          | 72 +++++++++++++++++++++++
 configs/am65x_evm_a53_defconfig           |  1 +
 configs/am65x_evm_r5_defconfig            |  1 +
 configs/evb-rk3229_defconfig              | 25 ++++++--
 configs/mt7629_rfb_defconfig              |  1 +
 configs/sandbox_spl_defconfig             |  1 +
 drivers/clk/rockchip/clk_rk322x.c         |  6 +-
 drivers/ram/rockchip/sdram_rk322x.c       | 12 ++--
 drivers/sysreset/Kconfig                  | 18 ++++++
 drivers/sysreset/Makefile                 |  2 +-
 include/configs/evb_rk3229.h              | 44 +-------------
 include/configs/rk322x_common.h           | 10 ++--
 21 files changed, 278 insertions(+), 91 deletions(-)
 create mode 100644 arch/arm/mach-rockchip/rk322x-board-tpl.c
 create mode 100644 arch/arm/mach-rockchip/u-boot-tpl.lds
 create mode 100644 board/rockchip/evb_rk3229/README
Signature · 1 line
2.20.1
author
#1 lore raw

PATCH v6 1/11 Revert "rockchip: rk322x: ram: enable DRAM init in SPL instead of TPL"

This reverts commit f338cca1d2bce906b049722d2fdbf527a4963b61.

---

Changes in v6: None

 drivers/ram/rockchip/sdram_rk322x.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/ram/rockchip/sdram_rk322x.c +6 -6
index c596523d4f..e96ac54c39 100644
@@ -49,7 +49,7 @@ struct rk322x_sdram_params {
 		struct regmap *map;
 };
 
-#ifdef CONFIG_SPL_BUILD
+#ifdef CONFIG_TPL_BUILD
 /*
  * [7:6]  bank(n:n bit bank)
  * [5:4]  row(13+n)
@@ -750,7 +750,7 @@ static int rk322x_dmc_ofdata_to_platdata(struct udevice *dev)
 
 	return 0;
 }
-#endif /* CONFIG_SPL_BUILD */
+#endif /* CONFIG_TPL_BUILD */
 
 #if CONFIG_IS_ENABLED(OF_PLATDATA)
 static int conv_of_platdata(struct udevice *dev)
@@ -778,7 +778,7 @@ static int conv_of_platdata(struct udevice *dev)
 
 static int rk322x_dmc_probe(struct udevice *dev)
 {
-#ifdef CONFIG_SPL_BUILD
+#ifdef CONFIG_TPL_BUILD
 	struct rk322x_sdram_params *plat = dev_get_platdata(dev);
 	int ret;
 	struct udevice *dev_clk;
@@ -786,7 +786,7 @@ static int rk322x_dmc_probe(struct udevice *dev)
 	struct dram_info *priv = dev_get_priv(dev);
 
 	priv->grf = syscon_get_first_range(ROCKCHIP_SYSCON_GRF);
-#ifdef CONFIG_SPL_BUILD
+#ifdef CONFIG_TPL_BUILD
 #if CONFIG_IS_ENABLED(OF_PLATDATA)
 	ret = conv_of_platdata(dev);
 	if (ret)
@@ -842,12 +842,12 @@ U_BOOT_DRIVER(dmc_rk322x) = {
 	.id = UCLASS_RAM,
 	.of_match = rk322x_dmc_ids,
 	.ops = &rk322x_dmc_ops,
-#ifdef CONFIG_SPL_BUILD
+#ifdef CONFIG_TPL_BUILD
 	.ofdata_to_platdata = rk322x_dmc_ofdata_to_platdata,
 #endif
 	.probe = rk322x_dmc_probe,
 	.priv_auto_alloc_size = sizeof(struct dram_info),
-#ifdef CONFIG_SPL_BUILD
+#ifdef CONFIG_TPL_BUILD
 	.platdata_auto_alloc_size = sizeof(struct rk322x_sdram_params),
 #endif
 };
Signature · 1 line
2.20.1
author
#2 lore raw

PATCH v6 2/11 arm: add option for TPL support in arm 32bit

In reply to Kever Yang

Some options like TPL_SYS_THUMB_BUILD, TPL_USE_ARCH_MEMCPY and TPL_USE_ARCH_MEMCPY are needed for TPL build in 32bit arm.

---

Changes in v6: None

 arch/arm/Kconfig | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)
arch/arm/Kconfig +29 -0
index a5851aeeae..18e8d9355c 100644
@@ -338,6 +338,17 @@ config SPL_SYS_THUMB_BUILD
 	   density. For ARM architectures that support Thumb2 this flag will
 	   result in Thumb2 code generated by GCC.
 
+config TPL_SYS_THUMB_BUILD
+	bool "Build TPL using the Thumb instruction set"
+	default y if SYS_THUMB_BUILD
+	depends on TPL && !ARM64
+	help
+	   Use this flag to build SPL using the Thumb instruction set for
+	   ARM architectures. Thumb instruction set provides better code
+	   density. For ARM architectures that support Thumb2 this flag will
+	   result in Thumb2 code generated by GCC.
+
+
 config SYS_L2CACHE_OFF
 	bool "L2cache off"
 	help
@@ -373,6 +384,15 @@ config SPL_USE_ARCH_MEMCPY
 	  Such implementation may be faster under some conditions
 	  but may increase the binary size.
 
+config TPL_USE_ARCH_MEMCPY
+	bool "Use an assembly optimized implementation of memcpy for TPL"
+	default y if USE_ARCH_MEMCPY
+	depends on !ARM64
+	help
+	  Enable the generation of an optimized version of memcpy.
+	  Such implementation may be faster under some conditions
+	  but may increase the binary size.
+
 config USE_ARCH_MEMSET
 	bool "Use an assembly optimized implementation of memset"
 	default y
@@ -391,6 +411,15 @@ config SPL_USE_ARCH_MEMSET
 	  Such implementation may be faster under some conditions
 	  but may increase the binary size.
 
+config TPL_USE_ARCH_MEMSET
+	bool "Use an assembly optimized implementation of memset for TPL"
+	default y if USE_ARCH_MEMSET
+	depends on !ARM64
+	help
+	  Enable the generation of an optimized version of memset.
+	  Such implementation may be faster under some conditions
+	  but may increase the binary size.
+
 config ARM64_SUPPORT_AARCH32
 	bool "ARM64 system support AArch32 execution state"
 	default y if ARM64 && !TARGET_THUNDERX_88XX
Signature · 1 line
2.20.1
author
#3 lore raw

PATCH v6 3/11 arm: add a separate stack for TPL

In reply to Kever Yang

TPL stack may different from SPL and sys stack, add support for separate one when the board defines it.

---

Changes in v6: None

 arch/arm/lib/crt0.S | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
arch/arm/lib/crt0.S +3 -1
index fe312db690..30fba20e1b 100644
@@ -67,7 +67,9 @@ ENTRY(_main)
  * Set up initial C runtime environment and call board_init_f(0).
  */
 
-#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK)
+#if defined(CONFIG_TPL_BUILD) && defined(CONFIG_TPL_NEEDS_SEPARATE_STACK)
+	ldr	r0, =(CONFIG_TPL_STACK)
+#elif defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK)
 	ldr	r0, =(CONFIG_SPL_STACK)
 #else
 	ldr	r0, =(CONFIG_SYS_INIT_SP_ADDR)
Signature · 1 line
2.20.1
author
#4 lore raw

PATCH v6 4/11 rockchip: rk322x: add CLK_EMMC_SAMPLE clock support

In reply to Kever Yang

---

Changes in v6: None

 drivers/clk/rockchip/clk_rk322x.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/clk/rockchip/clk_rk322x.c +2 -0
index 48ed14b2af..4b599fbb24 100644
@@ -217,6 +217,7 @@ static ulong rockchip_mmc_get_clk(struct rk322x_cru *cru, uint clk_general_rate,
 	switch (periph) {
 	case HCLK_EMMC:
 	case SCLK_EMMC:
+	case SCLK_EMMC_SAMPLE:
 		con = readl(&cru->cru_clksel_con[11]);
 		mux = (con & EMMC_PLL_MASK) >> EMMC_PLL_SHIFT;
 		con = readl(&cru->cru_clksel_con[12]);
@@ -293,6 +294,7 @@ static ulong rockchip_mmc_set_clk(struct rk322x_cru *cru, uint clk_general_rate,
 	switch (periph) {
 	case HCLK_EMMC:
 	case SCLK_EMMC:
+	case SCLK_EMMC_SAMPLE:
 		rk_clrsetreg(&cru->cru_clksel_con[11],
 			     EMMC_PLL_MASK,
 			     mux << EMMC_PLL_SHIFT);
Signature · 1 line
2.20.1
author
#5 lore raw

PATCH v6 5/11 rockchip: clk: rk322x: fix assert clock value

In reply to Kever Yang

BUS_PCLK_HZ and BUS_HCLK_HZ are from BUS_ACLK_HZ, not from GPLL_HZ.

---

Changes in v6: None

 drivers/clk/rockchip/clk_rk322x.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/clk/rockchip/clk_rk322x.c +2 -2
index 4b599fbb24..f09730c91b 100644
@@ -121,10 +121,10 @@ static void rkclk_init(struct rk322x_cru *cru)
 	assert((aclk_div + 1) * BUS_ACLK_HZ == GPLL_HZ && aclk_div <= 0x1f);
 
 	pclk_div = BUS_ACLK_HZ / BUS_PCLK_HZ - 1;
-	assert((pclk_div + 1) * BUS_PCLK_HZ == GPLL_HZ && pclk_div <= 0x7);
+	assert((pclk_div + 1) * BUS_PCLK_HZ == BUS_ACLK_HZ && pclk_div <= 0x7);
 
 	hclk_div = BUS_ACLK_HZ / BUS_HCLK_HZ - 1;
-	assert((hclk_div + 1) * BUS_HCLK_HZ == GPLL_HZ && hclk_div <= 0x3);
+	assert((hclk_div + 1) * BUS_HCLK_HZ == BUS_ACLK_HZ && hclk_div <= 0x3);
 
 	rk_clrsetreg(&cru->cru_clksel_con[0],
 		     BUS_ACLK_PLL_SEL_MASK | BUS_ACLK_DIV_MASK,
Signature · 1 line
2.20.1
author
#6 lore raw

PATCH v6 6/11 rockchip: rk322x: add tpl support

In reply to Kever Yang

Move original spl to tpl, and add spl to load next stage firmware, adapt all the address and option for them.

---

Changes in v6: None

 arch/arm/mach-rockchip/Kconfig            | 26 +++++++++++
 arch/arm/mach-rockchip/Makefile           |  3 +-
 arch/arm/mach-rockchip/rk322x-board-spl.c | 46 ++++++++------------
 arch/arm/mach-rockchip/rk322x-board-tpl.c | 53 +++++++++++++++++++++++
 arch/arm/mach-rockchip/u-boot-tpl.lds     | 12 +++++
 include/configs/rk322x_common.h           | 10 +++--
 6 files changed, 116 insertions(+), 34 deletions(-)
 create mode 100644 arch/arm/mach-rockchip/rk322x-board-tpl.c
 create mode 100644 arch/arm/mach-rockchip/u-boot-tpl.lds
arch/arm/mach-rockchip/Kconfig +26 -0
index 17b3b9372d..d0ed369f55 100644
@@ -47,14 +47,40 @@ config ROCKCHIP_RK322X
 	bool "Support Rockchip RK3228/RK3229"
 	select CPU_V7A
 	select SUPPORT_SPL
+	select SUPPORT_TPL
 	select SPL
+	select SPL_DM
+	select SPL_OF_LIBFDT
+	select TPL
+	select TPL_DM
+	select TPL_OF_LIBFDT
+	select TPL_NEEDS_SEPARATE_TEXT_BASE if SPL
+	select TPL_NEEDS_SEPARATE_STACK if TPL
+	select SPL_DRIVERS_MISC_SUPPORT
+	imply SPL_SERIAL_SUPPORT
+	imply TPL_SERIAL_SUPPORT
 	select ROCKCHIP_BROM_HELPER
+	select TPL_LIBCOMMON_SUPPORT
+	select TPL_LIBGENERIC_SUPPORT
 	help
 	  The Rockchip RK3229 is a ARM-based SoC with a dual-core Cortex-A7
 	  including NEON and GPU, Mali-400 graphics, several DDR3 options
 	  and video codec support. Peripherals include Gigabit Ethernet,
 	  USB2 host and OTG, SDIO, I2S, UART, SPI, I2C and PWMs.
 
+if ROCKCHIP_RK322X
+
+config TPL_TEXT_BASE
+        default 0x10081000
+
+config TPL_MAX_SIZE
+        default 28672
+
+config TPL_STACK
+        default 0x10088000
+
+endif
+
 config ROCKCHIP_RK3288
 	bool "Support Rockchip RK3288"
 	select CPU_V7A
arch/arm/mach-rockchip/Makefile +2 -1
index 368302e1da..fd62a693fe 100644
@@ -11,10 +11,11 @@ obj-tpl-$(CONFIG_ROCKCHIP_BROM_HELPER) += bootrom.o
 
 obj-tpl-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board-tpl.o
 obj-tpl-$(CONFIG_ROCKCHIP_RK3368) += rk3368-board-tpl.o
+obj-tpl-$(CONFIG_ROCKCHIP_RK322X) += rk322x-board-tpl.o
 
 obj-spl-$(CONFIG_ROCKCHIP_RK3036) += rk3036-board-spl.o
 obj-spl-$(CONFIG_ROCKCHIP_RK3188) += rk3188-board-spl.o
-obj-spl-$(CONFIG_ROCKCHIP_RK322X) += rk322x-board-spl.o
+obj-spl-$(CONFIG_ROCKCHIP_RK322X) += rk322x-board-spl.o spl-boot-order.o
 obj-spl-$(CONFIG_ROCKCHIP_RK3288) += rk3288-board-spl.o
 obj-spl-$(CONFIG_ROCKCHIP_RK3368) += rk3368-board-spl.o spl-boot-order.o
 obj-spl-$(CONFIG_ROCKCHIP_RK3399) += rk3399-board-spl.o spl-boot-order.o
arch/arm/mach-rockchip/rk322x-board-spl.c +17 -29

72 lines not on this page · raw message

arch/arm/mach-rockchip/rk322x-board-tpl.c new file +53 -0

53 lines not on this page · raw message

arch/arm/mach-rockchip/u-boot-tpl.lds new file +12 -0
new file mode 100644
index 0000000000..f5a89721ce
@@ -0,0 +1,12 @@
+// SPDX-License-Identifier:	GPL-2.0+
+/*
+ * Copyright (C) 2019 Rockchip Electronic Co.,Ltd
+ */
+
+#undef CONFIG_SPL_TEXT_BASE
+#define CONFIG_SPL_TEXT_BASE CONFIG_TPL_TEXT_BASE
+
+#undef CONFIG_SPL_MAX_SIZE
+#define CONFIG_SPL_MAX_SIZE CONFIG_TPL_MAX_SIZE
+
+#include "../cpu/u-boot-spl.lds"
include/configs/rk322x_common.h +6 -4
index 9e1ff17f48..cb4dc42122 100644
@@ -17,10 +17,12 @@
 #define CONFIG_SYS_TIMER_BASE		0x110c00a0 /* TIMER5 */
 #define CONFIG_SYS_TIMER_COUNTER	(CONFIG_SYS_TIMER_BASE + 8)
 
-#define CONFIG_SYS_INIT_SP_ADDR		0x60100000
-#define CONFIG_SYS_LOAD_ADDR		0x60800800
-#define CONFIG_SPL_STACK		0x10088000
-#define CONFIG_SPL_TEXT_BASE		0x10081000
+#define CONFIG_SYS_NS16550_MEM32
+#define CONFIG_SYS_INIT_SP_ADDR		0x61100000
+#define CONFIG_SYS_LOAD_ADDR		0x61800800
+#define CONFIG_SPL_STACK		0x60088000
+#define CONFIG_SPL_TEXT_BASE		0x60000000
+#define CONFIG_SPL_MAX_SIZE		0x100000
 
 #define CONFIG_ROCKCHIP_MAX_INIT_SIZE	(28 << 10)
 #define CONFIG_ROCKCHIP_CHIP_TAG	"RK32"
Signature · 1 line
2.20.1
author
#7 lore raw

PATCH v6 7/11 sysreset: enable driver support in SPL/TPL

In reply to Kever Yang

SPL/TPL also need use sysreset for some feature like panic callback.

---

Changes in v6:
- update defconfig for stm32mp15_basic, am65x_evm_r5, mt7629_rfb, x86, sandbox... to enable SPL_SYSRESET.

 arch/Kconfig                    |  1 +
 arch/arm/Kconfig                |  1 +
 configs/am65x_evm_a53_defconfig |  1 +
 configs/am65x_evm_r5_defconfig  |  1 +
 configs/mt7629_rfb_defconfig    |  1 +
 configs/sandbox_spl_defconfig   |  1 +
 drivers/sysreset/Kconfig        | 18 ++++++++++++++++++
 drivers/sysreset/Makefile       |  2 +-
 8 files changed, 25 insertions(+), 1 deletion(-)
arch/Kconfig +1 -0
index 2f3d07c13a..562f9ea692 100644
@@ -158,6 +158,7 @@ config X86
 	imply DM_USB
 	imply DM_VIDEO
 	imply SYSRESET
+	imply SPL_SYSRESET
 	imply SYSRESET_X86
 	imply USB_ETHER_ASIX
 	imply USB_ETHER_SMSC95XX
arch/arm/Kconfig +1 -0
index 18e8d9355c..3f67d98755 100644
@@ -1433,6 +1433,7 @@ config ARCH_STM32MP
 	select SYSRESET
 	select SYS_THUMB_BUILD
 	imply CMD_DM
+	imply SPL_SYSRESET
 	help
 	  Support for STM32MP SoC family developed by STMicroelectronics,
 	  MPUs based on ARM cortex A core
configs/am65x_evm_a53_defconfig +1 -0
index 8f6fd25531..23db645c24 100644
@@ -68,4 +68,5 @@ CONFIG_DM_RESET=y
 CONFIG_RESET_TI_SCI=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYSRESET=y
+CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_TI_SCI=y
configs/am65x_evm_r5_defconfig +1 -0
index 49498b13b6..0371189688 100644
@@ -82,6 +82,7 @@ CONFIG_DM_RESET=y
 CONFIG_RESET_TI_SCI=y
 CONFIG_DM_SERIAL=y
 CONFIG_SYSRESET=y
+CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_TI_SCI=y
 CONFIG_TIMER=y
 CONFIG_SPL_TIMER=y
configs/mt7629_rfb_defconfig +1 -0
index 459c67827d..f9de4b26df 100644
@@ -64,6 +64,7 @@ CONFIG_SPI=y
 CONFIG_DM_SPI=y
 CONFIG_MTK_QSPI=y
 CONFIG_SYSRESET=y
+CONFIG_SPL_SYSRESET=y
 CONFIG_SYSRESET_WATCHDOG=y
 CONFIG_TIMER=y
 CONFIG_SPL_TIMER=y
configs/sandbox_spl_defconfig +1 -0
index 012f3342ac..784a2fe4bb 100644
@@ -174,6 +174,7 @@ CONFIG_SANDBOX_SPI=y
 CONFIG_SPMI=y
 CONFIG_SPMI_SANDBOX=y
 CONFIG_SYSRESET=y
+CONFIG_SPL_SYSRESET=y
 CONFIG_TIMER=y
 CONFIG_TIMER_EARLY=y
 CONFIG_SANDBOX_TIMER=y
drivers/sysreset/Kconfig +18 -0
index 8ce3e2e207..d456f0ce36 100644
@@ -13,6 +13,24 @@ config SYSRESET
 	  to effect a reset. The uclass will try all available drivers when
 	  reset_walk() is called.
 
+config SPL_SYSRESET
+	bool "Enable support for system reset drivers in SPL mode"
+	depends on SYSRESET && SPL_DM
+	help
+	  Enable system reset drivers which can be used to reset the CPU or
+	  board. Each driver can provide a reset method which will be called
+	  to effect a reset. The uclass will try all available drivers when
+	  reset_walk() is called.
+
+config TPL_SYSRESET
+	bool "Enable support for system reset drivers in TPL mode"
+	depends on SYSRESET && TPL_DM
+	help
+	  Enable system reset drivers which can be used to reset the CPU or
+	  board. Each driver can provide a reset method which will be called
+	  to effect a reset. The uclass will try all available drivers when
+	  reset_walk() is called.
+
 if SYSRESET
 
 config SYSRESET_GPIO
drivers/sysreset/Makefile +1 -1
index b3728ac17f..8e1c845dfe 100644
@@ -2,7 +2,7 @@
 #
 # (C) Copyright 2016 Cadence Design Systems Inc.
 
-obj-$(CONFIG_SYSRESET) += sysreset-uclass.o
+obj-$(CONFIG_$(SPL_TPL_)SYSRESET) += sysreset-uclass.o
 obj-$(CONFIG_ARCH_ASPEED) += sysreset_ast.o
 obj-$(CONFIG_ARCH_ROCKCHIP) += sysreset_rockchip.o
 obj-$(CONFIG_ARCH_STI) += sysreset_sti.o
Signature · 1 line
2.20.1
author
#8 lore raw

PATCH v6 8/11 rockchip: rk322x: dts: enable uart2 for SPL/TPL

In reply to Kever Yang

When we use DM_SERIAL for serial driver, we need enable the dts node for the debug console.

---

Changes in v6: None

 arch/arm/dts/rk3229-evb.dts | 1 +
 1 file changed, 1 insertion(+)
arch/arm/dts/rk3229-evb.dts +1 -0
index bfb367ac99..632cdc9bc3 100644
@@ -82,6 +82,7 @@
 };
 
 &uart2 {
+	u-boot,dm-pre-reloc;
 	status = "okay";
 };
 
Signature · 1 line
2.20.1
author
#9 lore raw

PATCH v6 9/11 rockchip: evb-rk3229: remove unnecessary defines

In reply to Kever Yang

Prefer to use default setting like other SoCs.

---

Changes in v6: None

 include/configs/evb_rk3229.h | 44 +-----------------------------------
 1 file changed, 1 insertion(+), 43 deletions(-)
include/configs/evb_rk3229.h +1 -43
index 369b0bc68a..6a91a82ceb 100644
@@ -8,48 +8,6 @@
 
 #include <configs/rk322x_common.h>
 
-
-/* Store env in emmc */
-#define CONFIG_SYS_MMC_ENV_DEV          0
-#define CONFIG_SYS_MMC_ENV_PART         0
-#define CONFIG_SYS_REDUNDAND_ENVIRONMENT
-
-#ifndef CONFIG_SPL_BUILD
-/* Enable gpt partition table */
-#undef PARTS_DEFAULT
-#define PARTS_DEFAULT \
-	"uuid_disk=${uuid_gpt_disk};" \
-	"name=loader_a,start=4M,size=4M,uuid=${uuid_gpt_loader};" \
-	"name=loader_b,size=4M,uuid=${uuid_gpt_reserved};" \
-	"name=trust_a,size=4M,uuid=${uuid_gpt_reserved};" \
-	"name=trust_b,size=4M,uuid=${uuid_gpt_reserved};" \
-	"name=misc,size=4M,uuid=${uuid_gpt_misc};" \
-	"name=metadata,size=16M,uuid=${uuid_gpt_metadata};" \
-	"name=boot_a,size=32M,uuid=${uuid_gpt_boot_a};" \
-	"name=boot_b,size=32M,uuid=${uuid_gpt_boot_b};" \
-	"name=system_a,size=818M,uuid=${uuid_gpt_system_a};" \
-	"name=system_b,size=818M,uuid=${uuid_gpt_system_b};" \
-	"name=vendor_a,size=50M,uuid=${uuid_gpt_vendor_a};" \
-	"name=vendor_b,size=50M,uuid=${uuid_gpt_vendor_b};" \
-	"name=cache,size=100M,uuid=${uuid_gpt_cache};" \
-	"name=persist,size=4M,uuid=${uuid_gpt_persist};" \
-	"name=userdata,size=-,uuid=${uuid_gpt_userdata};\0" \
-
-#define CONFIG_PREBOOT
-
-#define CONFIG_SYS_BOOT_RAMDISK_HIGH
-
-#undef CONFIG_BOOTCOMMAND
-#define CONFIG_BOOTCOMMAND \
-	"mmc read 0x61000000 0x8000 0x5000;" \
-	"bootm 0x61000000" \
-
-/* Enable atags */
-#define CONFIG_SYS_BOOTPARAMS_LEN	(64*1024)
-#define CONFIG_INITRD_TAG
-#define CONFIG_SETUP_MEMORY_TAGS
-#define CONFIG_CMDLINE_TAG
-
-#endif
+#define CONFIG_SYS_MMC_ENV_DEV 0
 
 #endif
Signature · 1 line
2.20.1
author
#10 lore raw

PATCH v6 10/11 rockchip: evb-rk3229: add README file for OP-TEE support

In reply to Kever Yang

Detail of step by step to bring up the board with OP-TEE support.

---

Changes in v6: None

 board/rockchip/evb_rk3229/README | 72 ++++++++++++++++++++++++++++++++
 1 file changed, 72 insertions(+)
 create mode 100644 board/rockchip/evb_rk3229/README
board/rockchip/evb_rk3229/README new file +72 -0
new file mode 100644
index 0000000000..93328c75b2
@@ -0,0 +1,72 @@
+Get the Source and prebuild binary
+==================================
+
+  > mkdir ~/evb_rk3229
+  > cd ~/evb_rk3229
+  > git clone git://git.denx.de/u-boot.git
+  > git clone https://github.com/OP-TEE/optee_os.git
+  > git clone https://github.com/rockchip-linux/rkbin.git
+  > git clone https://github.com/rockchip-linux/rkdeveloptool.git
+
+Compile the OP-TEE
+===============
+
+  > cd optee_os
+  > make clean
+  > make CROSS_COMPILE_ta_arm32=arm-none-eabi- PLATFORM=rockchip-rk322x
+  Get tee.bin in this step, copy it to U-Boot root dir:
+  > cp out/arm-plat-rockchip/core/tee-pager.bin ../u-boot/tee.bin
+
+Compile the U-Boot
+==================
+
+  > cd ../u-boot
+  > export CROSS_COMPILE=arm-linux-gnueabihf-
+  > export ARCH=arm
+  > make evb-rk3229_defconfig
+  > make
+  > make u-boot.itb
+
+  Get tpl/u-boot-tpl.bin, spl/u-boot-spl.bin and u-boot.itb in this step.
+
+Compile the rkdeveloptool
+=======================
+  Follow instructions in latest README
+  > cd ../rkflashtool
+  > autoreconf -i
+  > ./configure
+  > make
+  > sudo make install
+
+  Get rkdeveloptool in you Host in this step.
+
+Both origin binaries and Tool are ready now, choose either option 1 or
+option 2 to deploy U-Boot.
+
+Package the image
+=================
+
+  > cd ../u-boot
+  > tools/mkimage -n rk322x -T rksd -d tpl/u-boot-spl.bin idbloader.img
+  > cat spl/u-boot-spl.bin >> idbloader.img
+
+  Get idbloader.img in this step.
+
+Flash the image to eMMC
+=======================
+Power on(or reset with RESET KEY) with MASKROM KEY preesed, and then:
+  > cd ..
+  > rkdeveloptool db rkbin/rk32/rk322x_loader_v1.04.232.bin
+  > rkdeveloptool wl 64 u-boot/idbloader.img
+  > rkdeveloptool wl 0x4000 u-boot/u-boot.itb
+  > rkdeveloptool rd
+
+Flash the image to SD card
+==========================
+  > dd if=u-boot/idbloader.img of=/dev/sdb seek=64
+  > dd if=u-boot/u-boot.itb of=/dev/sdb seek=16384
+
+You should be able to get U-Boot log message with OP-TEE boot info.
+
+For more detail, please reference to:
+http://opensource.rock-chips.com/wiki_Boot_option
Signature · 1 line
2.20.1
author
#11 lore raw

PATCH v6 11/11 rockchip: evb-rk322x: update defconfig with tpl and optee support

In reply to Kever Yang

Enable all the options for TPL/SPL and OPTEE.

---

Changes in v6: None

 configs/evb-rk3229_defconfig | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)
configs/evb-rk3229_defconfig +21 -4
index 14ff54af20..8ad48bad68 100644
@@ -1,37 +1,51 @@
 CONFIG_ARM=y
 CONFIG_ARCH_ROCKCHIP=y
-CONFIG_SYS_TEXT_BASE=0x60000000
+CONFIG_SYS_TEXT_BASE=0x61000000
 CONFIG_SPL_LIBCOMMON_SUPPORT=y
 CONFIG_SPL_LIBGENERIC_SUPPORT=y
 CONFIG_SYS_MALLOC_F_LEN=0x800
 CONFIG_ROCKCHIP_RK322X=y
-CONFIG_SPL_ROCKCHIP_BACK_TO_BROM=y
+CONFIG_TPL_ROCKCHIP_BACK_TO_BROM=y
+CONFIG_ROCKCHIP_SPL_RESERVE_IRAM=0x0
 CONFIG_TARGET_EVB_RK3229=y
 CONFIG_DEBUG_UART_BASE=0x11030000
 CONFIG_DEBUG_UART_CLOCK=24000000
-CONFIG_SPL_STACK_R_ADDR=0x80000
+CONFIG_SPL_STACK_R_ADDR=0x60600000
 CONFIG_DEBUG_UART=y
 CONFIG_NR_DRAM_BANKS=2
+CONFIG_FIT=y
+CONFIG_FIT_VERBOSE=y
+CONFIG_SPL_LOAD_FIT=y
+CONFIG_SPL_OPTEE=y
+CONFIG_SPL_FIT_SOURCE="arch/arm/mach-rockchip/fit_spl_optee.its"
 CONFIG_DEFAULT_FDT_FILE="rk3229-evb.dtb"
 # CONFIG_DISPLAY_CPUINFO is not set
 CONFIG_DISPLAY_BOARDINFO_LATE=y
+# CONFIG_SPL_RAW_IMAGE_SUPPORT is not set
+# CONFIG_SPL_LEGACY_IMAGE_SUPPORT is not set
 CONFIG_SPL_STACK_R=y
-CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x200
+CONFIG_SPL_STACK_R_MALLOC_SIMPLE_LEN=0x2000
+CONFIG_TPL_LDSCRIPT="arch/arm/mach-rockchip/u-boot-tpl.lds"
 CONFIG_CMD_GPT=y
 CONFIG_CMD_MMC=y
 # CONFIG_CMD_SETEXPR is not set
 CONFIG_CMD_TIME=y
 CONFIG_SPL_OF_CONTROL=y
+CONFIG_TPL_OF_CONTROL=y
 CONFIG_DEFAULT_DEVICE_TREE="rk3229-evb"
 CONFIG_OF_SPL_REMOVE_PROPS="pinctrl-0 pinctrl-names clock-names interrupt-parent assigned-clocks assigned-clock-rates assigned-clock-parents"
 CONFIG_ENV_IS_IN_MMC=y
 CONFIG_NET_RANDOM_ETHADDR=y
 CONFIG_REGMAP=y
 CONFIG_SPL_REGMAP=y
+CONFIG_TPL_REGMAP=y
 CONFIG_SYSCON=y
 CONFIG_SPL_SYSCON=y
+CONFIG_TPL_SYSCON=y
 CONFIG_CLK=y
 CONFIG_SPL_CLK=y
+CONFIG_TPL_CLK=y
+CONFIG_FASTBOOT_BUF_SIZE=0x04000000
 CONFIG_FASTBOOT_FLASH=y
 CONFIG_FASTBOOT_FLASH_MMC_DEV=0
 CONFIG_FASTBOOT_CMD_OEM_FORMAT=y
@@ -46,6 +60,7 @@ CONFIG_PHY=y
 CONFIG_PINCTRL=y
 CONFIG_RAM=y
 CONFIG_SPL_RAM=y
+CONFIG_TPL_RAM=y
 CONFIG_BAUDRATE=1500000
 CONFIG_DEBUG_UART_SHIFT=2
 CONFIG_SYSRESET=y
@@ -57,3 +72,5 @@ CONFIG_USB_GADGET_PRODUCT_NUM=0x320a
 CONFIG_USB_GADGET_DWC2_OTG=y
 CONFIG_USB_FUNCTION_MASS_STORAGE=y
 CONFIG_ERRNO_STR=y
+CONFIG_TPL_TINY_MEMSET=y
+CONFIG_USE_TINY_PRINTF=y
Signature · 1 line
2.20.1