diff options
author | Nico Huber <nico.huber@secunet.com> | 2017-01-24 11:18:07 +0100 |
---|---|---|
committer | Nico Huber <nico.h@gmx.de> | 2017-04-08 13:17:56 +0200 |
commit | e223c3aee9ac7f3b91fbbb810e9f2b2acd3fc4f6 (patch) | |
tree | 8779833321a87c9f7d953145d37e46b1b081c8fb /src/ec/roda/it8518 | |
parent | 105d8e8b01bd024c3df100b4809684628d3e8f2c (diff) |
ec/roda/it8518: Do EC write manually with long timeout
The EC may take very long for the first command on a cold boot (~180ms
witnessed). Since this needs an incredibly long timeout, we do this
single command manually.
Change-Id: I3302622a845ac6651bc7f563370d8f0511836f94
Signed-off-by: Nico Huber <nico.huber@secunet.com>
Reviewed-on: https://review.coreboot.org/18707
Tested-by: build bot (Jenkins)
Reviewed-by: Martin Roth <martinroth@google.com>
Diffstat (limited to 'src/ec/roda/it8518')
-rw-r--r-- | src/ec/roda/it8518/ec.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/src/ec/roda/it8518/ec.c b/src/ec/roda/it8518/ec.c index 707d9e9371..ad51945cef 100644 --- a/src/ec/roda/it8518/ec.c +++ b/src/ec/roda/it8518/ec.c @@ -19,6 +19,7 @@ #include <pc80/keyboard.h> #include <ec/acpi/ec.h> #include <stdlib.h> +#include <delay.h> #include "chip.h" @@ -29,11 +30,20 @@ static void it8518_init(struct device *dev) if (!dev->enabled) return; - if (conf && conf->cpuhot_limit) - ec_write(0xb2, conf->cpuhot_limit); - printk(BIOS_DEBUG, "Roda IT8518: Initializing keyboard.\n"); pc_keyboard_init(NO_AUX_DEVICE); + + if (conf && conf->cpuhot_limit) { + /* The EC may take very long for the first command on a + cold boot (~180ms witnessed). Since we need an incre- + dibly long timeout, we do this EC RAM write manually. */ + int timeout = 50000; /* 50,000 * 10us = 500ms */ + send_ec_command(0x81); + while (ec_status() & EC_IBF && --timeout) + udelay(10); + send_ec_data(0xb2); + send_ec_data(conf->cpuhot_limit); + } } static struct device_operations ops = { |