From patchwork Fri Oct 12 01:15:49 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 191027 X-Patchwork-Delegate: trini@ti.com Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from theia.denx.de (theia.denx.de [85.214.87.163]) by ozlabs.org (Postfix) with ESMTP id 2FA252C007B for ; Fri, 12 Oct 2012 12:16:26 +1100 (EST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id C63074A02A; Fri, 12 Oct 2012 03:16:24 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id p5ggF5dcKpKk; Fri, 12 Oct 2012 03:16:24 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 475194A01C; Fri, 12 Oct 2012 03:16:22 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 351204A01C for ; Fri, 12 Oct 2012 03:16:19 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at theia.denx.de Received: from theia.denx.de ([127.0.0.1]) by localhost (theia.denx.de [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id y7gLST8xMT6C for ; Fri, 12 Oct 2012 03:16:05 +0200 (CEST) X-policyd-weight: NOT_IN_SBL_XBL_SPAMHAUS=-1.5 NOT_IN_SPAMCOP=-1.5 NOT_IN_BL_NJABL=-1.5 (only DNSBL check requested) Received: from mail-wi0-f202.google.com (mail-wi0-f202.google.com [209.85.212.202]) by theia.denx.de (Postfix) with ESMTPS id 238814A019 for ; Fri, 12 Oct 2012 03:16:03 +0200 (CEST) Received: by mail-wi0-f202.google.com with SMTP id hr7so3754wib.3 for ; Thu, 11 Oct 2012 18:16:00 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=from:to:cc:subject:date:message-id:x-mailer:x-gm-message-state; bh=sWUQB7oYxTwybQulBVbWgAFbnWxrEqsYed5uB9st4Io=; b=kzQI8fbKXMw2E6S7HMJucJbGU6O0ICsG1Biy68IbloXCBDpw2BUOyFgsyffiNPaqdY 0SNnz4P5vPjJw4SR4RLqD8KhuYQeWMIFMcqwEj0d/LTnVMUWp252rH9u/f1YDAQrI4hG +ER9Do1eNtc4XHFDCb4JhPrYM/Ts/V2LZSAA/zr8/qU+xlwZkWPKFlXLgG4wdxOgAUay 6u9hq6y/DQLcR0kOUowr1GFNeUpABYD8cPOQUCsWcIqQhsiNbxCPhLWtMsREGWLvgTIH AqyTp6YHvQt7FBlyNRhNsUZpo6FSZtSXn/WSMB2e35MBmHtbj/suKgP35uKwDbKLPud7 xyjA== Received: by 10.216.202.93 with SMTP id c71mr164445weo.3.1350004560583; Thu, 11 Oct 2012 18:16:00 -0700 (PDT) Received: from hpza9.eem.corp.google.com ([74.125.121.33]) by gmr-mx.google.com with ESMTPS id bu8si36289wib.2.2012.10.11.18.16.00 (version=TLSv1/SSLv3 cipher=AES128-SHA); Thu, 11 Oct 2012 18:16:00 -0700 (PDT) Received: from kaka.mtv.corp.google.com (kaka.mtv.corp.google.com [172.22.73.79]) by hpza9.eem.corp.google.com (Postfix) with ESMTP id 33BE55C0050; Thu, 11 Oct 2012 18:16:00 -0700 (PDT) Received: by kaka.mtv.corp.google.com (Postfix, from userid 121222) id 7F664160EA0; Thu, 11 Oct 2012 18:15:59 -0700 (PDT) From: Simon Glass To: U-Boot Mailing List Date: Thu, 11 Oct 2012 18:15:49 -0700 Message-Id: <1350004554-18506-1-git-send-email-sjg@chromium.org> X-Mailer: git-send-email 1.7.7.3 X-Gm-Message-State: ALoCoQl7I6lJPufBNb1P2KuVpwA0vaRMqhkLJPL0NKdDUZVTTW2zHvha2inea5U7jxlcM3wU53pcqmI2lSEbs8Z/O7d+vlrNS9d9B4lJTAE28Q1yMc43aCt8EdExgJkE3vstrpvVW/qacBuPAy4hbP/vr4VVq9p5afiuRi4J0q9af19M9YbdOV4F+5mnbpM60ZFcumvZJxYZ Cc: Tom Rini Subject: [U-Boot] [PATCH 1/5] input: Use finer grain udelays while waitng for the i8042 keyboard buffer to empty X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.11 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: u-boot-bounces@lists.denx.de Errors-To: u-boot-bounces@lists.denx.de From: Gabe Black On x86, the i8042 keyboard controller driver frequently waits for the keyboard input buffer to be empty to make sure the controller has had a chance to process the data it was given. The way the delay loop was structured, if the controller hadn't cleared the corresponding status bit immediately, it would wait 1ms before checking again. If the keyboard responded quickly but not instantly, the driver would still wait a full 1ms when perhaps 1us would have been sufficient. Because udelay is a busy wait anyway, this change decreases the delay between checks to 1us. Also, this change gets rid of a hardcoded 250ms delay. On Stumpy, this saves 100-150ms during boot. Signed-off-by: Gabe Black Signed-off-by: Simon Glass --- drivers/input/i8042.c | 7 ++----- 1 files changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/input/i8042.c b/drivers/input/i8042.c index c3bc536..99254e4 100644 --- a/drivers/input/i8042.c +++ b/drivers/input/i8042.c @@ -607,11 +607,10 @@ static void kbd_led_set(void) static int kbd_input_empty(void) { - int kbdTimeout = KBD_TIMEOUT; + int kbdTimeout = KBD_TIMEOUT * 1000; - /* wait for input buf empty */ while ((in8(I8042_STATUS_REG) & 0x02) && kbdTimeout--) - udelay(1000); + udelay(1); return kbdTimeout != -1; } @@ -625,8 +624,6 @@ static int kbd_reset(void) out8(I8042_DATA_REG, 0xff); - udelay(250000); - if (kbd_input_empty() == 0) return -1;