summaryrefslogtreecommitdiff
path: root/common/case_closed_debug.c
diff options
context:
space:
mode:
authorAnton Staaf <robotboy@chromium.org>2015-03-17 11:49:29 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-03-23 19:23:35 +0000
commita0158dd136b63b2daffd666d51d84a67481cb609 (patch)
treeb3ceb010fbba052fb63825d862a0ef2eae2767a6 /common/case_closed_debug.c
parent4002d66297f381c18e1118fa8e2cc156bc5baffd (diff)
downloadchrome-ec-a0158dd136b63b2daffd666d51d84a67481cb609.tar.gz
CCD: Add ability to enable and disable SPI bridgestabilize-6909.B
This required changing the USB-SPI implementation slightly so that all work is done within the deferred callback. In particular, this allows the board specific enable and disable functions to do things that can only be done from a task context, like sleeping. Signed-off-by: Anton Staaf <robotboy@chromium.org> BRANCH=None BUG=None TEST=make buildall -j Change-Id: I3f6a01ed9d6f31a3259ba0a0f6b4e123d6d2e718 Reviewed-on: https://chromium-review.googlesource.com/260964 Trybot-Ready: Anton Staaf <robotboy@chromium.org> Tested-by: Anton Staaf <robotboy@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org> Commit-Queue: Anton Staaf <robotboy@chromium.org>
Diffstat (limited to 'common/case_closed_debug.c')
-rw-r--r--common/case_closed_debug.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/common/case_closed_debug.c b/common/case_closed_debug.c
index a1f8522ccd..3adc563c4f 100644
--- a/common/case_closed_debug.c
+++ b/common/case_closed_debug.c
@@ -10,6 +10,7 @@
#include "common.h"
#include "usb_api.h"
#include "usb_console.h"
+#include "usb_spi.h"
#if !defined(CONFIG_USB)
#error "CONFIG_USB must be defined to use Case Closed Debugging"
@@ -23,6 +24,10 @@
#error "CONFIG_USB_INHIBIT_INIT must be defined to use Case Closed Debugging"
#endif
+#if defined(CONFIG_USB_SPI)
+USB_SPI_CONFIG(ccd_usb_spi, USB_IFACE_SPI, USB_EP_SPI);
+#endif
+
static enum ccd_mode current_mode = CCD_MODE_DISABLED;
void ccd_set_mode(enum ccd_mode new_mode)
@@ -41,6 +46,10 @@ void ccd_set_mode(enum ccd_mode new_mode)
*/
usb_console_enable(new_mode == CCD_MODE_ENABLED);
+#if defined(CONFIG_USB_SPI)
+ usb_spi_enable(&ccd_usb_spi, new_mode == CCD_MODE_ENABLED);
+#endif
+
if (new_mode != CCD_MODE_DISABLED)
usb_init();
}