summaryrefslogtreecommitdiffstats
path: root/drivers/misc/cros_ec.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2014-02-27 13:26:08 -0700
committerSimon Glass <sjg@chromium.org>2014-03-17 20:05:47 -0600
commite8c12662364fbcf5ea917d341f707534c8574900 (patch)
tree92b10bee92329f51223785449ba781c9cdbaee74 /drivers/misc/cros_ec.c
parent836bb6e8277aaa8f0f86e39b0c38b207d32723d9 (diff)
downloadu-boot-e8c12662364fbcf5ea917d341f707534c8574900.tar.gz
u-boot-e8c12662364fbcf5ea917d341f707534c8574900.tar.xz
u-boot-e8c12662364fbcf5ea917d341f707534c8574900.zip
cros_ec: Clean up multiple EC protocol support
Version 1 protocols (without command version) were already no longer supported in cros_ec.c. This removes some dead code from the cros_ec_i2c driver. Version 2 protcols (with command version) are now called protocol_version=2, instead of cmd_version_is_supported=1. A subsequent change will introduce protocol version 3 for SPI. Reviewed-by: Simon Glass <sjg@chromium.org> Signed-off-by: Randall Spangler <rspangler@chromium.org> Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'drivers/misc/cros_ec.c')
-rw-r--r--drivers/misc/cros_ec.c21
1 files changed, 13 insertions, 8 deletions
diff --git a/drivers/misc/cros_ec.c b/drivers/misc/cros_ec.c
index ff46762dde..33b9390d3e 100644
--- a/drivers/misc/cros_ec.c
+++ b/drivers/misc/cros_ec.c
@@ -501,18 +501,23 @@ static int cros_ec_check_version(struct cros_ec_dev *dev)
*
* So for now, just read all the data anyway.
*/
- dev->cmd_version_is_supported = 1;
+
+ /* Try sending a version 2 packet */
+ dev->protocol_version = 2;
if (ec_command_inptr(dev, EC_CMD_HELLO, 0, &req, sizeof(req),
(uint8_t **)&resp, sizeof(*resp)) > 0) {
- /* It appears to understand new version commands */
- dev->cmd_version_is_supported = 1;
- } else {
- printf("%s: ERROR: old EC interface not supported\n",
- __func__);
- return -1;
+ return 0;
}
- return 0;
+ /*
+ * Fail if we're still here, since the EC doesn't understand any
+ * protcol version we speak. Version 1 interface without command
+ * version is no longer supported, and we don't know about any new
+ * protocol versions.
+ */
+ dev->protocol_version = 0;
+ printf("%s: ERROR: old EC interface not supported\n", __func__);
+ return -1;
}
int cros_ec_test(struct cros_ec_dev *dev)