summaryrefslogtreecommitdiff
path: root/driver/mcdp28x0.c
diff options
context:
space:
mode:
Diffstat (limited to 'driver/mcdp28x0.c')
-rw-r--r--driver/mcdp28x0.c29
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];