U-Boot has two distinct phases: before and after relocation. These are
commonly referred to as F (running from Flash) and R (Relocated and
running from RAM). Some drivers want to do different things in these
phases so update the SPL phase function to return a different value for
each.
Signed-off-by: Simon Glass <sjg@chromium.org>
Reviewed-by: Bin Meng <bmeng.cn@gmail.com>
}
enum u_boot_phase {
- PHASE_TPL,
- PHASE_SPL,
- PHASE_U_BOOT,
+ PHASE_TPL, /* Running in TPL */
+ PHASE_SPL, /* Running in SPL */
+ PHASE_BOARD_F, /* Running in U-Boot before relocation */
+ PHASE_BOARD_R, /* Running in U-Boot after relocation */
};
/**
*
* but with this you can use:
*
- * if (spl_phase() == PHASE_U_BOOT) {
+ * if (spl_phase() == PHASE_BOARD_F) {
* ...
* }
*
#elif CONFIG_SPL_BUILD
return PHASE_SPL;
#else
- return PHASE_U_BOOT;
+ DECLARE_GLOBAL_DATA_PTR;
+
+ if (!(gd->flags & GD_FLG_RELOC))
+ return PHASE_BOARD_F;
+ else
+ return PHASE_BOARD_R;
#endif
}