blob: 53ed5041c3b59083e42e7344bf1ae46e473facfc [file] [log] [blame]
Simon Glass42bf7db2019-12-08 17:40:19 -07001// SPDX-License-Identifier: GPL-2.0+
2/*
3 * Copyright 2019 Google LLC
4 * Written by Simon Glass <sjg@chromium.org>
5 */
6
7#include <common.h>
Simon Glass42bf7db2019-12-08 17:40:19 -07008#include <binman.h>
Simon Glass1ea97892020-05-10 11:40:00 -06009#include <bootstage.h>
Simon Glass42bf7db2019-12-08 17:40:19 -070010#include <dm.h>
Simon Glass97589732020-05-10 11:40:02 -060011#include <init.h>
Simon Glass42bf7db2019-12-08 17:40:19 -070012#include <irq.h>
Simon Glass0f2af882020-05-10 11:40:05 -060013#include <log.h>
Simon Glass9bc15642020-02-03 07:36:16 -070014#include <malloc.h>
Simon Glass50461092020-04-08 16:57:35 -060015#include <acpi/acpi_s3.h>
Simon Glass42bf7db2019-12-08 17:40:19 -070016#include <asm/intel_pinctrl.h>
17#include <asm/io.h>
18#include <asm/intel_regs.h>
19#include <asm/msr.h>
20#include <asm/msr-index.h>
21#include <asm/pci.h>
22#include <asm/arch/cpu.h>
23#include <asm/arch/systemagent.h>
24#include <asm/arch/fsp/fsp_configs.h>
25#include <asm/arch/fsp/fsp_s_upd.h>
Simon Glass4dcacfc2020-05-10 11:40:13 -060026#include <linux/bitops.h>
Simon Glass42bf7db2019-12-08 17:40:19 -070027
28#define PCH_P2SB_E0 0xe0
29#define HIDE_BIT BIT(0)
30
31#define INTEL_GSPI_MAX 3
Simon Glass42bf7db2019-12-08 17:40:19 -070032#define MAX_USB2_PORTS 8
33
34enum {
35 CHIPSET_LOCKDOWN_FSP = 0, /* FSP handles locking per UPDs */
36 CHIPSET_LOCKDOWN_COREBOOT, /* coreboot handles locking */
37};
38
Simon Glass42bf7db2019-12-08 17:40:19 -070039/* Serial IRQ control. SERIRQ_QUIET is the default (0) */
40enum serirq_mode {
41 SERIRQ_QUIET,
42 SERIRQ_CONTINUOUS,
43 SERIRQ_OFF,
44};
45
Simon Glass42bf7db2019-12-08 17:40:19 -070046struct gspi_cfg {
47 /* Bus speed in MHz */
48 u32 speed_mhz;
49 /* Bus should be enabled prior to ramstage with temporary base */
50 u8 early_init;
51};
52
53/*
54 * This structure will hold data required by common blocks.
55 * These are soc specific configurations which will be filled by soc.
56 * We'll fill this structure once during init and use the data in common block.
57 */
58struct soc_intel_common_config {
59 int chipset_lockdown;
60 struct gspi_cfg gspi[INTEL_GSPI_MAX];
Simon Glass42bf7db2019-12-08 17:40:19 -070061};
62
63enum pnp_settings {
64 PNP_PERF,
65 PNP_POWER,
66 PNP_PERF_POWER,
67};
68
69struct usb2_eye_per_port {
70 u8 per_port_tx_pe_half;
71 u8 per_port_pe_txi_set;
72 u8 per_port_txi_set;
73 u8 hs_skew_sel;
74 u8 usb_tx_emphasis_en;
75 u8 per_port_rxi_set;
76 u8 hs_npre_drv_sel;
77 u8 override_en;
78};
79
80struct apl_config {
81 /* Common structure containing soc config data required by common code*/
82 struct soc_intel_common_config common_soc_config;
83
84 /*
85 * Mapping from PCIe root port to CLKREQ input on the SOC. The SOC has
86 * four CLKREQ inputs, but six root ports. Root ports without an
87 * associated CLKREQ signal must be marked with "CLKREQ_DISABLED"
88 */
89 u8 pcie_rp_clkreq_pin[MAX_PCIE_PORTS];
90
91 /* Enable/disable hot-plug for root ports (0 = disable, 1 = enable) */
92 u8 pcie_rp_hotplug_enable[MAX_PCIE_PORTS];
93
94 /* De-emphasis enable configuration for each PCIe root port */
95 u8 pcie_rp_deemphasis_enable[MAX_PCIE_PORTS];
96
97 /*
98 * [14:8] DDR mode Number of dealy elements.Each = 125pSec.
99 * [6:0] SDR mode Number of dealy elements.Each = 125pSec.
100 */
101 u32 emmc_tx_cmd_cntl;
102
103 /*
104 * [14:8] HS400 mode Number of dealy elements.Each = 125pSec.
105 * [6:0] SDR104/HS200 mode Number of dealy elements.Each = 125pSec.
106 */
107 u32 emmc_tx_data_cntl1;
108
109 /*
110 * [30:24] SDR50 mode Number of dealy elements.Each = 125pSec.
111 * [22:16] DDR50 mode Number of dealy elements.Each = 125pSec.
112 * [14:8] SDR25/HS50 mode Number of dealy elements.Each = 125pSec.
113 * [6:0] SDR12/Compatibility mode Number of dealy elements.
114 * Each = 125pSec.
115 */
116 u32 emmc_tx_data_cntl2;
117
118 /*
119 * [30:24] SDR50 mode Number of dealy elements.Each = 125pSec.
120 * [22:16] DDR50 mode Number of dealy elements.Each = 125pSec.
121 * [14:8] SDR25/HS50 mode Number of dealy elements.Each = 125pSec.
122 * [6:0] SDR12/Compatibility mode Number of dealy elements.
123 * Each = 125pSec.
124 */
125 u32 emmc_rx_cmd_data_cntl1;
126
127 /*
128 * [14:8] HS400 mode 1 Number of dealy elements.Each = 125pSec.
129 * [6:0] HS400 mode 2 Number of dealy elements.Each = 125pSec.
130 */
131 u32 emmc_rx_strobe_cntl;
132
133 /*
134 * [13:8] Auto Tuning mode Number of dealy elements.Each = 125pSec.
135 * [6:0] SDR104/HS200 Number of dealy elements.Each = 125pSec.
136 */
137 u32 emmc_rx_cmd_data_cntl2;
138
139 /* Select the eMMC max speed allowed */
140 u32 emmc_host_max_speed;
141
142 /* Specifies on which IRQ the SCI will internally appear */
143 u32 sci_irq;
144
145 /* Configure serial IRQ (SERIRQ) line */
146 enum serirq_mode serirq_mode;
147
148 /* Configure LPSS S0ix Enable */
149 bool lpss_s0ix_enable;
150
151 /* Enable DPTF support */
152 bool dptf_enable;
153
154 /* TCC activation offset value in degrees Celsius */
155 int tcc_offset;
156
157 /*
158 * Configure Audio clk gate and power gate
159 * IOSF-SB port ID 92 offset 0x530 [5] and [3]
160 */
161 bool hdaudio_clk_gate_enable;
162 bool hdaudio_pwr_gate_enable;
163 bool hdaudio_bios_config_lockdown;
164
165 /* SLP S3 minimum assertion width */
166 int slp_s3_assertion_width_usecs;
167
168 /* GPIO pin for PERST_0 */
169 u32 prt0_gpio;
170
171 /* USB2 eye diagram settings per port */
172 struct usb2_eye_per_port usb2eye[MAX_USB2_PORTS];
173
174 /* GPIO SD card detect pin */
175 unsigned int sdcard_cd_gpio;
176
177 /*
178 * PRMRR size setting with three options
179 * 0x02000000 - 32MiB
180 * 0x04000000 - 64MiB
181 * 0x08000000 - 128MiB
182 */
183 u32 PrmrrSize;
184
185 /*
186 * Enable SGX feature.
187 * Enabling SGX feature is 2 step process,
188 * (1) set sgx_enable = 1
189 * (2) set PrmrrSize to supported size
190 */
191 bool sgx_enable;
192
193 /*
194 * Select PNP Settings.
195 * (0) Performance,
196 * (1) Power
197 * (2) Power & Performance
198 */
199 enum pnp_settings pnp_settings;
200
201 /*
202 * PMIC PCH_PWROK delay configuration - IPC Configuration
203 * Upd for changing PCH_PWROK delay configuration : I2C_Slave_Address
204 * (31:24) + Register_Offset (23:16) + OR Value (15:8) + AND Value (7:0)
205 */
206 u32 pmic_pmc_ipc_ctrl;
207
208 /*
209 * Options to disable XHCI Link Compliance Mode. Default is FALSE to not
210 * disable Compliance Mode. Set TRUE to disable Compliance Mode.
211 * 0:FALSE(Default), 1:True.
212 */
213 bool disable_compliance_mode;
214
215 /*
216 * Options to change USB3 ModPhy setting for the Integrated Filter (IF)
217 * value. Default is 0 to not changing default IF value (0x12). Set
218 * value with the range from 0x01 to 0xff to change IF value.
219 */
220 u32 mod_phy_if_value;
221
222 /*
223 * Options to bump USB3 LDO voltage. Default is FALSE to not increasing
224 * LDO voltage. Set TRUE to increase LDO voltage with 40mV.
225 * 0:FALSE (default), 1:True.
226 */
227 bool mod_phy_voltage_bump;
228
229 /*
230 * Options to adjust PMIC Vdd2 voltage. Default is 0 to not adjusting
231 * the PMIC Vdd2 default voltage 1.20v. Upd for changing Vdd2 Voltage
232 * configuration: I2C_Slave_Address (31:23) + Register_Offset (23:16)
233 * + OR Value (15:8) + AND Value (7:0) through BUCK5_VID[3:2]:
234 * 00=1.10v, 01=1.15v, 10=1.24v, 11=1.20v (default).
235 */
236 u32 pmic_vdd2_voltage;
237
238 /* Option to enable VTD feature */
239 bool enable_vtd;
240};
241
242static int get_config(struct udevice *dev, struct apl_config *apl)
243{
244 const u8 *ptr;
245 ofnode node;
246 u32 emmc[4];
247 int ret;
248
249 memset(apl, '\0', sizeof(*apl));
250
251 node = dev_read_subnode(dev, "fsp-s");
252 if (!ofnode_valid(node))
253 return log_msg_ret("fsp-s settings", -ENOENT);
254
255 ptr = ofnode_read_u8_array_ptr(node, "pcie-rp-clkreq-pin",
256 MAX_PCIE_PORTS);
257 if (!ptr)
258 return log_msg_ret("pcie-rp-clkreq-pin", -EINVAL);
259 memcpy(apl->pcie_rp_clkreq_pin, ptr, MAX_PCIE_PORTS);
260
261 ret = ofnode_read_u32(node, "prt0-gpio", &apl->prt0_gpio);
262 if (ret)
263 return log_msg_ret("prt0-gpio", ret);
264 ret = ofnode_read_u32(node, "sdcard-cd-gpio", &apl->sdcard_cd_gpio);
265 if (ret)
266 return log_msg_ret("sdcard-cd-gpio", ret);
267
268 ret = ofnode_read_u32_array(node, "emmc", emmc, ARRAY_SIZE(emmc));
269 if (ret)
270 return log_msg_ret("emmc", ret);
271 apl->emmc_tx_data_cntl1 = emmc[0];
272 apl->emmc_tx_data_cntl2 = emmc[1];
273 apl->emmc_rx_cmd_data_cntl1 = emmc[2];
274 apl->emmc_rx_cmd_data_cntl2 = emmc[3];
275
276 apl->dptf_enable = ofnode_read_bool(node, "dptf-enable");
277
278 apl->hdaudio_clk_gate_enable = ofnode_read_bool(node,
279 "hdaudio-clk-gate-enable");
280 apl->hdaudio_pwr_gate_enable = ofnode_read_bool(node,
281 "hdaudio-pwr-gate-enable");
282 apl->hdaudio_bios_config_lockdown = ofnode_read_bool(node,
283 "hdaudio-bios-config-lockdown");
284 apl->lpss_s0ix_enable = ofnode_read_bool(node, "lpss-s0ix-enable");
285
286 /* Santa */
287 apl->usb2eye[1].per_port_pe_txi_set = 7;
288 apl->usb2eye[1].per_port_txi_set = 2;
289
290 return 0;
291}
292
293static void apl_fsp_silicon_init_params_cb(struct apl_config *apl,
294 struct fsp_s_config *cfg)
295{
296 u8 port;
297
298 for (port = 0; port < MAX_USB2_PORTS; port++) {
299 if (apl->usb2eye[port].per_port_tx_pe_half)
300 cfg->port_usb20_per_port_tx_pe_half[port] =
301 apl->usb2eye[port].per_port_tx_pe_half;
302
303 if (apl->usb2eye[port].per_port_pe_txi_set)
304 cfg->port_usb20_per_port_pe_txi_set[port] =
305 apl->usb2eye[port].per_port_pe_txi_set;
306
307 if (apl->usb2eye[port].per_port_txi_set)
308 cfg->port_usb20_per_port_txi_set[port] =
309 apl->usb2eye[port].per_port_txi_set;
310
311 if (apl->usb2eye[port].hs_skew_sel)
312 cfg->port_usb20_hs_skew_sel[port] =
313 apl->usb2eye[port].hs_skew_sel;
314
315 if (apl->usb2eye[port].usb_tx_emphasis_en)
316 cfg->port_usb20_i_usb_tx_emphasis_en[port] =
317 apl->usb2eye[port].usb_tx_emphasis_en;
318
319 if (apl->usb2eye[port].per_port_rxi_set)
320 cfg->port_usb20_per_port_rxi_set[port] =
321 apl->usb2eye[port].per_port_rxi_set;
322
323 if (apl->usb2eye[port].hs_npre_drv_sel)
324 cfg->port_usb20_hs_npre_drv_sel[port] =
325 apl->usb2eye[port].hs_npre_drv_sel;
326 }
327}
328
329int fsps_update_config(struct udevice *dev, ulong rom_offset,
330 struct fsps_upd *upd)
331{
332 struct fsp_s_config *cfg = &upd->config;
333 struct apl_config *apl;
Simon Glass42bf7db2019-12-08 17:40:19 -0700334
Bernhard Messerklinger7f8ff512020-05-18 12:33:33 +0200335 if (IS_ENABLED(CONFIG_HAVE_VBT)) {
336 struct binman_entry vbt;
337 void *vbt_buf;
338 int ret;
339
340 ret = binman_entry_find("intel-vbt", &vbt);
341 if (ret)
342 return log_msg_ret("Cannot find VBT", ret);
343 vbt.image_pos += rom_offset;
344 vbt_buf = malloc(vbt.size);
345 if (!vbt_buf)
346 return log_msg_ret("Alloc VBT", -ENOMEM);
347
348 /*
349 * Load VBT before devicetree-specific config. This only
350 * supports memory-mapped SPI at present.
351 */
352 bootstage_start(BOOTSTAGE_ID_ACCUM_MMAP_SPI, "mmap_spi");
353 memcpy(vbt_buf, (void *)vbt.image_pos, vbt.size);
354 bootstage_accum(BOOTSTAGE_ID_ACCUM_MMAP_SPI);
355 if (*(u32 *)vbt_buf != VBT_SIGNATURE)
356 return log_msg_ret("VBT signature", -EINVAL);
Simon Glass42bf7db2019-12-08 17:40:19 -0700357
Bernhard Messerklinger7f8ff512020-05-18 12:33:33 +0200358 cfg->graphics_config_ptr = (ulong)vbt_buf;
359 }
Simon Glass42bf7db2019-12-08 17:40:19 -0700360
361 apl = malloc(sizeof(*apl));
362 if (!apl)
363 return log_msg_ret("config", -ENOMEM);
364 get_config(dev, apl);
365
366 cfg->ish_enable = 0;
367 cfg->enable_sata = 0;
368 cfg->pcie_root_port_en[2] = 0;
369 cfg->pcie_rp_hot_plug[2] = 0;
370 cfg->pcie_root_port_en[3] = 0;
371 cfg->pcie_rp_hot_plug[3] = 0;
372 cfg->pcie_root_port_en[4] = 0;
373 cfg->pcie_rp_hot_plug[4] = 0;
374 cfg->pcie_root_port_en[5] = 0;
375 cfg->pcie_rp_hot_plug[5] = 0;
376 cfg->pcie_root_port_en[1] = 0;
377 cfg->pcie_rp_hot_plug[1] = 0;
378 cfg->usb_otg = 0;
379 cfg->i2c6_enable = 0;
380 cfg->i2c7_enable = 0;
381 cfg->hsuart3_enable = 0;
382 cfg->spi1_enable = 0;
383 cfg->spi2_enable = 0;
384 cfg->sdio_enabled = 0;
385
386 memcpy(cfg->pcie_rp_clk_req_number, apl->pcie_rp_clkreq_pin,
387 sizeof(cfg->pcie_rp_clk_req_number));
388
389 memcpy(cfg->pcie_rp_hot_plug, apl->pcie_rp_hotplug_enable,
390 sizeof(cfg->pcie_rp_hot_plug));
391
392 switch (apl->serirq_mode) {
393 case SERIRQ_QUIET:
394 cfg->sirq_enable = 1;
395 cfg->sirq_mode = 0;
396 break;
397 case SERIRQ_CONTINUOUS:
398 cfg->sirq_enable = 1;
399 cfg->sirq_mode = 1;
400 break;
401 case SERIRQ_OFF:
402 default:
403 cfg->sirq_enable = 0;
404 break;
405 }
406
407 if (apl->emmc_tx_cmd_cntl)
408 cfg->emmc_tx_cmd_cntl = apl->emmc_tx_cmd_cntl;
409 if (apl->emmc_tx_data_cntl1)
410 cfg->emmc_tx_data_cntl1 = apl->emmc_tx_data_cntl1;
411 if (apl->emmc_tx_data_cntl2)
412 cfg->emmc_tx_data_cntl2 = apl->emmc_tx_data_cntl2;
413 if (apl->emmc_rx_cmd_data_cntl1)
414 cfg->emmc_rx_cmd_data_cntl1 = apl->emmc_rx_cmd_data_cntl1;
415 if (apl->emmc_rx_strobe_cntl)
416 cfg->emmc_rx_strobe_cntl = apl->emmc_rx_strobe_cntl;
417 if (apl->emmc_rx_cmd_data_cntl2)
418 cfg->emmc_rx_cmd_data_cntl2 = apl->emmc_rx_cmd_data_cntl2;
419 if (apl->emmc_host_max_speed)
420 cfg->e_mmc_host_max_speed = apl->emmc_host_max_speed;
421
422 cfg->lpss_s0ix_enable = apl->lpss_s0ix_enable;
423
424 cfg->skip_mp_init = true;
425
426 /* Disable setting of EISS bit in FSP */
427 cfg->spi_eiss = 0;
428
429 /* Disable FSP from locking access to the RTC NVRAM */
430 cfg->rtc_lock = 0;
431
432 /* Enable Audio clk gate and power gate */
433 cfg->hd_audio_clk_gate = apl->hdaudio_clk_gate_enable;
434 cfg->hd_audio_pwr_gate = apl->hdaudio_pwr_gate_enable;
435 /* Bios config lockdown Audio clk and power gate */
436 cfg->bios_cfg_lock_down = apl->hdaudio_bios_config_lockdown;
437 apl_fsp_silicon_init_params_cb(apl, cfg);
438
439 cfg->usb_otg = true;
440 cfg->vtd_enable = apl->enable_vtd;
441
442 return 0;
443}
444
445static void p2sb_set_hide_bit(pci_dev_t dev, int hide)
446{
447 pci_x86_clrset_config(dev, PCH_P2SB_E0 + 1, HIDE_BIT,
448 hide ? HIDE_BIT : 0, PCI_SIZE_8);
449}
450
451/* Configure package power limits */
452static int set_power_limits(struct udevice *dev)
453{
454 msr_t rapl_msr_reg, limit;
455 u32 power_unit;
456 u32 tdp, min_power, max_power;
457 u32 pl2_val;
458 u32 override_tdp[2];
459 int ret;
460
461 /* Get units */
462 rapl_msr_reg = msr_read(MSR_PKG_POWER_SKU_UNIT);
463 power_unit = 1 << (rapl_msr_reg.lo & 0xf);
464
465 /* Get power defaults for this SKU */
466 rapl_msr_reg = msr_read(MSR_PKG_POWER_SKU);
467 tdp = rapl_msr_reg.lo & PKG_POWER_LIMIT_MASK;
468 pl2_val = rapl_msr_reg.hi & PKG_POWER_LIMIT_MASK;
469 min_power = (rapl_msr_reg.lo >> 16) & PKG_POWER_LIMIT_MASK;
470 max_power = rapl_msr_reg.hi & PKG_POWER_LIMIT_MASK;
471
472 if (min_power > 0 && tdp < min_power)
473 tdp = min_power;
474
475 if (max_power > 0 && tdp > max_power)
476 tdp = max_power;
477
478 ret = dev_read_u32_array(dev, "tdp-pl-override-mw", override_tdp,
479 ARRAY_SIZE(override_tdp));
480 if (ret)
481 return log_msg_ret("tdp-pl-override-mw", ret);
482
483 /* Set PL1 override value */
484 if (override_tdp[0])
485 tdp = override_tdp[0] * power_unit / 1000;
486
487 /* Set PL2 override value */
488 if (override_tdp[1])
489 pl2_val = override_tdp[1] * power_unit / 1000;
490
491 /* Set long term power limit to TDP */
492 limit.lo = tdp & PKG_POWER_LIMIT_MASK;
493 /* Set PL1 Pkg Power clamp bit */
494 limit.lo |= PKG_POWER_LIMIT_CLAMP;
495
496 limit.lo |= PKG_POWER_LIMIT_EN;
497 limit.lo |= (MB_POWER_LIMIT1_TIME_DEFAULT &
498 PKG_POWER_LIMIT_TIME_MASK) << PKG_POWER_LIMIT_TIME_SHIFT;
499
500 /* Set short term power limit PL2 */
501 limit.hi = pl2_val & PKG_POWER_LIMIT_MASK;
502 limit.hi |= PKG_POWER_LIMIT_EN;
503
504 /* Program package power limits in RAPL MSR */
505 msr_write(MSR_PKG_POWER_LIMIT, limit);
506 log_info("RAPL PL1 %d.%dW\n", tdp / power_unit,
507 100 * (tdp % power_unit) / power_unit);
508 log_info("RAPL PL2 %d.%dW\n", pl2_val / power_unit,
509 100 * (pl2_val % power_unit) / power_unit);
510
511 /*
512 * Sett RAPL MMIO register for Power limits. RAPL driver is using MSR
513 * instead of MMIO, so disable LIMIT_EN bit for MMIO
514 */
515 writel(limit.lo & ~PKG_POWER_LIMIT_EN, MCHBAR_REG(MCHBAR_RAPL_PPL));
516 writel(limit.hi & ~PKG_POWER_LIMIT_EN, MCHBAR_REG(MCHBAR_RAPL_PPL + 4));
517
518 return 0;
519}
520
521int p2sb_unhide(void)
522{
523 pci_dev_t dev = PCI_BDF(0, 0xd, 0);
524 ulong val;
525
526 p2sb_set_hide_bit(dev, 0);
527
528 pci_x86_read_config(dev, PCI_VENDOR_ID, &val, PCI_SIZE_16);
529
530 if (val != PCI_VENDOR_ID_INTEL)
531 return log_msg_ret("p2sb unhide", -EIO);
532
533 return 0;
534}
535
536/* Overwrites the SCI IRQ if another IRQ number is given by device tree */
537static void set_sci_irq(void)
538{
539 /* Skip this for now */
540}
541
542int arch_fsps_preinit(void)
543{
544 struct udevice *itss;
545 int ret;
546
Simon Glass21bb12a2020-02-06 09:54:58 -0700547 ret = irq_first_device_type(X86_IRQT_ITSS, &itss);
Simon Glass42bf7db2019-12-08 17:40:19 -0700548 if (ret)
549 return log_msg_ret("no itss", ret);
550 /*
551 * Snapshot the current GPIO IRQ polarities. FSP is setting a default
552 * policy that doesn't honour boards' requirements
553 */
554 irq_snapshot_polarities(itss);
555
556 /*
557 * Clear the GPI interrupt status and enable registers. These
558 * registers do not get reset to default state when booting from S5.
559 */
560 ret = pinctrl_gpi_clear_int_cfg();
561 if (ret)
562 return log_msg_ret("gpi_clear", ret);
563
564 return 0;
565}
566
567int arch_fsp_init_r(void)
568{
569#ifdef CONFIG_HAVE_ACPI_RESUME
570 bool s3wake = gd->arch.prev_sleep_state == ACPI_S3;
571#else
572 bool s3wake = false;
573#endif
574 struct udevice *dev, *itss;
575 int ret;
576
Simon Glass8eac3f32020-04-26 09:12:54 -0600577 if (!ll_boot_init())
578 return 0;
Simon Glass42bf7db2019-12-08 17:40:19 -0700579 /*
580 * This must be called before any devices are probed. Put any probing
581 * into arch_fsps_preinit() above.
582 *
583 * We don't use CONFIG_APL_BOOT_FROM_FAST_SPI_FLASH here since it will
584 * force PCI to be probed.
585 */
586 ret = fsp_silicon_init(s3wake, false);
587 if (ret)
588 return ret;
589
Simon Glass21bb12a2020-02-06 09:54:58 -0700590 ret = irq_first_device_type(X86_IRQT_ITSS, &itss);
Simon Glass42bf7db2019-12-08 17:40:19 -0700591 if (ret)
592 return log_msg_ret("no itss", ret);
593 /* Restore GPIO IRQ polarities back to previous settings */
594 irq_restore_polarities(itss);
595
596 /* soc_init() */
597 ret = p2sb_unhide();
598 if (ret)
599 return log_msg_ret("unhide p2sb", ret);
600
601 /* Set RAPL MSR for Package power limits*/
602 ret = uclass_first_device_err(UCLASS_NORTHBRIDGE, &dev);
603 if (ret)
604 return log_msg_ret("Cannot get northbridge", ret);
605 set_power_limits(dev);
606
607 /*
608 * FSP-S routes SCI to IRQ 9. With the help of this function you can
609 * select another IRQ for SCI.
610 */
611 set_sci_irq();
612
613 return 0;
614}