Commit 692bb011e8b0302b9e96b54de7a8fc9a17e69b56
1 parent
a7549ea99f
Exists in
smarc_8mq_lf_v2020.04
and in
4 other branches
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)
Showing 4 changed files with 11 additions and 14 deletions Side-by-side Diff
board/freescale/imx8mm_evk/spl.c
... | ... | @@ -125,6 +125,9 @@ |
125 | 125 | struct udevice *dev; |
126 | 126 | int ret; |
127 | 127 | |
128 | + /* Clear the BSS. */ | |
129 | + memset(__bss_start, 0, __bss_end - __bss_start); | |
130 | + | |
128 | 131 | arch_cpu_init(); |
129 | 132 | |
130 | 133 | init_uart_clk(1); |
... | ... | @@ -134,9 +137,6 @@ |
134 | 137 | timer_init(); |
135 | 138 | |
136 | 139 | preloader_console_init(); |
137 | - | |
138 | - /* Clear the BSS. */ | |
139 | - memset(__bss_start, 0, __bss_end - __bss_start); | |
140 | 140 | |
141 | 141 | ret = spl_early_init(); |
142 | 142 | if (ret) { |
board/freescale/imx8mn_evk/spl.c
... | ... | @@ -88,6 +88,9 @@ |
88 | 88 | { |
89 | 89 | int ret; |
90 | 90 | |
91 | + /* Clear the BSS. */ | |
92 | + memset(__bss_start, 0, __bss_end - __bss_start); | |
93 | + | |
91 | 94 | arch_cpu_init(); |
92 | 95 | |
93 | 96 | init_uart_clk(1); |
... | ... | @@ -97,9 +100,6 @@ |
97 | 100 | timer_init(); |
98 | 101 | |
99 | 102 | preloader_console_init(); |
100 | - | |
101 | - /* Clear the BSS. */ | |
102 | - memset(__bss_start, 0, __bss_end - __bss_start); | |
103 | 103 | |
104 | 104 | ret = spl_init(); |
105 | 105 | if (ret) { |
board/freescale/imx8mp_evk/spl.c
... | ... | @@ -118,6 +118,9 @@ |
118 | 118 | { |
119 | 119 | int ret; |
120 | 120 | |
121 | + /* Clear the BSS. */ | |
122 | + memset(__bss_start, 0, __bss_end - __bss_start); | |
123 | + | |
121 | 124 | arch_cpu_init(); |
122 | 125 | |
123 | 126 | init_uart_clk(1); |
... | ... | @@ -127,9 +130,6 @@ |
127 | 130 | timer_init(); |
128 | 131 | |
129 | 132 | preloader_console_init(); |
130 | - | |
131 | - /* Clear the BSS. */ | |
132 | - memset(__bss_start, 0, __bss_end - __bss_start); | |
133 | 133 | |
134 | 134 | ret = spl_init(); |
135 | 135 | if (ret) { |
board/freescale/imx8mq_evk/spl.c
... | ... | @@ -212,8 +212,8 @@ |
212 | 212 | { |
213 | 213 | int ret; |
214 | 214 | |
215 | - /* Clear global data */ | |
216 | - memset((void *)gd, 0, sizeof(gd_t)); | |
215 | + /* Clear the BSS. */ | |
216 | + memset(__bss_start, 0, __bss_end - __bss_start); | |
217 | 217 | |
218 | 218 | arch_cpu_init(); |
219 | 219 | |
... | ... | @@ -224,9 +224,6 @@ |
224 | 224 | timer_init(); |
225 | 225 | |
226 | 226 | preloader_console_init(); |
227 | - | |
228 | - /* Clear the BSS. */ | |
229 | - memset(__bss_start, 0, __bss_end - __bss_start); | |
230 | 227 | |
231 | 228 | ret = spl_init(); |
232 | 229 | if (ret) { |
-
mentioned in commit 409888