Angel Pons | 89ab250 | 2020-04-03 01:22:28 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
| 2 | /* This file is part of the coreboot project. */ |
Nicolas Reinecke | 572795b | 2014-12-29 19:57:29 +0100 | [diff] [blame] | 3 | |
Kyösti Mälkki | f1b58b7 | 2019-03-01 13:43:02 +0200 | [diff] [blame] | 4 | #include <device/pci_ops.h> |
Nicolas Reinecke | 572795b | 2014-12-29 19:57:29 +0100 | [diff] [blame] | 5 | #include <northbridge/intel/sandybridge/raminit_native.h> |
| 6 | #include <southbridge/intel/bd82x6x/pch.h> |
Patrick Rudolph | db27e338 | 2017-07-27 18:00:59 +0200 | [diff] [blame] | 7 | #include <drivers/lenovo/hybrid_graphics/hybrid_graphics.h> |
| 8 | #include <northbridge/intel/sandybridge/sandybridge.h> |
| 9 | #include <device/device.h> |
Patrick Rudolph | db27e338 | 2017-07-27 18:00:59 +0200 | [diff] [blame] | 10 | |
| 11 | static void hybrid_graphics_init(void) |
| 12 | { |
| 13 | bool peg, igd; |
| 14 | u32 reg32; |
| 15 | |
| 16 | early_hybrid_graphics(&igd, &peg); |
| 17 | |
Evgeny Zinoviev | 384e9ae | 2018-08-30 02:18:48 +0300 | [diff] [blame] | 18 | if (peg && igd) |
| 19 | return; |
| 20 | |
Patrick Rudolph | db27e338 | 2017-07-27 18:00:59 +0200 | [diff] [blame] | 21 | /* 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 Reinecke | 572795b | 2014-12-29 19:57:29 +0100 | [diff] [blame] | 36 | |
Nicolas Reinecke | 572795b | 2014-12-29 19:57:29 +0100 | [diff] [blame] | 37 | const struct southbridge_usb_port mainboard_usb_ports[] = { |
Peter Lemenkov | 18f8885 | 2019-10-23 22:07:58 +0200 | [diff] [blame^] | 38 | { 0, 1, -1 }, /* P0: empty */ |
| 39 | { 1, 1, 1 }, /* P1: system port 2 (To system port) (EHCI debug), OC 1 */ |
Nicolas Reinecke | 572795b | 2014-12-29 19:57:29 +0100 | [diff] [blame] | 40 | { 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 Lemenkov | 498f1cc | 2019-02-07 10:48:10 +0100 | [diff] [blame] | 54 | void mainboard_get_spd(spd_raw_data *spd, bool id_only) |
| 55 | { |
Kyösti Mälkki | e258b9a | 2016-11-18 19:59:23 +0200 | [diff] [blame] | 56 | read_spd(&spd[0], 0x50, id_only); |
| 57 | read_spd(&spd[2], 0x51, id_only); |
Nicolas Reinecke | 572795b | 2014-12-29 19:57:29 +0100 | [diff] [blame] | 58 | } |
Vladimir Serbinenko | 609bd94 | 2016-01-31 14:00:54 +0100 | [diff] [blame] | 59 | |
Patrick Rudolph | db27e338 | 2017-07-27 18:00:59 +0200 | [diff] [blame] | 60 | void mainboard_early_init(int s3resume) |
| 61 | { |
| 62 | hybrid_graphics_init(); |
Vladimir Serbinenko | 609bd94 | 2016-01-31 14:00:54 +0100 | [diff] [blame] | 63 | } |