]> git.dujemihanovic.xyz Git - u-boot.git/commitdiff
cros_ec: Increase command timeout for flash erase
authorSimon Glass <sjg@chromium.org>
Mon, 9 Nov 2020 14:14:44 +0000 (07:14 -0700)
committerSimon Glass <sjg@chromium.org>
Sat, 14 Nov 2020 22:23:41 +0000 (15:23 -0700)
Erasing the flash can take over a second on some devices and the EC is
not responsive during this time. Update the timeout to 5 seconds to cope
with this.

Signed-off-by: Simon Glass <sjg@chromium.org>
drivers/misc/cros_ec_lpc.c

index 63702f90fbcf67c367e4c5f58541b2e00e39cf56..e0002b9753f8c0beb269ab0d639e1184b95ac668 100644 (file)
 #define debug_trace(fmt, b...)
 #endif
 
+/* Timeout waiting for a flash erase command to complete */
+static const int CROS_EC_CMD_TIMEOUT_MS = 5000;
+
 static int wait_for_sync(struct cros_ec_dev *dev)
 {
        unsigned long start;
 
        start = get_timer(0);
        while (inb(EC_LPC_ADDR_HOST_CMD) & EC_LPC_STATUS_BUSY_MASK) {
-               if (get_timer(start) > 1000) {
+               if (get_timer(start) > CROS_EC_CMD_TIMEOUT_MS) {
                        debug("%s: Timeout waiting for CROS_EC sync\n",
                              __func__);
                        return -1;