Commit af1e8fda authored by Andre Przywara's avatar Andre Przywara
Browse files

uniphier: 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: Ia9d996bb45ff3a7f1b240f12fd75805b48a048e9
Signed-off-by: default avatarAndre Przywara <andre.przywara@arm.com>
parent 7b8fe2de
...@@ -17,7 +17,7 @@ ...@@ -17,7 +17,7 @@
*/ */
.globl uniphier_console_putc .globl uniphier_console_putc
func uniphier_console_putc func uniphier_console_putc
ldr x1, [x1, #CONSOLE_T_DRVDATA] ldr x1, [x1, #CONSOLE_T_BASE]
/* Wait until the transmitter FIFO gets empty */ /* Wait until the transmitter FIFO gets empty */
0: ldr w2, [x1, #UNIPHIER_UART_LSR] 0: ldr w2, [x1, #UNIPHIER_UART_LSR]
...@@ -36,7 +36,7 @@ endfunc uniphier_console_putc ...@@ -36,7 +36,7 @@ endfunc uniphier_console_putc
*/ */
.globl uniphier_console_getc .globl uniphier_console_getc
func uniphier_console_getc func uniphier_console_getc
ldr x0, [x0, #CONSOLE_T_DRVDATA] ldr x0, [x0, #CONSOLE_T_BASE]
ldr w1, [x0, #UNIPHIER_UART_LSR] ldr w1, [x0, #UNIPHIER_UART_LSR]
tbz w1, #UNIPHIER_UART_LSR_DR_BIT, 0f tbz w1, #UNIPHIER_UART_LSR_DR_BIT, 0f
...@@ -55,7 +55,7 @@ endfunc uniphier_console_getc ...@@ -55,7 +55,7 @@ endfunc uniphier_console_getc
*/ */
.global uniphier_console_flush .global uniphier_console_flush
func uniphier_console_flush func uniphier_console_flush
ldr x0, [x0, #CONSOLE_T_DRVDATA] ldr x0, [x0, #CONSOLE_T_BASE]
/* wait until the transmitter gets empty */ /* wait until the transmitter gets empty */
0: ldr w1, [x0, #UNIPHIER_UART_LSR] 0: ldr w1, [x0, #UNIPHIER_UART_LSR]
......
...@@ -17,28 +17,21 @@ ...@@ -17,28 +17,21 @@
#define UNIPHIER_UART_OFFSET 0x100 #define UNIPHIER_UART_OFFSET 0x100
#define UNIPHIER_UART_NR_PORTS 4 #define UNIPHIER_UART_NR_PORTS 4
struct uniphier_console {
struct console console;
uintptr_t base;
};
/* These callbacks are implemented in assembly to use crash_console_helpers.S */ /* These callbacks are implemented in assembly to use crash_console_helpers.S */
int uniphier_console_putc(int character, struct console *console); int uniphier_console_putc(int character, struct console *console);
int uniphier_console_getc(struct console *console); int uniphier_console_getc(struct console *console);
int uniphier_console_flush(struct console *console); int uniphier_console_flush(struct console *console);
static struct uniphier_console uniphier_console = { static console_t uniphier_console = {
.console = { .flags = CONSOLE_FLAG_BOOT |
.flags = CONSOLE_FLAG_BOOT |
#if DEBUG #if DEBUG
CONSOLE_FLAG_RUNTIME | CONSOLE_FLAG_RUNTIME |
#endif #endif
CONSOLE_FLAG_CRASH | CONSOLE_FLAG_CRASH |
CONSOLE_FLAG_TRANSLATE_CRLF, CONSOLE_FLAG_TRANSLATE_CRLF,
.putc = uniphier_console_putc, .putc = uniphier_console_putc,
.getc = uniphier_console_getc, .getc = uniphier_console_getc,
.flush = uniphier_console_flush, .flush = uniphier_console_flush,
},
}; };
static const uintptr_t uniphier_uart_base[] = { static const uintptr_t uniphier_uart_base[] = {
...@@ -86,7 +79,7 @@ void uniphier_console_setup(unsigned int soc) ...@@ -86,7 +79,7 @@ void uniphier_console_setup(unsigned int soc)
plat_error_handler(-EINVAL); plat_error_handler(-EINVAL);
uniphier_console.base = base; uniphier_console.base = base;
console_register(&uniphier_console.console); console_register(&uniphier_console);
/* /*
* The hardware might be still printing characters queued up in the * The hardware might be still printing characters queued up in the
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment