diff options
author | Ye Li <ye.li@nxp.com> | 2019-06-25 02:51:42 -0700 |
---|---|---|
committer | Ye Li <ye.li@nxp.com> | 2020-04-26 23:21:48 -0700 |
commit | 3d0b50f6087183362cb3b43609ca6cd04d7470cd (patch) | |
tree | e67ba427e18cf056116571edf150d999367d7ca0 | |
parent | d2df5aa8e995c63b324bcbc826846e44e5b77aa5 (diff) |
MLK-22105-3 imx8m: spl: Move bss clean up before arch_cpu_init
Since rng_init is used arch_cpu_init, we have to clean up BSS section
before it.
Also remove the unnecessary memset to global data, because
board_init_f_init_reserve already memset it. If we memset it in board_init_f,
the gd->malloc_base is reset to 0 and will cause early malloc problem
when CONFIG_MALLOC_F_ADDR is not set.
Signed-off-by: Ye Li <ye.li@nxp.com>
Reviewed-by: Peng Fan <peng.fan@nxp.com>
(cherry picked from commit c36ae6a623b075192b20d93f9e3fe966961d86f4)
(cherry picked from commit f7e11efcb4689cd7e1068677454b2bd4480708f3)
-rw-r--r-- | board/freescale/imx8mm_evk/spl.c | 6 | ||||
-rw-r--r-- | board/freescale/imx8mn_evk/spl.c | 6 | ||||
-rw-r--r-- | board/freescale/imx8mp_evk/spl.c | 6 | ||||
-rw-r--r-- | board/freescale/imx8mq_evk/spl.c | 7 |
4 files changed, 11 insertions, 14 deletions
diff --git a/board/freescale/imx8mm_evk/spl.c b/board/freescale/imx8mm_evk/spl.c index 5d17f397cb6..490d5d456bf 100644 --- a/board/freescale/imx8mm_evk/spl.c +++ b/board/freescale/imx8mm_evk/spl.c @@ -125,6 +125,9 @@ void board_init_f(ulong dummy) struct udevice *dev; int ret; + /* Clear the BSS. */ + memset(__bss_start, 0, __bss_end - __bss_start); + arch_cpu_init(); init_uart_clk(1); @@ -135,9 +138,6 @@ void board_init_f(ulong dummy) preloader_console_init(); - /* Clear the BSS. */ - memset(__bss_start, 0, __bss_end - __bss_start); - ret = spl_early_init(); if (ret) { debug("spl_early_init() failed: %d\n", ret); diff --git a/board/freescale/imx8mn_evk/spl.c b/board/freescale/imx8mn_evk/spl.c index 7aed14c52b6..7108deccb99 100644 --- a/board/freescale/imx8mn_evk/spl.c +++ b/board/freescale/imx8mn_evk/spl.c @@ -88,6 +88,9 @@ void board_init_f(ulong dummy) { int ret; + /* Clear the BSS. */ + memset(__bss_start, 0, __bss_end - __bss_start); + arch_cpu_init(); init_uart_clk(1); @@ -98,9 +101,6 @@ void board_init_f(ulong dummy) preloader_console_init(); - /* Clear the BSS. */ - memset(__bss_start, 0, __bss_end - __bss_start); - ret = spl_init(); if (ret) { debug("spl_init() failed: %d\n", ret); diff --git a/board/freescale/imx8mp_evk/spl.c b/board/freescale/imx8mp_evk/spl.c index 0b20668e2b3..006d2e417de 100644 --- a/board/freescale/imx8mp_evk/spl.c +++ b/board/freescale/imx8mp_evk/spl.c @@ -118,6 +118,9 @@ void board_init_f(ulong dummy) { int ret; + /* Clear the BSS. */ + memset(__bss_start, 0, __bss_end - __bss_start); + arch_cpu_init(); init_uart_clk(1); @@ -128,9 +131,6 @@ void board_init_f(ulong dummy) preloader_console_init(); - /* Clear the BSS. */ - memset(__bss_start, 0, __bss_end - __bss_start); - ret = spl_init(); if (ret) { debug("spl_init() failed: %d\n", ret); diff --git a/board/freescale/imx8mq_evk/spl.c b/board/freescale/imx8mq_evk/spl.c index fa05381ad76..e8cb0f0caa9 100644 --- a/board/freescale/imx8mq_evk/spl.c +++ b/board/freescale/imx8mq_evk/spl.c @@ -212,8 +212,8 @@ void board_init_f(ulong dummy) { int ret; - /* Clear global data */ - memset((void *)gd, 0, sizeof(gd_t)); + /* Clear the BSS. */ + memset(__bss_start, 0, __bss_end - __bss_start); arch_cpu_init(); @@ -225,9 +225,6 @@ void board_init_f(ulong dummy) preloader_console_init(); - /* Clear the BSS. */ - memset(__bss_start, 0, __bss_end - __bss_start); - ret = spl_init(); if (ret) { debug("spl_init() failed: %d\n", ret); |