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>
This commit is contained in:
Bill Richardson
2016-09-07 11:34:05 -07:00
committed by chrome-bot
parent 4848d7e8fa
commit 7a075cb54a

View File

@@ -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))