summaryrefslogtreecommitdiff
path: root/drivers/console
diff options
context:
space:
mode:
authorVikram Kanigiri <vikram.kanigiri@arm.com>2014-03-25 17:35:26 +0000
committerDan Handley <dan.handley@arm.com>2014-03-26 17:36:36 +0000
commit0796fe01f8a596d4fad84c228cb5f01117b4029e (patch)
tree80d1bac690c19ef48eb49faf5eead43a85795ad5 /drivers/console
parentc1df3be7dd61fcc6ff31c4ff0ecc1e822fc5d573 (diff)
Initialise UART console in all bootloader stages
This patch reworks the console driver to ensure that each bootloader stage initializes it independently. As a result, both BL3-1 and BL2 platform code now calls console_init() instead of relying on BL1 to perform console setup Fixes ARM-software/tf-issues#120 Change-Id: Ic4d66e0375e40a2fc7434afcabc8bbb4715c14ab
Diffstat (limited to 'drivers/console')
-rw-r--r--drivers/console/console.c14
1 files changed, 13 insertions, 1 deletions
diff --git a/drivers/console/console.c b/drivers/console/console.c
index efe12014..1a684ff6 100644
--- a/drivers/console/console.c
+++ b/drivers/console/console.c
@@ -31,11 +31,19 @@
#include <console.h>
#include <platform.h>
#include <pl011.h>
+#include <assert.h>
-static unsigned long uart_base = PL011_BASE;
+static unsigned long uart_base;
void console_init(unsigned long base_addr)
{
+ /* TODO: assert() internally calls printf() and will result in
+ * an infinite loop. This needs to be fixed with some kind of
+ * exception mechanism or early panic support. This also applies
+ * to the other assert() calls below.
+ */
+ assert(base_addr);
+
/* Initialise internal base address variable */
uart_base = base_addr;
@@ -60,6 +68,8 @@ void console_init(unsigned long base_addr)
int console_putc(int c)
{
+ assert(uart_base);
+
if (c == '\n')
console_putc('\r');
@@ -71,6 +81,8 @@ int console_putc(int c)
int console_getc(void)
{
+ assert(uart_base);
+
while ((pl011_read_fr(uart_base) & PL011_UARTFR_RXFE) != 0)
;
return pl011_read_dr(uart_base);