diff mbox

[U-Boot,11/28] i8042: Handle a duplicate power-on-reset response

Message ID 1441773171-4575-12-git-send-email-sjg@chromium.org
State Superseded
Delegated to: Simon Glass
Headers show

Commit Message

Simon Glass Sept. 9, 2015, 4:32 a.m. UTC
Sometimes we seem to get 0xaa twice which causes the config read to fail.
This causes chromebook_link to fail to set up the keyboard.

Add a check for this and read the config again when detected.

Signed-off-by: Simon Glass <sjg@chromium.org>
---

 drivers/input/i8042.c | 2 ++
 1 file changed, 2 insertions(+)

Comments

Bin Meng Sept. 15, 2015, 6:12 a.m. UTC | #1
Hi Simon,

On Wed, Sep 9, 2015 at 12:32 PM, Simon Glass <sjg@chromium.org> wrote:
> Sometimes we seem to get 0xaa twice which causes the config read to fail.
> This causes chromebook_link to fail to set up the keyboard.
>
> Add a check for this and read the config again when detected.
>
> Signed-off-by: Simon Glass <sjg@chromium.org>
> ---
>
>  drivers/input/i8042.c | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/drivers/input/i8042.c b/drivers/input/i8042.c
> index dbd4b00..c6a92a2 100644
> --- a/drivers/input/i8042.c
> +++ b/drivers/input/i8042.c
> @@ -497,6 +497,8 @@ static int kbd_reset(void)
>         config = kbd_cmd_read(CMD_RD_CONFIG);
>         if (config == -1)
>                 return -1;
> +       else if (config == KBD_POR)     /* Sometimes get a second byte */
> +               config = kbd_cmd_read(CMD_RD_CONFIG);
>
>         config |= CONFIG_AT_TRANS;
>         config &= ~(CONFIG_KIRQ_EN | CONFIG_MIRQ_EN);
> --

This unfortunately breaks QEMU, that sometimes (not every time)
keyboard is not working. Maybe we should create a device tree property
to control such quirk?

Regards,
Bin
diff mbox

Patch

diff --git a/drivers/input/i8042.c b/drivers/input/i8042.c
index dbd4b00..c6a92a2 100644
--- a/drivers/input/i8042.c
+++ b/drivers/input/i8042.c
@@ -497,6 +497,8 @@  static int kbd_reset(void)
 	config = kbd_cmd_read(CMD_RD_CONFIG);
 	if (config == -1)
 		return -1;
+	else if (config == KBD_POR)	/* Sometimes get a second byte */
+		config = kbd_cmd_read(CMD_RD_CONFIG);
 
 	config |= CONFIG_AT_TRANS;
 	config &= ~(CONFIG_KIRQ_EN | CONFIG_MIRQ_EN);