From d29e655b68143e86199ab1d74f89e125b16b67cc Mon Sep 17 00:00:00 2001 From: Gabe Black Date: Fri, 4 Oct 2013 06:17:22 -0700 Subject: [PATCH] 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 Reviewed-on: https://chromium-review.googlesource.com/171807 Reviewed-by: Ronald Minnich Reviewed-by: David Hendricks Commit-Queue: Gabe Black Tested-by: Gabe Black --- src/soc/nvidia/tegra124/bootblock.c | 22 +++++++++------------- 1 file changed, 9 insertions(+), 13 deletions(-) diff --git a/src/soc/nvidia/tegra124/bootblock.c b/src/soc/nvidia/tegra124/bootblock.c index cd7ea34147..3461c25e06 100644 --- a/src/soc/nvidia/tegra124/bootblock.c +++ b/src/soc/nvidia/tegra124/bootblock.c @@ -22,6 +22,8 @@ #include #include +#include "pinmux.h" + static void hacky_hardcoded_uart_setup_function(void) { int i; @@ -39,19 +41,6 @@ static void hacky_hardcoded_uart_setup_function(void) 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 @@ void main(void) 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();