summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorSam Hurst <shurst@google.com>2018-12-28 11:06:01 -0800
committerchrome-bot <chrome-bot@chromium.org>2019-01-07 19:40:45 -0800
commit1f7de7c939c1f0bf318f4d8b6012183d5755df91 (patch)
tree47761cbff48ae0b9a90cfd2c76ccc6cfdab8239e /include
parentaed008f87c3c880edecf7608ab24eaa4bee1bc46 (diff)
downloadchrome-ec-1f7de7c939c1f0bf318f4d8b6012183d5755df91.tar.gz
pd: Enable USB PD SOP' and SOP'' Communication
Currently, the PD stack ignores messages received from SOP' and SOP'' and this prevents the stack from communicating with VCONN Power Devices and Cable Plugs in general. I propose encoding the message address (SOP*) in the message header. The message header is encoded as a 16-bit value but the TCPC drivers use a 32-bit type for the header. The SOP* address will be stored in bits 31 to 28 of the message header and the PD stack can check those bits to determine the address of the message. BUG=b:122109575 BRANCH=none TEST=manual Change-Id: I2b34c16cae186202c9cf0bc5f940e05151e88cbf Signed-off-by: Sam Hurst <shurst@chromium.org> Reviewed-on: https://chromium-review.googlesource.com/1390951 Commit-Ready: ChromeOS CL Exonerator Bot <chromiumos-cl-exonerator@appspot.gserviceaccount.com> Tested-by: Sam Hurst <shurst@google.com> Reviewed-by: Jett Rink <jettrink@chromium.org>
Diffstat (limited to 'include')
-rw-r--r--include/config.h3
-rw-r--r--include/usb_pd.h14
2 files changed, 17 insertions, 0 deletions
diff --git a/include/config.h b/include/config.h
index 16326ae7c7..8163205c02 100644
--- a/include/config.h
+++ b/include/config.h
@@ -3290,6 +3290,9 @@
/* Enable TCPC to enter low power mode */
#undef CONFIG_USB_PD_TCPC_LOW_POWER
+/* Enable the encoding of msg SOP* in bits 31-28 of 32-bit msg header type */
+#undef CONFIG_USB_PD_DECODE_SOP
+
/*
* Track VBUS level in TCPC module. This will only be needed if we're acting
* as an external TCPC.
diff --git a/include/usb_pd.h b/include/usb_pd.h
index f57d8edbb5..d87fcc8fa4 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -954,6 +954,20 @@ enum pd_data_msg_type {
#define PD_HEADER_REV(header) (((header) >> 6) & 3)
#define PD_HEADER_DROLE(header) (((header) >> 5) & 1)
+/*
+ * The message header is a 16-bit value that's stored in a 32-bit data type.
+ * SOP* is encoded in bits 31 to 28 of the 32-bit data type.
+ * NOTE: This is not part of the PD spec.
+ */
+#define PD_HEADER_GET_SOP(header) (((header) >> 28) & 0xf)
+#define PD_HEADER_SOP(sop) ((sop) << 28)
+#define PD_MSG_SOP 0
+#define PD_MSG_SOPP 1
+#define PD_MSG_SOPPP 2
+#define PD_MSG_SOP_DBGP 3
+#define PD_MSG_SOP_DBGPP 4
+#define PD_MSG_SOP_CBL_RST 5
+
/* Used for processing pd extended header */
#define PD_EXT_HEADER_CHUNKED(header) (((header) >> 15) & 1)
#define PD_EXT_HEADER_CHUNK_NUM(header) (((header) >> 11) & 0xf)