nyan: Use the new pinmux functions as part of UART setup.

The pins for the UART had been configured manually using hardcoded offsets and
values. Now that we have pinmux functions for that sort of thing, we should
use that instead. This also provides a very simple test for the pinmux code.

Ultimately this code should be wrapped in a function which handles setting up
any of the UARTs which is appropriately parameterized and which would be
called from the bootblock main instead of being in it, but for now this is
sufficient.

BUG=None
TEST=Built and booted into the bootblock on nyan. Saw console output.
BRANCH=None

Change-Id: I69e36fa5fc9b6f3f5ef7f1be3e9f18cdbfdd7fe9
Signed-off-by: Gabe Black <gabeblack@google.com>
Reviewed-on: https://chromium-review.googlesource.com/171807
Reviewed-by: Ronald Minnich <rminnich@chromium.org>
Reviewed-by: David Hendricks <dhendrix@chromium.org>
Commit-Queue: Gabe Black <gabeblack@chromium.org>
Tested-by: Gabe Black <gabeblack@chromium.org>
diff --git a/src/soc/nvidia/tegra124/bootblock.c b/src/soc/nvidia/tegra124/bootblock.c
index cd7ea34..3461c25 100644
--- a/src/soc/nvidia/tegra124/bootblock.c
+++ b/src/soc/nvidia/tegra124/bootblock.c
@@ -22,6 +22,8 @@
 #include <cbfs.h>
 #include <console/console.h>
 
+#include "pinmux.h"
+
 static void hacky_hardcoded_uart_setup_function(void)
 {
 	int i;
@@ -39,19 +41,6 @@
 	for (i = 0; i < 0x10000; i++)
 		__asm__ __volatile__("");
 
-	// Set function.
-	setbits_le32((void *)(0x70000000 + 0x3000 + 0x2e0), 3 << 0);
-	setbits_le32((void *)(0x70000000 + 0x3000 + 0x2e4), 3 << 0);
-
-	// Output.
-	clrbits_le32((void *)(0x70000000 + 0x3000 + 0x2e0), 1 << 5);
-	// Input.
-	setbits_le32((void *)(0x70000000 + 0x3000 + 0x2e4), 1 << 5);
-
-	// Disable tristate.
-	clrbits_le32((void *)(0x70000000 + 0x3000 + 0x2e0), 1 << 4);
-	clrbits_le32((void *)(0x70000000 + 0x3000 + 0x2e4), 1 << 4);
-
 	// Assert UART reset and enable clock.
 	setbits_le32((void *)(0x60006000 + 4 + 0), 1 << 6);
 
@@ -75,6 +64,13 @@
 
 	hacky_hardcoded_uart_setup_function();
 
+	// Serial out, tristate off.
+	pinmux_set_config(PINMUX_KB_ROW9_INDEX, PINMUX_KB_ROW9_FUNC_UA3);
+	// Serial in, tristate_on.
+	pinmux_set_config(PINMUX_KB_ROW10_INDEX, PINMUX_KB_ROW10_FUNC_UA3 |
+						 PINMUX_TRISTATE |
+						 PINMUX_INPUT_ENABLE);
+
 	if (CONFIG_BOOTBLOCK_CONSOLE)
 		console_init();