]> git.baikalelectronics.ru Git - arm-tf.git/commitdiff
marvell: Consolidate console register calls
authorAndre Przywara <andre.przywara@arm.com>
Sat, 25 Jan 2020 23:55:08 +0000 (23:55 +0000)
committerAndre Przywara <andre.przywara@arm.com>
Tue, 25 Feb 2020 09:34:38 +0000 (09:34 +0000)
Now that different UARTs share the same console_t struct, we can
simplify the console selection for the Marvell platforms:
We share the same console_t pointers, just change the name of the
console register functions, depending on the selected platform.

Change-Id: I6fe3e49fd7f208a9b3372c5deef43236a12867bc
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
plat/marvell/common/marvell_console.c

index b57b84f3f602fc8f40e882fb3622e6f1e3996486..17166618af6c4bd61afa575059d9cae7e614d671 100644 (file)
 
 #ifdef PLAT_a3700
 #include <drivers/marvell/uart/a3700_console.h>
-
-static console_t marvell_boot_console;
-static console_t marvell_runtime_console;
+#define console_marvell_register console_a3700_register
 #else
 #include <drivers/ti/uart/uart_16550.h>
+#define console_marvell_register console_16550_register
+#endif
 
 static console_t marvell_boot_console;
 static console_t marvell_runtime_console;
-#endif
 
 /*******************************************************************************
  * Functions that set up the console
@@ -32,15 +31,10 @@ static console_t marvell_runtime_console;
 void marvell_console_boot_init(void)
 {
        int rc =
-#ifdef PLAT_a3700
-       console_a3700_register(
-#else
-       console_16550_register(
-#endif
-                               PLAT_MARVELL_BOOT_UART_BASE,
-                               PLAT_MARVELL_BOOT_UART_CLK_IN_HZ,
-                               MARVELL_CONSOLE_BAUDRATE,
-                               &marvell_boot_console);
+       console_marvell_register(PLAT_MARVELL_BOOT_UART_BASE,
+                                PLAT_MARVELL_BOOT_UART_CLK_IN_HZ,
+                                MARVELL_CONSOLE_BAUDRATE,
+                                &marvell_boot_console);
        if (rc == 0) {
                /*
                 * The crash console doesn't use the multi console API, it uses
@@ -64,15 +58,10 @@ void marvell_console_boot_end(void)
 void marvell_console_runtime_init(void)
 {
        int rc =
-#ifdef PLAT_a3700
-       console_a3700_register(
-#else
-       console_16550_register(
-#endif
-                               PLAT_MARVELL_BOOT_UART_BASE,
-                               PLAT_MARVELL_BOOT_UART_CLK_IN_HZ,
-                               MARVELL_CONSOLE_BAUDRATE,
-                               &marvell_runtime_console);
+       console_marvell_register(PLAT_MARVELL_BOOT_UART_BASE,
+                                PLAT_MARVELL_BOOT_UART_CLK_IN_HZ,
+                                MARVELL_CONSOLE_BAUDRATE,
+                                &marvell_runtime_console);
        if (rc == 0)
                panic();