summaryrefslogtreecommitdiffstats
path: root/drivers/misc/cros_ec.c
diff options
context:
space:
mode:
authorSimon Glass <sjg@chromium.org>2014-02-27 13:26:12 -0700
committerSimon Glass <sjg@chromium.org>2014-03-17 20:05:47 -0600
commitdf93d90aea85deff0b19ece43ba6f379c7c4d9cc (patch)
treeb34d47fe922a6479a034ce25ba801c55dcd01aad /drivers/misc/cros_ec.c
parent2ab83f0d7522e34f6a67e6ed80f7ba03aa7c8dd6 (diff)
downloadtalos-obmc-uboot-df93d90aea85deff0b19ece43ba6f379c7c4d9cc.tar.gz
talos-obmc-uboot-df93d90aea85deff0b19ece43ba6f379c7c4d9cc.zip
cros_ec: sandbox: Add Chrome OS EC emulation
Add a simple emulation of the Chrome OS EC for sandbox, so that it can perform various EC tasks such as keyboard handling. Reviewed-by: Vadim Bendebury <vbendeb@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.c16
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/misc/cros_ec.c b/drivers/misc/cros_ec.c
index a4bdb23072..7e8c58f86a 100644
--- a/drivers/misc/cros_ec.c
+++ b/drivers/misc/cros_ec.c
@@ -224,6 +224,11 @@ static int send_command_proto3(struct cros_ec_dev *dev,
rv = cros_ec_spi_packet(dev, out_bytes, in_bytes);
break;
#endif
+#ifdef CONFIG_CROS_EC_SANDBOX
+ case CROS_EC_IF_SANDBOX:
+ rv = cros_ec_sandbox_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:
@@ -1033,6 +1038,11 @@ static int cros_ec_decode_fdt(const void *blob, int node,
dev->interface = CROS_EC_IF_LPC;
break;
#endif
+#ifdef CONFIG_CROS_EC_SANDBOX
+ case COMPAT_SANDBOX_HOST_EMULATION:
+ dev->interface = CROS_EC_IF_SANDBOX;
+ break;
+#endif
default:
debug("%s: Unknown compat id %d\n", __func__, compat);
return -1;
@@ -1088,6 +1098,12 @@ int cros_ec_init(const void *blob, struct cros_ec_dev **cros_ecp)
return -CROS_EC_ERR_DEV_INIT;
break;
#endif
+#ifdef CONFIG_CROS_EC_SANDBOX
+ case CROS_EC_IF_SANDBOX:
+ if (cros_ec_sandbox_init(dev, blob))
+ return -CROS_EC_ERR_DEV_INIT;
+ break;
+#endif
case CROS_EC_IF_NONE:
default:
return 0;
OpenPOWER on IntegriCloud