Bill XIE has uploaded this change for review. ( https://review.coreboot.org/c/coreboot/+/85997?usp=email )
Change subject: mb/lenovo/t400: Add ThinkPad T400s as a variant ......................................................................
mb/lenovo/t400: Add ThinkPad T400s as a variant
It is more similar to X301 than to T400, but it shares BDC detection PIN with T400, while using different HDA chip and has no SuperIO.
The laptop works well under coreboot with SeaBIOS 1.16.3 payload, running PureOS with Linux kernel 5.10.0.
Signed-off-by: Bill XIE persmule@hardenedlinux.org Change-Id: Ic96696921d5a5542a42226c24f7fae253acc4698 --- M Documentation/mainboard/index.md A Documentation/mainboard/lenovo/t400s.md A Documentation/mainboard/lenovo/t400s_flash.jpg M src/mainboard/lenovo/t400/Kconfig M src/mainboard/lenovo/t400/Kconfig.name M src/mainboard/lenovo/t400/Makefile.mk M src/mainboard/lenovo/t400/devicetree.cb C src/mainboard/lenovo/t400/variants/r500/hda_verb.c M src/mainboard/lenovo/t400/variants/r500/overridetree.cb R src/mainboard/lenovo/t400/variants/t400/hda_verb.c M src/mainboard/lenovo/t400/variants/t400/overridetree.cb A src/mainboard/lenovo/t400/variants/t400s/board_info.txt A src/mainboard/lenovo/t400/variants/t400s/data.vbt A src/mainboard/lenovo/t400/variants/t400s/gpio.c A src/mainboard/lenovo/t400/variants/t400s/hda_verb.c A src/mainboard/lenovo/t400/variants/t400s/overridetree.cb 16 files changed, 299 insertions(+), 27 deletions(-)
git pull ssh://review.coreboot.org:29418/coreboot refs/changes/97/85997/1
diff --git a/Documentation/mainboard/index.md b/Documentation/mainboard/index.md index 1bbacaf..93ab450 100644 --- a/Documentation/mainboard/index.md +++ b/Documentation/mainboard/index.md @@ -189,6 +189,7 @@
X200 / T400 / T500 / X301 common <lenovo/montevina_series.md> X301 <lenovo/x301.md> +T400s <lenovo/t400s.md> ```
### Arrandale series diff --git a/Documentation/mainboard/lenovo/t400s.md b/Documentation/mainboard/lenovo/t400s.md new file mode 100644 index 0000000..7eef4c1 --- /dev/null +++ b/Documentation/mainboard/lenovo/t400s.md @@ -0,0 +1,53 @@ +# Lenovo T400s + +## Disassembly Instructions + +You must remove the following parts to access the SPI flash: + + + +* Battery pack +* RAM lid +* Left DIMM on Slot-1 +* PCI Express Mini Card on wireless WAN socket + +Its [Hardware Maintenance Manual](https://download.lenovo.com/pccbbs/mobiles_pdf/45m2271_01.pdf) can be used as a guidance of disassembly. + +The WSON-8 flash chip (surrounded with red circle in the photo above, +already replaced with a SOIC-8 one) sits between the left DIMM and +the wireless WAN card under two pieces of insulating tape. If solders +between the chip and soldering pads fortunately overflows beside the +chip as tiny tin balls attached to soldering pads, it will be +possible to use a pomona 5250 clip to hold the chip, with its metal +tips just attached to tin balls, thus connecting the chip to the +programmer. Otherwise, it may be recommended to replace it with a +SOIC-8 one (you might need to add the chip to the IFD VSCC list), as +what is done in the photo. + +The vendor IFD VSCC list contains: +- MACRONIX_MX25L6405 (0xc2, 0x2017) +- WINBOND_NEX_W25X64 (0xef, 0x3017) +- ATMEL_AT25DF641 (0x1f, 0x4800) + +The general [flashing tutorial] has more details. + +Tested: +- Core 2 Duo P9600 CPU +- Slotted DIMM 4GiB*2 from Hynix +- Camera +- PCI-e and ExpressCard slots +- SATA, ESATAp and USB2 +- libgfxinit-based graphics init +- NVRAM options for North and South bridges +- Sound +- ThinkPad EC +- Linux 5.10.0-23 within PureOS, loaded from SeaBIOS. + +Known issues: +- Drives hot-swapped to ESATAp port are not detected automatically, + and not considered removable after detected with a manual scan +- S3 resume is unstable + + +[flashing tutorial]: ../../tutorial/flashing_firmware/ext_power.md + diff --git a/Documentation/mainboard/lenovo/t400s_flash.jpg b/Documentation/mainboard/lenovo/t400s_flash.jpg new file mode 100644 index 0000000..c82e6ac --- /dev/null +++ b/Documentation/mainboard/lenovo/t400s_flash.jpg Binary files differ diff --git a/src/mainboard/lenovo/t400/Kconfig b/src/mainboard/lenovo/t400/Kconfig index 5afcde8..8a9cff8 100644 --- a/src/mainboard/lenovo/t400/Kconfig +++ b/src/mainboard/lenovo/t400/Kconfig @@ -1,7 +1,7 @@ ## SPDX-License-Identifier: GPL-2.0-only
if BOARD_LENOVO_T400 || BOARD_LENOVO_T500 || BOARD_LENOVO_R400 \ - || BOARD_LENOVO_W500 || BOARD_LENOVO_R500 + || BOARD_LENOVO_W500 || BOARD_LENOVO_R500 || BOARD_LENOVO_T400S
config BOARD_SPECIFIC_OPTIONS def_bool y @@ -48,9 +48,11 @@ default "t400" if BOARD_LENOVO_T400 || BOARD_LENOVO_T500 \ || BOARD_LENOVO_R400 || BOARD_LENOVO_W500 default "r500" if BOARD_LENOVO_R500 + default "t400s" if BOARD_LENOVO_T400S
config MAINBOARD_PART_NUMBER default "ThinkPad T400" if BOARD_LENOVO_T400 + default "ThinkPad T400s" if BOARD_LENOVO_T400S default "ThinkPad T500" if BOARD_LENOVO_T500 default "ThinkPad R400" if BOARD_LENOVO_R400 default "ThinkPad R500" if BOARD_LENOVO_R500 diff --git a/src/mainboard/lenovo/t400/Kconfig.name b/src/mainboard/lenovo/t400/Kconfig.name index 13c5d63..37bd67a 100644 --- a/src/mainboard/lenovo/t400/Kconfig.name +++ b/src/mainboard/lenovo/t400/Kconfig.name @@ -3,6 +3,9 @@ config BOARD_LENOVO_T400 bool "ThinkPad T400"
+config BOARD_LENOVO_T400S + bool "ThinkPad T400s" + config BOARD_LENOVO_T500 bool "ThinkPad T500"
diff --git a/src/mainboard/lenovo/t400/Makefile.mk b/src/mainboard/lenovo/t400/Makefile.mk index 982c209..6cd90b4 100644 --- a/src/mainboard/lenovo/t400/Makefile.mk +++ b/src/mainboard/lenovo/t400/Makefile.mk @@ -4,6 +4,7 @@ bootblock-y += dock.c
romstage-y += variants/$(VARIANT_DIR)/gpio.c +ramstage-y += variants/$(VARIANT_DIR)/hda_verb.c
ramstage-y += dock.c ramstage-y += cstates.c @@ -14,5 +15,6 @@ ramstage-$(CONFIG_BOARD_LENOVO_R400) += variants/t400/malibu-3/gma-mainboard.ads ramstage-$(CONFIG_BOARD_LENOVO_T500) += variants/t400/coronado-5/gma-mainboard.ads ramstage-$(CONFIG_BOARD_LENOVO_W500) += variants/t400/coronado-5/gma-mainboard.ads +ramstage-$(CONFIG_BOARD_LENOVO_T400S) += variants/t400/coronado-5/gma-mainboard.ads ramstage-$(CONFIG_BOARD_LENOVO_R500) += variants/r500/gma-mainboard.ads endif diff --git a/src/mainboard/lenovo/t400/devicetree.cb b/src/mainboard/lenovo/t400/devicetree.cb index 259c3e1..fae8892 100644 --- a/src/mainboard/lenovo/t400/devicetree.cb +++ b/src/mainboard/lenovo/t400/devicetree.cb @@ -159,32 +159,6 @@ register "bdc_gpio_num" = "48" register "bdc_gpio_lvl" = "0" end - - chip superio/nsc/pc87382 - device pnp 164e.2 off end # IR - device pnp 164e.3 off end # Serial Port - device pnp 164e.7 on # GPIO - io 0x60 = 0x1680 - end - device pnp 164e.19 on # DLPC - io 0x60 = 0x164c - end - end - - chip superio/nsc/pc87384 - device pnp 2e.1 on # Parallel Port - io 0x60 = 0x3bc - irq 0x70 = 7 - end - device pnp 2e.2 off end # Serial Port / IR - device pnp 2e.3 on # Serial Port - io 0x60 = 0x3f8 - irq 0x70 = 4 - end - device pnp 2e.7 on # GPIO - io 0x60 = 0x1620 - end - end end device pci 1f.2 on # SATA/IDE 1 subsystemid 0x17aa 0x20f8 diff --git a/src/mainboard/lenovo/t400/hda_verb.c b/src/mainboard/lenovo/t400/variants/r500/hda_verb.c similarity index 100% copy from src/mainboard/lenovo/t400/hda_verb.c copy to src/mainboard/lenovo/t400/variants/r500/hda_verb.c diff --git a/src/mainboard/lenovo/t400/variants/r500/overridetree.cb b/src/mainboard/lenovo/t400/variants/r500/overridetree.cb index f8291d8..c7b7f50 100644 --- a/src/mainboard/lenovo/t400/variants/r500/overridetree.cb +++ b/src/mainboard/lenovo/t400/variants/r500/overridetree.cb @@ -29,6 +29,30 @@ register "eventa_enable" = "0x83" register "eventb_enable" = "0x00" end + chip superio/nsc/pc87382 + device pnp 164e.2 off end # IR + device pnp 164e.3 off end # Serial Port + device pnp 164e.7 on # GPIO + io 0x60 = 0x1680 + end + device pnp 164e.19 on # DLPC + io 0x60 = 0x164c + end + end + chip superio/nsc/pc87384 + device pnp 2e.1 on # Parallel Port + io 0x60 = 0x3bc + irq 0x70 = 7 + end + device pnp 2e.2 off end # Serial Port / IR + device pnp 2e.3 on # Serial Port + io 0x60 = 0x3f8 + irq 0x70 = 4 + end + device pnp 2e.7 on # GPIO + io 0x60 = 0x1620 + end + end end device pci 1f.3 on # SMBus subsystemid 0x17aa 0x20f9 diff --git a/src/mainboard/lenovo/t400/hda_verb.c b/src/mainboard/lenovo/t400/variants/t400/hda_verb.c similarity index 100% rename from src/mainboard/lenovo/t400/hda_verb.c rename to src/mainboard/lenovo/t400/variants/t400/hda_verb.c diff --git a/src/mainboard/lenovo/t400/variants/t400/overridetree.cb b/src/mainboard/lenovo/t400/variants/t400/overridetree.cb index a1b4f9d..d45f04e 100644 --- a/src/mainboard/lenovo/t400/variants/t400/overridetree.cb +++ b/src/mainboard/lenovo/t400/variants/t400/overridetree.cb @@ -22,6 +22,31 @@
register "has_thinker1" = "0" end + + chip superio/nsc/pc87382 + device pnp 164e.2 off end # IR + device pnp 164e.3 off end # Serial Port + device pnp 164e.7 on # GPIO + io 0x60 = 0x1680 + end + device pnp 164e.19 on # DLPC + io 0x60 = 0x164c + end + end + chip superio/nsc/pc87384 + device pnp 2e.1 on # Parallel Port + io 0x60 = 0x3bc + irq 0x70 = 7 + end + device pnp 2e.2 off end # Serial Port / IR + device pnp 2e.3 on # Serial Port + io 0x60 = 0x3f8 + irq 0x70 = 4 + end + device pnp 2e.7 on # GPIO + io 0x60 = 0x1620 + end + end end device pci 1f.3 on # SMBus subsystemid 0x17aa 0x20f9 diff --git a/src/mainboard/lenovo/t400/variants/t400s/board_info.txt b/src/mainboard/lenovo/t400/variants/t400s/board_info.txt new file mode 100644 index 0000000..c72acb2 --- /dev/null +++ b/src/mainboard/lenovo/t400/variants/t400s/board_info.txt @@ -0,0 +1,6 @@ +Category: laptop +ROM package: WSON-8 +ROM protocol: SPI +ROM socketed: n +Flashrom support: n +Release year: 2009 diff --git a/src/mainboard/lenovo/t400/variants/t400s/data.vbt b/src/mainboard/lenovo/t400/variants/t400s/data.vbt new file mode 100644 index 0000000..f19452d --- /dev/null +++ b/src/mainboard/lenovo/t400/variants/t400s/data.vbt Binary files differ diff --git a/src/mainboard/lenovo/t400/variants/t400s/gpio.c b/src/mainboard/lenovo/t400/variants/t400s/gpio.c new file mode 100644 index 0000000..6f0d091 --- /dev/null +++ b/src/mainboard/lenovo/t400/variants/t400s/gpio.c @@ -0,0 +1,114 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <southbridge/intel/common/gpio.h> + +static const struct pch_gpio_set1 pch_gpio_set1_mode = { + .gpio1 = GPIO_MODE_GPIO, + .gpio2 = GPIO_MODE_GPIO, + .gpio3 = GPIO_MODE_GPIO, + .gpio4 = GPIO_MODE_GPIO, + .gpio5 = GPIO_MODE_GPIO, + .gpio6 = GPIO_MODE_GPIO, + .gpio7 = GPIO_MODE_GPIO, + .gpio8 = GPIO_MODE_GPIO, + .gpio9 = GPIO_MODE_GPIO, + .gpio13 = GPIO_MODE_GPIO, + .gpio17 = GPIO_MODE_GPIO, + .gpio18 = GPIO_MODE_GPIO, + .gpio20 = GPIO_MODE_GPIO, + .gpio21 = GPIO_MODE_GPIO, + .gpio22 = GPIO_MODE_GPIO, + .gpio24 = GPIO_MODE_GPIO, + .gpio27 = GPIO_MODE_GPIO, + .gpio28 = GPIO_MODE_GPIO, +}; + +static const struct pch_gpio_set1 pch_gpio_set1_direction = { + .gpio1 = GPIO_DIR_INPUT, + .gpio2 = GPIO_DIR_INPUT, + .gpio3 = GPIO_DIR_INPUT, + .gpio4 = GPIO_DIR_INPUT, + .gpio5 = GPIO_DIR_INPUT, + .gpio6 = GPIO_DIR_INPUT, + .gpio7 = GPIO_DIR_INPUT, + .gpio8 = GPIO_DIR_INPUT, + .gpio9 = GPIO_DIR_OUTPUT, + .gpio13 = GPIO_DIR_INPUT, + .gpio17 = GPIO_DIR_INPUT, + .gpio18 = GPIO_DIR_INPUT, + .gpio20 = GPIO_DIR_OUTPUT, + .gpio21 = GPIO_DIR_INPUT, + .gpio22 = GPIO_DIR_INPUT, + .gpio24 = GPIO_DIR_OUTPUT, + .gpio27 = GPIO_DIR_OUTPUT, + .gpio28 = GPIO_DIR_OUTPUT, +}; + +static const struct pch_gpio_set1 pch_gpio_set1_level = { + .gpio9 = GPIO_LEVEL_HIGH, + .gpio20 = GPIO_LEVEL_HIGH, + .gpio24 = GPIO_LEVEL_HIGH, + .gpio27 = GPIO_LEVEL_LOW, + .gpio28 = GPIO_LEVEL_LOW, +}; + +static const struct pch_gpio_set1 pch_gpio_set1_invert = { + .gpio1 = GPIO_INVERT, + .gpio8 = GPIO_INVERT, +}; + +static const struct pch_gpio_set1 pch_gpio_set1_blink = { +}; + +static const struct pch_gpio_set2 pch_gpio_set2_mode = { + .gpio33 = GPIO_MODE_GPIO, + .gpio34 = GPIO_MODE_GPIO, + .gpio36 = GPIO_MODE_GPIO, + .gpio37 = GPIO_MODE_GPIO, + .gpio38 = GPIO_MODE_GPIO, + .gpio39 = GPIO_MODE_GPIO, + .gpio41 = GPIO_MODE_GPIO, + .gpio42 = GPIO_MODE_GPIO, + .gpio48 = GPIO_MODE_GPIO, + .gpio49 = GPIO_MODE_GPIO, + .gpio56 = GPIO_MODE_GPIO, + .gpio57 = GPIO_MODE_GPIO, +}; + +static const struct pch_gpio_set2 pch_gpio_set2_direction = { + .gpio33 = GPIO_DIR_OUTPUT, + .gpio34 = GPIO_DIR_OUTPUT, + .gpio36 = GPIO_DIR_INPUT, + .gpio37 = GPIO_DIR_INPUT, + .gpio38 = GPIO_DIR_INPUT, + .gpio39 = GPIO_DIR_INPUT, + .gpio41 = GPIO_DIR_OUTPUT, + .gpio42 = GPIO_DIR_OUTPUT, + .gpio48 = GPIO_DIR_INPUT, + .gpio49 = GPIO_DIR_OUTPUT, + .gpio56 = GPIO_DIR_INPUT, + .gpio57 = GPIO_DIR_INPUT, +}; + +static const struct pch_gpio_set2 pch_gpio_set2_level = { + .gpio33 = GPIO_LEVEL_HIGH, + .gpio34 = GPIO_LEVEL_LOW, + .gpio41 = GPIO_LEVEL_HIGH, + .gpio42 = GPIO_LEVEL_HIGH, + .gpio49 = GPIO_LEVEL_HIGH, +}; + +const struct pch_gpio_map mainboard_gpio_map = { + .set1 = { + .mode = &pch_gpio_set1_mode, + .direction = &pch_gpio_set1_direction, + .level = &pch_gpio_set1_level, + .blink = &pch_gpio_set1_blink, + .invert = &pch_gpio_set1_invert, + }, + .set2 = { + .mode = &pch_gpio_set2_mode, + .direction = &pch_gpio_set2_direction, + .level = &pch_gpio_set2_level, + }, +}; diff --git a/src/mainboard/lenovo/t400/variants/t400s/hda_verb.c b/src/mainboard/lenovo/t400/variants/t400s/hda_verb.c new file mode 100644 index 0000000..ef60952 --- /dev/null +++ b/src/mainboard/lenovo/t400/variants/t400s/hda_verb.c @@ -0,0 +1,38 @@ +/* SPDX-License-Identifier: GPL-2.0-only */ + +#include <device/azalia_device.h> + +const u32 cim_verb_data[] = { + 0x14f15069, // Vendor/Device ID: Conexant CX20585 + 0x17aa2132, // Subsystem ID + 11, + AZALIA_SUBVENDOR(0, 0x17aa2132), + + AZALIA_PIN_CFG(0, 0x19, + AZALIA_PIN_DESC(AZALIA_JACK, + AZALIA_EXTERNAL_PRIMARY_CHASSIS | AZALIA_LEFT, + AZALIA_HP_OUT, AZALIA_STEREO_MONO_1_8, AZALIA_BLACK, + AZALIA_JACK_PRESENCE_DETECT, 15, 0)), + AZALIA_PIN_CFG(0, 0x1a, 0x61a190f0), // does not describe a jack or internal device + AZALIA_PIN_CFG(0, 0x1b, + AZALIA_PIN_DESC(AZALIA_JACK, + AZALIA_EXTERNAL_PRIMARY_CHASSIS | AZALIA_LEFT, + AZALIA_MIC_IN, AZALIA_STEREO_MONO_1_8, AZALIA_BLACK, + AZALIA_JACK_PRESENCE_DETECT, 15, 0)), + AZALIA_PIN_CFG(0, 0x1c, 0x612140f0), // does not describe a jack or internal device + AZALIA_PIN_CFG(0, 0x1d, 0x40f001f0), // does not describe a jack or internal device + AZALIA_PIN_CFG(0, 0x1e, 0x40f001f0), // does not describe a jack or internal device + AZALIA_PIN_CFG(0, 0x1f, + AZALIA_PIN_DESC(AZALIA_INTEGRATED, AZALIA_INTERNAL, AZALIA_SPEAKER, + AZALIA_OTHER_ANALOG, AZALIA_COLOR_UNKNOWN, + AZALIA_NO_JACK_PRESENCE_DETECT, 15, 0)), + AZALIA_PIN_CFG(0, 0x20, 0x40f001f0), // does not describe a jack or internal device + AZALIA_PIN_CFG(0, 0x22, 0x40f001f0), // does not describe a jack or internal device + AZALIA_PIN_CFG(0, 0x23, + AZALIA_PIN_DESC(AZALIA_INTEGRATED, AZALIA_INTERNAL, AZALIA_MIC_IN, + AZALIA_OTHER_DIGITAL, AZALIA_COLOR_UNKNOWN, + AZALIA_NO_JACK_PRESENCE_DETECT, 15, 0)), +}; + +const u32 pc_beep_verbs[] = {}; +AZALIA_ARRAY_SIZES; diff --git a/src/mainboard/lenovo/t400/variants/t400s/overridetree.cb b/src/mainboard/lenovo/t400/variants/t400s/overridetree.cb new file mode 100644 index 0000000..9ef5947 --- /dev/null +++ b/src/mainboard/lenovo/t400/variants/t400s/overridetree.cb @@ -0,0 +1,30 @@ +chip northbridge/intel/gm45 + device domain 0 on + chip southbridge/intel/i82801ix + # Enable PCIe ports 1,2,3,4 as slots (Mini * PCIe). + register "pcie_slot_implemented" = "0xf" + # Set power limits to 10 * 10^0 watts. + # Maybe we should set less for Mini PCIe. + register "pcie_power_limits" = "{ { 10, 0 }, { 10, 0 }, { 10, 0 }, { 10, 0 }, { 0, 0 }, { 0, 0 } }" + # Set AHCI mode, enable ports 1, 2, 5 (ESATAP), 6 (ESATA). + register "sata_port_map" = "0x33" + register "sata_clock_request" = "0" + register "sata_traffic_monitor" = "0" + + device pci 1f.3 on # SMBus + subsystemid 0x17aa 0x20f9 + # eeprom, 8 virtual devices, same chip + chip drivers/i2c/at24rf08c + device i2c 54 on end + device i2c 55 on end + device i2c 56 on end + device i2c 57 on end + device i2c 5c on end + device i2c 5d on end + device i2c 5e on end + device i2c 5f on end + end + end + end + end +end