summaryrefslogtreecommitdiff
path: root/chip/stm32/usb-stream.c
diff options
context:
space:
mode:
authorVincent Palatin <vpalatin@chromium.org>2015-09-02 14:45:14 -0700
committerchrome-bot <chrome-bot@chromium.org>2015-09-08 13:49:09 -0700
commit96093145cb6549a6058627a7aa196e86ac3911f4 (patch)
tree8e027d656391fb277e4c22d9dfb63389e53741de /chip/stm32/usb-stream.c
parent15fcbc95967b79157dc892f547206f2a0967d2ff (diff)
downloadchrome-ec-96093145cb6549a6058627a7aa196e86ac3911f4.tar.gz
update case closed debugging partial mode policy
When a debug accessory is connected to the type-C port while the write protection is enabled, put the case closed debugging in "partial" mode rather than "full". Update the "partial" mode to provide read-only access to the AP and EC consoles. Signed-off-by: Vincent Palatin <vpalatin@chromium.org> BRANCH=smaug BUG=chrome-os-partner:44700 TEST=check the EC console input/output over USB is still working with SuzyQ on a write-protected system, verify that the console input is disabled. Change-Id: I5baa03d6e738d06437c45469f46b286e76a755a4 Reviewed-on: https://chromium-review.googlesource.com/297141 Commit-Ready: Vincent Palatin <vpalatin@chromium.org> Tested-by: Vincent Palatin <vpalatin@chromium.org> Reviewed-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org>
Diffstat (limited to 'chip/stm32/usb-stream.c')
-rw-r--r--chip/stm32/usb-stream.c9
1 files changed, 7 insertions, 2 deletions
diff --git a/chip/stm32/usb-stream.c b/chip/stm32/usb-stream.c
index 256dc829e1..08004dcad4 100644
--- a/chip/stm32/usb-stream.c
+++ b/chip/stm32/usb-stream.c
@@ -56,6 +56,11 @@ static int rx_valid(struct usb_stream_config const *config)
return (STM32_USB_EP(config->endpoint) & EP_RX_MASK) == EP_RX_VALID;
}
+static int rx_disabled(struct usb_stream_config const *config)
+{
+ return config->state->rx_disabled;
+}
+
static void usb_read(struct producer const *producer, size_t count)
{
struct usb_stream_config const *config =
@@ -95,7 +100,7 @@ void usb_stream_deferred(struct usb_stream_config const *config)
if (!tx_valid(config) && tx_write(config))
STM32_TOGGLE_EP(config->endpoint, EP_TX_MASK, EP_TX_VALID, 0);
- if (!rx_valid(config) && rx_read(config))
+ if (!rx_valid(config) && !rx_disabled(config) && rx_read(config))
STM32_TOGGLE_EP(config->endpoint, EP_RX_MASK, EP_RX_VALID, 0);
}
@@ -136,5 +141,5 @@ void usb_stream_reset(struct usb_stream_config const *config)
STM32_USB_EP(i) = ((i << 0) | /* Endpoint Addr*/
(2 << 4) | /* TX NAK */
(0 << 9) | /* Bulk EP */
- (3 << 12)); /* RX VALID */
+ (rx_disabled(config) ? EP_RX_NAK : EP_RX_VALID));
}