Commit 2e419edbe5a9d9c014f640ae3f1bfa753f4b5e59

Authored by Ji Luo
Committed by faqiang.zhu
1 parent 9d5a4e04e2

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

Showing 3 changed files with 46 additions and 0 deletions Side-by-side Diff

board/freescale/imx8mq_phanbell/imx8m_phanbell.c
... ... @@ -169,6 +169,25 @@
169 169  
170 170 return baseboard_id;
171 171 }
  172 +#ifdef CONFIG_IMX_TRUSTY_OS
  173 +int get_tee_load(ulong *load)
  174 +{
  175 + int board_id;
  176 +
  177 + board_id = get_imx8m_baseboard_id();
  178 + /* load TEE to the last 32M of DDR */
  179 + if ((board_id == ENTERPRISE_MICRON_1G) ||
  180 + (board_id == ENTERPRISE_HYNIX_1G)) {
  181 + /* for 1G DDR board */
  182 + *load = (ulong)TEE_LOAD_ADDR_1G;
  183 + } else {
  184 + /* for 3G DDR board */
  185 + *load = (ulong)TEE_LOAD_ADDR_3G;
  186 + }
  187 +
  188 + return 0;
  189 +}
  190 +#endif
172 191  
173 192 int dram_init(void)
174 193 {
common/spl/spl_fit.c
... ... @@ -155,6 +155,15 @@
155 155 return (data_size + info->bl_len - 1) / info->bl_len;
156 156 }
157 157  
  158 +#if defined(CONFIG_DUAL_BOOTLOADER) && defined(CONFIG_IMX_TRUSTY_OS)
  159 +__weak int get_tee_load(ulong *load)
  160 +{
  161 + /* default return ok */
  162 + return 0;
  163 +}
  164 +
  165 +#endif
  166 +
158 167 /**
159 168 * spl_load_fit_image(): load the image described in a certain FIT node
160 169 * @info: points to information about the device to load data from
... ... @@ -203,6 +212,21 @@
203 212  
204 213 if (fit_image_get_load(fit, node, &load_addr))
205 214 load_addr = image_info->load_addr;
  215 +
  216 +#if defined(CONFIG_DUAL_BOOTLOADER) && defined(CONFIG_IMX_TRUSTY_OS)
  217 + char *desc = NULL;
  218 +
  219 + if (fit_get_desc(fit, node, &desc)) {
  220 + printf("can't found node description!\n");
  221 + return -ENOENT;
  222 + } else if (!strncmp(desc, "TEE firmware",
  223 + strlen("TEE firmware"))) {
  224 + if (get_tee_load(&load_addr)) {
  225 + printf("Failed to get TEE load address!\n");
  226 + return -ENOENT;
  227 + }
  228 + }
  229 +#endif
206 230  
207 231 if (!fit_image_get_data_position(fit, node, &offset)) {
208 232 external_data = true;
include/configs/imx8mq_evk_androidthings.h
... ... @@ -48,6 +48,9 @@
48 48 #define WIBO_3G 0x00
49 49 #define IMX8M_REF_3G 0x00
50 50  
  51 +#define TEE_LOAD_ADDR_1G 0x7e000000
  52 +#define TEE_LOAD_ADDR_3G 0xfe000000
  53 +
51 54 #ifdef CONFIG_SPL_BUILD
52 55  
53 56 #define CONFIG_SPL_SHA256