[coreboot-gerrit] New patch to review for coreboot: superio/nuvoton/nct5572d: Add PS/2 presence detect

Paul Menzel (paulepanter@users.sourceforge.net) gerrit at coreboot.org
Sun Feb 7 23:40:17 CET 2016


Paul Menzel (paulepanter at users.sourceforge.net) just uploaded a new patch set to gerrit, which you can find at https://review.coreboot.org/13618

-gerrit

commit 4ddaa5ed0965344c49326533e02a28135aa7a03e
Author: Paul Menzel <paulepanter at users.sourceforge.net>
Date:   Sun Feb 7 22:14:29 2016 +0100

    superio/nuvoton/nct5572d: Add PS/2 presence detect
    
    On certain Super I/O devices, when a PS/2 mouse is not present on the
    auxiliary channel both channels will cease to function if the
    auxiliary channel is probed while the primary channel is active.
    Therefore, knowledge of mouse presence must be gathered by coreboot
    during early boot, and used to enable or disable the auxiliary PS/2
    port before control is passed to the operating system.
    
    This is added in commit 448e3863 (drivers/pc80: Add PS/2 mouse
    presence detect).
    
    Update the Winbond W83667HG-A driver to flag the auxiliary channel as
    disabled if no device was detected.
    
    TEST=Currently, on the ASRock E350M1, PS/2 does not work. With this
    change, a PS/2 keyboard works fine in Debian GNU/Linux Sid/unstable
    with Linux 3.19.
    
    ```
    [    1.185195] i8042: PNP: No PS/2 controller found. Probing ports directly.
    [    1.189110] serio: i8042 KBD port at 0x60,0x64 irq 1
    [    1.189133] serio: i8042 AUX port at 0x60,0x64 irq 12
    [    1.189970] mousedev: PS/2 mouse device common for all mice
    ```
    
    Change-Id: I7f9be348d295e70437bef089d4c2173169f38459
    Signed-off-by: Paul Menzel <paulepanter at users.sourceforge.net>
---
 src/superio/nuvoton/nct5572d/superio.c | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git a/src/superio/nuvoton/nct5572d/superio.c b/src/superio/nuvoton/nct5572d/superio.c
index 6cafb03..8c80a3e 100644
--- a/src/superio/nuvoton/nct5572d/superio.c
+++ b/src/superio/nuvoton/nct5572d/superio.c
@@ -23,6 +23,7 @@
 #include <pc80/keyboard.h>
 #include <pc80/mc146818rtc.h>
 #include <stdlib.h>
+#include <arch/acpi.h>
 #include <superio/conf_mode.h>
 
 #include "nct5572d.h"
@@ -38,6 +39,7 @@ static void nct5572d_init(struct device *dev)
 {
 	uint8_t byte;
 	uint8_t power_status;
+	uint8_t mouse_detected;
 
 	if (!dev->enabled)
 		return;
@@ -45,7 +47,23 @@ static void nct5572d_init(struct device *dev)
 	switch(dev->path.pnp.device) {
 	/* TODO: Might potentially need code for HWM or FDC etc. */
 	case NCT5572D_KBC:
-		pc_keyboard_init(NO_AUX_DEVICE);
+		/* Enable mouse controller */
+		pnp_enter_conf_mode_8787(dev);
+		byte = pnp_read_config(dev, 0x2a);
+		byte &= ~(0x1 << 1);
+		pnp_write_config(dev, 0x2a, byte);
+		pnp_exit_conf_mode_aa(dev);
+
+		mouse_detected = pc_keyboard_init(PROBE_AUX_DEVICE);
+
+		if (!mouse_detected && !acpi_is_wakeup_s3()) {
+			/* Disable mouse controller */
+			pnp_enter_conf_mode_8787(dev);
+			byte = pnp_read_config(dev, 0x2a);
+			byte |= 0x1 << 1;
+			pnp_write_config(dev, 0x2a, byte);
+			pnp_exit_conf_mode_aa(dev);
+		}
 		break;
 	case NCT5572D_ACPI:
 		/* Set power state after power fail */



More information about the coreboot-gerrit mailing list