summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBernard Shyu <bernard_shyu@bizlinktech.com>2014-11-19 19:05:34 +0800
committerchrome-internal-fetch <chrome-internal-fetch@google.com>2014-11-19 23:17:44 +0000
commit1e9491e07db038541d9c707d081aad83bb1ace5d (patch)
treedfc186858121059a90ab7ce6271692ebb853786c
parent6be0040bbe0316058330392fe7327ff0c58e5081 (diff)
downloadchrome-ec-1e9491e07db038541d9c707d081aad83bb1ace5d.tar.gz
usb_pd: SVDM DP protocol definition errors
The role of hoho & dingdong is UFP, and the corresponding protocol fields in VDO (vdo_idh) should reflect it. Fix error in IDH_PTYPE definitions of SVDM Identity Header, it's reversed Adds more legible names to protocol field constants BUG=none BRANCH=none TEST=make buildall Change-Id: Idac9327bf3e8e9597221654bce80bb311b3304af Reviewed-on: https://chromium-review.googlesource.com/230657 Reviewed-by: Alec Berg <alecaberg@chromium.org> Reviewed-by: Todd Broch <tbroch@chromium.org> Commit-Queue: Bernard Shyu <bernard_shyu@bizlinktech.com> Tested-by: Bernard Shyu <bernard_shyu@bizlinktech.com>
-rw-r--r--board/dingdong/usb_pd_policy.c2
-rw-r--r--board/hoho/usb_pd_policy.c2
-rw-r--r--include/usb_pd.h22
3 files changed, 21 insertions, 5 deletions
diff --git a/board/dingdong/usb_pd_policy.c b/board/dingdong/usb_pd_policy.c
index d082f99c60..63223d8927 100644
--- a/board/dingdong/usb_pd_policy.c
+++ b/board/dingdong/usb_pd_policy.c
@@ -139,7 +139,7 @@ void pd_new_contract(int port, int pr_role, int dr_role,
}
/* ----------------- Vendor Defined Messages ------------------ */
const uint32_t vdo_idh = VDO_IDH(0, /* data caps as USB host */
- 0, /* data caps as USB device */
+ 1, /* data caps as USB device */
IDH_PTYPE_AMA, /* Alternate mode */
1, /* supports alt modes */
USB_VID_GOOGLE);
diff --git a/board/hoho/usb_pd_policy.c b/board/hoho/usb_pd_policy.c
index adb3e1ddc4..6098c790c1 100644
--- a/board/hoho/usb_pd_policy.c
+++ b/board/hoho/usb_pd_policy.c
@@ -139,7 +139,7 @@ void pd_new_contract(int port, int pr_role, int dr_role,
}
/* ----------------- Vendor Defined Messages ------------------ */
const uint32_t vdo_idh = VDO_IDH(0, /* data caps as USB host */
- 0, /* data caps as USB device */
+ 1, /* data caps as USB device */
IDH_PTYPE_AMA, /* Alternate mode */
1, /* supports alt modes */
USB_VID_GOOGLE);
diff --git a/include/usb_pd.h b/include/usb_pd.h
index d498570366..b743324566 100644
--- a/include/usb_pd.h
+++ b/include/usb_pd.h
@@ -277,8 +277,8 @@ struct pd_policy {
#define IDH_PTYPE_UNDEF 0
#define IDH_PTYPE_HUB 1
#define IDH_PTYPE_PERIPH 2
-#define IDH_PTYPE_ACABLE 3
-#define IDH_PTYPE_PCABLE 4
+#define IDH_PTYPE_PCABLE 3
+#define IDH_PTYPE_ACABLE 4
#define IDH_PTYPE_AMA 5
#define VDO_IDH(usbh, usbd, ptype, is_modal, vid) \
@@ -330,6 +330,12 @@ struct pd_policy {
#define CABLE_CTYPE 2
#define CABLE_PLUG 0
#define CABLE_RECEPTACLE 1
+#define CABLE_CURR_1A5 0
+#define CABLE_CURR_3A 1
+#define CABLE_CURR_5A 2
+#define CABLE_USBSS_U2_ONLY 0
+#define CABLE_USBSS_U31_GEN1 1
+#define CABLE_USBSS_U31_GEN2 2
#define VDO_CABLE(hw, fw, cbl, gdr, lat, term, tx1d, tx2d, rx1d, rx2d, cur, vps, sopp, usbss) \
(((hw) & 0x7) << 28 | ((fw) & 0x7) << 24 | ((cbl) & 0x3) << 18 \
| (gdr) << 17 | ((lat) & 0x7) << 13 | ((term) & 0x3) << 11 \
@@ -361,7 +367,17 @@ struct pd_policy {
#define PD_VDO_AMA_VCONN_REQ(vdo) (((vdo) >> 4) & 1)
#define PD_VDO_AMA_VBUS_REQ(vdo) (((vdo) >> 3) & 1)
-#define AMA_USBSS_BBONLY 0x3
+#define AMA_VCONN_PWR_1W 0
+#define AMA_VCONN_PWR_1W5 1
+#define AMA_VCONN_PWR_2W 2
+#define AMA_VCONN_PWR_3W 3
+#define AMA_VCONN_PWR_4W 4
+#define AMA_VCONN_PWR_5W 5
+#define AMA_VCONN_PWR_6W 6
+#define AMA_USBSS_U2_ONLY 0
+#define AMA_USBSS_U31_GEN1 1
+#define AMA_USBSS_U31_GEN2 2
+#define AMA_USBSS_BBONLY 3
/*
* SVDM Discover SVIDs request -> response