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>
This commit is contained in:
Simon Glass 2014-02-27 13:26:12 -07:00
parent 2ab83f0d75
commit df93d90aea
6 changed files with 599 additions and 0 deletions

View file

@ -223,6 +223,11 @@ static int send_command_proto3(struct cros_ec_dev *dev,
case CROS_EC_IF_SPI:
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 */
@ -1032,6 +1037,11 @@ static int cros_ec_decode_fdt(const void *blob, int node,
case COMPAT_INTEL_LPC:
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);
@ -1087,6 +1097,12 @@ int cros_ec_init(const void *blob, struct cros_ec_dev **cros_ecp)
if (cros_ec_lpc_init(dev, blob))
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: