summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTodd Broch <tbroch@chromium.org>2015-05-29 13:17:33 -0700
committerChromeOS Commit Bot <chromeos-commit-bot@chromium.org>2015-05-30 01:04:47 +0000
commit61ee1d732368da2e3c6e51ebf9102969273c11a8 (patch)
treef92cf6cadde1dc86a1f823cec0dea6122b4f2261
parent362ed174eb63246ec5f1fc06eb7911eef785acae (diff)
downloadchrome-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>
-rw-r--r--board/hoho/board.c4
-rw-r--r--driver/mcdp28x0.c29
2 files changed, 18 insertions, 15 deletions
diff --git a/board/hoho/board.c b/board/hoho/board.c
index 8e0a370bf3..56484bc0a7 100644
--- a/board/hoho/board.c
+++ b/board/hoho/board.c
@@ -141,8 +141,8 @@ static void factory_validation_deferred(void)
mcdp_enable();
/* test mcdp via serial to validate function */
- if (!mcdp_get_info(&info) && (MCDP_FAMILY(info.family) == 0xe) &&
- (MCDP_CHIPID(info.chipid) == 0x1)) {
+ if (!mcdp_get_info(&info) && (MCDP_FAMILY(info.family) == 0x0010) &&
+ (MCDP_CHIPID(info.chipid) == 0x2850)) {
gpio_set_level(GPIO_MCDP_READY, 1);
pd_log_event(PD_EVENT_VIDEO_CODEC,
PD_LOG_PORT_SIZE(0, sizeof(info)),
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];