Commit 5fc3494fdb00dd7894090ce0c21936815a575558

Authored by Stefan Roese
Committed by Wolfgang Denk
1 parent c07e8da1a4

powerpc: mpc52xx: Clear GD in the main U-Boot stage for SPL usage

When an MPC5200 based board is used with SPL support, the main
U-Boot needs to clear the GD (global data) struct again.

Otherwise the generic board init code in board_init_f (when
CONFIG_SYS_GENERIC_BOARD is defined) will not initialize all
GD variables correctly. Resulting in a hangup on the a4m2k
board.

Signed-off-by: Stefan Roese <sr@denx.de>
Cc: Wolfgang Denk <wd@denx.de>

Showing 1 changed file with 15 additions and 0 deletions Side-by-side Diff

arch/powerpc/cpu/mpc5xxx/start.S
... ... @@ -76,6 +76,21 @@
76 76 * been done in the SPL u-boot version.
77 77 */
78 78 GET_GOT /* initialize GOT access */
  79 +
  80 + /*
  81 + * The GD (global data) struct needs to get cleared. Lets do
  82 + * this by calling memset().
  83 + * This function is called when the platform is build with SPL
  84 + * support from the main (full-blown) U-Boot. And the GD needs
  85 + * to get cleared (again) so that the following generic
  86 + * board support code, defined via CONFIG_SYS_GENERIC_BOARD,
  87 + * initializes all variables correctly.
  88 + */
  89 + mr r3, r2 /* parameter 1: GD pointer */
  90 + li r4,0 /* parameter 2: value to fill */
  91 + li r5,GD_SIZE /* parameter 3: count */
  92 + bl memset
  93 +
79 94 bl board_init_f /* run 1st part of board init code (in Flash)*/
80 95 /* NOTREACHED - board_init_f() does not return */
81 96 #else