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>
This commit is contained in:
Nico Huber 2017-01-24 11:18:07 +01:00 committed by Nico Huber
parent 105d8e8b01
commit e223c3aee9
1 changed files with 13 additions and 3 deletions

View File

@ -19,6 +19,7 @@
#include <pc80/keyboard.h> #include <pc80/keyboard.h>
#include <ec/acpi/ec.h> #include <ec/acpi/ec.h>
#include <stdlib.h> #include <stdlib.h>
#include <delay.h>
#include "chip.h" #include "chip.h"
@ -29,11 +30,20 @@ static void it8518_init(struct device *dev)
if (!dev->enabled) if (!dev->enabled)
return; return;
if (conf && conf->cpuhot_limit)
ec_write(0xb2, conf->cpuhot_limit);
printk(BIOS_DEBUG, "Roda IT8518: Initializing keyboard.\n"); printk(BIOS_DEBUG, "Roda IT8518: Initializing keyboard.\n");
pc_keyboard_init(NO_AUX_DEVICE); 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 = { static struct device_operations ops = {