[coreboot-gerrit] New patch to review for coreboot: ec/roda/it8518: Do EC write manually with long timeout

Nico Huber (nico.h@gmx.de) gerrit at coreboot.org
Thu Mar 9 17:29:11 CET 2017


Nico Huber (nico.h at gmx.de) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/18707

-gerrit

commit 3f089e84af8573c1ede150fa246e7aacbdad79b5
Author: Nico Huber <nico.huber at secunet.com>
Date:   Tue Jan 24 11:18:07 2017 +0100

    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 at secunet.com>
---
 src/ec/roda/it8518/ec.c | 16 +++++++++++++---
 1 file changed, 13 insertions(+), 3 deletions(-)

diff --git a/src/ec/roda/it8518/ec.c b/src/ec/roda/it8518/ec.c
index 707d9e9..ad51945 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 = {



More information about the coreboot-gerrit mailing list