pd: dingdong/hoho: Include product VDO in discovery identity.

Per table 6-24 of USB PD spec an alternate mode adapter (AMA) should
include both product & AMA VDOs.

BRANCH=samus
BUG=chrome-os-partner:31192,chrome-os-partner:31193
TEST=manual,

Connect hoho/dingdong to fpie/samus and see product VDO proceed the
AMA VDO in DFP_U console output:

    Product VDO -----------------------------v
                                          |------|
    SVDM/5 [1] ff008041 340018d1 00000000 50100001 1100000b

    Note, hoho's PID == 0x5010

    And dingdong (0x5011)
    SVDM/5 [1] ff008041 340018d1 00000000 50110001 1100000b

    Also see bcdDevice field in descriptor match above data.

    $ lsusb -v -d 18d1: | egrep -i "idproduct|bcddev"
    idProduct          0x5011
    bcdDevice            0.01

Change-Id: I4d898816a45c68c7ff75a54fd348fc11be408ae0
Signed-off-by: Todd Broch <tbroch@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/226125
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
Todd Broch
2014-10-28 18:04:01 -07:00
committed by chrome-internal-fetch
parent aac88442d7
commit ce9ae08b68
7 changed files with 42 additions and 15 deletions

View File

@@ -35,6 +35,7 @@
/* USB configuration */
#define CONFIG_USB_PID 0x5011
#define CONFIG_USB_BCD_DEV 0x0001 /* v 0.01 */
/*
* Allow dangerous commands all the time, since we don't have a write protect

View File

@@ -14,6 +14,7 @@
#include "timer.h"
#include "util.h"
#include "usb.h"
#include "usb_bb.h"
#include "usb_pd.h"
#include "version.h"
@@ -105,6 +106,8 @@ const uint32_t vdo_idh = VDO_IDH(0, /* data caps as USB host */
1, /* supports alt modes */
USB_VID_GOOGLE);
const uint32_t vdo_product = VDO_PRODUCT(CONFIG_USB_PID, CONFIG_USB_BCD_DEV);
const uint32_t vdo_ama = VDO_AMA(CONFIG_USB_PD_IDENTITY_HW_VERS,
CONFIG_USB_PD_IDENTITY_SW_VERS,
0, 0, 0, 0, /* SS[TR][12] */
@@ -118,8 +121,9 @@ static int svdm_response_identity(int port, uint32_t *payload)
payload[VDO_I(IDH)] = vdo_idh;
/* TODO(tbroch): Do we plan to obtain TID (test ID) for hoho */
payload[VDO_I(CSTAT)] = VDO_CSTAT(0);
payload[VDO_I(PRODUCT)] = vdo_product;
payload[VDO_I(AMA)] = vdo_ama;
return 4;
return VDO_I(AMA) + 1;
}
static int svdm_response_svids(int port, uint32_t *payload)
@@ -128,9 +132,9 @@ static int svdm_response_svids(int port, uint32_t *payload)
return 2;
}
/* Will only ever be a single mode for this UFP_D device as it has no USB
* support (2.0 or 3.0) making it only PIN_E configureable nor does it have any
* source functionality.
/*
* Will only ever be a single mode for this UFP_D device as it has no real USB
* support making it only PIN_E configureable
*/
#define MODE_CNT 1
#define OPOS 1

View File

@@ -46,6 +46,7 @@
/* USB configuration */
#define CONFIG_USB_PID 0x5010
#define CONFIG_USB_BCD_DEV 0x0001 /* v 0.01 */
/*
* Allow dangerous commands all the time, since we don't have a write protect

View File

@@ -13,6 +13,7 @@
#include "task.h"
#include "timer.h"
#include "usb.h"
#include "usb_bb.h"
#include "usb_pd.h"
#include "util.h"
#include "version.h"
@@ -105,6 +106,8 @@ const uint32_t vdo_idh = VDO_IDH(0, /* data caps as USB host */
1, /* supports alt modes */
USB_VID_GOOGLE);
const uint32_t vdo_product = VDO_PRODUCT(CONFIG_USB_PID, CONFIG_USB_BCD_DEV);
const uint32_t vdo_ama = VDO_AMA(CONFIG_USB_PD_IDENTITY_HW_VERS,
CONFIG_USB_PD_IDENTITY_SW_VERS,
0, 0, 0, 0, /* SS[TR][12] */
@@ -118,8 +121,9 @@ static int svdm_response_identity(int port, uint32_t *payload)
payload[VDO_I(IDH)] = vdo_idh;
/* TODO(tbroch): Do we plan to obtain TID (test ID) for hoho */
payload[VDO_I(CSTAT)] = VDO_CSTAT(0);
payload[VDO_I(PRODUCT)] = vdo_product;
payload[VDO_I(AMA)] = vdo_ama;
return 4;
return VDO_I(AMA) + 1;
}
static int svdm_response_svids(int port, uint32_t *payload)
@@ -128,9 +132,9 @@ static int svdm_response_svids(int port, uint32_t *payload)
return 2;
}
/* Will only ever be a single mode for this UFP_D device as it has no USB
* support (2.0 or 3.0) making it only PIN_E configureable nor does it have any
* source functionality.
/*
* Will only ever be a single mode for this UFP_D device as it has no real USB
* support making it only PIN_C configureable
*/
#define MODE_CNT 1
#define OPOS 1

View File

@@ -30,6 +30,10 @@
#define USB_DEV_CLASS USB_CLASS_PER_INTERFACE
#endif
#ifndef CONFIG_USB_BCD_DEV
#define CONFIG_USB_BCD_DEV 0x0100 /* 1.00 */
#endif
/* USB Standard Device Descriptor */
static const struct usb_device_descriptor dev_desc = {
.bLength = USB_DT_DEVICE_SIZE,
@@ -41,7 +45,7 @@ static const struct usb_device_descriptor dev_desc = {
.bMaxPacketSize0 = USB_MAX_PACKET_SIZE,
.idVendor = USB_VID_GOOGLE,
.idProduct = CONFIG_USB_PID,
.bcdDevice = 0x0200, /* 2.00 */
.bcdDevice = CONFIG_USB_BCD_DEV,
.iManufacturer = USB_STR_VENDOR,
.iProduct = USB_STR_PRODUCT,
.iSerialNumber = 0,

View File

@@ -1111,6 +1111,9 @@
/* USB Binary device Object Store support */
#undef CONFIG_USB_BOS
/* USB Device version of product */
#undef CONFIG_USB_BCD_DEV
/*****************************************************************************/
/* USB interfaces config */

View File

@@ -247,14 +247,16 @@ struct pd_policy {
* [0] :: SVDM header
* [1] :: Identitiy header
* [2] :: Cert Stat VDO
* [3] :: (Product | Cable | AMA) VDO
* [3] :: (Product | Cable) VDO
* [4] :: AMA VDO
*
*/
#define VDO_INDEX_HDR 0
#define VDO_INDEX_IDH 1
#define VDO_INDEX_CSTAT 2
#define VDO_INDEX_CABLE 3
#define VDO_INDEX_AMA 3
#define VDO_INDEX_HDR 0
#define VDO_INDEX_IDH 1
#define VDO_INDEX_CSTAT 2
#define VDO_INDEX_CABLE 3
#define VDO_INDEX_PRODUCT 3
#define VDO_INDEX_AMA 4
#define VDO_I(name) VDO_INDEX_##name
/*
@@ -290,6 +292,14 @@ struct pd_policy {
#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))
/*
* Cable VDO
* ---------