]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
stm32: Use generic console_t data structure
authorAndre Przywara <andre.przywara@arm.com>
Sat, 25 Jan 2020 00:58:35 +0000 (00:58 +0000)
committerAndre Przywara <andre.przywara@arm.com>
Tue, 25 Feb 2020 09:34:38 +0000 (09:34 +0000)
Since now the generic console_t structure holds the UART base address as
well, let's use that generic location and drop the UART driver specific
data structure at all.

Change-Id: Iea6ca26ff4903c33f0fad27fec96fdbabd4e0a91
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
drivers/st/uart/aarch32/stm32_console.S
include/drivers/st/stm32_console.h
plat/st/stm32mp1/bl2_plat_setup.c
plat/st/stm32mp1/sp_min/sp_min_setup.c

index ca3c1f61854a5d6420f1267ff2f8330294b0dffd..0ed37d1bddc436941bb997bbf4fde508012a8fd0 100644 (file)
@@ -91,14 +91,14 @@ endfunc console_stm32_core_init
        /* -------------------------------------------------------
         * int console_stm32_register(uintptr_t baseaddr,
         *     uint32_t clock, uint32_t baud,
-        *     struct console_stm32 *console);
+        *     console_t *console);
         * Function to initialize and register a new STM32
         * console. Storage passed in for the console struct
         * *must* be persistent (i.e. not from the stack).
         * In: r0 - UART register base address
         *     r1 - UART clock in Hz
         *     r2 - Baud rate
-        *     r3 - pointer to empty console_stm32 struct
+        *     r3 - pointer to empty console_t struct
         * Out: return 1 on success, 0 on error
         * Clobber list : r0, r1, r2
         * -------------------------------------------------------
@@ -108,7 +108,7 @@ func console_stm32_register
        mov     r4, r3
        cmp     r4, #0
        beq     register_fail
-       str     r0, [r4, #CONSOLE_T_STM32_BASE]
+       str     r0, [r4, #CONSOLE_T_BASE]
 
        bl console_stm32_core_init
        cmp     r0, #0
@@ -157,7 +157,7 @@ putc_error:
 endfunc console_stm32_core_putc
 
        /* ------------------------------------------------------------
-        * int console_stm32_putc(int c, struct console_stm32 *console)
+        * int console_stm32_putc(int c, console_t *console)
         * Function to output a character over the console. It
         * returns the character printed on success or -1 on error.
         * In: r0 - character to be printed
@@ -171,7 +171,7 @@ func console_stm32_putc
        cmp     r1, #0
        ASM_ASSERT(ne)
 #endif /* ENABLE_ASSERTIONS */
-       ldr     r1, [r1, #CONSOLE_T_STM32_BASE]
+       ldr     r1, [r1, #CONSOLE_T_BASE]
        b       console_stm32_core_putc
 endfunc console_stm32_putc
 
@@ -219,7 +219,7 @@ flush_error:
 endfunc console_stm32_core_flush
 
        /* ------------------------------------------------------
-        * int console_stm32_flush(struct console_stm32 *console)
+        * int console_stm32_flush(console_t *console)
         * Function to force a write of all buffered
         * data that hasn't been output.
         * In : r0 - pointer to console_t structure
@@ -232,6 +232,6 @@ func console_stm32_flush
        cmp     r0, #0
        ASM_ASSERT(ne)
 #endif /* ENABLE_ASSERTIONS */
-       ldr     r0, [r0, #CONSOLE_T_STM32_BASE]
+       ldr     r0, [r0, #CONSOLE_T_BASE]
        b       console_stm32_core_flush
 endfunc console_stm32_flush
index a2ad87cb5f01dd65e53261409d9171d7aced2dba..8d9187d2ad73f1e64e170af7d9c25093bf2187d9 100644 (file)
@@ -9,17 +9,10 @@
 
 #include <drivers/console.h>
 
-#define CONSOLE_T_STM32_BASE   CONSOLE_T_DRVDATA
-
 #ifndef __ASSEMBLER__
 
 #include <stdint.h>
 
-struct console_stm32 {
-       console_t console;
-       uintptr_t base;
-};
-
 /*
  * Initialize a new STM32 console instance and register it with the console
  * framework. The |console| pointer must point to storage that will be valid
@@ -27,7 +20,7 @@ struct console_stm32 {
  * Its contents will be reinitialized from scratch.
  */
 int console_stm32_register(uintptr_t baseaddr, uint32_t clock, uint32_t baud,
-                          struct console_stm32 *console);
+                          console_t *console);
 
 #endif /*__ASSEMBLER__*/
 
index d9e29b4e845d67082b57b560f226af841a614fdb..024dbe076d4102a89df58676a97f1ea7edfc49b1 100644 (file)
@@ -31,7 +31,7 @@
 #include <stm32mp1_context.h>
 #include <stm32mp1_dbgmcu.h>
 
-static struct console_stm32 console;
+static console_t console;
 static struct stm32mp_auth_ops stm32mp1_auth_ops;
 
 static void print_reset_reason(void)
@@ -273,7 +273,7 @@ void bl2_el3_plat_arch_setup(void)
                panic();
        }
 
-       console_set_scope(&console.console, CONSOLE_FLAG_BOOT |
+       console_set_scope(&console, CONSOLE_FLAG_BOOT |
                          CONSOLE_FLAG_CRASH | CONSOLE_FLAG_TRANSLATE_CRLF);
 
        stm32mp_print_cpuinfo();
index e10dfbfc047c632ae7d10d1b7a72a2111a799b10..4e74c275d462d4ca3ca3be3d3972c79a5d6783d9 100644 (file)
@@ -35,7 +35,7 @@
  ******************************************************************************/
 static entry_point_info_t bl33_image_ep_info;
 
-static struct console_stm32 console;
+static console_t console;
 
 /*******************************************************************************
  * Interrupt handler for FIQ (secure IRQ)
@@ -142,7 +142,7 @@ void sp_min_early_platform_setup2(u_register_t arg0, u_register_t arg1,
 #ifdef DEBUG
                console_flags |= CONSOLE_FLAG_RUNTIME;
 #endif
-               console_set_scope(&console.console, console_flags);
+               console_set_scope(&console, console_flags);
        }
 }