summaryrefslogtreecommitdiff
path: root/include/usb_pd.h
diff options
context:
space:
mode:
authorDiana Z <dzigterman@chromium.org>2020-03-29 00:01:15 -0600
committerCommit Bot <commit-bot@chromium.org>2020-04-07 01:22:02 +0000
commit3163d24804d637f4c4cf3350b432889f07ac1ae1 (patch)
tree985f210ad287d6f72176213a3b86474cd5ee01f5 /include/usb_pd.h
parentec865fc4873ddea4ace3d948aa9fab088913a70d (diff)
downloadchrome-ec-3163d24804d637f4c4cf3350b432889f07ac1ae1.tar.gz
PD: Create unified structure for all SOP* identity
Creates a structure to be used by all SOP* types to store identity information. Combines the full response size storage currently used for SOP, as well as some of the structure accessibility introduced with the cable attributes. Currently not all product type VDOs have defined structures, but these may be added as needed by the code. BRANCH=None BUG=b:152417977 TEST=make -j buildall Signed-off-by: Diana Z <dzigterman@chromium.org> Change-Id: I7b57b43447653dfbe1024b8fe71375916e0821b6 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/ec/+/2130475 Reviewed-by: Abe Levkoy <alevkoy@chromium.org>
Diffstat (limited to 'include/usb_pd.h')
-rw-r--r--include/usb_pd.h74
1 files changed, 22 insertions, 52 deletions
diff --git a/include/usb_pd.h b/include/usb_pd.h
index 49a14654ec..f781abae22 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -335,6 +335,26 @@ enum pd_discovery_state {
PD_DISC_FAIL, /* Cable did not respond, or Discover* NAK */
};
+/* Discover Identity ACK contents after headers */
+union disc_ident_ack {
+ struct {
+ struct id_header_vdo_rev20 idh;
+ struct cert_stat_vdo cert;
+ struct product_vdo product;
+ union product_type_vdo1 product_t1;
+ union product_type_vdo2 product_t2;
+ uint32_t product_t3;
+ };
+
+ uint32_t raw_value[PDO_MAX_OBJECTS - 1];
+};
+
+/* Discover Identity data - ACK plus discovery state */
+struct identity_data {
+ union disc_ident_ack response;
+ enum pd_discovery_state discovery;
+};
+
/* supported alternate modes */
enum pd_alternate_modes {
PD_AMODE_GOOGLE,
@@ -469,27 +489,6 @@ struct pd_discovery {
#define VDO_INDEX_PTYPE_DFP_VDO 6
#define VDO_I(name) VDO_INDEX_##name
-/*
- * SVDM Identity Header
- * --------------------
- * <31> :: data capable as a USB host
- * <30> :: data capable as a USB device
- * <29:27> :: product type
- * <26> :: modal operation supported (1b == yes)
- * <25:16> :: SBZ
- * <15:0> :: USB-IF assigned VID for this cable vendor
- */
-
-enum idh_ptype {
- IDH_PTYPE_UNDEF,
- IDH_PTYPE_HUB,
- IDH_PTYPE_PERIPH,
- IDH_PTYPE_PCABLE,
- IDH_PTYPE_ACABLE,
- IDH_PTYPE_AMA,
- IDH_PTYPE_VPD,
- IDH_PTYPE_COUNT,
-};
#define VDO_IDH(usbh, usbd, ptype, is_modal, vid) \
((usbh) << 31 | (usbd) << 30 | ((ptype) & 0x7) << 27 \
| (is_modal) << 26 | ((vid) & 0xffff))
@@ -498,21 +497,9 @@ enum idh_ptype {
#define PD_IDH_IS_MODAL(vdo) (((vdo) >> 26) & 0x1)
#define PD_IDH_VID(vdo) ((vdo) & 0xffff)
-/*
- * Cert Stat VDO
- * -------------
- * <31:20> : SBZ
- * <19:0> : USB-IF assigned TID for this cable
- */
#define VDO_CSTAT(tid) ((tid) & 0xfffff)
#define PD_CSTAT_TID(vdo) ((vdo) & 0xfffff)
-/*
- * Product VDO
- * -----------
- * <31:16> : USB Product ID
- * <15:0> : USB bcdDevice
- */
#define VDO_PRODUCT(pid, bcd) (((pid) & 0xffff) << 16 | ((bcd) & 0xffff))
#define PD_PRODUCT_PID(vdo) (((vdo) >> 16) & 0xffff)
@@ -523,23 +510,6 @@ enum idh_ptype {
*/
#define INVALID_MSG_ID_COUNTER 0xff
-union cable_vdo {
- /* Passive cable VDO */
- union passive_cable_vdo_rev20 p_rev20;
- union passive_cable_vdo_rev30 p_rev30;
-
- /* Active cable VDO */
- union active_cable_vdo_rev20 a_rev20;
- union active_cable_vdo1_rev30 a_rev30;
-
- uint32_t raw_value;
-};
-
-union active_cable_vdo2 {
- union active_cable_vdo2_rev30 a2_rev30;
- uint32_t raw_value;
-};
-
/* Protocol revision */
enum pd_rev_type {
PD_REV10,
@@ -575,9 +545,9 @@ struct pd_cable {
/* Type of cable */
enum idh_ptype type;
/* Cable attributes */
- union cable_vdo attr;
+ union product_type_vdo1 attr;
/* For USB PD REV3, active cable has 2 VDOs */
- union active_cable_vdo2 attr2;
+ union product_type_vdo2 attr2;
/* Cable revision */
enum pd_rev_type rev;