ARM: DRA7: Add support for IO delay configuration
[oweals/u-boot.git] / arch / arm / lib / crt0_64.S
index 77563967e517902863a530967f4c2ea02e891305..bc9c53c308debaf82965dcbf912836c91ff33ab6 100644 (file)
@@ -61,13 +61,27 @@ ENTRY(_main)
 /*
  * Set up initial C runtime environment and call board_init_f(0).
  */
+#if defined(CONFIG_SPL_BUILD) && defined(CONFIG_SPL_STACK)
+       ldr     x0, =(CONFIG_SPL_STACK)
+#else
        ldr     x0, =(CONFIG_SYS_INIT_SP_ADDR)
-       sub     x0, x0, #GD_SIZE        /* allocate one GD above SP */
+#endif
+       sub     x18, x0, #GD_SIZE       /* allocate one GD above SP */
+       bic     x18, x18, #0x7          /* 8-byte alignment for GD */
+zero_gd:
+       sub     x0, x0, #0x8
+       str     xzr, [x0]
+       cmp     x0, x18
+       b.gt    zero_gd
+#if defined(CONFIG_SYS_MALLOC_F_LEN)
+       sub     x0, x18, #CONFIG_SYS_MALLOC_F_LEN
+       str     x0, [x18, #GD_MALLOC_BASE]
+#endif
        bic     sp, x0, #0xf    /* 16-byte alignment for ABI compliance */
-       mov     x18, sp                 /* GD is above SP */
        mov     x0, #0
        bl      board_init_f
 
+#if !defined(CONFIG_SPL_BUILD)
 /*
  * Set up intermediate environment (new sp and gd) and call
  * relocate_code(addr_moni). Trick here is that we'll return
@@ -110,4 +124,6 @@ clear_loop:
 
        /* NOTREACHED - board_init_r() does not return */
 
+#endif /* !CONFIG_SPL_BUILD */
+
 ENDPROC(_main)