From 9a710bd340f12db0334e08bc46cb2228f42ff956 Mon Sep 17 00:00:00 2001 From: Mary Ruthven Date: Thu, 30 Jun 2016 12:54:18 -0700 Subject: [PATCH] cr50: disable UART0 RX If the UART0 RX pad is not pulled up, cr50 will get held up on all of the interrupts triggered by the low signal. This causes cr50 to reboot continuously. UART0 RX was moved to DIOA13, which does not have an internal pull up. This means we have to rely on an external pull up. Because not having an external pull up on DIOA13 could prevent the system from booting and UART0 RX is only used as an alternate debugging mechanism from suzyq, we decided it is best for UART0 RX to be disabled by default. BUG=none BRANCH=none TEST=Connect UART1_RX to DIOA1 and test that it still accepts input. Disconnect it from any pads. Verify the system boots normally and console input from DIOA1 no longer works but the suzyq shell still does. Change-Id: I68988c59cfce610cc6c360bf8dd9685e98ab12ff Reviewed-on: https://chromium-review.googlesource.com/357881 Commit-Ready: Mary Ruthven Tested-by: Mary Ruthven Reviewed-by: Scott Collyer --- board/cr50/gpio.inc | 10 ++++++++-- chip/g/uartn.c | 8 ++++++-- 2 files changed, 14 insertions(+), 4 deletions(-) diff --git a/board/cr50/gpio.inc b/board/cr50/gpio.inc index a0381021fb..bb3150452b 100644 --- a/board/cr50/gpio.inc +++ b/board/cr50/gpio.inc @@ -76,8 +76,14 @@ PINMUX(GPIO(BATT_PRES), M2, 0) /* UARTs */ PINMUX(FUNC(UART0_TX), A0, DIO_OUTPUT) /* Cr50 console */ -PINMUX(FUNC(UART0_RX), A1, DIO_INPUT | DIO_WAKE_LOW) -/* UART1_TX and UART2_TX are configured in usart.c. They are not set as outputs +/* + * UART0_RX should only be used for debugging purposes. There is no internal + * pull up on DIOA13, so make sure there is an external pull up. If there is + * no external pull up cr50 will be held in UART0RX interrupts and will + * constantly reboot. + * UART0_RX = DIOA13 + * + * UART1_TX and UART2_TX are configured in usart.c. They are not set as outputs * here in order to avoid interfering with servo. They can be controlled using * the 'uart' console command. * UART1_TX = DIOA7 AP console diff --git a/chip/g/uartn.c b/chip/g/uartn.c index 17cd5e51b8..cda77c819d 100644 --- a/chip/g/uartn.c +++ b/chip/g/uartn.c @@ -116,8 +116,12 @@ void uartn_enable_interrupt(int uart) /* Enable TX and RX. Disable HW flow control and loopback */ void uartn_enable(int uart) { - /* TX and RX enable */ - GR_UART_CTRL(uart) = 0x03; + /* Enable UART TX */ + GR_UART_CTRL(uart) = 0x01; + + /* Enable UART RX if it is connected to an external pad */ + if (DIO_SEL_REG(GC_PINMUX_UART0_RX_SEL_OFFSET + (uart * 16))) + GR_UART_CTRL(uart) |= 0x02; } /* Disable TX, RX, HW flow control, and loopback */