summaryrefslogtreecommitdiff
path: root/include/usb_pd_tcpm.h
diff options
context:
space:
mode:
authorAlec Berg <alecaberg@chromium.org>2015-06-02 10:55:29 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-06-03 03:50:06 +0000
commite3cd6444aac2e978af8d149b208a4a0acf10b2d4 (patch)
tree3b14e79e3fcac0b1ddf14004251b43b08a1ca86b /include/usb_pd_tcpm.h
parent457d9086f3ae7d1c30e76d193e9a2bc3f6389c50 (diff)
downloadchrome-ec-e3cd6444aac2e978af8d149b208a4a0acf10b2d4.tar.gz
pd: implement TCPC RX Detect register to enable/disable TCPC RX
Implement the TCPC RX Detect register and use it for the TCPM to enable and disable PD communication. When no type-C connection, disable TCPC RX so that we don't send goodCRC when we are not ready. Once TCPM establishes a type-C connection, enable TCPC RX. BUG=none BRANCH=none TEST=tested on glados and on samus. On glados, without this change, sometimes when you plug in zinger, we get into a hard reset loop because TCPC is sending goodCRC to source cap while TCPM is still debouncing CC and is not ready. With this change, we reliably form PD contract. Also tested enabling and disabling PD comms from the TCPM console with "pd enable 0|1". Change-Id: I8c9e696f2597978436f6ceccfe06ffb021c95ea3 Signed-off-by: Alec Berg <alecaberg@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/274811 Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
Diffstat (limited to 'include/usb_pd_tcpm.h')
-rw-r--r--include/usb_pd_tcpm.h12
1 files changed, 12 insertions, 0 deletions
diff --git a/include/usb_pd_tcpm.h b/include/usb_pd_tcpm.h
index 47b60622f7..951de5572f 100644
--- a/include/usb_pd_tcpm.h
+++ b/include/usb_pd_tcpm.h
@@ -102,6 +102,8 @@ enum tcpc_cc_pull {
#define TCPC_REG_RX_BYTE_CNT 0x2f
#define TCPC_REG_RX_STATUS 0x30
#define TCPC_REG_RX_DETECT 0x31
+#define TCPC_REG_RX_DETECT_SOP_HRST_MASK 0x21
+
#define TCPC_REG_RX_HDR 0x32
#define TCPC_REG_RX_DATA 0x34 /* through 0x4f */
@@ -211,6 +213,16 @@ int tcpm_set_vconn(int port, int enable);
int tcpm_set_msg_header(int port, int power_role, int data_role);
/**
+ * Set RX enable flag
+ *
+ * @param port Type-C port number
+ * @enable true for enable, false for disable
+ *
+ * @return EC_SUCCESS or error
+ */
+int tcpm_set_rx_enable(int port, int enable);
+
+/**
* Read last received PD message.
*
* @param port Type-C port number