From ae7d4d890be1936cc86dc15adeb33f3b46a51ae5 Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Mon, 30 Sep 2013 18:43:18 -0700 Subject: [PATCH] tegra124: Seperate out the non-UART specific hardcoded init in the bootblock. The hardcoded init in the test function in the bootblock is actually useful generally because it doesn't belong in the UART driver itself but is necessary for the UART to work. Until we have real implementations for the pinmux, etc., we can use that code to get the UART and console going. BUG=None TEST=Built and booted into the bootblock on nyan with and without the test function enabled. When it was, saw the "!"s on the console. BRANCH=None Change-Id: I2efe0b571d8b022eb2a2e5569620558540b28373 Signed-off-by: Gabe Black Reviewed-on: https://chromium-review.googlesource.com/171334 Reviewed-by: Ronald Minnich Tested-by: Gabe Black Commit-Queue: Gabe Black --- src/soc/nvidia/tegra124/bootblock.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/soc/nvidia/tegra124/bootblock.c b/src/soc/nvidia/tegra124/bootblock.c index fb5ddea3c4..cd3d5d5541 100644 --- a/src/soc/nvidia/tegra124/bootblock.c +++ b/src/soc/nvidia/tegra124/bootblock.c @@ -36,9 +36,8 @@ static void writer(int reg, uint8_t val) write8(val, (void *)(0x70000000 + 0x6000 + 4 * reg)); } -static int test_func(void) +static void hacky_hardcoded_uart_setup_function(void) { - unsigned divisor = 221; int i; /* @@ -82,6 +81,11 @@ static int test_func(void) // De-assert reset to UART. clrbits_le32((void *)(0x60006000 + 4 + 0), 1 << 6); +} + +static void test_func(void) +{ + const unsigned divisor = 221; while (!(readr(5) & 0x40)); @@ -99,13 +103,14 @@ static int test_func(void) for (;;) { writer(0, '!'); } - return 0; } void main(void) { void *entry; + hacky_hardcoded_uart_setup_function(); + if (UART_TEST) test_func();