blob: 1be50fd6ed10123dd7dcb08d0807ba00fd0305ed [file] [log] [blame]
Angel Pons89ab2502020-04-03 01:22:28 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Nicolas Reinecke2bffa8a2015-10-01 15:34:37 +02002
Kyösti Mälkkif1b58b72019-03-01 13:43:02 +02003#include <device/pci_ops.h>
Nicolas Reinecke2bffa8a2015-10-01 15:34:37 +02004#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 Reinecke2bffa8a2015-10-01 15:34:37 +020035
Elyes HAOUAS6dc9d032020-02-16 16:22:52 +010036// OC3 set in BIOS to port 2-7, OC7 set in BIOS to port 10-13
Nicolas Reinecke2bffa8a2015-10-01 15:34:37 +020037const struct southbridge_usb_port mainboard_usb_ports[] = {
38 { 1, 1, 0 }, /* P0: system port 4, OC0 */
39 { 1, 1, 1 }, /* P1: system port 2 (EHCI debug), OC 1 */
40 { 1, 1, -1 }, /* P2: HALF MINICARD (WLAN) no oc */
41 { 1, 0, -1 }, /* P3: WWAN, no OC */
42 { 1, 0, -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 { 1, 1, 4 }, /* P8: system port 3, OC4*/
47 { 1, 1, 5 }, /* P9: system port 1 (EHCI debug), OC 5 */
48 { 1, 0, -1 }, /* P10: fingerprint reader, no OC */
49 { 1, 0, -1 }, /* P11: bluetooth, no OC. */
50 { 1, 1, -1 }, /* P12: docking, no OC */
51 { 1, 1, -1 }, /* P13: camera (LCD), no OC */
52};
53
Kyösti Mälkkie258b9a2016-11-18 19:59:23 +020054void mainboard_get_spd(spd_raw_data *spd, bool id_only)
Nicolas Reinecke2bffa8a2015-10-01 15:34:37 +020055{
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 Reinecke2bffa8a2015-10-01 15:34:37 +020058}
59
60void mainboard_early_init(int s3resume)
61{
Patrick Rudolphdb27e3382017-07-27 18:00:59 +020062 hybrid_graphics_init();
Nicolas Reinecke2bffa8a2015-10-01 15:34:37 +020063}