blob: 5e397ab7c433f359a4c0a04354fcd363fc63d0a9 [file] [log] [blame]
Angel Pons89ab2502020-04-03 01:22:28 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Philipp Deppenwiese714baa12017-01-02 17:58:09 +01002
Kyösti Mälkkif1b58b72019-03-01 13:43:02 +02003#include <device/pci_ops.h>
Philipp Deppenwiese714baa12017-01-02 17:58:09 +01004#include <device/pci_def.h>
Philipp Deppenwiese714baa12017-01-02 17:58:09 +01005#include <southbridge/intel/bd82x6x/pch.h>
6#include <ec/lenovo/pmh7/pmh7.h>
Patrick Rudolphdb27e3382017-07-27 18:00:59 +02007#include <drivers/lenovo/hybrid_graphics/hybrid_graphics.h>
8#include <northbridge/intel/sandybridge/sandybridge.h>
Patrick Rudolphdb27e3382017-07-27 18:00:59 +02009
10static void hybrid_graphics_init(void)
11{
12 bool peg, igd;
13 u32 reg32;
14
15 early_hybrid_graphics(&igd, &peg);
16
Evgeny Zinoviev384e9ae2018-08-30 02:18:48 +030017 if (peg && igd)
18 return;
19
Patrick Rudolphdb27e3382017-07-27 18:00:59 +020020 /* Hide disabled devices */
21 reg32 = pci_read_config32(PCI_DEV(0, 0, 0), DEVEN);
22 reg32 &= ~(DEVEN_PEG10 | DEVEN_IGD);
23
24 if (peg)
25 reg32 |= DEVEN_PEG10;
26
27 if (igd)
28 reg32 |= DEVEN_IGD;
29 else
30 /* Disable IGD VGA decode, no GTT or GFX stolen */
31 pci_write_config16(PCI_DEV(0, 0, 0), GGC, 2);
32
33 pci_write_config32(PCI_DEV(0, 0, 0), DEVEN, reg32);
34}
Philipp Deppenwiese714baa12017-01-02 17:58:09 +010035
Philipp Deppenwiese714baa12017-01-02 17:58:09 +010036/* FIXME: used T530 values here */
37const struct southbridge_usb_port mainboard_usb_ports[] = {
38 { 1, 1, 0 },
39 { 1, 1, 1 },
40 { 1, 2, 3 },
41 { 1, 1, -1 },
42 { 1, 1, 2 },
43 { 1, 0, -1 },
44 { 0, 0, -1 },
45 { 1, 2, -1 },
46 { 1, 0, -1 },
47 { 1, 1, 5 },
48 { 1, 0, -1 },
49 { 1, 0, -1 },
50 { 1, 3, -1 },
51 { 1, 1, -1 },
52};
53
54void mainboard_early_init(int s3resume)
55{
Patrick Rudolphdb27e3382017-07-27 18:00:59 +020056 hybrid_graphics_init();
Philipp Deppenwiese714baa12017-01-02 17:58:09 +010057}