summaryrefslogtreecommitdiff
path: root/src/superio/winbond
diff options
context:
space:
mode:
authorTimothy Pearson <tpearson@raptorengineeringinc.com>2015-11-24 14:12:01 -0600
committerMartin Roth <martinroth@google.com>2016-02-01 22:10:46 +0100
commit448e386309c20ed1d22360e06192b632af0af720 (patch)
tree61f1b0a1c8ccb65a5efda1e6571b9edd7051bc98 /src/superio/winbond
parentc2ed40b48ae3e9874213d4e70e1ac3c5fbbba8fc (diff)
downloadcoreboot-448e386309c20ed1d22360e06192b632af0af720.tar.xz
drivers/pc80: Add PS/2 mouse presence detect
On certain Winbond SuperIO 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. Add auxiliary channel PS/2 device presence detect, and update the Winbond W83667HG-A driver to flag the auxiliary channel as disabled if no device was detected. Change-Id: I76274493dacc9016ac6d0dff8548d1dc931c6266 Signed-off-by: Timothy Pearson <tpearson@raptorengineeringinc.com> Reviewed-on: https://review.coreboot.org/13165 Tested-by: build bot (Jenkins) Tested-by: Raptor Engineering Automated Test Stand <noreply@raptorengineeringinc.com> Reviewed-by: Martin Roth <martinroth@google.com>
Diffstat (limited to 'src/superio/winbond')
-rw-r--r--src/superio/winbond/w83627dhg/superio.c2
-rw-r--r--src/superio/winbond/w83627ehg/superio.c2
-rw-r--r--src/superio/winbond/w83627hf/superio.c2
-rw-r--r--src/superio/winbond/w83627thg/superio.c2
-rw-r--r--src/superio/winbond/w83627uhg/superio.c2
-rw-r--r--src/superio/winbond/w83667hg-a/ps2_controller.asl78
-rw-r--r--src/superio/winbond/w83667hg-a/superio.c20
-rw-r--r--src/superio/winbond/w83977tf/superio.c2
-rw-r--r--src/superio/winbond/wpcd376i/superio.c2
9 files changed, 104 insertions, 8 deletions
diff --git a/src/superio/winbond/w83627dhg/superio.c b/src/superio/winbond/w83627dhg/superio.c
index 10dba59fca..5a1502ad89 100644
--- a/src/superio/winbond/w83627dhg/superio.c
+++ b/src/superio/winbond/w83627dhg/superio.c
@@ -43,7 +43,7 @@ static void w83627dhg_init(struct device *dev)
w83627dhg_enable_UR2(dev);
break;
case W83627DHG_KBC:
- pc_keyboard_init();
+ pc_keyboard_init(NO_AUX_DEVICE);
break;
}
}
diff --git a/src/superio/winbond/w83627ehg/superio.c b/src/superio/winbond/w83627ehg/superio.c
index ea7a98223e..bf3508862a 100644
--- a/src/superio/winbond/w83627ehg/superio.c
+++ b/src/superio/winbond/w83627ehg/superio.c
@@ -85,7 +85,7 @@ static void w83627ehg_init(struct device *dev)
switch(dev->path.pnp.device) {
case W83627EHG_KBC:
- pc_keyboard_init();
+ pc_keyboard_init(NO_AUX_DEVICE);
break;
case W83627EHG_HWM:
res0 = find_resource(dev, PNP_IDX_IO0);
diff --git a/src/superio/winbond/w83627hf/superio.c b/src/superio/winbond/w83627hf/superio.c
index fe250a1a0e..4039f5f214 100644
--- a/src/superio/winbond/w83627hf/superio.c
+++ b/src/superio/winbond/w83627hf/superio.c
@@ -92,7 +92,7 @@ static void w83627hf_init(struct device *dev)
switch(dev->path.pnp.device) {
case W83627HF_KBC:
- pc_keyboard_init();
+ pc_keyboard_init(NO_AUX_DEVICE);
break;
case W83627HF_HWM:
res0 = find_resource(dev, PNP_IDX_IO0);
diff --git a/src/superio/winbond/w83627thg/superio.c b/src/superio/winbond/w83627thg/superio.c
index f42f948c27..77aaf7da6e 100644
--- a/src/superio/winbond/w83627thg/superio.c
+++ b/src/superio/winbond/w83627thg/superio.c
@@ -33,7 +33,7 @@ static void w83627thg_init(struct device *dev)
switch(dev->path.pnp.device) {
case W83627THG_KBC:
- pc_keyboard_init();
+ pc_keyboard_init(NO_AUX_DEVICE);
break;
}
}
diff --git a/src/superio/winbond/w83627uhg/superio.c b/src/superio/winbond/w83627uhg/superio.c
index 5192c32d1b..b8f5d2f803 100644
--- a/src/superio/winbond/w83627uhg/superio.c
+++ b/src/superio/winbond/w83627uhg/superio.c
@@ -79,7 +79,7 @@ static void w83627uhg_init(struct device *dev)
set_uart_clock_source(dev, 0);
break;
case W83627UHG_KBC:
- pc_keyboard_init();
+ pc_keyboard_init(NO_AUX_DEVICE);
break;
}
}
diff --git a/src/superio/winbond/w83667hg-a/ps2_controller.asl b/src/superio/winbond/w83667hg-a/ps2_controller.asl
new file mode 100644
index 0000000000..c3b5c758fa
--- /dev/null
+++ b/src/superio/winbond/w83667hg-a/ps2_controller.asl
@@ -0,0 +1,78 @@
+/*
+ * This file is part of the coreboot project.
+ *
+ * Copyright (c) 2013 Vladimir Serbinenko
+ * Copyright (c) 2015 Raptor Engineering
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License as
+ * published by the Free Software Foundation; version 2 of
+ * the License.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ */
+
+ /* SuperIO control port */
+ Name (SPIO, 0x2E)
+
+ /* SuperIO control map */
+ OperationRegion (SPIM, SystemIO, SPIO, 0x02)
+ Field (SPIM, ByteAcc, NoLock, Preserve) {
+ SIOI, 8,
+ SIOD, 8
+ }
+
+ /* SuperIO control registers */
+ IndexField (SIOI, SIOD, ByteAcc, NoLock, Preserve) {
+ Offset (0x2A),
+ CR2A, 8, /* Pin function selection */
+ }
+
+ Device (PS2K) // Keyboard
+ {
+ Name(_HID, EISAID("PNP0303"))
+ Name(_CID, EISAID("PNP030B"))
+
+ Name(_CRS, ResourceTemplate()
+ {
+ IO (Decode16, 0x60, 0x60, 0x01, 0x01)
+ IO (Decode16, 0x64, 0x64, 0x01, 0x01)
+ IRQ (Edge, ActiveHigh, Exclusive) { 0x01 } // IRQ 1
+ })
+
+ Method (_STA, 0)
+ {
+ Return (0xf)
+ }
+ }
+
+ Device (PS2M) // Mouse
+ {
+ Name(_HID, EISAID("PNP0F13"))
+ Name(_CRS, ResourceTemplate()
+ {
+ IRQ (Edge, ActiveHigh, Exclusive) { 0x0c } // IRQ 12
+ })
+
+ Method(_STA, 0)
+ {
+ /* Access SuperIO ACPI device */
+ Store(0x87, SIOI)
+ Store(0x87, SIOI)
+
+ /* Read Pin56 function select */
+ And(CR2A, 0x2, Local0)
+
+ /* Restore default SuperIO access */
+ Store(0xAA, SIOI)
+
+ if (LEqual(Local0, 0x0)) {
+ /* Mouse function selected */
+ Return (0xf)
+ }
+ Return (0x0)
+ }
+ }
diff --git a/src/superio/winbond/w83667hg-a/superio.c b/src/superio/winbond/w83667hg-a/superio.c
index 96eddd7310..6cd54ef9fc 100644
--- a/src/superio/winbond/w83667hg-a/superio.c
+++ b/src/superio/winbond/w83667hg-a/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 "w83667hg-a.h"
@@ -38,6 +39,7 @@ static void w83667hg_a_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 w83667hg_a_init(struct device *dev)
switch(dev->path.pnp.device) {
/* TODO: Might potentially need code for HWM or FDC etc. */
case W83667HG_A_KBC:
- pc_keyboard_init();
+ /* 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 W83667HG_A_ACPI:
/* Set power state after power fail */
diff --git a/src/superio/winbond/w83977tf/superio.c b/src/superio/winbond/w83977tf/superio.c
index f23d7c4319..45520f8b1b 100644
--- a/src/superio/winbond/w83977tf/superio.c
+++ b/src/superio/winbond/w83977tf/superio.c
@@ -34,7 +34,7 @@ static void w83977tf_init(struct device *dev)
switch(dev->path.pnp.device) {
case W83977TF_KBC:
- pc_keyboard_init();
+ pc_keyboard_init(NO_AUX_DEVICE);
break;
}
}
diff --git a/src/superio/winbond/wpcd376i/superio.c b/src/superio/winbond/wpcd376i/superio.c
index c455340e27..9f4162756a 100644
--- a/src/superio/winbond/wpcd376i/superio.c
+++ b/src/superio/winbond/wpcd376i/superio.c
@@ -41,7 +41,7 @@ static void init(device_t dev)
break;
case WPCD376I_KBCK:
- pc_keyboard_init();
+ pc_keyboard_init(NO_AUX_DEVICE);
break;
}
}