blob: 990a0b3e52e40effee2c84a1e08068135ff264af [file] [log] [blame]
Angel Pons89ab2502020-04-03 01:22:28 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Nicolas Reinecke572795b2014-12-29 19:57:29 +01002
Kyösti Mälkkif1b58b72019-03-01 13:43:02 +02003#include <device/pci_ops.h>
Nicolas Reinecke572795b2014-12-29 19:57:29 +01004#include <northbridge/intel/sandybridge/raminit_native.h>
5#include <southbridge/intel/bd82x6x/pch.h>
Patrick Rudolphdb27e3382017-07-27 18:00:59 +02006#include <drivers/lenovo/hybrid_graphics/hybrid_graphics.h>
7#include <northbridge/intel/sandybridge/sandybridge.h>
8#include <device/device.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}
Nicolas Reinecke572795b2014-12-29 19:57:29 +010035
Nicolas Reinecke572795b2014-12-29 19:57:29 +010036const struct southbridge_usb_port mainboard_usb_ports[] = {
Peter Lemenkov18f88852019-10-23 22:07:58 +020037 { 0, 1, -1 }, /* P0: empty */
38 { 1, 1, 1 }, /* P1: system port 2 (To system port) (EHCI debug), OC 1 */
Nicolas Reinecke572795b2014-12-29 19:57:29 +010039 { 1, 1, -1 }, /* P2: HALF MINICARD (WLAN) no oc */
40 { 1, 0, -1 }, /* P3: WWAN, no OC */
41 { 1, 1, -1 }, /* P4: smartcard, no OC */
42 { 1, 1, -1 }, /* P5: ExpressCard, no OC */
43 { 0, 0, -1 }, /* P6: empty */
44 { 0, 0, -1 }, /* P7: empty */
45 { 0, 1, -1 }, /* P8: empty (touch panel) */
46 { 1, 0, 5 }, /* P9: system port 1 (To USBAO) (EHCI debug), OC 5 */
47 { 1, 0, -1 }, /* P10: fingerprint reader, no OC */
48 { 1, 1, -1 }, /* P11: bluetooth, no OC. */
49 { 1, 1, -1 }, /* P12: docking, no OC */
50 { 1, 1, -1 }, /* P13: camera (LCD), no OC */
51};
52
Peter Lemenkov498f1cc2019-02-07 10:48:10 +010053void mainboard_get_spd(spd_raw_data *spd, bool id_only)
54{
Kyösti Mälkkie258b9a2016-11-18 19:59:23 +020055 read_spd(&spd[0], 0x50, id_only);
56 read_spd(&spd[2], 0x51, id_only);
Nicolas Reinecke572795b2014-12-29 19:57:29 +010057}
Vladimir Serbinenko609bd942016-01-31 14:00:54 +010058
Patrick Rudolphdb27e3382017-07-27 18:00:59 +020059void mainboard_early_init(int s3resume)
60{
61 hybrid_graphics_init();
Vladimir Serbinenko609bd942016-01-31 14:00:54 +010062}