summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2015-07-21 15:52:45 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-07-22 18:04:36 +0000
commit642fa3f3bc0e1d8feb84ad653371959aacfae2db (patch)
tree1b0c9d109cb4d402a040eedaef5d87c831a4acd5 /board
parent0115834bb637f95c7bb0d9d882a09dd1c4349d15 (diff)
downloadchrome-ec-642fa3f3bc0e1d8feb84ad653371959aacfae2db.tar.gz
ryu: plankton: allow plankton to send VDM to enter CCD
Create new custom VDM to notify DUT to enter case closed debugging mode. Send this VDM from Plankton when the case closed debugging enable button is pressed. Once DUT receives the CCD enable VDM, CCD remains enabled until a reboot. Note, this is polarity dependent, so cable might need to be flipped. BUG=chrome-os-partner:42569 BRANCH=smaug TEST=load on plankton and ryu. attach full feature C to C cable (must have USB3.0 wires). make sure plankton is in USB mode (USB_SS_USB_MODE light should be set, which can be done by pressing DP_USB_TOGGLE button). Press CASE_CLOSE_EN button to send VDM, and then attach micro-B to debug port CN14 on plankton. See that VID/PID for Ryu show up in lsusb on host, and EC console works. If device does not show up, flip polarity of cable. Change-Id: Ifa469e4a43e32089becd75fe6cdfe0ed462d950b Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/287441 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'board')
-rw-r--r--board/plankton/board.c12
-rw-r--r--board/ryu/usb_pd_policy.c6
2 files changed, 17 insertions, 1 deletions
diff --git a/board/plankton/board.c b/board/plankton/board.c
index d8b8dcd56c..d3a66f1fe2 100644
--- a/board/plankton/board.c
+++ b/board/plankton/board.c
@@ -126,6 +126,7 @@ enum usbc_action {
USBC_ACT_MUX_FLIP,
USBC_ACT_CABLE_POLARITY0,
USBC_ACT_CABLE_POLARITY1,
+ USBC_ACT_CCD_EN,
/* Number of USBC actions */
USBC_ACT_COUNT
@@ -310,6 +311,9 @@ static void set_usbc_action(enum usbc_action act)
case USBC_ACT_CABLE_POLARITY1:
gpio_set_level(GPIO_USBC_POLARITY, 1);
break;
+ case USBC_ACT_CCD_EN:
+ pd_send_vdm(0, USB_VID_GOOGLE, VDO_CMD_CCD_EN, NULL, 0);
+ break;
default:
break;
}
@@ -358,6 +362,9 @@ static void button_deferred(void)
case GPIO_DBG_MUX_FLIP_L:
set_usbc_action(USBC_ACT_MUX_FLIP);
break;
+ case GPIO_DBG_CASE_CLOSE_EN_L:
+ set_usbc_action(USBC_ACT_CCD_EN);
+ break;
default:
break;
}
@@ -499,6 +506,8 @@ static int cmd_usbc_action(int argc, char *argv[])
act = USBC_ACT_12V_TO_DUT;
else if (!strcasecmp(argv[1], "20v"))
act = USBC_ACT_20V_TO_DUT;
+ else if (!strcasecmp(argv[1], "ccd"))
+ act = USBC_ACT_CCD_EN;
else if (!strcasecmp(argv[1], "dev"))
act = USBC_ACT_DEVICE;
else if (!strcasecmp(argv[1], "usb"))
@@ -519,7 +528,7 @@ static int cmd_usbc_action(int argc, char *argv[])
return EC_SUCCESS;
}
DECLARE_CONSOLE_COMMAND(usbc_action, cmd_usbc_action,
- "<5v|12v|20v|dev|usb|dp|flip|pol0|pol1>",
+ "<5v|12v|20v|ccd|dev|usb|dp|flip|pol0|pol1>",
"Set Plankton type-C port state",
NULL);
@@ -647,6 +656,7 @@ static void board_init(void)
gpio_enable_interrupt(GPIO_DBG_CHG_TO_DEV_L);
gpio_enable_interrupt(GPIO_DBG_USB_TOGGLE_L);
gpio_enable_interrupt(GPIO_DBG_MUX_FLIP_L);
+ gpio_enable_interrupt(GPIO_DBG_CASE_CLOSE_EN_L);
/* TODO(crosbug.com/33761): poll DBG_20V_TO_DUT_L */
enable_dbg20v_poll();
diff --git a/board/ryu/usb_pd_policy.c b/board/ryu/usb_pd_policy.c
index 6a22a76a16..14e5828f17 100644
--- a/board/ryu/usb_pd_policy.c
+++ b/board/ryu/usb_pd_policy.c
@@ -4,6 +4,7 @@
*/
#include "config.h"
+#include "case_closed_debug.h"
#include "charge_manager.h"
#include "charger.h"
#include "common.h"
@@ -252,6 +253,11 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload,
pd_log_recv_vdm(port, cnt, payload);
break;
#endif /* CONFIG_USB_PD_LOGGING */
+#ifdef CONFIG_CASE_CLOSED_DEBUG
+ case VDO_CMD_CCD_EN:
+ ccd_set_mode(CCD_MODE_ENABLED);
+ break;
+#endif
}
return 0;