summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJi Luo <ji.luo@nxp.com>2018-07-26 08:39:30 +0800
committerfaqiang.zhu <faqiang.zhu@nxp.com>2018-11-12 09:18:36 +0800
commit2e419edbe5a9d9c014f640ae3f1bfa753f4b5e59 (patch)
tree5304e2703b8aa53b2aef0d4593f89cfaa3af9182
parent9d5a4e04e2160c691be468d3368ce34fcd7271a3 (diff)
[iot] Load Trusty to different address for AIY 1G/3G ddr board
Trusty image should be loaded to different address for AIY 1G/3G ddr board which have different ddr size. Use board id to distinguish different baseboard, load trusty image to 0x7e00_0000 for AIY 1G ddr board and 0xfe00_0000 for AIY 3G ddr board. Test: build and boot Trusty ok for AIY 1G/3G ddr board. Change-Id: I62d8a19b13fe19f38075512a6faa4bbb36f74791 Signed-off-by: Ji Luo <ji.luo@nxp.com>
-rw-r--r--board/freescale/imx8mq_phanbell/imx8m_phanbell.c19
-rw-r--r--common/spl/spl_fit.c24
-rw-r--r--include/configs/imx8mq_evk_androidthings.h3
3 files changed, 46 insertions, 0 deletions
diff --git a/board/freescale/imx8mq_phanbell/imx8m_phanbell.c b/board/freescale/imx8mq_phanbell/imx8m_phanbell.c
index d26c63c7edf..56fca2af884 100644
--- a/board/freescale/imx8mq_phanbell/imx8m_phanbell.c
+++ b/board/freescale/imx8mq_phanbell/imx8m_phanbell.c
@@ -169,6 +169,25 @@ int get_imx8m_baseboard_id(void)
return baseboard_id;
}
+#ifdef CONFIG_IMX_TRUSTY_OS
+int get_tee_load(ulong *load)
+{
+ int board_id;
+
+ board_id = get_imx8m_baseboard_id();
+ /* load TEE to the last 32M of DDR */
+ if ((board_id == ENTERPRISE_MICRON_1G) ||
+ (board_id == ENTERPRISE_HYNIX_1G)) {
+ /* for 1G DDR board */
+ *load = (ulong)TEE_LOAD_ADDR_1G;
+ } else {
+ /* for 3G DDR board */
+ *load = (ulong)TEE_LOAD_ADDR_3G;
+ }
+
+ return 0;
+}
+#endif
int dram_init(void)
{
diff --git a/common/spl/spl_fit.c b/common/spl/spl_fit.c
index d9bb7d55a75..7595a33e816 100644
--- a/common/spl/spl_fit.c
+++ b/common/spl/spl_fit.c
@@ -155,6 +155,15 @@ static int get_aligned_image_size(struct spl_load_info *info, int data_size,
return (data_size + info->bl_len - 1) / info->bl_len;
}
+#if defined(CONFIG_DUAL_BOOTLOADER) && defined(CONFIG_IMX_TRUSTY_OS)
+__weak int get_tee_load(ulong *load)
+{
+ /* default return ok */
+ return 0;
+}
+
+#endif
+
/**
* spl_load_fit_image(): load the image described in a certain FIT node
* @info: points to information about the device to load data from
@@ -204,6 +213,21 @@ static int spl_load_fit_image(struct spl_load_info *info, ulong sector,
if (fit_image_get_load(fit, node, &load_addr))
load_addr = image_info->load_addr;
+#if defined(CONFIG_DUAL_BOOTLOADER) && defined(CONFIG_IMX_TRUSTY_OS)
+ char *desc = NULL;
+
+ if (fit_get_desc(fit, node, &desc)) {
+ printf("can't found node description!\n");
+ return -ENOENT;
+ } else if (!strncmp(desc, "TEE firmware",
+ strlen("TEE firmware"))) {
+ if (get_tee_load(&load_addr)) {
+ printf("Failed to get TEE load address!\n");
+ return -ENOENT;
+ }
+ }
+#endif
+
if (!fit_image_get_data_position(fit, node, &offset)) {
external_data = true;
} else if (!fit_image_get_data_offset(fit, node, &offset)) {
diff --git a/include/configs/imx8mq_evk_androidthings.h b/include/configs/imx8mq_evk_androidthings.h
index 0be6d64f620..02344560454 100644
--- a/include/configs/imx8mq_evk_androidthings.h
+++ b/include/configs/imx8mq_evk_androidthings.h
@@ -48,6 +48,9 @@
#define WIBO_3G 0x00
#define IMX8M_REF_3G 0x00
+#define TEE_LOAD_ADDR_1G 0x7e000000
+#define TEE_LOAD_ADDR_3G 0xfe000000
+
#ifdef CONFIG_SPL_BUILD
#define CONFIG_SPL_SHA256