diff options
author | Alec Berg <alecaberg@chromium.org> | 2014-10-02 15:34:31 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-10-07 05:53:26 +0000 |
commit | 7b305b752b6b22e48ce71160cc18b3ddcd0dfa89 (patch) | |
tree | 50243b3521d898cff4b17a7d602a40fd7175cbcd | |
parent | a67adf4af55274251bd05028ae89a60f868f5823 (diff) | |
download | chrome-ec-7b305b752b6b22e48ce71160cc18b3ddcd0dfa89.tar.gz |
zinger: samus_pd: increment zinger hardware id minor revision
Add a minor revision to the PD device hardware ID field in the info
custom VDM and set increment this minor ID from 0 to 1 for zinger.
This differentiates zingers for the auto-update payload, so we can
update only those with a specific major and minor ID version.
BUG=none
BRANCH=samus
TEST=load onto samus and zinger. when connect zinger, see on PD
console: Dev:0x0401 SW:2289 RW:0, which shows the appropriate
device ID.
Change-Id: I482ee2d850332b608cdd81537f68d4dc509bfc1a
Signed-off-by: Alec Berg <alecaberg@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/221320
Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
-rw-r--r-- | board/fruitpie/usb_pd_policy.c | 4 | ||||
-rw-r--r-- | board/samus_pd/usb_pd_policy.c | 4 | ||||
-rw-r--r-- | board/zinger/board.h | 9 | ||||
-rw-r--r-- | board/zinger/usb_pd_policy.c | 9 | ||||
-rw-r--r-- | common/usb_pd_protocol.c | 8 | ||||
-rw-r--r-- | include/ec_commands.h | 5 | ||||
-rw-r--r-- | include/usb_pd.h | 14 |
7 files changed, 30 insertions, 23 deletions
diff --git a/board/fruitpie/usb_pd_policy.c b/board/fruitpie/usb_pd_policy.c index 16d96dd66f..b5d51540a7 100644 --- a/board/fruitpie/usb_pd_policy.c +++ b/board/fruitpie/usb_pd_policy.c @@ -139,7 +139,7 @@ int pd_board_checks(void) int pd_custom_vdm(int port, int cnt, uint32_t *payload, uint32_t **rpayload) { int cmd = PD_VDO_CMD(payload[0]); - uint8_t dev_id = 0; + uint16_t dev_id = 0; ccprintf("VDM/%d [%d] %08x\n", cnt, cmd, payload[0]); /* make sure we have some payload */ @@ -157,7 +157,7 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, uint32_t **rpayload) /* if last word is present, it contains lots of info */ if (cnt == 7) { dev_id = VDO_INFO_HW_DEV_ID(payload[6]); - ccprintf("Dev:%d SW:%d RW:%d\n", dev_id, + ccprintf("Dev:0x%04x SW:%d RW:%d\n", dev_id, VDO_INFO_SW_DBG_VER(payload[6]), VDO_INFO_IS_RW(payload[6])); } diff --git a/board/samus_pd/usb_pd_policy.c b/board/samus_pd/usb_pd_policy.c index fe143668a9..6689866463 100644 --- a/board/samus_pd/usb_pd_policy.c +++ b/board/samus_pd/usb_pd_policy.c @@ -161,7 +161,7 @@ static void pd_send_host_event(void) int pd_custom_vdm(int port, int cnt, uint32_t *payload, uint32_t **rpayload) { int cmd = PD_VDO_CMD(payload[0]); - uint8_t dev_id = 0; + uint16_t dev_id = 0; ccprintf("VDM/%d [%d] %08x\n", cnt, cmd, payload[0]); /* make sure we have some payload */ @@ -182,7 +182,7 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, uint32_t **rpayload) pd_send_host_event(); dev_id = VDO_INFO_HW_DEV_ID(payload[6]); - ccprintf("Dev:%d SW:%d RW:%d\n", dev_id, + ccprintf("Dev:0x%04x SW:%d RW:%d\n", dev_id, VDO_INFO_SW_DBG_VER(payload[6]), VDO_INFO_IS_RW(payload[6])); } diff --git a/board/zinger/board.h b/board/zinger/board.h index 93b7379d37..f4509c0e2e 100644 --- a/board/zinger/board.h +++ b/board/zinger/board.h @@ -50,15 +50,6 @@ #define UARTN CONFIG_UART_CONSOLE #define UARTN_BASE STM32_USART_BASE(CONFIG_UART_CONSOLE) -/* USB PD ChromeOS VDM information */ -#if defined(BOARD_ZINGER) -#define USB_PD_HARDWARE_DEVICE_ID 1 -#elif defined(BOARD_MINIMUFFIN) -#define USB_PD_HARDWARE_DEVICE_ID 2 -#else -#error "Board does not have a USB-PD HW Device ID" -#endif - #ifndef __ASSEMBLER__ #include "common.h" diff --git a/board/zinger/usb_pd_policy.c b/board/zinger/usb_pd_policy.c index 177826bb51..3bd0e08132 100644 --- a/board/zinger/usb_pd_policy.c +++ b/board/zinger/usb_pd_policy.c @@ -384,8 +384,15 @@ uint32_t *pd_get_info(void) /* copy first 20 bytes of RW hash */ memcpy(info_data, hash, 5 * sizeof(uint32_t)); /* copy other info into data msg */ - info_data[5] = VDO_INFO(USB_PD_HARDWARE_DEVICE_ID, +#ifdef BOARD_ZINGER + info_data[5] = VDO_INFO(USB_PD_HW_DEV_ID_ZINGER, 1, ver_get_numcommits(), !is_ro_mode()); +#elif defined(BOARD_MINIMUFFIN) + info_data[5] = VDO_INFO(USB_PD_HW_DEV_ID_MINIMUFFIN, 0, + ver_get_numcommits(), !is_ro_mode()); +#else +#error "Board does not have a USB-PD HW Device ID" +#endif return info_data; } diff --git a/common/usb_pd_protocol.c b/common/usb_pd_protocol.c index 7f0532f7b3..4876deb9d8 100644 --- a/common/usb_pd_protocol.c +++ b/common/usb_pd_protocol.c @@ -229,7 +229,7 @@ static struct pd_protocol { uint8_t vdo_count; /* Attached ChromeOS device id & RW hash */ - uint8_t dev_id; + uint16_t dev_id; uint32_t dev_rw_hash[SHA1_DIGEST_SIZE/4]; } pd[PD_PORT_COUNT]; @@ -1075,16 +1075,16 @@ static void pd_vdm_send_state_machine(int port) } } -static inline void pd_dev_dump_info(uint8_t dev_id, uint32_t *hash) +static inline void pd_dev_dump_info(uint16_t dev_id, uint32_t *hash) { int j; - ccprintf("Device:%d Hash:", dev_id); + ccprintf("Device:0x%04x Hash:", dev_id); for (j = 0; j < SHA1_DIGEST_SIZE/4; j++) ccprintf(" 0x%08x", hash[j]); ccprintf("\n"); } -void pd_dev_store_rw_hash(int port, uint8_t dev_id, uint32_t *rw_hash) +void pd_dev_store_rw_hash(int port, uint16_t dev_id, uint32_t *rw_hash) { pd[port].dev_id = dev_id; memcpy(pd[port].dev_rw_hash, rw_hash, SHA1_DIGEST_SIZE); diff --git a/include/ec_commands.h b/include/ec_commands.h index c0d1300160..91967d2b23 100644 --- a/include/ec_commands.h +++ b/include/ec_commands.h @@ -2654,10 +2654,9 @@ enum usb_pd_fw_update_cmds { }; struct ec_params_usb_pd_fw_update { + uint16_t dev_id; uint8_t cmd; - uint8_t dev_id; uint8_t port; - uint8_t reserved; /* reserved */ uint32_t size; /* Size to write in bytes */ /* Followed by data to write */ } __packed; @@ -2666,7 +2665,7 @@ struct ec_params_usb_pd_fw_update { #define EC_CMD_USB_PD_RW_HASH_ENTRY 0x111 #define SHA1_DIGEST_SIZE 20 struct ec_params_usb_pd_rw_hash_entry { - uint8_t dev_id; + uint16_t dev_id; union { uint8_t b[SHA1_DIGEST_SIZE]; uint32_t w[SHA1_DIGEST_SIZE/4]; diff --git a/include/usb_pd.h b/include/usb_pd.h index 04aedff5b0..1f3a183998 100644 --- a/include/usb_pd.h +++ b/include/usb_pd.h @@ -135,13 +135,23 @@ enum pd_errors { #define PD_VDO_CMD(vdo) ((vdo) & 0x1f) /* + * ChromeOS specific PD device Hardware IDs. Used to identify unique + * products and used in VDO_INFO. Note this field is 10 bits. + */ +#define USB_PD_HW_DEV_ID_RESERVED 0 +#define USB_PD_HW_DEV_ID_ZINGER 1 +#define USB_PD_HW_DEV_ID_MINIMUFFIN 2 + +/* * ChromeOS specific VDO_CMD_READ_INFO responds with device info including: * RW Hash: sha1 of RW hash (20 bytes) * HW Device ID: unique descriptor for each ChromeOS model (2 bytes) + * top 6 bits are minor revision, bottom 10 bits are major * SW Debug Version: Software version useful for debugging (15 bits) * IS RW: True if currently in RW, False otherwise (1 bit) */ -#define VDO_INFO(id, ver, is_rw) ((id) << 16 \ +#define VDO_INFO(id, id_minor, ver, is_rw) ((id_minor) << 26 \ + | ((id) & 0x3ff) << 16 \ | ((ver) & 0x7fff) << 1 \ | ((is_rw) & 1)) #define VDO_INFO_HW_DEV_ID(x) ((x) >> 16) @@ -344,7 +354,7 @@ int pd_custom_vdm(int port, int cnt, uint32_t *payload, uint32_t **rpayload); * @param dev_id device identifier * @param rw_hash pointer to sha1 rw_hash */ -void pd_dev_store_rw_hash(int port, uint8_t dev_id, uint32_t *rw_hash); +void pd_dev_store_rw_hash(int port, uint16_t dev_id, uint32_t *rw_hash); /** * Send Vendor Defined Message |