blob: 9080f46c49f73fe294810c758c84e853a4622cbc [file] [log] [blame]
Angel Ponsd28443e2020-04-05 13:22:44 +02001/* SPDX-License-Identifier: GPL-2.0-only */
Matt DeVillierc12e5ae2016-11-27 02:19:02 -06002
Matt DeVillierc12e5ae2016-11-27 02:19:02 -06003#include <string.h>
4#include <cbfs.h>
5#include <console/console.h>
6#include <cpu/intel/haswell/haswell.h>
7#include "ec/google/chromeec/ec.h"
8#include <northbridge/intel/haswell/haswell.h>
9#include <northbridge/intel/haswell/raminit.h>
10#include <southbridge/intel/lynxpoint/pch.h>
11#include <southbridge/intel/lynxpoint/lp_gpio.h>
Matt DeVillierc12e5ae2016-11-27 02:19:02 -060012#include "../../variant.h"
13
Matt DeVillierc12e5ae2016-11-27 02:19:02 -060014/* Copy SPD data for on-board memory */
Angel Pons6eea1912020-07-03 14:14:30 +020015void copy_spd(struct pei_data *peid)
Matt DeVillierc12e5ae2016-11-27 02:19:02 -060016{
17 const int gpio_vector[] = {13, 9, 47, -1};
18 int spd_index = get_gpios(gpio_vector);
19 char *spd_file;
20 size_t spd_file_len;
Matt DeVilliercadd7c72017-05-29 19:10:57 -050021 size_t spd_len = sizeof(peid->spd_data[0]);
Matt DeVillierc12e5ae2016-11-27 02:19:02 -060022
23 printk(BIOS_DEBUG, "SPD index %d\n", spd_index);
Julius Werner834b3ec2020-03-04 16:52:08 -080024 spd_file = cbfs_map("spd.bin", &spd_file_len);
Matt DeVillierc12e5ae2016-11-27 02:19:02 -060025 if (!spd_file)
26 die("SPD data not found.");
27
Matt DeVilliercadd7c72017-05-29 19:10:57 -050028 if (spd_file_len < ((spd_index + 1) * spd_len)) {
Matt DeVillierc12e5ae2016-11-27 02:19:02 -060029 printk(BIOS_ERR, "SPD index override to 0 - old hardware?\n");
30 spd_index = 0;
31 }
32
Matt DeVilliercadd7c72017-05-29 19:10:57 -050033 if (spd_file_len < spd_len)
Matt DeVillierc12e5ae2016-11-27 02:19:02 -060034 die("Missing SPD data.");
35
Matt DeVilliercadd7c72017-05-29 19:10:57 -050036 memcpy(peid->spd_data[0], spd_file + (spd_index * spd_len), spd_len);
37
Matt DeVillierc12e5ae2016-11-27 02:19:02 -060038 /* Index 0-2, are 4GB config with both CH0 and CH1
39 * Index 3-5, are 2GB config with CH0 only
40 */
41 switch (spd_index) {
Matt DeVilliercadd7c72017-05-29 19:10:57 -050042 case 0: case 1: case 2:
43 memcpy(peid->spd_data[1],
44 spd_file + (spd_index * spd_len), spd_len);
45 break;
Matt DeVillierc12e5ae2016-11-27 02:19:02 -060046 case 3: case 4: case 5:
47 peid->dimm_channel1_disabled = 3;
48 }
Matt DeVillierc12e5ae2016-11-27 02:19:02 -060049}
50
Angel Ponsa3c6ed02021-02-11 13:59:12 +010051const struct usb2_port_setting mainboard_usb2_ports[MAX_USB2_PORTS] = {
52 /* Length, Enable, OCn#, Location */
53 { 0x0040, 1, 0, /* P0: Port A, CN10 */
54 USB_PORT_BACK_PANEL },
55 { 0x0040, 1, 2, /* P1: Port B, CN11 */
56 USB_PORT_BACK_PANEL },
57 { 0x0080, 1, USB_OC_PIN_SKIP, /* P2: CCD */
58 USB_PORT_INTERNAL },
59 { 0x0040, 1, USB_OC_PIN_SKIP, /* P3: BT */
60 USB_PORT_MINI_PCIE },
61 { 0x0040, 1, USB_OC_PIN_SKIP, /* P4: LTE */
62 USB_PORT_INTERNAL },
63 { 0x0000, 1, USB_OC_PIN_SKIP, /* P5: EMPTY */
64 USB_PORT_SKIP },
65 { 0x0040, 1, USB_OC_PIN_SKIP, /* P6: SD Card */
66 USB_PORT_INTERNAL },
67 { 0x0000, 0, USB_OC_PIN_SKIP, /* P7: EMPTY */
68 USB_PORT_SKIP },
69};
Matt DeVillierc12e5ae2016-11-27 02:19:02 -060070
Angel Ponsa3c6ed02021-02-11 13:59:12 +010071const struct usb3_port_setting mainboard_usb3_ports[MAX_USB3_PORTS] = {
72 /* Enable, OCn# */
73 { 1, 0 }, /* P1; Port A, CN10 */
74 { 1, 2 }, /* P2; Port B, CN11 */
75 { 0, USB_OC_PIN_SKIP }, /* P3; */
76 { 0, USB_OC_PIN_SKIP }, /* P4; */
77};