a3700: Use generic console_t data structure

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: I89c3ab2ed85ab941d8b38ced48474feb4aaa8b7e
Signed-off-by: Andre Przywara <andre.przywara@arm.com>
This commit is contained in:
Andre Przywara 2020-01-25 00:58:35 +00:00
parent 98964f0523
commit 3968bc08ab
3 changed files with 12 additions and 19 deletions

View File

@ -110,7 +110,7 @@ endfunc console_a3700_core_init
.globl console_a3700_register .globl console_a3700_register
/* ----------------------------------------------- /* -----------------------------------------------
* int console_a3700_register(console_16550_t *console, * int console_a3700_register(console_t *console,
uintptr_t base, uint32_t clk, uint32_t baud) uintptr_t base, uint32_t clk, uint32_t baud)
* Function to initialize and register a new a3700 * Function to initialize and register a new a3700
* console. Storage passed in for the console struct * console. Storage passed in for the console struct
@ -118,7 +118,7 @@ endfunc console_a3700_core_init
* In: x0 - UART register base address * In: x0 - UART register base address
* w1 - UART clock in Hz * w1 - UART clock in Hz
* w2 - Baud rate * w2 - Baud rate
* x3 - pointer to empty console_a3700_t struct * x3 - pointer to empty console_t struct
* Out: return 1 on success, 0 on error * Out: return 1 on success, 0 on error
* Clobber list : x0, x1, x2, x6, x7, x14 * Clobber list : x0, x1, x2, x6, x7, x14
* ----------------------------------------------- * -----------------------------------------------
@ -127,7 +127,7 @@ func console_a3700_register
mov x7, x30 mov x7, x30
mov x6, x3 mov x6, x3
cbz x6, register_fail cbz x6, register_fail
str x0, [x6, #CONSOLE_T_A3700_BASE] str x0, [x6, #CONSOLE_T_BASE]
bl console_a3700_core_init bl console_a3700_core_init
cbz x0, register_fail cbz x0, register_fail
@ -178,7 +178,7 @@ putc_error:
endfunc console_a3700_core_putc endfunc console_a3700_core_putc
/* -------------------------------------------------------- /* --------------------------------------------------------
* int console_a3700_putc(int c, console_a3700_t *console) * int console_a3700_putc(int c, console_t *console)
* Function to output a character over the console. It * Function to output a character over the console. It
* returns the character printed on success or -1 on error. * returns the character printed on success or -1 on error.
* In : w0 - character to be printed * In : w0 - character to be printed
@ -188,7 +188,7 @@ endfunc console_a3700_core_putc
* -------------------------------------------------------- * --------------------------------------------------------
*/ */
func console_a3700_putc func console_a3700_putc
ldr x1, [x1, #CONSOLE_T_A3700_BASE] ldr x1, [x1, #CONSOLE_T_BASE]
b console_a3700_core_putc b console_a3700_core_putc
endfunc console_a3700_putc endfunc console_a3700_putc
@ -208,7 +208,7 @@ func console_a3700_core_getc
endfunc console_a3700_core_getc endfunc console_a3700_core_getc
/* --------------------------------------------- /* ---------------------------------------------
* int console_a3700_getc(console_a3700_t *console) * int console_a3700_getc(console_t *console)
* Function to get a character from the console. * Function to get a character from the console.
* It returns the character grabbed on success * It returns the character grabbed on success
* or -1 on if no character is available. * or -1 on if no character is available.
@ -218,7 +218,7 @@ endfunc console_a3700_core_getc
* --------------------------------------------- * ---------------------------------------------
*/ */
func console_a3700_getc func console_a3700_getc
ldr x0, [x0, #CONSOLE_T_A3700_BASE] ldr x0, [x0, #CONSOLE_T_BASE]
b console_a3700_core_getc b console_a3700_core_getc
endfunc console_a3700_getc endfunc console_a3700_getc
@ -237,7 +237,7 @@ func console_a3700_core_flush
endfunc console_a3700_core_flush endfunc console_a3700_core_flush
/* --------------------------------------------- /* ---------------------------------------------
* int console_a3700_flush(console_a3700_t *console) * int console_a3700_flush(console_t *console)
* Function to force a write of all buffered * Function to force a write of all buffered
* data that hasn't been output. * data that hasn't been output.
* In : x0 - pointer to console_t structure * In : x0 - pointer to console_t structure
@ -246,7 +246,7 @@ endfunc console_a3700_core_flush
* --------------------------------------------- * ---------------------------------------------
*/ */
func console_a3700_flush func console_a3700_flush
ldr x0, [x0, #CONSOLE_T_A3700_BASE] ldr x0, [x0, #CONSOLE_T_BASE]
b console_a3700_core_flush b console_a3700_core_flush
endfunc console_a3700_flush endfunc console_a3700_flush

View File

@ -54,17 +54,10 @@
#define UART_CTRL_TXFIFO_RESET (1 << 15) #define UART_CTRL_TXFIFO_RESET (1 << 15)
#define UARTLSR_TXFIFOEMPTY (1 << 6) #define UARTLSR_TXFIFOEMPTY (1 << 6)
#define CONSOLE_T_A3700_BASE CONSOLE_T_DRVDATA
#ifndef __ASSEMBLER__ #ifndef __ASSEMBLER__
#include <stdint.h> #include <stdint.h>
typedef struct {
console_t console;
uintptr_t base;
} console_a3700_t;
/* /*
* Initialize a new a3700 console instance and register it with the console * Initialize a new a3700 console instance and register it with the console
* framework. The |console| pointer must point to storage that will be valid * framework. The |console| pointer must point to storage that will be valid
@ -72,7 +65,7 @@ typedef struct {
* Its contents will be reinitialized from scratch. * Its contents will be reinitialized from scratch.
*/ */
int console_a3700_register(uintptr_t baseaddr, uint32_t clock, uint32_t baud, int console_a3700_register(uintptr_t baseaddr, uint32_t clock, uint32_t baud,
console_a3700_t *console); console_t *console);
#endif /*__ASSEMBLER__*/ #endif /*__ASSEMBLER__*/

View File

@ -15,8 +15,8 @@
#ifdef PLAT_a3700 #ifdef PLAT_a3700
#include <drivers/marvell/uart/a3700_console.h> #include <drivers/marvell/uart/a3700_console.h>
static console_a3700_t marvell_boot_console; static console_t marvell_boot_console;
static console_a3700_t marvell_runtime_console; static console_t marvell_runtime_console;
#else #else
#include <drivers/ti/uart/uart_16550.h> #include <drivers/ti/uart/uart_16550.h>