blob: 817797f67ee9db5cef0f55bbea92edb10e9bf17b [file] [log] [blame]
Angel Pons89ab2502020-04-03 01:22:28 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Iru Caib5594322019-06-30 21:16:50 +08002
3#include <stdint.h>
Iru Caib5594322019-06-30 21:16:50 +08004#include <northbridge/intel/haswell/haswell.h>
Angel Pons45f448f2020-07-03 14:46:47 +02005#include <northbridge/intel/haswell/raminit.h>
Iru Caib5594322019-06-30 21:16:50 +08006#include <southbridge/intel/lynxpoint/pch.h>
Chris Morganf8a13d52020-02-05 12:38:48 -06007#include <option.h>
8#include <ec/lenovo/pmh7/pmh7.h>
9#include <device/pci_ops.h>
Iru Caib5594322019-06-30 21:16:50 +080010
Angel Pons6e1c4712020-07-03 13:05:10 +020011void mainboard_config_rcba(void)
12{
13 RCBA16(D31IR) = DIR_ROUTE(PIRQA, PIRQD, PIRQC, PIRQA);
14 RCBA16(D29IR) = DIR_ROUTE(PIRQH, PIRQD, PIRQA, PIRQC);
15 RCBA16(D28IR) = DIR_ROUTE(PIRQA, PIRQA, PIRQA, PIRQA);
16 RCBA16(D27IR) = DIR_ROUTE(PIRQG, PIRQB, PIRQC, PIRQD);
17 RCBA16(D26IR) = DIR_ROUTE(PIRQA, PIRQF, PIRQC, PIRQD);
18 RCBA16(D25IR) = DIR_ROUTE(PIRQE, PIRQF, PIRQG, PIRQH);
19 RCBA16(D22IR) = DIR_ROUTE(PIRQA, PIRQB, PIRQC, PIRQD);
20 RCBA16(D20IR) = DIR_ROUTE(PIRQA, PIRQB, PIRQC, PIRQD);
21}
Iru Caib5594322019-06-30 21:16:50 +080022
Angel Pons73fa0352020-07-03 12:29:03 +020023void mb_late_romstage_setup(void)
24{
Angel Ponsf8a5eb22020-11-02 22:49:51 +010025 u8 enable_peg = get_int_option("enable_dual_graphics", 0);
Angel Pons73fa0352020-07-03 12:29:03 +020026
27 bool power_en = pmh7_dgpu_power_state();
28
29 if (enable_peg != power_en)
30 pmh7_dgpu_power_enable(!power_en);
31
32 if (!enable_peg) {
33 // Hide disabled dGPU device
34 u32 reg32 = pci_read_config32(PCI_DEV(0, 0, 0), DEVEN);
35 reg32 &= ~DEVEN_D1F0EN;
36
37 pci_write_config32(PCI_DEV(0, 0, 0), DEVEN, reg32);
38 }
39}
40
Angel Pons90ae0892021-03-12 17:00:52 +010041void mb_get_spd_map(struct spd_info *spdi)
Angel Ponsd37b7d82020-07-03 23:52:34 +020042{
Angel Ponsc4ee7142021-03-12 20:48:53 +010043 spdi->addresses[0] = 0x50;
44 spdi->addresses[2] = 0x51;
Angel Ponsd37b7d82020-07-03 23:52:34 +020045}
46
Angel Ponsd0f971f2021-03-12 14:20:05 +010047const struct usb2_port_config mainboard_usb2_ports[MAX_USB2_PORTS] = {
Angel Ponsa3c6ed02021-02-11 13:59:12 +010048 /* Length, Enable, OCn#, Location */
49 { 0x0040, 1, 0, USB_PORT_BACK_PANEL }, /* USB3 */
50 { 0x0040, 1, 0, USB_PORT_BACK_PANEL }, /* USB3 */
51 { 0x0110, 1, 1, USB_PORT_BACK_PANEL }, /* USB2 charge */
52 { 0x0040, 1, USB_OC_PIN_SKIP, USB_PORT_BACK_PANEL },
53 { 0x0080, 1, USB_OC_PIN_SKIP, USB_PORT_DOCK },
54 { 0x0080, 1, 2, USB_PORT_BACK_PANEL }, /* USB2 */
55 { 0x0040, 1, 3, USB_PORT_BACK_PANEL },
56 { 0x0040, 1, 3, USB_PORT_BACK_PANEL },
57 { 0x0040, 1, 4, USB_PORT_BACK_PANEL },
58 { 0x0110, 1, 4, USB_PORT_BACK_PANEL }, /* WWAN */
59 { 0x0040, 1, 5, USB_PORT_INTERNAL }, /* WLAN */
60 { 0x0040, 1, 5, USB_PORT_BACK_PANEL }, /* webcam */
61 { 0x0080, 1, 6, USB_PORT_BACK_PANEL },
62 { 0x0040, 1, 6, USB_PORT_BACK_PANEL },
63};
Iru Caib5594322019-06-30 21:16:50 +080064
Angel Ponsd0f971f2021-03-12 14:20:05 +010065const struct usb3_port_config mainboard_usb3_ports[MAX_USB3_PORTS] = {
Angel Ponsa3c6ed02021-02-11 13:59:12 +010066 { 1, 0 },
67 { 1, 0 },
68 { 1, USB_OC_PIN_SKIP },
69 { 1, USB_OC_PIN_SKIP },
70 { 1, 1 },
71 { 1, 1 }, /* WWAN */
72};