This allows to get log messages from SPL on stdio consoles. The pre-console
buffer is placed in 2 KiB of SRAM, chopped off from the upper addresses of
stack. This size is completely arbitrary and can be increased or decreased
if necessary. Only normal SPL is supported, but not FEL mode.

Signed-off-by: Siarhei Siamashka <[email protected]>
---
 include/configs/sunxi-common.h | 27 ++++++++++++++++++++++++---
 1 file changed, 24 insertions(+), 3 deletions(-)

diff --git a/include/configs/sunxi-common.h b/include/configs/sunxi-common.h
index e839053..9d00951 100644
--- a/include/configs/sunxi-common.h
+++ b/include/configs/sunxi-common.h
@@ -170,11 +170,19 @@
 #define CONFIG_SYS_MMCSD_RAW_MODE_U_BOOT_SECTOR        80      /* 40KiB */
 #define CONFIG_SPL_PAD_TO              32768           /* decimal for 'dd' */
 
+/*
+ * Allocate 2 KiB pre-console buffer for SPL at the end of 32 KiB SRAM and
+ * the pre-console buffer index copy right below it (aligned at 8 bytes).
+ * The stack is placed below the pre-console buffer.
+ */
+#define CONFIG_SPL_PRE_CON_BUF_SZ      2048
+#define CONFIG_SPL_PRE_CON_BUF_ADDR    (0x00008000 - CONFIG_SPL_PRE_CON_BUF_SZ)
+#define CONFIG_SPL_PRE_CON_IDX_ADDR    (CONFIG_SPL_PRE_CON_BUF_ADDR - 8)
+#define LOW_LEVEL_SRAM_STACK           CONFIG_SPL_PRE_CON_IDX_ADDR
+#define CONFIG_SPL_STACK               LOW_LEVEL_SRAM_STACK
+
 #endif /* CONFIG_SPL */
 
-/* end of 32 KiB in sram */
-#define LOW_LEVEL_SRAM_STACK           0x00008000 /* End of sram */
-#define CONFIG_SPL_STACK               LOW_LEVEL_SRAM_STACK
 #define CONFIG_SYS_SPL_MALLOC_START    0x4ff00000
 #define CONFIG_SYS_SPL_MALLOC_SIZE     0x00080000      /* 512 KiB */
 
@@ -269,6 +277,14 @@
 #define CONFIG_MISC_INIT_R
 #define CONFIG_SYS_CONSOLE_IS_IN_ENV
 
+/* Enable pre-console buffer in SPL */
+#if defined(CONFIG_SPL_BUILD) && !defined(CONFIG_SPL_FEL)
+#define CONFIG_PRE_CONSOLE_BUFFER
+#define CONFIG_PRE_CON_BUF_SZ          CONFIG_SPL_PRE_CON_BUF_SZ
+#define CONFIG_PRE_CON_BUF_ADDR                CONFIG_SPL_PRE_CON_BUF_ADDR
+#define CONFIG_PRE_CON_IDX_ADDR                CONFIG_SPL_PRE_CON_IDX_ADDR
+#endif
+
 #ifndef CONFIG_SPL_BUILD
 #include <config_distro_defaults.h>
 
@@ -278,6 +294,11 @@
 /* Use the room between the end of bootm_size and the framebuffer */
 #define CONFIG_PRE_CON_BUF_ADDR                0x4f000000
 
+/* Extract SPL log messages from SRAM when updating the VGA console */
+#if !defined(CONFIG_SPL_FEL)
+#define CONFIG_SPL_PRE_CONSOLE_BUFFER
+#endif
+
 /*
  * 240M RAM (256M minimum minus space for the framebuffer),
  * 32M uncompressed kernel, 16M compressed kernel, 1M fdt,
-- 
2.0.5

_______________________________________________
U-Boot mailing list
[email protected]
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to