diff options
author | Randall Spangler <rspangler@chromium.org> | 2017-07-31 16:24:08 -0700 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-08-01 13:01:41 -0700 |
commit | c7b11ca7b855d35dce75502429ed56af990ea41a (patch) | |
tree | b2eaef6673a012941835ad80b9b6a23178067af0 /chip | |
parent | 00ea73ab166ebc8a2c4b5693b7fa776c76c7fe45 (diff) | |
download | chrome-ec-c7b11ca7b855d35dce75502429ed56af990ea41a.tar.gz |
cr50: CCD V1 controls UART access
AP and EC UART now use the CCD V1 capabilities to determine when
access is allowed. Transmit to AP and EC can be toggled independently
from read access to output from those UARTs.
Note that disabling read access disables both transmit and receive.
That is, it's not possible to set a UART where transmit is allowed but
receive isn't. Why would you want to do that, anyway?
See go/cr50-ccd-wp for more information.
BUG=b:62537474
BRANCH=cr50
TEST=manual with CR50_DEV=1
ccdoops
ccdset cr50fullconsole always -> so we can use ccd command for testing
ccd -> AP RX+TX, EC RX+TX
ccdset uartecrx unlesslocked
ccdset uartectx ifopened
ccdset uartaprx always
ccdset uartaptx unlesslocked
ccdunlock
ccd -> AP RX+TX, EC RX
ccdlock
ccd -> AP RX, EC disabled
ccdoops
ccdset cr50fullconsole always
ccd -> AP RX+TX, EC RX+TX
ccdset uartaprx ifopened
ccdlock
ccd -> AP disabled, EC RX
Change-Id: I55db5897bb52cd60658ab221eadf5c59fc86744a
Signed-off-by: Randall Spangler <rspangler@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/595196
Reviewed-by: Aseda Aboagye <aaboagye@chromium.org>
Diffstat (limited to 'chip')
-rw-r--r-- | chip/g/uartn.c | 5 | ||||
-rw-r--r-- | chip/g/uartn.h | 11 |
2 files changed, 16 insertions, 0 deletions
diff --git a/chip/g/uartn.c b/chip/g/uartn.c index 6140e8cff4..b9d08d4375 100644 --- a/chip/g/uartn.c +++ b/chip/g/uartn.c @@ -197,6 +197,11 @@ void uartn_disable(int uart) GR_UART_CTRL(uart) = 0; } +int uartn_is_enabled(int uart) +{ + return !!(GR_UART_CTRL(uart) & 0x03); +} + void uartn_init(int uart) { long long setting = (16 * (1 << UART_NCO_WIDTH) * diff --git a/chip/g/uartn.h b/chip/g/uartn.h index 967136de22..bfb7772518 100644 --- a/chip/g/uartn.h +++ b/chip/g/uartn.h @@ -89,6 +89,17 @@ void uartn_tx_connect(int uart); void uartn_tx_disconnect(int uart); /** + * Return non-zero if TX and RX are enabled for the UART. + * + * Note that TX won't be connected unless uart_tx_is_connected() is also + * non-zero. + * + * @param uart UART to check + * @return 1 if UART is enabled, 0 if disabled. + */ +int uartn_is_enabled(int uart); + +/** * Enable TX and RX for the UART. Disable HW flow control and loopback. * * @param uart UART to enable |