[coreboot-gerrit] Patch set updated for coreboot: 7a96bcd lenovo/x201: Support digitizer on x201t variant
Vladimir Serbinenko (phcoder@gmail.com)
gerrit at coreboot.org
Mon Feb 3 01:49:47 CET 2014
Vladimir Serbinenko (phcoder at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/5096
-gerrit
commit 7a96bcdd9acb5920af0dd06481d7e1650ae1f4b8
Author: Vladimir Serbinenko <phcoder at gmail.com>
Date: Sat Feb 1 18:39:26 2014 +0100
lenovo/x201: Support digitizer on x201t variant
Since ACPI declaration of Wacom tablet when there is none
causes hangs, split x201 port to x201 and x201t.
Thanks to Peter Stuge for his helpful insights
Thanks to Carl-Daniel Hailfinger for info on PnP superio.
Thanks to Jens Erat for letting me to experiment with his X201t.
Change-Id: Idb504fabf1ac1a55d8ada8d2b2268038110e32e0
Signed-off-by: Vladimir Serbinenko <phcoder at gmail.com>
---
src/device/device_util.c | 21 +++++++++++++++++++++
src/ec/acpi/Makefile.inc | 1 +
src/ec/lenovo/h8/acpi/ec.asl | 2 +-
src/ec/lenovo/h8/acpi/thermal.asl | 4 ++--
src/include/device/device.h | 1 +
src/mainboard/lenovo/Kconfig | 6 ++++++
src/mainboard/lenovo/x201/Kconfig | 7 ++++++-
src/mainboard/lenovo/x201/acpi/superio.asl | 18 ++++++++++++++++++
src/mainboard/lenovo/x201/devicetree.cb | 8 ++++++++
src/mainboard/lenovo/x201/mainboard.c | 12 ++++++++++--
src/mainboard/lenovo/x201/romstage.c | 2 +-
src/mainboard/lenovo/x201t/Kconfig | 22 ++++++++++++++++++++++
12 files changed, 97 insertions(+), 7 deletions(-)
diff --git a/src/device/device_util.c b/src/device/device_util.c
index 38654fa..8faa0c3 100644
--- a/src/device/device_util.c
+++ b/src/device/device_util.c
@@ -94,6 +94,27 @@ struct device *dev_find_slot_on_smbus(unsigned int bus, unsigned int addr)
}
/**
+ * Given a PnP port and a device number, find the device structure.
+ *
+ * @param bus The bus number.
+ * @param addr A device number.
+ * @return Pointer to the device structure (if found), 0 otherwise.
+ */
+struct device *dev_find_slot_pnp(unsigned int port, unsigned int device)
+{
+ struct device *dev;
+
+ for (dev = all_devices; dev; dev = dev->next) {
+ if ((dev->path.type == DEVICE_PATH_PNP) &&
+ (dev->path.pnp.port == port) &&
+ (dev->path.pnp.device == device)) {
+ return dev;
+ }
+ }
+ return 0;
+}
+
+/**
* Given a Local APIC ID, find the device structure.
*
* @param apic_id The Local APIC ID number.
diff --git a/src/ec/acpi/Makefile.inc b/src/ec/acpi/Makefile.inc
index b39aaa2..3b5712b 100644
--- a/src/ec/acpi/Makefile.inc
+++ b/src/ec/acpi/Makefile.inc
@@ -1,3 +1,4 @@
ramstage-y += ec.c
smm-$(CONFIG_HAVE_SMI_HANDLER) += ec.c
romstage-$(CONFIG_BOARD_LENOVO_X201) += ec.c
+romstage-$(CONFIG_BOARD_LENOVO_X201T) += ec.c
diff --git a/src/ec/lenovo/h8/acpi/ec.asl b/src/ec/lenovo/h8/acpi/ec.asl
index 4b3fb12..9e983f0 100644
--- a/src/ec/lenovo/h8/acpi/ec.asl
+++ b/src/ec/lenovo/h8/acpi/ec.asl
@@ -227,7 +227,7 @@ Device(EC)
^HKEY.RHK (0x18)
}
-#if CONFIG_BOARD_LENOVO_X201
+#if CONFIG_BOARD_LENOVO_X201 || CONFIG_BOARD_LENOVO_X201T
Method (_Q1C, 0, NotSerialized)
{
^HKEY.RHK (0x19)
diff --git a/src/ec/lenovo/h8/acpi/thermal.asl b/src/ec/lenovo/h8/acpi/thermal.asl
index 83d66c6..cecf520 100644
--- a/src/ec/lenovo/h8/acpi/thermal.asl
+++ b/src/ec/lenovo/h8/acpi/thermal.asl
@@ -1,6 +1,6 @@
Scope(\_TZ)
{
-#if defined (CONFIG_BOARD_LENOVO_X201) && CONFIG_BOARD_LENOVO_X201
+#if IS_ENABLED(CONFIG_BOARD_LENOVO_X201) || IS_ENABLED(CONFIG_BOARD_LENOVO_X201T)
Name (MEBT, 0)
#endif
@@ -24,7 +24,7 @@ Scope(\_TZ)
Return (C2K(127))
}
Method(_TMP) {
-#if defined (CONFIG_BOARD_LENOVO_X201) && CONFIG_BOARD_LENOVO_X201
+#if IS_ENABLED(CONFIG_BOARD_LENOVO_X201) || IS_ENABLED (CONFIG_BOARD_LENOVO_X201T)
/* Avoid tripping alarm if ME isn't booted at all yet */
If (LAnd (LNot (MEBT), LEqual (\_SB.PCI0.LPCB.EC.TMP0, 128))) {
Return (C2K(40))
diff --git a/src/include/device/device.h b/src/include/device/device.h
index c1a2c3d..3801409 100644
--- a/src/include/device/device.h
+++ b/src/include/device/device.h
@@ -169,6 +169,7 @@ device_t dev_find_device (u16 vendor, u16 device, device_t from);
device_t dev_find_class (unsigned int class, device_t from);
device_t dev_find_slot (unsigned int bus, unsigned int devfn);
device_t dev_find_slot_on_smbus (unsigned int bus, unsigned int addr);
+device_t dev_find_slot_pnp(unsigned int port, unsigned int device);
device_t dev_find_lapic(unsigned apic_id);
int dev_count_cpu(void);
diff --git a/src/mainboard/lenovo/Kconfig b/src/mainboard/lenovo/Kconfig
index a29fdbf..27ffd66 100644
--- a/src/mainboard/lenovo/Kconfig
+++ b/src/mainboard/lenovo/Kconfig
@@ -17,6 +17,11 @@ config BOARD_LENOVO_X201
help
Lenovo X201 laptop. Consult wiki for details.
+config BOARD_LENOVO_X201T
+ bool "ThinkPad X201 Tablet"
+ help
+ Lenovo X201 convertible tablet. Consult wiki for details.
+
config BOARD_LENOVO_X230
bool "ThinkPad X230"
help
@@ -34,6 +39,7 @@ endchoice
source "src/mainboard/lenovo/x60/Kconfig"
source "src/mainboard/lenovo/x201/Kconfig"
+source "src/mainboard/lenovo/x201t/Kconfig"
source "src/mainboard/lenovo/x230/Kconfig"
source "src/mainboard/lenovo/t60/Kconfig"
diff --git a/src/mainboard/lenovo/x201/Kconfig b/src/mainboard/lenovo/x201/Kconfig
index 8e7ebae..1ad1ffa 100644
--- a/src/mainboard/lenovo/x201/Kconfig
+++ b/src/mainboard/lenovo/x201/Kconfig
@@ -1,10 +1,11 @@
-if BOARD_LENOVO_X201
+if BOARD_LENOVO_X201 || BOARD_LENOVO_X201T
config BOARD_SPECIFIC_OPTIONS # dummy
def_bool y
select ARCH_X86
select NORTHBRIDGE_INTEL_NEHALEM
select SOUTHBRIDGE_INTEL_IBEXPEAK
+ select SUPERIO_NSC_PC87382
select EC_LENOVO_PMH7
select EC_LENOVO_H8
select DRIVERS_ICS_954309
@@ -23,6 +24,8 @@ config MAINBOARD_DIR
string
default lenovo/x201
+if BOARD_LENOVO_X201
+
config MAINBOARD_PART_NUMBER
string
default "3626EN1"
@@ -31,6 +34,8 @@ config MAINBOARD_VERSION
string
default "ThinkPad X201"
+endif
+
config MAINBOARD_VENDOR
string
default "LENOVO"
diff --git a/src/mainboard/lenovo/x201/acpi/superio.asl b/src/mainboard/lenovo/x201/acpi/superio.asl
index a2657f1..19bb4c5 100644
--- a/src/mainboard/lenovo/x201/acpi/superio.asl
+++ b/src/mainboard/lenovo/x201/acpi/superio.asl
@@ -1 +1,19 @@
#include "../../../../drivers/pc80/ps2_controller.asl"
+
+#if IS_ENABLED(CONFIG_BOARD_LENOVO_X201T)
+ Device (DTR) // Digitizer
+ {
+ Name(_HID, EISAID("WACF004"))
+
+ Name(_CRS, ResourceTemplate()
+ {
+ IO (Decode16, 0x200, 0x200, 0x01, 0x08)
+ IRQNoFlags () {5}
+ })
+
+ Method (_STA, 0)
+ {
+ Return (0xf)
+ }
+ }
+#endif
diff --git a/src/mainboard/lenovo/x201/devicetree.cb b/src/mainboard/lenovo/x201/devicetree.cb
index 37a430c..6632f40 100644
--- a/src/mainboard/lenovo/x201/devicetree.cb
+++ b/src/mainboard/lenovo/x201/devicetree.cb
@@ -139,6 +139,14 @@ chip northbridge/intel/nehalem
end
device pci 1f.0 on # PCI-LPC bridge
subsystemid 0x17aa 0x2166
+ chip superio/nsc/pc87382
+ device pnp 164e.3 on # Digitizer
+ io 0x60 = 0x200
+ irq 0x29 = 0xb0
+ irq 0x70 = 0x5
+ irq 0xf0 = 0x82
+ end
+ end
end
device pci 1f.2 on # IDE/SATA
subsystemid 0x17aa 0x2168
diff --git a/src/mainboard/lenovo/x201/mainboard.c b/src/mainboard/lenovo/x201/mainboard.c
index c16c3a4..775583a 100644
--- a/src/mainboard/lenovo/x201/mainboard.c
+++ b/src/mainboard/lenovo/x201/mainboard.c
@@ -90,7 +90,11 @@ static int int15_handler(void)
const char *smbios_mainboard_version(void)
{
- return "Lenovo X201";
+#if IS_ENABLED(CONFIG_BOARD_LENOVO_X201T)
+ return "ThinkPad X201 Tablet";
+#else
+ return "ThinkPad X201";
+#endif
}
/* Audio Setup */
@@ -106,7 +110,7 @@ static void verb_setup(void)
static void mainboard_enable(device_t dev)
{
- device_t dev0;
+ device_t dev0, devwacom;
u16 pmbase;
printk(BIOS_SPEW, "starting SPI configuration\n");
@@ -153,6 +157,10 @@ static void mainboard_enable(device_t dev)
if (dev0 && pci_read_config32(dev0, SKPAD) == SKPAD_ACPI_S3_MAGIC)
ec_write(0x0c, 0xc7);
+ devwacom = dev_find_slot_pnp (0x164e, 3);
+ if (devwacom)
+ devwacom->enabled = IS_ENABLED(CONFIG_BOARD_LENOVO_X201T);
+
#if CONFIG_PCI_OPTION_ROM_RUN_YABEL || CONFIG_PCI_OPTION_ROM_RUN_REALMODE
/* Install custom int15 handler for VGA OPROM */
mainboard_interrupt_handlers(0x15, &int15_handler);
diff --git a/src/mainboard/lenovo/x201/romstage.c b/src/mainboard/lenovo/x201/romstage.c
index e3e0a62..5ed48a9 100644
--- a/src/mainboard/lenovo/x201/romstage.c
+++ b/src/mainboard/lenovo/x201/romstage.c
@@ -53,7 +53,7 @@ static void pch_enable_lpc(void)
/* Enable EC, PS/2 Keyboard/Mouse */
pci_write_config16(PCH_LPC_DEV, LPC_EN,
CNF2_LPC_EN | CNF1_LPC_EN | MC_LPC_EN | KBC_LPC_EN |
- COMA_LPC_EN);
+ COMA_LPC_EN | GAMEL_LPC_EN);
pci_write_config32(PCH_LPC_DEV, LPC_GEN1_DEC, 0x7c1601);
pci_write_config32(PCH_LPC_DEV, LPC_GEN2_DEC, 0xc15e1);
diff --git a/src/mainboard/lenovo/x201t/Kconfig b/src/mainboard/lenovo/x201t/Kconfig
new file mode 100644
index 0000000..45e30a2
--- /dev/null
+++ b/src/mainboard/lenovo/x201t/Kconfig
@@ -0,0 +1,22 @@
+if BOARD_LENOVO_X201T
+
+config TABLET_SPECIFIC_OPTIONS # dummy
+ def_bool y
+ select SUPERIO_NSC_PC87382
+ # Following ones are for scripts benefit
+ select ARCH_X86
+ select NORTHBRIDGE_INTEL_NEHALEM
+ select SOUTHBRIDGE_INTEL_IBEXPEAK
+ select EC_LENOVO_PMH7
+ select EC_LENOVO_H8
+ select DRIVERS_ICS_954309
+
+config MAINBOARD_PART_NUMBER
+ string
+ default "0831CTO"
+
+config MAINBOARD_VERSION
+ string
+ default "ThinkPad X201 Tablet"
+
+endif
More information about the coreboot-gerrit
mailing list