diff options
author | Bill Richardson <wfrichar@chromium.org> | 2016-09-07 11:34:05 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2016-09-07 21:32:28 -0700 |
commit | 7a075cb54af20969b58bdfbcb90f6c65749a9080 (patch) | |
tree | af8b692e1649b0918998de207e94bf057ea1ea4c /board | |
parent | 4848d7e8fa0db6faecf0dabb31eaa0db2acc4a0b (diff) | |
download | chrome-ec-7a075cb54af20969b58bdfbcb90f6c65749a9080.tar.gz |
Cr50: AP console is always available via CCD
Input to the EC UART console is restricted by default so that
casual passers-by can't type random commands to it through the
case-closed debug connection. However, there's no need to
restrict the AP UART console, since it's entirely under the AP's
control.
This CL leaves the AP console enabled by default whenever the CCD
cable is connected. It will be disabled when the AP is powered
down or while servo is attached, but enabled otherwise.
BUG=chrome-os-partner:55322
BRANCH=none
TEST=make buildall, test on Cr50 hardware
Use the "ccd" command to see and modify the UART console
settings, and the "devices" command to observe how things change
when servo is connected and things are powered up and down.
Change-Id: I5cc453bc60473269e22112cf49f61495733abb10
Signed-off-by: Bill Richardson <wfrichar@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/382152
Commit-Ready: Bill Richardson <wfrichar@google.com>
Tested-by: Bill Richardson <wfrichar@google.com>
Reviewed-by: Mary Ruthven <mruthven@chromium.org>
Diffstat (limited to 'board')
-rw-r--r-- | board/cr50/rdd.c | 17 |
1 files changed, 10 insertions, 7 deletions
diff --git a/board/cr50/rdd.c b/board/cr50/rdd.c index 0d46ec141d..a72967fb93 100644 --- a/board/cr50/rdd.c +++ b/board/cr50/rdd.c @@ -15,7 +15,7 @@ #define CPRINTS(format, args...) cprints(CC_USB, format, ## args) -static int uart_enabled, enable_usb_wakeup; +static int ec_uart_enabled, enable_usb_wakeup; struct uart_config { const char *name; @@ -63,7 +63,10 @@ static int servo_is_connected(void) void uartn_tx_connect(int uart) { - if (!uart_enabled || !ccd_is_enabled()) + if (uart == UART_EC && !ec_uart_enabled) + return; + + if (!ccd_is_enabled()) return; if (servo_is_connected()) { @@ -82,7 +85,7 @@ void uartn_tx_disconnect(int uart) { /* If servo is connected disable UART */ if (servo_is_connected()) - uart_enabled = 0; + ec_uart_enabled = 0; /* Disconnect the TX pin from UART peripheral */ uart_select_tx(uart, 0); @@ -97,6 +100,7 @@ void rdd_attached(void) ccd_set_mode(CCD_MODE_ENABLED); enable_usb_wakeup = 1; + uartn_tx_connect(UART_AP); /* Enable device state monitoring */ device_detect_state_enable(1); @@ -119,6 +123,7 @@ void rdd_detached(void) gpio_set_level(GPIO_CCD_MODE_L, 1); enable_usb_wakeup = 0; + ec_uart_enabled = 0; /* Disable CCD */ ccd_set_mode(CCD_MODE_DISABLED); @@ -158,13 +163,11 @@ static int command_ccd(int argc, char **argv) return EC_ERROR_PARAM2; if (val) { - uart_enabled = 1; + ec_uart_enabled = 1; uartn_tx_connect(UART_EC); - uartn_tx_connect(UART_AP); } else { - uart_enabled = 0; + ec_uart_enabled = 0; uartn_tx_disconnect(UART_EC); - uartn_tx_disconnect(UART_AP); } } else if (argc == 2) { if (!parse_bool(argv[1], &val)) |