diff options
author | Daisuke Nojiri <dnojiri@chromium.org> | 2017-02-10 14:11:54 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2017-02-14 17:28:15 -0800 |
commit | c9ea4bddbc45ef9b0104d5afc8a1d2a811cad372 (patch) | |
tree | 8f24d9994f27484f7f7932f1d8a0201851e44983 /driver | |
parent | df2f085c16167f3afa2dbc4c34ef3c638b4f4f45 (diff) | |
download | chrome-ec-c9ea4bddbc45ef9b0104d5afc8a1d2a811cad372.tar.gz |
pdchipinfo: Increase compatibility of fw_version
The firmware version formats may vary chip to chip. fw_version field is
changed to a union of a 8 byte string and an 64-bit integer.
BUG=chrome-os-partner:62383
BRANCH=none
TEST=ectool pdchipinfo 0/1 on Electro
Change-Id: Id51e66c44338a09ed897ee61f54cd6a394400e63
Signed-off-by: Daisuke Nojiri <dnojiri@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/441270
Diffstat (limited to 'driver')
-rw-r--r-- | driver/tcpm/anx74xx.c | 2 | ||||
-rw-r--r-- | driver/tcpm/tcpci.c | 23 |
2 files changed, 14 insertions, 11 deletions
diff --git a/driver/tcpm/anx74xx.c b/driver/tcpm/anx74xx.c index 6311a53446..56728548c6 100644 --- a/driver/tcpm/anx74xx.c +++ b/driver/tcpm/anx74xx.c @@ -928,8 +928,6 @@ static int anx74xx_tcpm_init(int port) if (rv) return EC_ERROR_UNKNOWN; - tcpm_get_chip_info(port, NULL); - return EC_SUCCESS; } diff --git a/driver/tcpm/tcpci.c b/driver/tcpm/tcpci.c index ad50cdbb8d..be98248e1f 100644 --- a/driver/tcpm/tcpci.c +++ b/driver/tcpm/tcpci.c @@ -327,36 +327,39 @@ void tcpci_tcpc_alert(int port) int tcpci_get_chip_info(int port, struct ec_response_pd_chip_info **chip_info) { static struct ec_response_pd_chip_info info[CONFIG_USB_PD_PORT_COUNT]; + struct ec_response_pd_chip_info *i; int error; int val; if (port >= CONFIG_USB_PD_PORT_COUNT) return EC_ERROR_INVAL; + i = &info[port]; + /* If chip_info is NULL, chip info will be stored in cache and can be * read later by another call. */ if (chip_info) - *chip_info = &info[port]; + *chip_info = i; - if (info[port].vendor_id) + if (i->vendor_id) return EC_SUCCESS; error = tcpc_read16(port, TCPC_REG_VENDOR_ID, &val); if (error) return error; - info[port].vendor_id = val; + i->vendor_id = val; error = tcpc_read16(port, TCPC_REG_PRODUCT_ID, &val); if (error) return error; - info[port].product_id = val; + i->product_id = val; error = tcpc_read16(port, TCPC_REG_BCD_DEV, &val); if (error) return error; - info[port].device_id = val; + i->device_id = val; - switch(info[port].vendor_id) { + switch (i->vendor_id) { #ifdef CONFIG_USB_PD_TCPM_ANX74XX case ANX74XX_VENDOR_ID: error = anx74xx_tcpc_get_fw_version(port, &val); @@ -369,12 +372,14 @@ int tcpci_get_chip_info(int port, struct ec_response_pd_chip_info **chip_info) #endif default: /* Even if the chip doesn't implement get_fw_version, we - * return success. The version will be 0xffff. */ - return EC_SUCCESS; + * return success.*/ + val = -1; + error = EC_SUCCESS; } if (error) return error; - info[port].fw_version = val; + /* This may vary chip to chip. For now everything fits in this format */ + i->fw_version_number = val; return EC_SUCCESS; } |