summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorPaul Menzel <paulepanter@users.sourceforge.net>2016-02-07 22:14:29 +0100
committerMartin Roth <martinroth@google.com>2016-02-09 20:34:15 +0100
commitbf725b48f730b5996cf1ee7e5ac84ebc0ec78460 (patch)
tree3a34b507cc4ced931d30adcdc06682d40251d62b /src
parent21c0650fdd8322ace159f91b23ba4e04657ccdec (diff)
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 Nuvoton NCT5572D driver to flag the auxiliary channel as disabled if no device was detected. The code is copied from the Winbond W83667HG-A driver. Note, the ACPI changes are not part of this commit. TEST=Currently, on the ASRock E350M1, PS/2 does not work. With this change, a PS/2 keyboard works fine in SeaBIOS, GRUB in MBR, and 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@users.sourceforge.net> Reviewed-on: https://review.coreboot.org/13618 Tested-by: build bot (Jenkins) Reviewed-by: Timothy Pearson <tpearson@raptorengineeringinc.com> Reviewed-by: Martin Roth <martinroth@google.com>
Diffstat (limited to 'src')
-rw-r--r--src/superio/nuvoton/nct5572d/superio.c20
1 files changed, 19 insertions, 1 deletions
diff --git a/src/superio/nuvoton/nct5572d/superio.c b/src/superio/nuvoton/nct5572d/superio.c
index 6cafb039e6..8c80a3ef93 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 */