Commit 5a89fa927cf6c54efe36918a4894ce31274d9ef1
Committed by
York Sun
1 parent
ee4d65117d
Exists in
master
and in
49 other branches
SPL: P2020RDB: fix the problem booting from spi flash
There was no enough stack in SPL, so the buffer needed in SPL is to malloc from memory pool and to repalce the temporary variable. Signed-off-by: Ying Zhang <b40530@freescale.com> Reviewed-by: York Sun <yorksun@freescale.com>
Showing 2 changed files with 14 additions and 5 deletions Side-by-side Diff
common/env_sf.c
... | ... | @@ -299,13 +299,16 @@ |
299 | 299 | |
300 | 300 | void env_relocate_spec(void) |
301 | 301 | { |
302 | - char buf[CONFIG_ENV_SIZE]; | |
303 | 302 | int ret; |
303 | + char *buf = NULL; | |
304 | 304 | |
305 | + buf = (char *)malloc(CONFIG_ENV_SIZE); | |
305 | 306 | env_flash = spi_flash_probe(CONFIG_ENV_SPI_BUS, CONFIG_ENV_SPI_CS, |
306 | 307 | CONFIG_ENV_SPI_MAX_HZ, CONFIG_ENV_SPI_MODE); |
307 | 308 | if (!env_flash) { |
308 | 309 | set_default_env("!spi_flash_probe() failed"); |
310 | + if (buf) | |
311 | + free(buf); | |
309 | 312 | return; |
310 | 313 | } |
311 | 314 | |
... | ... | @@ -321,6 +324,8 @@ |
321 | 324 | gd->env_valid = 1; |
322 | 325 | out: |
323 | 326 | spi_flash_free(env_flash); |
327 | + if (buf) | |
328 | + free(buf); | |
324 | 329 | env_flash = NULL; |
325 | 330 | } |
326 | 331 | #endif |
include/configs/p1_p2_rdb_pc.h
... | ... | @@ -579,11 +579,15 @@ |
579 | 579 | #define CONFIG_SYS_INIT_L2_ADDR_PHYS CONFIG_SYS_INIT_L2_ADDR |
580 | 580 | #define CONFIG_SYS_INIT_L2_END (CONFIG_SYS_INIT_L2_ADDR + CONFIG_SYS_L2_SIZE) |
581 | 581 | #define CONFIG_SPL_RELOC_TEXT_BASE 0xf8f81000 |
582 | -#define CONFIG_SPL_RELOC_STACK (CONFIG_SYS_INIT_L2_ADDR + 128 * 1024) | |
583 | -#define CONFIG_SPL_RELOC_STACK_SIZE (32 << 10) | |
584 | -#define CONFIG_SPL_RELOC_MALLOC_ADDR (CONFIG_SYS_INIT_L2_ADDR + 160 * 1024) | |
585 | -#define CONFIG_SPL_RELOC_MALLOC_SIZE (96 << 10) | |
586 | 582 | #define CONFIG_SPL_GD_ADDR (CONFIG_SYS_INIT_L2_ADDR + 112 * 1024) |
583 | +#define CONFIG_SPL_RELOC_STACK (CONFIG_SYS_INIT_L2_ADDR + 116 * 1024) | |
584 | +#define CONFIG_SPL_RELOC_STACK_SIZE (32 << 10) | |
585 | +#define CONFIG_SPL_RELOC_MALLOC_ADDR (CONFIG_SYS_INIT_L2_ADDR + 148 * 1024) | |
586 | +#if defined(CONFIG_P2020RDB) | |
587 | +#define CONFIG_SPL_RELOC_MALLOC_SIZE (364 << 10) | |
588 | +#else | |
589 | +#define CONFIG_SPL_RELOC_MALLOC_SIZE (108 << 10) | |
590 | +#endif | |
587 | 591 | #elif defined(CONFIG_NAND) |
588 | 592 | #ifdef CONFIG_TPL_BUILD |
589 | 593 | #define CONFIG_SYS_INIT_L2_ADDR 0xf8f80000 |