From patchwork Mon Aug 17 10:45:44 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bin Meng X-Patchwork-Id: 507929 X-Patchwork-Delegate: sjg@chromium.org 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 B55C7140134 for ; Mon, 17 Aug 2015 20:46:17 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.b=xJUOMvrY; dkim-atps=neutral Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id DB0F64B9A7; Mon, 17 Aug 2015 12:46:15 +0200 (CEST) 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 4h8LMlPdsuVZ; Mon, 17 Aug 2015 12:46:15 +0200 (CEST) Received: from theia.denx.de (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id BEDCD4B999; Mon, 17 Aug 2015 12:46:14 +0200 (CEST) Received: from localhost (localhost [127.0.0.1]) by theia.denx.de (Postfix) with ESMTP id 1A5214B992 for ; Mon, 17 Aug 2015 12:46:09 +0200 (CEST) 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 PR4IXQOq_f59 for ; Mon, 17 Aug 2015 12:46:08 +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-qg0-f52.google.com (mail-qg0-f52.google.com [209.85.192.52]) by theia.denx.de (Postfix) with ESMTPS id 5883D4B994 for ; Mon, 17 Aug 2015 12:46:05 +0200 (CEST) Received: by qgeg42 with SMTP id g42so90988626qge.1 for ; Mon, 17 Aug 2015 03:46:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=message-id:from:to:subject:date:in-reply-to:references:mime-version :content-type; bh=IvJ3+N7HVA8twUZcIUYE49OO0vEYOveWZhqtNcdHJ74=; b=xJUOMvrY26f51YKAPMF62KV/xGIfDnt3lWV8UYqIF5D0WYHsseZzqvOeDXUANhXE8P uSgY7wz0GNsLGpXtG+lhIIgdAB53a33HY/n3iu+xMfQxO7JMknGLGtIQbikCoEknqEkM WamS2HPSNROjDjyXURwMAg5OseauvlrmjcflkOvPrzgt8Hk+/Y/iX96+jkXn62F6nFqX FjLhTNJ6YESHq//r82Ie3KZdUgske3FVyK6A7Wq+dnN+3E+F5RtBlRuoZc3EMafwMoE7 bvyEvJUh4JSI6L7oj/gw85ot6VmZY465LJvDCCF18pZqJw/jowz1toIV/t10ds9IxQSt b0Ag== X-Received: by 10.140.31.4 with SMTP id e4mr1129770qge.85.1439808364110; Mon, 17 Aug 2015 03:46:04 -0700 (PDT) Received: from mail.hotmail.com (blu004-wss1s1.hotmail.com. [134.170.2.216]) by smtp.gmail.com with ESMTPSA id j30sm8018027qgj.20.2015.08.17.03.46.03 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 17 Aug 2015 03:46:03 -0700 (PDT) Received: from BLU436-SMTP188 ([134.170.2.215]) by BLU004-WSS1S1.hotmail.com over TLS secured channel with Microsoft SMTPSVC(7.5.7601.23008); Mon, 17 Aug 2015 03:46:02 -0700 X-TMN: [TiM82UZ/Tx9P+qoTQFWayvEvsxOijsc4] Message-ID: From: Bin Meng To: Simon Glass , U-Boot Mailing List Date: Mon, 17 Aug 2015 18:45:44 +0800 X-Mailer: git-send-email 2.3.2 (Apple Git-55) In-Reply-To: <1439808347-757-1-git-send-email-bmeng.cn@gmail.com> References: <1439808347-757-1-git-send-email-bmeng.cn@gmail.com> X-OriginalArrivalTime: 17 Aug 2015 10:46:01.0611 (UTC) FILETIME=[E8A0F5B0:01D0D8D9] MIME-Version: 1.0 Subject: [U-Boot] [PATCH 2/5] x86: i8042: Correctly initialize the controller X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.15 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" The existing i8042 keyboard controller driver has some issues. First of all, it does not issue a self-test command (0xaa) to the controller at the very beginning. Without this, the controller does not respond any command at all. Secondly, it initializes the configuration byte reigster to turn on keyboard's interrupt, which is not allowed as U-Boot we don't normally enable interrupt. Finally, at the end of the initialization routine, it wrongly sets the controller to disable all interfaces including both keyboard and mouse. Signed-off-by: Bin Meng Acked-by: Simon Glass --- drivers/input/i8042.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) diff --git a/drivers/input/i8042.c b/drivers/input/i8042.c index 1769c5e..3799580 100644 --- a/drivers/input/i8042.c +++ b/drivers/input/i8042.c @@ -664,6 +664,18 @@ static int wait_until_kbd_output_full(void) static int kbd_reset(void) { + /* controller self test */ + if (kbd_input_empty() == 0) + return -1; + + out8(I8042_COMMAND_REG, 0xaa); + + if (wait_until_kbd_output_full() == 0) + return -1; + + if (in8(I8042_DATA_REG) != 0x55) /* success */ + return -1; + /* KB Reset */ if (kbd_input_empty() == 0) return -1; @@ -691,7 +703,7 @@ static int kbd_reset(void) if (kbd_input_empty() == 0) return -1; - out8(I8042_DATA_REG, 0x45); + out8(I8042_DATA_REG, 0x44); if (kbd_input_empty() == 0) return -1; @@ -701,13 +713,5 @@ static int kbd_reset(void) if (kbd_input_empty() == 0) return -1; - out8(I8042_COMMAND_REG, 0x60); - if (kbd_input_empty() == 0) - return -1; - - out8(I8042_DATA_REG, 0xf4); - if (kbd_input_empty() == 0) - return -1; - return 0; }