Commit f7e11efcb4689cd7e1068677454b2bd4480708f3

Authored by Ye Li
1 parent 50790eb958

MLK-22105-3 imx8/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)

Showing 8 changed files with 8 additions and 32 deletions Side-by-side Diff

board/freescale/imx8mm_evk/spl.c
... ... @@ -223,8 +223,8 @@
223 223 {
224 224 int ret;
225 225  
226   - /* Clear global data */
227   - memset((void *)gd, 0, sizeof(gd_t));
  226 + /* Clear the BSS. */
  227 + memset(__bss_start, 0, __bss_end - __bss_start);
228 228  
229 229 arch_cpu_init();
230 230  
... ... @@ -233,9 +233,6 @@
233 233 timer_init();
234 234  
235 235 preloader_console_init();
236   -
237   - /* Clear the BSS. */
238   - memset(__bss_start, 0, __bss_end - __bss_start);
239 236  
240 237 ret = spl_init();
241 238 if (ret) {
board/freescale/imx8mm_val/spl.c
... ... @@ -233,8 +233,8 @@
233 233  
234 234 void board_init_f(ulong dummy)
235 235 {
236   - /* Clear global data */
237   - memset((void *)gd, 0, sizeof(gd_t));
  236 + /* Clear the BSS. */
  237 + memset(__bss_start, 0, __bss_end - __bss_start);
238 238  
239 239 arch_cpu_init();
240 240  
... ... @@ -243,9 +243,6 @@
243 243 timer_init();
244 244  
245 245 preloader_console_init();
246   -
247   - /* Clear the BSS. */
248   - memset(__bss_start, 0, __bss_end - __bss_start);
249 246  
250 247 board_init_r(NULL, 0);
251 248 }
board/freescale/imx8mq_arm2/spl.c
... ... @@ -224,8 +224,8 @@
224 224 {
225 225 int ret;
226 226  
227   - /* Clear global data */
228   - memset((void *)gd, 0, sizeof(gd_t));
  227 + /* Clear the BSS. */
  228 + memset(__bss_start, 0, __bss_end - __bss_start);
229 229  
230 230 arch_cpu_init();
231 231  
... ... @@ -236,9 +236,6 @@
236 236 timer_init();
237 237  
238 238 preloader_console_init();
239   -
240   - /* Clear the BSS. */
241   - memset(__bss_start, 0, __bss_end - __bss_start);
242 239  
243 240 ret = spl_init();
244 241 if (ret) {
board/freescale/imx8mq_evk/spl.c
... ... @@ -220,8 +220,8 @@
220 220 {
221 221 int ret;
222 222  
223   - /* Clear global data */
224   - memset((void *)gd, 0, sizeof(gd_t));
  223 + /* Clear the BSS. */
  224 + memset(__bss_start, 0, __bss_end - __bss_start);
225 225  
226 226 arch_cpu_init();
227 227  
... ... @@ -232,9 +232,6 @@
232 232 timer_init();
233 233  
234 234 preloader_console_init();
235   -
236   - /* Clear the BSS. */
237   - memset(__bss_start, 0, __bss_end - __bss_start);
238 235  
239 236 ret = spl_init();
240 237 if (ret) {
board/freescale/imx8qm_arm2/spl.c
... ... @@ -53,9 +53,6 @@
53 53  
54 54 void board_init_f(ulong dummy)
55 55 {
56   - /* Clear global data */
57   - memset((void *)gd, 0, sizeof(gd_t));
58   -
59 56 /* Clear the BSS. */
60 57 memset(__bss_start, 0, __bss_end - __bss_start);
61 58  
board/freescale/imx8qm_mek/spl.c
... ... @@ -53,9 +53,6 @@
53 53  
54 54 void board_init_f(ulong dummy)
55 55 {
56   - /* Clear global data */
57   - memset((void *)gd, 0, sizeof(gd_t));
58   -
59 56 /* Clear the BSS. */
60 57 memset(__bss_start, 0, __bss_end - __bss_start);
61 58  
board/freescale/imx8qxp_arm2/spl.c
... ... @@ -53,9 +53,6 @@
53 53  
54 54 void board_init_f(ulong dummy)
55 55 {
56   - /* Clear global data */
57   - memset((void *)gd, 0, sizeof(gd_t));
58   -
59 56 /* Clear the BSS. */
60 57 memset(__bss_start, 0, __bss_end - __bss_start);
61 58  
board/freescale/imx8qxp_mek/spl.c
... ... @@ -53,9 +53,6 @@
53 53  
54 54 void board_init_f(ulong dummy)
55 55 {
56   - /* Clear global data */
57   - memset((void *)gd, 0, sizeof(gd_t));
58   -
59 56 /* Clear the BSS. */
60 57 memset(__bss_start, 0, __bss_end - __bss_start);
61 58