synquacer: Enable PL011 UART Console
authorSumit Garg <sumit.garg@linaro.org>
Fri, 15 Jun 2018 09:04:42 +0000 (14:34 +0530)
committerSumit Garg <sumit.garg@linaro.org>
Thu, 21 Jun 2018 05:52:32 +0000 (11:22 +0530)
Signed-off-by: Masahisa Kojima <masahisa.kojima@linaro.org>
Signed-off-by: Sumit Garg <sumit.garg@linaro.org>
plat/socionext/synquacer/include/platform_def.h
plat/socionext/synquacer/sq_bl31_setup.c
plat/socionext/synquacer/sq_helpers.S

index e356bf5d31e1a4f8d77e6e3450352279273c22a2..7ef0f13d953104eaae8862297a2ed3bbe682fe3d 100644 (file)
 #define BL31_SIZE                      0x00080000
 #define BL31_LIMIT                     (BL31_BASE + BL31_SIZE)
 
+/* UART related constants */
+#define PLAT_SQ_BOOT_UART_BASE         0x2A400000
+#define PLAT_SQ_BOOT_UART_CLK_IN_HZ    62500000
+#define SQ_CONSOLE_BAUDRATE            115200
+
 #define SQ_BOOT_CFG_ADDR                       0x45410000
 #define PLAT_SQ_PRIMARY_CPU_SHIFT              8
 #define PLAT_SQ_PRIMARY_CPU_BIT_WIDTH          6
index e8553ab26e48654562fad280878d26619f5e0d94..3ebf788e977dbacc137f73d64c7247ec7565b421 100644 (file)
@@ -9,11 +9,22 @@
 #include <platform_def.h>
 #include <assert.h>
 #include <bl_common.h>
+#include <pl011.h>
 #include <debug.h>
 
+static console_pl011_t console;
+
 void bl31_early_platform_setup(bl31_params_t *from_bl2,
                                void *plat_params_from_bl2)
 {
+       /* Initialize the console to provide early debug support */
+       (void)console_pl011_register(PLAT_SQ_BOOT_UART_BASE,
+                              PLAT_SQ_BOOT_UART_CLK_IN_HZ,
+                              SQ_CONSOLE_BAUDRATE, &console);
+
+       console_set_scope(&console.console, CONSOLE_FLAG_BOOT |
+                         CONSOLE_FLAG_RUNTIME);
+
        /* There are no parameters from BL2 if BL31 is a reset vector */
        assert(from_bl2 == NULL);
        assert(plat_params_from_bl2 == NULL);
index d65e8525f903107abcff91c347b794b572d23f8d..558aa15f68e6405e23adf4528f97415f33e1bea9 100644 (file)
@@ -14,6 +14,9 @@
        .global platform_mem_init
        .global plat_is_my_cpu_primary
        .global plat_secondary_cold_boot_setup
+       .global plat_crash_console_init
+       .global plat_crash_console_putc
+       .global plat_crash_console_flush
 
 /*
  * unsigned int sq_calc_core_pos(u_register_t mpidr)
@@ -69,3 +72,39 @@ func plat_is_my_cpu_primary
        cset    w0, eq
        ret     x9
 endfunc plat_is_my_cpu_primary
+
+/*
+ * int plat_crash_console_init(void)
+ * Function to initialize the crash console
+ * without a C Runtime to print crash report.
+ * Clobber list : x0, x1, x2
+ */
+func plat_crash_console_init
+       mov_imm x0, PLAT_SQ_BOOT_UART_BASE
+       mov_imm x1, PLAT_SQ_BOOT_UART_CLK_IN_HZ
+       mov_imm x2, SQ_CONSOLE_BAUDRATE
+       b       console_pl011_core_init
+endfunc plat_crash_console_init
+
+/*
+ * int plat_crash_console_putc(int c)
+ * Function to print a character on the crash
+ * console without a C Runtime.
+ * Clobber list : x1, x2
+ */
+func plat_crash_console_putc
+       mov_imm x1, PLAT_SQ_BOOT_UART_BASE
+       b       console_pl011_core_putc
+endfunc plat_crash_console_putc
+
+/*
+ * int plat_crash_console_flush(int c)
+ * Function to force a write of all buffered
+ * data that hasn't been output.
+ * Out : return -1 on error else return 0.
+ * Clobber list : x0, x1
+ */
+func plat_crash_console_flush
+       mov_imm x0, PLAT_SQ_BOOT_UART_BASE
+       b       console_pl011_core_flush
+endfunc plat_crash_console_flush