diff options
Diffstat (limited to 'src/ec')
-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 = { |