blob: e24dcb9808ad7d7b14e40a9add426d5166f37d7a [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 <northbridge/intel/haswell/haswell.h>
8#include <northbridge/intel/haswell/raminit.h>
9#include <southbridge/intel/lynxpoint/pch.h>
10#include <southbridge/intel/lynxpoint/lp_gpio.h>
Matt DeVillierc12e5ae2016-11-27 02:19:02 -060011#include "../../variant.h"
12
Matt DeVillierc12e5ae2016-11-27 02:19:02 -060013/* Copy SPD data for on-board memory */
Angel Pons6eea1912020-07-03 14:14:30 +020014void copy_spd(struct pei_data *peid)
Matt DeVillierc12e5ae2016-11-27 02:19:02 -060015{
16 const int gpio_vector[] = {13, 9, 47, -1};
17 int spd_index = get_gpios(gpio_vector);
18 char *spd_file;
19 size_t spd_file_len;
Matt DeVilliercadd7c72017-05-29 19:10:57 -050020 size_t spd_len = sizeof(peid->spd_data[0]);
Matt DeVillierc12e5ae2016-11-27 02:19:02 -060021
22 printk(BIOS_DEBUG, "SPD index %d\n", spd_index);
Julius Werner834b3ec2020-03-04 16:52:08 -080023 spd_file = cbfs_map("spd.bin", &spd_file_len);
Matt DeVillierc12e5ae2016-11-27 02:19:02 -060024 if (!spd_file)
25 die("SPD data not found.");
26
Matt DeVilliercadd7c72017-05-29 19:10:57 -050027 if (spd_file_len < ((spd_index + 1) * spd_len)) {
28 printk(BIOS_ERR, "SPD index override to 0 - old hardware?\n");
29 spd_index = 0;
30 }
31
32 if (spd_file_len < spd_len)
33 die("Missing SPD data.");
34
35 memcpy(peid->spd_data[0], spd_file + (spd_index * spd_len), spd_len);
36
Matt DeVillierc12e5ae2016-11-27 02:19:02 -060037 /* Limiting to a single dimm for 2GB configuration
38 * Identified by bit 3
39 */
40 if (spd_index & 0x4)
41 peid->dimm_channel1_disabled = 3;
Matt DeVilliercadd7c72017-05-29 19:10:57 -050042 else
43 memcpy(peid->spd_data[1],
44 spd_file + (spd_index * spd_len), spd_len);
Matt DeVillierc12e5ae2016-11-27 02:19:02 -060045}
46
Angel Pons14c4f4f2020-07-03 14:22:20 +020047void variant_romstage_entry(struct pei_data *pei_data)
Matt DeVillierc12e5ae2016-11-27 02:19:02 -060048{
Angel Pons8d3bc492020-07-03 01:43:04 +020049 struct usb2_port_setting usb2_ports[MAX_USB2_PORTS] = {
50 /* Length, Enable, OCn#, Location */
51 { 0x0040, 1, 0, /* P0: Port A, CN10 */
52 USB_PORT_BACK_PANEL },
53 { 0x0040, 1, 2, /* P1: Port B, CN11 */
54 USB_PORT_BACK_PANEL },
55 { 0x0080, 1, USB_OC_PIN_SKIP, /* P2: CCD */
56 USB_PORT_INTERNAL },
57 { 0x0040, 1, USB_OC_PIN_SKIP, /* P3: BT */
58 USB_PORT_MINI_PCIE },
59 { 0x0080, 1, USB_OC_PIN_SKIP, /* P4: SD Card */
60 USB_PORT_INTERNAL },
61 { 0x0040, 1, USB_OC_PIN_SKIP, /* P5: LTE */
62 USB_PORT_INTERNAL },
63 { 0x0040, 1, USB_OC_PIN_SKIP, /* P6: SIM CARD */
64 USB_PORT_FLEX },
65 { 0x0000, 0, USB_OC_PIN_SKIP, /* P7: EMPTY */
66 USB_PORT_SKIP },
Matt DeVillierc12e5ae2016-11-27 02:19:02 -060067 };
68
Angel Pons8d3bc492020-07-03 01:43:04 +020069 struct usb3_port_setting usb3_ports[MAX_USB3_PORTS] = {
70 /* Enable, OCn# */
71 { 1, 0 }, /* P1; Port A, CN10 */
72 { 1, 2 }, /* P2; Port B, CN11 */
73 { 0, USB_OC_PIN_SKIP }, /* P3; */
74 { 0, USB_OC_PIN_SKIP }, /* P4; */
Matt DeVillierc12e5ae2016-11-27 02:19:02 -060075 };
76
Angel Pons14c4f4f2020-07-03 14:22:20 +020077 memcpy(pei_data->usb2_ports, usb2_ports, sizeof(usb2_ports));
78 memcpy(pei_data->usb3_ports, usb3_ports, sizeof(usb3_ports));
Matt DeVillierc12e5ae2016-11-27 02:19:02 -060079}