Angel Pons | 89ab250 | 2020-04-03 01:22:28 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Zaolin | a823f9b | 2014-05-06 21:31:45 +0200 | [diff] [blame] | 2 | |
| 3 | #include <stdint.h> |
Kyösti Mälkki | f1b58b7 | 2019-03-01 13:43:02 +0200 | [diff] [blame] | 4 | #include <device/pci_ops.h> |
Zaolin | a823f9b | 2014-05-06 21:31:45 +0200 | [diff] [blame] | 5 | #include <device/pci_def.h> |
Zaolin | a823f9b | 2014-05-06 21:31:45 +0200 | [diff] [blame] | 6 | #include <northbridge/intel/sandybridge/sandybridge.h> |
Zaolin | a823f9b | 2014-05-06 21:31:45 +0200 | [diff] [blame] | 7 | #include <southbridge/intel/bd82x6x/pch.h> |
Patrick Rudolph | db27e338 | 2017-07-27 18:00:59 +0200 | [diff] [blame] | 8 | #include <drivers/lenovo/hybrid_graphics/hybrid_graphics.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 | } |
Zaolin | a823f9b | 2014-05-06 21:31:45 +0200 | [diff] [blame] | 36 | |
Vladimir Serbinenko | fa1d688 | 2014-10-19 02:50:45 +0200 | [diff] [blame] | 37 | const struct southbridge_usb_port mainboard_usb_ports[] = { |
| 38 | { 1, 1, 0 }, /* P0 left dual conn, OC 0 */ |
Nico Rikken | ecea3d4 | 2018-01-30 19:00:45 +0100 | [diff] [blame] | 39 | { 1, 1, 1 }, /* P1 system onboard USB (eSATA), (EHCI debug), OC 1 */ |
Vladimir Serbinenko | fa1d688 | 2014-10-19 02:50:45 +0200 | [diff] [blame] | 40 | { 1, 2, -1 }, /* P2: wimax / WLAN */ |
| 41 | { 1, 1, -1 }, /* P3: WWAN, no OC */ |
| 42 | { 1, 1, -1 }, /* P4: smartcard, no OC */ |
| 43 | { 1, 1, -1 }, /* P5: ExpressCard, no OC */ |
| 44 | { 0, 2, -1 }, /* P6: empty */ |
| 45 | { 0, 2, -1 }, /* P7: to touch panel, no OC */ |
| 46 | { 1, 1, 4 }, /* P8: left dual conn, OC4 */ |
| 47 | { 1, 4, 5 }, /* P9: to system subcard back right, (EHCI debug), OC 5 */ |
| 48 | { 1, 1, -1 }, /* P10: fingerprint reader, no OC */ |
| 49 | { 1, 2, -1 }, /* P11: bluetooth, no OC. */ |
| 50 | { 1, 1, -1 }, /* P12: docking, no OC */ |
| 51 | { 1, 1, -1 }, /* P13: CAMERA (LCD), no OC */ |
| 52 | }; |
Zaolin | a823f9b | 2014-05-06 21:31:45 +0200 | [diff] [blame] | 53 | |
Patrick Rudolph | db27e338 | 2017-07-27 18:00:59 +0200 | [diff] [blame] | 54 | void mainboard_early_init(int s3resume) |
| 55 | { |
| 56 | hybrid_graphics_init(); |
Vladimir Serbinenko | 609bd94 | 2016-01-31 14:00:54 +0100 | [diff] [blame] | 57 | } |