From e223c3aee9ac7f3b91fbbb810e9f2b2acd3fc4f6 Mon Sep 17 00:00:00 2001 From: Nico Huber Date: Tue, 24 Jan 2017 11:18:07 +0100 Subject: 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 Reviewed-on: https://review.coreboot.org/18707 Tested-by: build bot (Jenkins) Reviewed-by: Martin Roth --- src/ec/roda/it8518/ec.c | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) (limited to 'src/ec/roda') 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 #include #include +#include #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 = { -- cgit v1.2.3