diff options
author | Todd Broch <tbroch@chromium.org> | 2015-05-29 13:17:33 -0700 |
---|---|---|
committer | ChromeOS Commit Bot <chromeos-commit-bot@chromium.org> | 2015-05-30 01:04:47 +0000 |
commit | 61ee1d732368da2e3c6e51ebf9102969273c11a8 (patch) | |
tree | f92cf6cadde1dc86a1f823cec0dea6122b4f2261 /driver/mcdp28x0.c | |
parent | 362ed174eb63246ec5f1fc06eb7911eef785acae (diff) | |
download | chrome-ec-61ee1d732368da2e3c6e51ebf9102969273c11a8.tar.gz |
mcdp28x0: Use custom appstest command for get_info
Firmware's original get_info command always returns the same values
for family, chipid, irom & fw despite indeed having different
versions.
Currently its:
family:000e chipid:0001 irom:1.0.0 fw:0.0.0
As we have a new stepping of the chip ('BB') and a corresponding new
firmware (>=0.74) we need a mechanism to verify and log this change.
CL uses the newly hatched appstest command (0x12) message 0x28 to
surface information that properly reflects both hardware and firmware
running.
Signed-off-by: Todd Broch <tbroch@chromium.org>
BRANCH=samus
BUG=chrome-os-partner:35939
TEST=manual,
For devices running 0.54 | 0.74 fw see gpio MCDP_READY asserted.
With CONFIG_CMD_MCDP in board/hoho/board.h see the following responses
when executing 'mcdp info'
Stepping | FW | Response
--------------------------------------------------------------------
'BA' 0.53 fails as expected
'BA' 0.54 family:0010 chipid:2850 irom:2.0.0 fw:0.54.0
'BB' 0.73 fails as expected
'BB' 0.74 family:0010 chipid:2850 irom:2.1.0 fw:0.74.0
Change-Id: I2c36393a298c617f903389dab24da631b60ec574
Reviewed-on: https://chromium-review.googlesource.com/274049
Reviewed-by: Scott Collyer <scollyer@chromium.org>
Commit-Queue: Todd Broch <tbroch@chromium.org>
Tested-by: Todd Broch <tbroch@chromium.org>
Diffstat (limited to 'driver/mcdp28x0.c')
-rw-r--r-- | driver/mcdp28x0.c | 29 |
1 files changed, 16 insertions, 13 deletions
diff --git a/driver/mcdp28x0.c b/driver/mcdp28x0.c index a7d9681c96..d5d37e1bed 100644 --- a/driver/mcdp28x0.c +++ b/driver/mcdp28x0.c @@ -139,6 +139,17 @@ static int rx_serial(uint8_t *msg, int cnt) return !(read == cnt); } +static int rx_serial_ack(void) +{ + if (rx_serial(mcdp_inbuf, 3)) + return EC_ERROR_UNKNOWN; + + if (mcdp_inbuf[1] != MCDP_CMD_ACK) + return EC_ERROR_UNKNOWN; + + return EC_SUCCESS; +} + void mcdp_enable(void) { usart_init(&usart_mcdp); @@ -151,31 +162,23 @@ void mcdp_disable(void) int mcdp_get_info(struct mcdp_info *info) { - const uint8_t msg[2] = {MCDP_CMD_GETINFO, 0x00}; /* cmd + msg type */ + const uint8_t msg[2] = {MCDP_CMD_APPSTEST, 0x28}; if (tx_serial(msg, sizeof(msg))) return EC_ERROR_UNKNOWN; - if (rx_serial(mcdp_inbuf, MCDP_RSP_LEN(MCDP_LEN_GETINFO))) + if (rx_serial_ack()) return EC_ERROR_UNKNOWN; + /* chksum is unreliable ... don't check */ + rx_serial(mcdp_inbuf, MCDP_RSP_LEN(MCDP_LEN_GETINFO)); + memcpy(info, &mcdp_inbuf[2], MCDP_LEN_GETINFO); return EC_SUCCESS; } #ifdef CONFIG_CMD_MCDP -static int rx_serial_ack(void) -{ - if (rx_serial(mcdp_inbuf, 3)) - return EC_ERROR_UNKNOWN; - - if (mcdp_inbuf[1] != MCDP_CMD_ACK) - return EC_ERROR_UNKNOWN; - - return EC_SUCCESS; -} - static int mcdp_get_dev_id(char *dev, uint8_t dev_id, int dev_cnt) { uint8_t msg[2]; |