]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
cdns: 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: I9f8b55414ab7965e431e3e86d182eabd511f32a4
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
drivers/cadence/uart/aarch64/cdns_console.S
include/drivers/cadence/cdns_uart.h
plat/xilinx/zynqmp/bl31_zynqmp_setup.c
plat/xilinx/zynqmp/tsp/tsp_plat_setup.c

index ecd0c478d2c76692f6826e60c3c9bb4a77ee7224..8e5d6a1aab07a23e4405fbb6973ce8d10d42fcfa 100644 (file)
@@ -56,14 +56,14 @@ endfunc console_cdns_core_init
        /* -----------------------------------------------
         * int console_cdns_register(uintptr_t baseaddr,
         *     uint32_t clock, uint32_t baud,
-        *     console_cdns_t *console);
+        *     console_t *console);
         * Function to initialize and register a new CDNS
         * console. Storage passed in for the console struct
         * *must* be persistent (i.e. not from the stack).
         * In: x0 - UART register base address
         *     w1 - UART clock in Hz
         *     w2 - Baud rate
-        *     x3 - pointer to empty console_16550_t struct
+        *     x3 - pointer to empty console_t struct
         * Out: return 1 on success, 0 on error
         * Clobber list : x0, x1, x2, x6, x7, x14
         * -----------------------------------------------
@@ -72,7 +72,7 @@ func console_cdns_register
        mov     x7, x30
        mov     x6, x3
        cbz     x6, register_fail
-       str     x0, [x6, #CONSOLE_T_CDNS_BASE]
+       str     x0, [x6, #CONSOLE_T_BASE]
 
        bl      console_cdns_core_init
        cbz     x0, register_fail
@@ -119,7 +119,7 @@ func console_cdns_core_putc
 endfunc console_cdns_core_putc
 
        /* --------------------------------------------------------
-        * int console_cdns_putc(int c, console_cdns_t *cdns)
+        * int console_cdns_putc(int c, console_t *cdns)
         * Function to output a character over the console. It
         * returns the character printed on success or -1 on error.
         * In : w0 - character to be printed
@@ -133,7 +133,7 @@ func console_cdns_putc
        cmp     x1, #0
        ASM_ASSERT(ne)
 #endif /* ENABLE_ASSERTIONS */
-       ldr     x1, [x1, #CONSOLE_T_CDNS_BASE]
+       ldr     x1, [x1, #CONSOLE_T_BASE]
        b       console_cdns_core_putc
 endfunc console_cdns_putc
 
@@ -165,7 +165,7 @@ no_char:
 endfunc console_cdns_core_getc
 
        /* ---------------------------------------------
-        * int console_cdns_getc(console_cdns_t *console)
+        * int console_cdns_getc(console_t *console)
         * Function to get a character from the console.
         * It returns the character grabbed on success
         * or -1 if no character is available.
@@ -179,7 +179,7 @@ func console_cdns_getc
        cmp     x0, #0
        ASM_ASSERT(ne)
 #endif /* ENABLE_ASSERTIONS */
-       ldr     x0, [x0, #CONSOLE_T_CDNS_BASE]
+       ldr     x0, [x0, #CONSOLE_T_BASE]
        b       console_cdns_core_getc
 endfunc console_cdns_getc
 
@@ -203,7 +203,7 @@ func console_cdns_core_flush
 endfunc console_cdns_core_flush
 
        /* ---------------------------------------------
-        * int console_cdns_flush(console_pl011_t *console)
+        * int console_cdns_flush(console_t *console)
         * Function to force a write of all buffered
         * data that hasn't been output.
         * In : x0 - pointer to console_t structure
@@ -216,6 +216,6 @@ func console_cdns_flush
        cmp     x0, #0
        ASM_ASSERT(ne)
 #endif /* ENABLE_ASSERTIONS */
-       ldr     x0, [x0, #CONSOLE_T_CDNS_BASE]
+       ldr     x0, [x0, #CONSOLE_T_BASE]
        b       console_cdns_core_flush
 endfunc console_cdns_flush
index 64a062ca148da47b83385794a3456b19632580f5..46ba4663eda9c00e06a365a289126628e61dfab0 100644 (file)
 #define R_UART_TX      0x30
 #define R_UART_RX      0x30
 
-#define CONSOLE_T_CDNS_BASE    CONSOLE_T_DRVDATA
-
 #ifndef __ASSEMBLER__
 
 #include <stdint.h>
 
-typedef struct {
-       console_t console;
-       uintptr_t base;
-} console_cdns_t;
-
 /*
  * Initialize a new Cadence console instance and register it with the console
  * framework. The |console| pointer must point to storage that will be valid
@@ -43,7 +36,7 @@ typedef struct {
  * Its contents will be reinitialized from scratch.
  */
 int console_cdns_register(uintptr_t baseaddr, uint32_t clock, uint32_t baud,
-                         console_cdns_t *console);
+                         console_t *console);
 
 #endif /*__ASSEMBLER__*/
 
index 6e0e811d4818a51874782e6bca76b81c27dfceb3..b6d8770cc922463b870b3e838cb6d58ee8648216 100644 (file)
@@ -62,12 +62,12 @@ void bl31_early_platform_setup2(u_register_t arg0, u_register_t arg1,
 {
        uint64_t atf_handoff_addr;
        /* Register the console to provide early debug support */
-       static console_cdns_t bl31_boot_console;
+       static console_t bl31_boot_console;
        (void)console_cdns_register(ZYNQMP_UART_BASE,
                                       zynqmp_get_uart_clk(),
                                       ZYNQMP_UART_BAUDRATE,
                                       &bl31_boot_console);
-       console_set_scope(&bl31_boot_console.console,
+       console_set_scope(&bl31_boot_console,
                          CONSOLE_FLAG_RUNTIME | CONSOLE_FLAG_BOOT);
 
        /* Initialize the platform config for future decision making */
index 7f0ac74cfbe789f2886a2e535a5516db145dd6f2..5e770f75c0e5657a790950848da60521c60311b0 100644 (file)
@@ -21,12 +21,12 @@ void tsp_early_platform_setup(void)
         * Register a different console than already in use to display
         * messages from TSP
         */
-       static console_cdns_t tsp_boot_console;
+       static console_t tsp_boot_console;
        (void)console_cdns_register(ZYNQMP_UART_BASE,
                                       zynqmp_get_uart_clk(),
                                       ZYNQMP_UART_BAUDRATE,
                                       &tsp_boot_console);
-       console_set_scope(&tsp_boot_console.console,
+       console_set_scope(&tsp_boot_console,
                          CONSOLE_FLAG_RUNTIME | CONSOLE_FLAG_BOOT);
 
        /* Initialize the platform config for future decision making */