mb/google/brya: Create rull variant
[coreboot2.git] / src / mainboard / lenovo / t60 / mainboard.c
blob5b38ec241748ff24f9d1c4e65305e189218e0c70
1 /* SPDX-License-Identifier: GPL-2.0-only */
3 #include <arch/io.h>
4 #include <device/device.h>
5 #include <ec/lenovo/pmh7/pmh7.h>
6 #include <ec/lenovo/h8/h8.h>
7 #include <ec/acpi/ec.h>
8 #include <northbridge/intel/i945/i945.h>
9 #include <southbridge/intel/i82801gx/chip.h>
10 #include <drivers/intel/gma/int15.h>
11 #include <acpi/acpigen.h>
13 #define PANEL INT15_5F35_CL_DISPLAY_DEFAULT
15 static void mainboard_init(struct device *dev)
17 struct southbridge_intel_i82801gx_config *config;
18 struct device *idedev;
20 install_intel_vga_int15_handler(GMA_INT15_ACTIVE_LFP_INT_LVDS,
21 GMA_INT15_PANEL_FIT_DEFAULT,
22 PANEL, 3);
24 /* If we're resuming from suspend, blink suspend LED */
25 if (acpi_is_wakeup_s3())
26 ec_write(0x0c, 0xc7);
28 idedev = pcidev_on_root(0x1f, 1);
30 if (!(inb(DEFAULT_GPIOBASE + 0x0c) & 0x40)) {
31 /* legacy I/O connected */
32 pmh7_ultrabay_power_enable(1);
33 ec_write(0x0c, 0x84);
34 } else if (idedev && idedev->chip_info &&
35 h8_ultrabay_device_present()) {
36 config = idedev->chip_info;
37 config->ide_enable_primary = true;
38 pmh7_ultrabay_power_enable(1);
39 ec_write(0x0c, 0x84);
40 } else {
41 pmh7_ultrabay_power_enable(0);
42 ec_write(0x0c, 0x04);
45 /* set dock status led */
46 ec_write(0x0c, 0x08);
47 ec_write(0x0c, inb(0x164c) & 8 ? 0x89 : 0x09);
50 static void mainboard_enable(struct device *dev)
52 dev->ops->init = mainboard_init;
55 struct chip_operations mainboard_ops = {
56 .enable_dev = mainboard_enable,