ARM: renesas: Add R8A779A0 V3U Falcon board code
[platform/kernel/u-boot.git] / include / spl.h
index a764878..cee9a42 100644 (file)
@@ -58,6 +58,7 @@ static inline bool u_boot_first_phase(void)
 }
 
 enum u_boot_phase {
+       PHASE_NONE,     /* Invalid phase, signifying before U-Boot */
        PHASE_TPL,      /* Running in TPL */
        PHASE_SPL,      /* Running in SPL */
        PHASE_BOARD_F,  /* Running in U-Boot before relocation */
@@ -123,6 +124,58 @@ static inline enum u_boot_phase spl_phase(void)
 #endif
 }
 
+/**
+ * spl_prev_phase() - Figure out the previous U-Boot phase
+ *
+ * @return the previous phase from this one, e.g. if called in SPL this returns
+ *     PHASE_TPL, if TPL is enabled
+ */
+static inline enum u_boot_phase spl_prev_phase(void)
+{
+#ifdef CONFIG_TPL_BUILD
+       return PHASE_NONE;
+#elif defined(CONFIG_SPL_BUILD)
+       return IS_ENABLED(CONFIG_TPL) ? PHASE_TPL : PHASE_NONE;
+#else
+       return IS_ENABLED(CONFIG_SPL) ? PHASE_SPL : PHASE_NONE;
+#endif
+}
+
+/**
+ * spl_next_phase() - Figure out the next U-Boot phase
+ *
+ * @return the next phase from this one, e.g. if called in TPL this returns
+ *     PHASE_SPL
+ */
+static inline enum u_boot_phase spl_next_phase(void)
+{
+#ifdef CONFIG_TPL_BUILD
+       return PHASE_SPL;
+#else
+       return PHASE_BOARD_F;
+#endif
+}
+
+/**
+ * spl_phase_name() - Get the name of the current phase
+ *
+ * @return phase name
+ */
+static inline const char *spl_phase_name(enum u_boot_phase phase)
+{
+       switch (phase) {
+       case PHASE_TPL:
+               return "TPL";
+       case PHASE_SPL:
+               return "SPL";
+       case PHASE_BOARD_F:
+       case PHASE_BOARD_R:
+               return "U-Boot";
+       default:
+               return "phase?";
+       }
+}
+
 /* A string name for SPL or TPL */
 #ifdef CONFIG_SPL_BUILD
 # ifdef CONFIG_TPL_BUILD
@@ -169,6 +222,15 @@ struct spl_load_info {
        void *priv;
        int bl_len;
        const char *filename;
+       /**
+        * read() - Read from device
+        *
+        * @load: Information about the load state
+        * @sector: Sector number to read from (each @load->bl_len bytes)
+        * @count: Number of sectors to read
+        * @buf: Buffer to read into
+        * @return number of sectors read, 0 on error
+        */
        ulong (*read)(struct spl_load_info *load, ulong sector, ulong count,
                      void *buf);
 };
@@ -202,6 +264,16 @@ ulong spl_get_image_pos(void);
 ulong spl_get_image_size(void);
 
 /**
+ * spl_get_image_text_base() - get the text base of the next phase
+ *
+ * This returns the address that the next stage is linked to run at, i.e.
+ * CONFIG_SPL_TEXT_BASE or CONFIG_SYS_TEXT_BASE
+ *
+ * @return text-base address
+ */
+ulong spl_get_image_text_base(void);
+
+/**
  * spl_load_simple_fit_skip_processing() - Hook to allow skipping the FIT
  *     image processing during spl_load_simple_fit().
  *
@@ -285,15 +357,7 @@ u32 spl_mmc_boot_mode(const u32 boot_device);
  * If not overridden, it is weakly defined in common/spl/spl_mmc.c.
  */
 int spl_mmc_boot_partition(const u32 boot_device);
-
-/**
- * spl_alloc_bd() - Allocate space for bd_info
- *
- * This sets up the gd->bd pointer by allocating memory for it
- *
- * @return 0 if OK, -ENOMEM if out of memory
- */
-int spl_alloc_bd(void);
+void spl_set_bd(void);
 
 /**
  * spl_set_header_raw_uboot() - Set up a standard SPL image structure
@@ -638,9 +702,9 @@ int board_return_to_bootrom(struct spl_image_info *spl_image,
 
 /**
  * board_spl_fit_post_load - allow process images after loading finished
- *
+ * @fit: Pointer to a valid Flattened Image Tree blob
  */
-void board_spl_fit_post_load(ulong load_addr, size_t length);
+void board_spl_fit_post_load(const void *fit);
 
 /**
  * board_spl_fit_size_align - specific size align before processing payload