summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVic Yang <victoryang@google.com>2015-02-06 16:03:16 -0800
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-02-09 02:13:50 +0000
commiteb86f21b05aaed4dc3bfda51a2eba3f53ec16590 (patch)
tree6a1fcf6ad3d39ceed4f347880bd3238706d44a69
parent911c1821f92bfadc9e0996926ee1b20f7977e562 (diff)
downloadchrome-ec-eb86f21b05aaed4dc3bfda51a2eba3f53ec16590.tar.gz
Plankton: Support DFU mode
This includes: - Enabling SBU path for debug USB usage in USB mode (not in DP mode) - Add a console command to enable DFU mode for lab devices. This requires the additional Silego chip on the device. BRANCH=None BUG=None TEST=Hook up a Ryu with the additional Silego chip. Issue 'dfu' command and see DFU device in 'lsusb' output. Issue the command again and the device goes away. Change-Id: I3f942c6abe52784351f2242c9b0b6400e9b2b6fd Signed-off-by: Vic Yang <victoryang@google.com> Reviewed-on: https://chromium-review.googlesource.com/247350 Tested-by: Vic Yang <victoryang@chromium.org> Reviewed-by: Alec Berg <alecaberg@chromium.org> Commit-Queue: Vic Yang <victoryang@chromium.org>
-rw-r--r--board/plankton/board.c24
1 files changed, 22 insertions, 2 deletions
diff --git a/board/plankton/board.c b/board/plankton/board.c
index 6ab987be95..b081a0f479 100644
--- a/board/plankton/board.c
+++ b/board/plankton/board.c
@@ -56,6 +56,7 @@ enum board_src_cap src_cap_mapping[USBC_ACT_COUNT] =
static void set_usbc_action(enum usbc_action act)
{
int need_soft_reset;
+ int was_usb_mode;
switch (act) {
case USBC_ACT_5V_TO_DUT:
@@ -71,8 +72,9 @@ static void set_usbc_action(enum usbc_action act)
pd_set_dual_role(PD_DRP_FORCE_SINK);
break;
case USBC_ACT_USBDP_TOGGLE:
- gpio_set_level(GPIO_USBC_SS_USB_MODE,
- !gpio_get_level(GPIO_USBC_SS_USB_MODE));
+ was_usb_mode = gpio_get_level(GPIO_USBC_SS_USB_MODE);
+ gpio_set_level(GPIO_USBC_SS_USB_MODE, !was_usb_mode);
+ gpio_set_level(GPIO_CASE_CLOSE_EN, !was_usb_mode);
break;
case USBC_ACT_USB_EN:
gpio_set_level(GPIO_USBC_SS_USB_MODE, 1);
@@ -380,3 +382,21 @@ static int cmd_fake_disconnect(int argc, char *argv[])
}
DECLARE_CONSOLE_COMMAND(fake_disconnect, cmd_fake_disconnect,
"<delay_ms> <duration_ms>", NULL, NULL);
+
+static void trigger_dfu_release(void)
+{
+ gpio_set_level(GPIO_CASE_CLOSE_DFU_L, 1);
+ ccprintf("Deasserting CASE_CLOSE_DFU_L.\n");
+}
+DECLARE_DEFERRED(trigger_dfu_release);
+
+static int cmd_trigger_dfu(int argc, char *argv[])
+{
+ gpio_set_level(GPIO_CASE_CLOSE_DFU_L, 0);
+ ccprintf("Asserting CASE_CLOSE_DFU_L.\n");
+ ccprintf("If you expect to see DFU debug but it doesn't show up,\n");
+ ccprintf("try flipping the USB type-C cable.\n");
+ hook_call_deferred(trigger_dfu_release, 1500 * MSEC);
+ return EC_SUCCESS;
+}
+DECLARE_CONSOLE_COMMAND(dfu, cmd_trigger_dfu, NULL, NULL, NULL);