From 76720d064da18d67c1be53ab4c0b2af6f1fcfd06 Mon Sep 17 00:00:00 2001 From: Hung-Te Lin Date: Mon, 15 Apr 2013 18:06:32 +0800 Subject: ec/google: Move plug-n-play initialization to LPC protocol. "Plug-n-play" is not supported on all platforms using Google's Chrome EC. For example, EC on I2C bus will need explicit configuration and initialization. So move the plug-n-play initialization to the LPC implementation. Verified by building Google/Link (with EC/LPC) successfully. Change-Id: I49e5943503fd5301aa2b2f8c1265f3813719d7e3 Signed-off-by: Hung-Te Lin Reviewed-on: http://review.coreboot.org/3089 Tested-by: build bot (Jenkins) Reviewed-by: Paul Menzel Reviewed-by: Stefan Reinauer --- src/ec/google/chromeec/ec_lpc.c | 49 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) (limited to 'src/ec/google/chromeec/ec_lpc.c') diff --git a/src/ec/google/chromeec/ec_lpc.c b/src/ec/google/chromeec/ec_lpc.c index 6443592532..4e8d3fbb77 100644 --- a/src/ec/google/chromeec/ec_lpc.c +++ b/src/ec/google/chromeec/ec_lpc.c @@ -18,9 +18,13 @@ */ #include +#include + #include #include #include +#include +#include "chip.h" #include "ec.h" #include "ec_commands.h" @@ -180,6 +184,51 @@ int google_chromeec_command(struct chromeec_command *cec_command) } #ifndef __PRE_RAM__ + +#ifndef __SMM__ +static void lpc_ec_init(device_t dev) +{ + struct ec_google_chromeec_config *conf = dev->chip_info; + + if (!dev->enabled) + return; + pc_keyboard_init(&conf->keyboard); + google_chromeec_init(); +} + +static void lpc_ec_read_resources(device_t dev) +{ + /* Nothing, but this function avoids an error on serial console. */ +} + +static void lpc_ec_enable_resources(device_t dev) +{ + /* Nothing, but this function avoids an error on serial console. */ +} + +static struct device_operations ops = { + .init = lpc_ec_init, + .read_resources = lpc_ec_read_resources, + .enable_resources = lpc_ec_enable_resources +}; + +static struct pnp_info pnp_dev_info[] = { + { &ops, 0, 0, { 0, 0 }, } +}; + +static void enable_dev(device_t dev) +{ + pnp_enable_devices(dev, &pnp_ops, ARRAY_SIZE(pnp_dev_info), + pnp_dev_info); +} + +struct chip_operations ec_google_chromeec_ops = { + CHIP_NAME("Google Chrome EC") + .enable_dev = enable_dev, +}; + +#endif /* __SMM__ */ + u8 google_chromeec_get_event(void) { if (google_chromeec_wait_ready(EC_LPC_ADDR_ACPI_CMD)) { -- cgit v1.2.3