summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorFelix Singer <felixsinger@posteo.net>2022-07-23 21:40:22 +0200
committerFelix Singer <felixsinger@posteo.net>2022-07-24 22:24:49 +0000
commitc5f705574615c307e3e098b2fbd396eb3cc84206 (patch)
tree83476fd74fd0a5dd1582f80b23a268dfd33e814b /src
parentb5bdd707583a5731722f848cecae75753decf9b9 (diff)
mb/lenovo: Integrate W541 into haswell mainboard
Lots of code from lenovo/haswell can be reused for lenovo/w541. Thus, integrate it into lenovo/haswell and make it a variant. Change-Id: If99d842cff777fe27ff63baabc447e69b9d0333c Signed-off-by: Felix Singer <felixsinger@posteo.net> Reviewed-on: https://review.coreboot.org/c/coreboot/+/63514 Tested-by: build bot (Jenkins) <no-reply@coreboot.org> Reviewed-by: Michael Niewöhner <foss@mniewoehner.de>
Diffstat (limited to 'src')
-rw-r--r--src/mainboard/lenovo/haswell/Kconfig13
-rw-r--r--src/mainboard/lenovo/haswell/Kconfig.name3
-rw-r--r--src/mainboard/lenovo/haswell/variants/w541/board_info.txt (renamed from src/mainboard/lenovo/w541/board_info.txt)0
-rw-r--r--src/mainboard/lenovo/haswell/variants/w541/data.vbt (renamed from src/mainboard/lenovo/w541/data.vbt)bin4400 -> 4400 bytes
-rw-r--r--src/mainboard/lenovo/haswell/variants/w541/devicetree.cb (renamed from src/mainboard/lenovo/w541/devicetree.cb)0
-rw-r--r--src/mainboard/lenovo/haswell/variants/w541/gma-mainboard.ads (renamed from src/mainboard/lenovo/w541/gma-mainboard.ads)0
-rw-r--r--src/mainboard/lenovo/haswell/variants/w541/gpio.c (renamed from src/mainboard/lenovo/w541/gpio.c)0
-rw-r--r--src/mainboard/lenovo/haswell/variants/w541/hda_verb.c (renamed from src/mainboard/lenovo/w541/hda_verb.c)0
-rw-r--r--src/mainboard/lenovo/haswell/variants/w541/romstage.c (renamed from src/mainboard/lenovo/w541/romstage.c)27
-rw-r--r--src/mainboard/lenovo/w541/Kconfig47
-rw-r--r--src/mainboard/lenovo/w541/Kconfig.name2
-rw-r--r--src/mainboard/lenovo/w541/Makefile.inc2
-rw-r--r--src/mainboard/lenovo/w541/acpi/ec.asl4
-rw-r--r--src/mainboard/lenovo/w541/acpi/platform.asl14
-rw-r--r--src/mainboard/lenovo/w541/acpi/superio.asl3
-rw-r--r--src/mainboard/lenovo/w541/acpi_tables.c15
-rw-r--r--src/mainboard/lenovo/w541/cmos.default13
-rw-r--r--src/mainboard/lenovo/w541/cmos.layout76
-rw-r--r--src/mainboard/lenovo/w541/dsdt.asl31
-rw-r--r--src/mainboard/lenovo/w541/smihandler.c85
20 files changed, 14 insertions, 321 deletions
diff --git a/src/mainboard/lenovo/haswell/Kconfig b/src/mainboard/lenovo/haswell/Kconfig
index efac41b1d7..897700df15 100644
--- a/src/mainboard/lenovo/haswell/Kconfig
+++ b/src/mainboard/lenovo/haswell/Kconfig
@@ -24,6 +24,9 @@ config BOARD_LENOVO_THINKPAD_T440P
select BOARD_LENOVO_HASWELL_COMMON
select INTEL_INT15
+config BOARD_LENOVO_THINKPAD_W541
+ select BOARD_LENOVO_HASWELL_COMMON
+
if BOARD_LENOVO_HASWELL_COMMON
config VBOOT
@@ -43,6 +46,7 @@ config VBOOT_VBNV_OFFSET
config VARIANT_DIR
default "t440p" if BOARD_LENOVO_THINKPAD_T440P
+ default "w541" if BOARD_LENOVO_THINKPAD_W541
config DEVICETREE
default "variants/\$(CONFIG_VARIANT_DIR)/devicetree.cb"
@@ -55,10 +59,11 @@ config MAINBOARD_DIR
config MAINBOARD_PART_NUMBER
default "ThinkPad T440p" if BOARD_LENOVO_THINKPAD_T440P
+ default "ThinkPad W541" if BOARD_LENOVO_THINKPAD_W541
config VGA_BIOS_ID
string
- default "8086,0416"
+ default "8086,0416" if BOARD_LENOVO_THINKPAD_T440P
config USBDEBUG_HCD_INDEX
int
@@ -72,9 +77,13 @@ config PS2K_EISAID
default "LEN0071"
config PS2M_EISAID
- default "LEN0036"
+ default "LEN0036" if BOARD_LENOVO_THINKPAD_T440P
+ default "LEN004A" if BOARD_LENOVO_THINKPAD_W541
config THINKPADEC_HKEY_EISAID
default "LEN0068"
+config GFX_GMA_PANEL_1_PORT
+ default "DP3" if BOARD_LENOVO_THINKPAD_W541
+
endif
diff --git a/src/mainboard/lenovo/haswell/Kconfig.name b/src/mainboard/lenovo/haswell/Kconfig.name
index e90299d930..61089977dc 100644
--- a/src/mainboard/lenovo/haswell/Kconfig.name
+++ b/src/mainboard/lenovo/haswell/Kconfig.name
@@ -1,2 +1,5 @@
config BOARD_LENOVO_THINKPAD_T440P
bool "ThinkPad T440p"
+
+config BOARD_LENOVO_THINKPAD_W541
+ bool "ThinkPad W541"
diff --git a/src/mainboard/lenovo/w541/board_info.txt b/src/mainboard/lenovo/haswell/variants/w541/board_info.txt
index 02c0871ea7..02c0871ea7 100644
--- a/src/mainboard/lenovo/w541/board_info.txt
+++ b/src/mainboard/lenovo/haswell/variants/w541/board_info.txt
diff --git a/src/mainboard/lenovo/w541/data.vbt b/src/mainboard/lenovo/haswell/variants/w541/data.vbt
index 519874fa25..519874fa25 100644
--- a/src/mainboard/lenovo/w541/data.vbt
+++ b/src/mainboard/lenovo/haswell/variants/w541/data.vbt
Binary files differ
diff --git a/src/mainboard/lenovo/w541/devicetree.cb b/src/mainboard/lenovo/haswell/variants/w541/devicetree.cb
index ae720e81bf..ae720e81bf 100644
--- a/src/mainboard/lenovo/w541/devicetree.cb
+++ b/src/mainboard/lenovo/haswell/variants/w541/devicetree.cb
diff --git a/src/mainboard/lenovo/w541/gma-mainboard.ads b/src/mainboard/lenovo/haswell/variants/w541/gma-mainboard.ads
index ad8a35b9a7..ad8a35b9a7 100644
--- a/src/mainboard/lenovo/w541/gma-mainboard.ads
+++ b/src/mainboard/lenovo/haswell/variants/w541/gma-mainboard.ads
diff --git a/src/mainboard/lenovo/w541/gpio.c b/src/mainboard/lenovo/haswell/variants/w541/gpio.c
index 43baeb5f59..43baeb5f59 100644
--- a/src/mainboard/lenovo/w541/gpio.c
+++ b/src/mainboard/lenovo/haswell/variants/w541/gpio.c
diff --git a/src/mainboard/lenovo/w541/hda_verb.c b/src/mainboard/lenovo/haswell/variants/w541/hda_verb.c
index f99c3938c3..f99c3938c3 100644
--- a/src/mainboard/lenovo/w541/hda_verb.c
+++ b/src/mainboard/lenovo/haswell/variants/w541/hda_verb.c
diff --git a/src/mainboard/lenovo/w541/romstage.c b/src/mainboard/lenovo/haswell/variants/w541/romstage.c
index 75b762aeef..4a189d42b8 100644
--- a/src/mainboard/lenovo/w541/romstage.c
+++ b/src/mainboard/lenovo/haswell/variants/w541/romstage.c
@@ -8,33 +8,6 @@
#include <ec/lenovo/pmh7/pmh7.h>
#include <device/pci_ops.h>
-void mainboard_config_rcba(void)
-{
- RCBA16(D31IR) = DIR_ROUTE(PIRQA, PIRQD, PIRQC, PIRQA);
- RCBA16(D29IR) = DIR_ROUTE(PIRQH, PIRQD, PIRQA, PIRQC);
- RCBA16(D28IR) = DIR_ROUTE(PIRQA, PIRQA, PIRQA, PIRQA);
- RCBA16(D27IR) = DIR_ROUTE(PIRQG, PIRQB, PIRQC, PIRQD);
- RCBA16(D26IR) = DIR_ROUTE(PIRQA, PIRQF, PIRQC, PIRQD);
- RCBA16(D25IR) = DIR_ROUTE(PIRQE, PIRQF, PIRQG, PIRQH);
- RCBA16(D22IR) = DIR_ROUTE(PIRQA, PIRQB, PIRQC, PIRQD);
- RCBA16(D20IR) = DIR_ROUTE(PIRQA, PIRQB, PIRQC, PIRQD);
-}
-
-void mb_late_romstage_setup(void)
-{
- u8 enable_peg = get_uint_option("enable_dual_graphics", 0);
-
- bool power_en = pmh7_dgpu_power_state();
-
- if (enable_peg != power_en)
- pmh7_dgpu_power_enable(!power_en);
-
- if (!enable_peg) {
- // Hide disabled dGPU device
- pci_and_config32(HOST_BRIDGE, DEVEN, ~DEVEN_D1F0EN);
- }
-}
-
void mb_get_spd_map(struct spd_info *spdi)
{
spdi->addresses[0] = 0x50;
diff --git a/src/mainboard/lenovo/w541/Kconfig b/src/mainboard/lenovo/w541/Kconfig
deleted file mode 100644
index 2cb4cf6820..0000000000
--- a/src/mainboard/lenovo/w541/Kconfig
+++ /dev/null
@@ -1,47 +0,0 @@
-if BOARD_LENOVO_THINKPAD_W541
-
-config BOARD_SPECIFIC_OPTIONS
- def_bool y
- select BOARD_ROMSIZE_KB_12288
- select EC_LENOVO_H8
- select EC_LENOVO_PMH7
- select H8_HAS_BAT_THRESHOLDS_IMPL
- select H8_HAS_PRIMARY_FN_KEYS
- select HAVE_ACPI_RESUME
- select HAVE_ACPI_TABLES
- select HAVE_CMOS_DEFAULT
- select HAVE_OPTION_TABLE
- select INTEL_GMA_HAVE_VBT
- select MAINBOARD_HAS_LIBGFXINIT
- select MAINBOARD_HAS_TPM1
- select MAINBOARD_USES_IFD_GBE_REGION
- select MEMORY_MAPPED_TPM
- select NORTHBRIDGE_INTEL_HASWELL
- select NO_UART_ON_SUPERIO
- select SERIRQ_CONTINUOUS_MODE
- select SOUTHBRIDGE_INTEL_LYNXPOINT
- select SYSTEM_TYPE_LAPTOP
-
-config GFX_GMA_PANEL_1_PORT
- default "DP3"
-
-config MAINBOARD_DIR
- default "lenovo/w541"
-
-config MAINBOARD_PART_NUMBER
- default "ThinkPad W541"
-
-config DRIVER_LENOVO_SERIALS
- bool
- default n
-
-config PS2K_EISAID
- default "LEN0071"
-
-config PS2M_EISAID
- default "LEN004A"
-
-config THINKPADEC_HKEY_EISAID
- default "LEN0068"
-
-endif
diff --git a/src/mainboard/lenovo/w541/Kconfig.name b/src/mainboard/lenovo/w541/Kconfig.name
deleted file mode 100644
index f2ee59c554..0000000000
--- a/src/mainboard/lenovo/w541/Kconfig.name
+++ /dev/null
@@ -1,2 +0,0 @@
-config BOARD_LENOVO_THINKPAD_W541
- bool "ThinkPad W541"
diff --git a/src/mainboard/lenovo/w541/Makefile.inc b/src/mainboard/lenovo/w541/Makefile.inc
deleted file mode 100644
index ebe01aea99..0000000000
--- a/src/mainboard/lenovo/w541/Makefile.inc
+++ /dev/null
@@ -1,2 +0,0 @@
-romstage-y += gpio.c
-ramstage-$(CONFIG_MAINBOARD_USE_LIBGFXINIT) += gma-mainboard.ads
diff --git a/src/mainboard/lenovo/w541/acpi/ec.asl b/src/mainboard/lenovo/w541/acpi/ec.asl
deleted file mode 100644
index 8dea152079..0000000000
--- a/src/mainboard/lenovo/w541/acpi/ec.asl
+++ /dev/null
@@ -1,4 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-
-#include <ec/lenovo/h8/acpi/ec.asl>
-#include <ec/lenovo/h8/acpi/thinkpad_bat_thresholds_b0.asl>
diff --git a/src/mainboard/lenovo/w541/acpi/platform.asl b/src/mainboard/lenovo/w541/acpi/platform.asl
deleted file mode 100644
index f5a4df75f4..0000000000
--- a/src/mainboard/lenovo/w541/acpi/platform.asl
+++ /dev/null
@@ -1,14 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-
-Method(_WAK,1)
-{
- /* ME may not be up yet. */
- \_TZ.MEB1 = 0
- \_TZ.MEB2 = 0
- Return(Package(){0,0})
-}
-
-Method(_PTS,1)
-{
- \_SB.PCI0.LPCB.EC.RADI(0)
-}
diff --git a/src/mainboard/lenovo/w541/acpi/superio.asl b/src/mainboard/lenovo/w541/acpi/superio.asl
deleted file mode 100644
index ee2eabeb75..0000000000
--- a/src/mainboard/lenovo/w541/acpi/superio.asl
+++ /dev/null
@@ -1,3 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-
-#include <drivers/pc80/pc/ps2_controller.asl>
diff --git a/src/mainboard/lenovo/w541/acpi_tables.c b/src/mainboard/lenovo/w541/acpi_tables.c
deleted file mode 100644
index 04318b56a8..0000000000
--- a/src/mainboard/lenovo/w541/acpi_tables.c
+++ /dev/null
@@ -1,15 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-
-#include <acpi/acpi_gnvs.h>
-#include <soc/nvs.h>
-
-void mainboard_fill_gnvs(struct global_nvs *gnvs)
-{
- /* The lid is open by default. */
- gnvs->lids = 1;
-
- /* Temperature at which OS will shut down. */
- gnvs->tcrt = 100;
- /* Temperature at which OS will throttle CPU. */
- gnvs->tpsv = 90;
-}
diff --git a/src/mainboard/lenovo/w541/cmos.default b/src/mainboard/lenovo/w541/cmos.default
deleted file mode 100644
index facdd3a774..0000000000
--- a/src/mainboard/lenovo/w541/cmos.default
+++ /dev/null
@@ -1,13 +0,0 @@
-boot_option=Fallback
-debug_level=Debug
-power_on_after_fail=Disable
-nmi=Enable
-volume=0x3
-wlan=Enable
-fn_ctrl_swap=Disable
-f1_to_f12_as_primary=Enable
-sticky_fn=Disable
-trackpoint=Enable
-backlight=Keyboard
-enable_dual_graphics=Disable
-usb_always_on=Disable
diff --git a/src/mainboard/lenovo/w541/cmos.layout b/src/mainboard/lenovo/w541/cmos.layout
deleted file mode 100644
index 28790a76e1..0000000000
--- a/src/mainboard/lenovo/w541/cmos.layout
+++ /dev/null
@@ -1,76 +0,0 @@
-## SPDX-License-Identifier: GPL-2.0-only
-
-# -----------------------------------------------------------------
-entries
-
-# -----------------------------------------------------------------
-0 120 r 0 reserved_memory
-
-# -----------------------------------------------------------------
-# RTC_BOOT_BYTE (coreboot hardcoded)
-384 1 e 4 boot_option
-388 4 h 0 reboot_counter
-
-# -----------------------------------------------------------------
-# coreboot config options: console
-395 4 e 6 debug_level
-
-#400 8 r 0 reserved for century byte
-
-# coreboot config options: southbridge
-408 1 e 1 nmi
-409 2 e 7 power_on_after_fail
-
-# coreboot config options: EC
-415 1 e 1 wlan
-416 1 e 1 trackpoint
-417 1 e 1 fn_ctrl_swap
-418 1 e 1 sticky_fn
-419 2 e 13 usb_always_on
-422 2 e 10 backlight
-424 1 e 1 f1_to_f12_as_primary
-
-# coreboot config options: northbridge
-435 1 e 1 enable_dual_graphics
-440 8 h 0 volume
-
-# VBOOT
-448 128 r 0 vbnv
-
-# coreboot config options: check sums
-984 16 h 0 check_sum
-
-# -----------------------------------------------------------------
-
-enumerations
-
-#ID value text
-1 0 Disable
-1 1 Enable
-4 0 Fallback
-4 1 Normal
-6 0 Emergency
-6 1 Alert
-6 2 Critical
-6 3 Error
-6 4 Warning
-6 5 Notice
-6 6 Info
-6 7 Debug
-6 8 Spew
-7 0 Disable
-7 1 Enable
-7 2 Keep
-# Haswell ThinkPads have no Thinklight
-#10 0 Both
-10 1 Keyboard
-#10 2 Thinklight only
-10 3 None
-13 0 Disable
-13 1 AC and battery
-13 2 AC only
-
-# -----------------------------------------------------------------
-checksums
-
-checksum 392 447 984
diff --git a/src/mainboard/lenovo/w541/dsdt.asl b/src/mainboard/lenovo/w541/dsdt.asl
deleted file mode 100644
index a7afeee766..0000000000
--- a/src/mainboard/lenovo/w541/dsdt.asl
+++ /dev/null
@@ -1,31 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-or-later */
-
-#define BRIGHTNESS_UP \_SB.PCI0.GFX0.INCB
-#define BRIGHTNESS_DOWN \_SB.PCI0.GFX0.DECB
-#define EC_LENOVO_H8_ME_WORKAROUND 1
-#define THINKPAD_EC_GPE 17
-
-#include <acpi/acpi.h>
-DefinitionBlock(
- "dsdt.aml",
- "DSDT",
- ACPI_DSDT_REV_2,
- OEM_ID,
- ACPI_TABLE_CREATOR,
- 0x20141018 // OEM revision
-)
-{
- #include <acpi/dsdt_top.asl>
- #include "acpi/platform.asl"
- #include <cpu/intel/common/acpi/cpu.asl>
- #include <southbridge/intel/common/acpi/platform.asl>
- #include <southbridge/intel/lynxpoint/acpi/globalnvs.asl>
- #include <southbridge/intel/common/acpi/sleepstates.asl>
-
- Device (\_SB.PCI0)
- {
- #include <northbridge/intel/haswell/acpi/hostbridge.asl>
- #include <drivers/intel/gma/acpi/default_brightness_levels.asl>
- #include <southbridge/intel/lynxpoint/acpi/pch.asl>
- }
-}
diff --git a/src/mainboard/lenovo/w541/smihandler.c b/src/mainboard/lenovo/w541/smihandler.c
deleted file mode 100644
index de48240e88..0000000000
--- a/src/mainboard/lenovo/w541/smihandler.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* SPDX-License-Identifier: GPL-2.0-only */
-
-#include <arch/io.h>
-#include <device/pci_ops.h>
-#include <console/console.h>
-#include <cpu/x86/smm.h>
-#include <ec/acpi/ec.h>
-#include <ec/lenovo/h8/h8.h>
-#include <southbridge/intel/lynxpoint/pch.h>
-
-#define GPE_EC_SCI 1
-#define GPE_EC_WAKE 13
-
-static void mainboard_smi_handle_ec_sci(void)
-{
- u8 status = inb(EC_SC);
- u8 event;
-
- if (!(status & EC_SCI_EVT))
- return;
-
- event = ec_query();
- printk(BIOS_DEBUG, "EC event %#02x\n", event);
-}
-
-void mainboard_smi_gpi(u32 gpi_sts)
-{
- if (gpi_sts & (1 << GPE_EC_SCI))
- mainboard_smi_handle_ec_sci();
-}
-
-/* lynxpoint doesn't have gpi_route_interrupt, so add it */
-#define GPI_DISABLE 0x00
-#define GPI_IS_SMI 0x01
-#define GPI_IS_SCI 0x02
-#define GPI_IS_NMI 0x03
-
-static void gpi_route_interrupt(u8 gpi, u8 mode)
-{
- u32 gpi_rout;
-
- gpi_rout = pci_read_config32(PCI_DEV(0, 0x1f, 0), GPIO_ROUT);
- gpi_rout &= ~(3 << (2 * gpi));
- gpi_rout |= ((mode & 3) << (2 * gpi));
- pci_write_config32(PCI_DEV(0, 0x1f, 0), GPIO_ROUT, gpi_rout);
-}
-
-int mainboard_smi_apmc(u8 data)
-{
- switch (data) {
- case APM_CNT_ACPI_ENABLE:
- /* use 0x1600/0x1604 to prevent races with userspace */
- ec_set_ports(0x1604, 0x1600);
- /* route EC_SCI to SCI */
- gpi_route_interrupt(GPE_EC_SCI, GPI_IS_SCI);
- /* discard all events, and enable attention */
- ec_write(0x80, 0x01);
- break;
- case APM_CNT_ACPI_DISABLE:
- /* we have to use port 0x62/0x66, as 0x1600/0x1604 doesn't
- provide a EC query function */
- ec_set_ports(0x66, 0x62);
- /* route EC_SCI to SMI */
- gpi_route_interrupt(GPE_EC_SCI, GPI_IS_SMI);
- /* discard all events, and enable attention */
- ec_write(0x80, 0x01);
- break;
- default:
- break;
- }
- return 0;
-}
-
-void mainboard_smi_sleep(u8 slp_typ)
-{
- if (slp_typ == 3) {
- u8 ec_wake = ec_read(0x32);
- /* If EC wake events are enabled,
- * enable wake on EC WAKE GPE. */
- if (ec_wake & 0x14) {
- /* Redirect EC WAKE GPE to SCI. */
- gpi_route_interrupt(GPE_EC_WAKE, GPI_IS_SCI);
- }
- }
-}