mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2026-01-11 18:35:28 +00:00
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>
This commit is contained in:
committed by
chrome-internal-fetch
parent
a67adf4af5
commit
7b305b752b
@@ -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]));
|
||||
}
|
||||
|
||||
@@ -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]));
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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];
|
||||
|
||||
@@ -134,14 +134,24 @@ enum pd_errors {
|
||||
#define PD_VDO_VID(vdo) ((vdo) >> 16)
|
||||
#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
|
||||
|
||||
Reference in New Issue
Block a user