Angel Pons | 89ab250 | 2020-04-03 01:22:28 +0200 | [diff] [blame] | 1 | /* SPDX-License-Identifier: GPL-2.0-only */ |
Iru Cai | b559432 | 2019-06-30 21:16:50 +0800 | [diff] [blame] | 2 | |
| 3 | #include <stdint.h> |
Iru Cai | b559432 | 2019-06-30 21:16:50 +0800 | [diff] [blame] | 4 | #include <northbridge/intel/haswell/haswell.h> |
Angel Pons | 45f448f | 2020-07-03 14:46:47 +0200 | [diff] [blame] | 5 | #include <northbridge/intel/haswell/raminit.h> |
Iru Cai | b559432 | 2019-06-30 21:16:50 +0800 | [diff] [blame] | 6 | #include <southbridge/intel/lynxpoint/pch.h> |
Chris Morgan | f8a13d5 | 2020-02-05 12:38:48 -0600 | [diff] [blame] | 7 | #include <option.h> |
| 8 | #include <ec/lenovo/pmh7/pmh7.h> |
| 9 | #include <device/pci_ops.h> |
Iru Cai | b559432 | 2019-06-30 21:16:50 +0800 | [diff] [blame] | 10 | |
Angel Pons | 6e1c471 | 2020-07-03 13:05:10 +0200 | [diff] [blame] | 11 | void 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 Cai | b559432 | 2019-06-30 21:16:50 +0800 | [diff] [blame] | 22 | |
Angel Pons | 73fa035 | 2020-07-03 12:29:03 +0200 | [diff] [blame] | 23 | void mb_late_romstage_setup(void) |
| 24 | { |
Angel Pons | f8a5eb2 | 2020-11-02 22:49:51 +0100 | [diff] [blame] | 25 | u8 enable_peg = get_int_option("enable_dual_graphics", 0); |
Angel Pons | 73fa035 | 2020-07-03 12:29:03 +0200 | [diff] [blame] | 26 | |
| 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 Pons | 90ae089 | 2021-03-12 17:00:52 +0100 | [diff] [blame] | 41 | void mb_get_spd_map(struct spd_info *spdi) |
Angel Pons | d37b7d8 | 2020-07-03 23:52:34 +0200 | [diff] [blame] | 42 | { |
Angel Pons | c4ee714 | 2021-03-12 20:48:53 +0100 | [diff] [blame] | 43 | spdi->addresses[0] = 0x50; |
| 44 | spdi->addresses[2] = 0x51; |
Angel Pons | d37b7d8 | 2020-07-03 23:52:34 +0200 | [diff] [blame] | 45 | } |
| 46 | |
Angel Pons | d0f971f | 2021-03-12 14:20:05 +0100 | [diff] [blame] | 47 | const struct usb2_port_config mainboard_usb2_ports[MAX_USB2_PORTS] = { |
Angel Pons | a3c6ed0 | 2021-02-11 13:59:12 +0100 | [diff] [blame] | 48 | /* 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 Cai | b559432 | 2019-06-30 21:16:50 +0800 | [diff] [blame] | 64 | |
Angel Pons | d0f971f | 2021-03-12 14:20:05 +0100 | [diff] [blame] | 65 | const struct usb3_port_config mainboard_usb3_ports[MAX_USB3_PORTS] = { |
Angel Pons | a3c6ed0 | 2021-02-11 13:59:12 +0100 | [diff] [blame] | 66 | { 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 | }; |