blob: 4f5f69d4dc307aad37f0a57efb3e6f68903c28a7 [file] [log] [blame]
Angel Pons89ab2502020-04-03 01:22:28 +02001/* SPDX-License-Identifier: GPL-2.0-only */
2/* This file is part of the coreboot project. */
Nicolas Reinecke572795b2014-12-29 19:57:29 +01003
Kyösti Mälkkif1b58b72019-03-01 13:43:02 +02004#include <device/pci_ops.h>
Nicolas Reinecke572795b2014-12-29 19:57:29 +01005#include <northbridge/intel/sandybridge/raminit_native.h>
6#include <southbridge/intel/bd82x6x/pch.h>
Patrick Rudolphdb27e3382017-07-27 18:00:59 +02007#include <drivers/lenovo/hybrid_graphics/hybrid_graphics.h>
8#include <northbridge/intel/sandybridge/sandybridge.h>
9#include <device/device.h>
Patrick Rudolphdb27e3382017-07-27 18:00:59 +020010
11static void hybrid_graphics_init(void)
12{
13 bool peg, igd;
14 u32 reg32;
15
16 early_hybrid_graphics(&igd, &peg);
17
Evgeny Zinoviev384e9ae2018-08-30 02:18:48 +030018 if (peg && igd)
19 return;
20
Patrick Rudolphdb27e3382017-07-27 18:00:59 +020021 /* Hide disabled devices */
22 reg32 = pci_read_config32(PCI_DEV(0, 0, 0), DEVEN);
23 reg32 &= ~(DEVEN_PEG10 | DEVEN_IGD);
24
25 if (peg)
26 reg32 |= DEVEN_PEG10;
27
28 if (igd)
29 reg32 |= DEVEN_IGD;
30 else
31 /* Disable IGD VGA decode, no GTT or GFX stolen */
32 pci_write_config16(PCI_DEV(0, 0, 0), GGC, 2);
33
34 pci_write_config32(PCI_DEV(0, 0, 0), DEVEN, reg32);
35}
Nicolas Reinecke572795b2014-12-29 19:57:29 +010036
Nicolas Reinecke572795b2014-12-29 19:57:29 +010037const struct southbridge_usb_port mainboard_usb_ports[] = {
Peter Lemenkov18f88852019-10-23 22:07:58 +020038 { 0, 1, -1 }, /* P0: empty */
39 { 1, 1, 1 }, /* P1: system port 2 (To system port) (EHCI debug), OC 1 */
Nicolas Reinecke572795b2014-12-29 19:57:29 +010040 { 1, 1, -1 }, /* P2: HALF MINICARD (WLAN) no oc */
41 { 1, 0, -1 }, /* P3: WWAN, no OC */
42 { 1, 1, -1 }, /* P4: smartcard, no OC */
43 { 1, 1, -1 }, /* P5: ExpressCard, no OC */
44 { 0, 0, -1 }, /* P6: empty */
45 { 0, 0, -1 }, /* P7: empty */
46 { 0, 1, -1 }, /* P8: empty (touch panel) */
47 { 1, 0, 5 }, /* P9: system port 1 (To USBAO) (EHCI debug), OC 5 */
48 { 1, 0, -1 }, /* P10: fingerprint reader, no OC */
49 { 1, 1, -1 }, /* P11: bluetooth, no OC. */
50 { 1, 1, -1 }, /* P12: docking, no OC */
51 { 1, 1, -1 }, /* P13: camera (LCD), no OC */
52};
53
Peter Lemenkov498f1cc2019-02-07 10:48:10 +010054void mainboard_get_spd(spd_raw_data *spd, bool id_only)
55{
Kyösti Mälkkie258b9a2016-11-18 19:59:23 +020056 read_spd(&spd[0], 0x50, id_only);
57 read_spd(&spd[2], 0x51, id_only);
Nicolas Reinecke572795b2014-12-29 19:57:29 +010058}
Vladimir Serbinenko609bd942016-01-31 14:00:54 +010059
Patrick Rudolphdb27e3382017-07-27 18:00:59 +020060void mainboard_early_init(int s3resume)
61{
62 hybrid_graphics_init();
Vladimir Serbinenko609bd942016-01-31 14:00:54 +010063}