summaryrefslogtreecommitdiff
path: root/drivers/misc/cros_ec.c
diff options
context:
space:
mode:
authorRandall Spangler <rspangler@chromium.org>2014-02-27 13:26:10 -0700
committerSimon Glass <sjg@chromium.org>2014-03-17 20:05:47 -0600
commita60702833150b8f9263a5f1fb9a6b64774cd44f3 (patch)
tree32581d04ab69321f2044c3cefc0f7560b384a65e /drivers/misc/cros_ec.c
parent2d8ede58ca5873f485c7691b1ca1c1bc6aae7212 (diff)
downloadu-boot-imx-a60702833150b8f9263a5f1fb9a6b64774cd44f3.zip
u-boot-imx-a60702833150b8f9263a5f1fb9a6b64774cd44f3.tar.gz
u-boot-imx-a60702833150b8f9263a5f1fb9a6b64774cd44f3.tar.bz2
cros_ec: spi: Add support for EC protocol version 3
Protocol version 3 will be attempted first; if the EC doesn't support it, u-boot will fall back to the old protocol version (2). 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.c12
1 files changed, 12 insertions, 0 deletions
diff --git a/drivers/misc/cros_ec.c b/drivers/misc/cros_ec.c
index a7716b8..5682d39 100644
--- a/drivers/misc/cros_ec.c
+++ b/drivers/misc/cros_ec.c
@@ -218,6 +218,11 @@ static int send_command_proto3(struct cros_ec_dev *dev,
return in_bytes;
switch (dev->interface) {
+#ifdef CONFIG_CROS_EC_SPI
+ case CROS_EC_IF_SPI:
+ rv = cros_ec_spi_packet(dev, out_bytes, in_bytes);
+ break;
+#endif
case CROS_EC_IF_NONE:
/* TODO: support protocol 3 for LPC, I2C; for now fall through */
default:
@@ -665,6 +670,13 @@ static int cros_ec_check_version(struct cros_ec_dev *dev)
* So for now, just read all the data anyway.
*/
+ /* Try sending a version 3 packet */
+ dev->protocol_version = 3;
+ if (ec_command_inptr(dev, EC_CMD_HELLO, 0, &req, sizeof(req),
+ (uint8_t **)&resp, sizeof(*resp)) > 0) {
+ return 0;
+ }
+
/* Try sending a version 2 packet */
dev->protocol_version = 2;
if (ec_command_inptr(dev, EC_CMD_HELLO, 0, &req, sizeof(req),