blob: 12aea77289966cd97f6835d2371f92aef7f75900 [file] [log] [blame]
Andrey Petrov70efecd2016-03-04 21:41:13 -08001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2015 Intel Corp.
5 * (Written by Alexandru Gagniuc <alexandrux.gagniuc@intel.com> for Intel Corp.)
6 * (Written by Andrey Petrov <andrey.petrov@intel.com> for Intel Corp.)
7 *
8 * This program is free software; you can redistribute it and/or modify
9 * it under the terms of the GNU General Public License as published by
10 * the Free Software Foundation; either version 2 of the License, or
11 * (at your option) any later version.
Martin Rothebabfad2016-04-10 11:09:16 -060012 *
13 * This program is distributed in the hope that it will be useful,
14 * but WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU General Public License for more details.
Andrey Petrov70efecd2016-03-04 21:41:13 -080017 */
18
Hannah Williams0f61da82016-04-18 13:47:08 -070019#include <arch/acpi.h>
Andrey Petrov70efecd2016-03-04 21:41:13 -080020#include <bootstate.h>
Lance Zhao1bd0c0c2016-04-19 18:04:21 -070021#include <cbmem.h>
Andrey Petrov70efecd2016-03-04 21:41:13 -080022#include <console/console.h>
23#include <cpu/cpu.h>
24#include <device/device.h>
25#include <device/pci.h>
26#include <fsp/api.h>
27#include <fsp/util.h>
Andrey Petrove07e13d2016-03-18 14:43:00 -070028#include <soc/iomap.h>
Andrey Petrov70efecd2016-03-04 21:41:13 -080029#include <soc/cpu.h>
Andrey Petrov868679f2016-05-12 19:11:48 -070030#include <soc/intel/common/vbt.h>
Aaron Durbin81d1e092016-07-13 01:49:10 -050031#include <soc/itss.h>
Lance Zhao1bd0c0c2016-04-19 18:04:21 -070032#include <soc/nvs.h>
Andrey Petrov70efecd2016-03-04 21:41:13 -080033#include <soc/pci_devs.h>
Furquan Shaikh6ac226d2016-06-15 17:13:20 -070034#include <spi-generic.h>
Andrey Petrov3dbea292016-06-14 22:20:28 -070035#include <soc/pm.h>
Aaron Durbinfadfc2e2016-07-01 16:36:03 -050036#include <soc/p2sb.h>
Sumeet Pawnikar35240eb2016-08-23 11:20:20 +053037#include <soc/northbridge.h>
Andrey Petrov70efecd2016-03-04 21:41:13 -080038
39#include "chip.h"
40
Andrey Petrov868679f2016-05-12 19:11:48 -070041static void *vbt;
42static struct region_device vbt_rdev;
43
Duncan Laurie02fcc882016-06-27 10:51:17 -070044static const char *soc_acpi_name(struct device *dev)
45{
46 if (dev->path.type == DEVICE_PATH_DOMAIN)
47 return "PCI0";
48
49 if (dev->path.type != DEVICE_PATH_PCI)
50 return NULL;
51
52 switch (dev->path.pci.devfn) {
53 /* DSDT: acpi/northbridge.asl */
54 case NB_DEVFN:
55 return "MCHC";
56 /* DSDT: acpi/lpc.asl */
57 case LPC_DEVFN:
58 return "LPCB";
59 /* DSDT: acpi/xhci.asl */
60 case XHCI_DEVFN:
61 return "XHCI";
62 /* DSDT: acpi/pch_hda.asl */
63 case HDA_DEVFN:
64 return "HDAS";
65 /* DSDT: acpi/lpss.asl */
66 case LPSS_DEVFN_UART0:
67 return "URT1";
68 case LPSS_DEVFN_UART1:
69 return "URT2";
70 case LPSS_DEVFN_UART2:
71 return "URT3";
72 case LPSS_DEVFN_UART3:
73 return "URT4";
74 case LPSS_DEVFN_SPI0:
75 return "SPI1";
76 case LPSS_DEVFN_SPI1:
77 return "SPI2";
78 case LPSS_DEVFN_SPI2:
79 return "SPI3";
80 case LPSS_DEVFN_PWM:
81 return "PWM";
82 case LPSS_DEVFN_I2C0:
83 return "I2C0";
84 case LPSS_DEVFN_I2C1:
85 return "I2C1";
86 case LPSS_DEVFN_I2C2:
87 return "I2C2";
88 case LPSS_DEVFN_I2C3:
89 return "I2C3";
90 case LPSS_DEVFN_I2C4:
91 return "I2C4";
92 case LPSS_DEVFN_I2C5:
93 return "I2C5";
94 case LPSS_DEVFN_I2C6:
95 return "I2C6";
96 case LPSS_DEVFN_I2C7:
97 return "I2C7";
98 /* Storage */
99 case SDCARD_DEVFN:
100 return "SDCD";
101 case EMMC_DEVFN:
102 return "EMMC";
103 case SDIO_DEVFN:
104 return "SDIO";
Vaibhav Shankarec9168f2016-09-16 14:20:53 -0700105 /* PCIe */
106 case PCIEB0_DEVFN:
107 return "RP01";
Duncan Laurie02fcc882016-06-27 10:51:17 -0700108 }
109
110 return NULL;
111}
112
Andrey Petrov70efecd2016-03-04 21:41:13 -0800113static void pci_domain_set_resources(device_t dev)
114{
115 assign_resources(dev->link_list);
116}
117
118static struct device_operations pci_domain_ops = {
119 .read_resources = pci_domain_read_resources,
120 .set_resources = pci_domain_set_resources,
121 .enable_resources = NULL,
122 .init = NULL,
123 .scan_bus = pci_domain_scan_bus,
124 .ops_pci_bus = pci_bus_default_ops,
Duncan Laurie02fcc882016-06-27 10:51:17 -0700125 .acpi_name = &soc_acpi_name,
Andrey Petrov70efecd2016-03-04 21:41:13 -0800126};
127
128static struct device_operations cpu_bus_ops = {
129 .read_resources = DEVICE_NOOP,
130 .set_resources = DEVICE_NOOP,
131 .enable_resources = DEVICE_NOOP,
132 .init = apollolake_init_cpus,
133 .scan_bus = NULL,
Hannah Williams0f61da82016-04-18 13:47:08 -0700134 .acpi_fill_ssdt_generator = generate_cpu_entries,
Andrey Petrov70efecd2016-03-04 21:41:13 -0800135};
136
137static void enable_dev(device_t dev)
138{
139 /* Set the operations if it is a special bus type */
140 if (dev->path.type == DEVICE_PATH_DOMAIN) {
141 dev->ops = &pci_domain_ops;
142 } else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER) {
143 dev->ops = &cpu_bus_ops;
144 }
145}
146
Kane Chend7796052016-07-11 12:17:13 +0800147/*
148 * If the PCIe root port at function 0 is disabled,
149 * the PCIe root ports might be coalesced after FSP silicon init.
150 * The below function will swap the devfn of the first enabled device
151 * in devicetree and function 0 resides a pci device
152 * so that it won't confuse coreboot.
153 */
154static void pcie_update_device_tree(unsigned int devfn0, int num_funcs)
155{
156 device_t func0;
157 unsigned int devfn;
158 int i;
159 unsigned int inc = PCI_DEVFN(0, 1);
160
161 func0 = dev_find_slot(0, devfn0);
162 if (func0 == NULL)
163 return;
164
165 /* No more functions if function 0 is disabled. */
166 if (pci_read_config32(func0, PCI_VENDOR_ID) == 0xffffffff)
167 return;
168
169 devfn = devfn0 + inc;
170
171 /*
172 * Increase funtion by 1.
173 * Then find first enabled device to replace func0
174 * as that port was move to func0.
175 */
176 for (i = 1; i < num_funcs; i++, devfn += inc) {
177 device_t dev = dev_find_slot(0, devfn);
178 if (dev == NULL)
179 continue;
180
181 if (!dev->enabled)
182 continue;
183 /* Found the first enabled device in given dev number */
184 func0->path.pci.devfn = dev->path.pci.devfn;
185 dev->path.pci.devfn = devfn0;
186 break;
187 }
188}
189
190static void pcie_override_devicetree_after_silicon_init(void)
191{
192 pcie_update_device_tree(PCIEA0_DEVFN, 4);
193 pcie_update_device_tree(PCIEB0_DEVFN, 2);
194}
195
Sumeet Pawnikara247d8e2016-09-27 23:18:35 +0530196/* Configure package power limits */
197static void set_power_limits(void)
Sumeet Pawnikar35240eb2016-08-23 11:20:20 +0530198{
Sumeet Pawnikara247d8e2016-09-27 23:18:35 +0530199 static struct soc_intel_apollolake_config *cfg;
200 struct device *dev = NB_DEV_ROOT;
201 msr_t rapl_msr_reg, limit;
202 uint32_t power_unit;
203 uint32_t tdp, min_power, max_power;
204 uint32_t *rapl_mmio_reg;
Sumeet Pawnikar35240eb2016-08-23 11:20:20 +0530205
Sumeet Pawnikara247d8e2016-09-27 23:18:35 +0530206 if (!dev || !dev->chip_info) {
207 printk(BIOS_ERR, "BUG! Could not find SOC devicetree config\n");
208 return;
209 }
Sumeet Pawnikar35240eb2016-08-23 11:20:20 +0530210
Sumeet Pawnikara247d8e2016-09-27 23:18:35 +0530211 cfg = dev->chip_info;
212
213 /* Get units */
214 rapl_msr_reg = rdmsr(MSR_PKG_POWER_SKU_UNIT);
215 power_unit = 1 << (rapl_msr_reg.lo & 0xf);
216
217 /* Get power defaults for this SKU */
218 rapl_msr_reg = rdmsr(MSR_PKG_POWER_SKU);
219 tdp = rapl_msr_reg.lo & PKG_POWER_LIMIT_MASK;
220 min_power = (rapl_msr_reg.lo >> 16) & PKG_POWER_LIMIT_MASK;
221 max_power = rapl_msr_reg.hi & PKG_POWER_LIMIT_MASK;
222
223 if (min_power > 0 && tdp < min_power)
224 tdp = min_power;
225
226 if (max_power > 0 && tdp > max_power)
227 tdp = max_power;
228
229 /* Set PL1 override value */
230 tdp = (cfg->tdp_pl1_override_mw == 0) ?
231 tdp : (cfg->tdp_pl1_override_mw * power_unit) / 1000;
232
233 /* Set long term power limit to TDP */
234 limit.lo = tdp & PKG_POWER_LIMIT_MASK;
235 /* PL2 is invalid for small core */
236 limit.hi = 0x0;
237
238 /* Set PL1 Pkg Power clamp bit */
239 limit.lo |= PKG_POWER_LIMIT_CLAMP;
240
241 limit.lo |= PKG_POWER_LIMIT_EN;
242 limit.lo |= (MB_POWER_LIMIT1_TIME_DEFAULT &
243 PKG_POWER_LIMIT_TIME_MASK) << PKG_POWER_LIMIT_TIME_SHIFT;
244
245 /* Program package power limits in RAPL MSR */
246 wrmsr(MSR_PKG_POWER_LIMIT, limit);
247 printk(BIOS_INFO, "RAPL PL1 %d.%dW\n", tdp / power_unit,
248 100 * (tdp % power_unit) / power_unit);
249
250 /* Get the MMIO address */
251 rapl_mmio_reg = (void *)(uintptr_t) (MCH_BASE_ADDR + MCHBAR_RAPL_PPL);
252 /*
253 * Disable RAPL MMIO PL1 Power limits because RAPL uses MSR value.
254 * PL2 (limit.hi) is invalid for small cores
255 */
256 write32(rapl_mmio_reg, limit.lo & ~(PKG_POWER_LIMIT_EN));
Sumeet Pawnikar35240eb2016-08-23 11:20:20 +0530257}
258
Andrey Petrov70efecd2016-03-04 21:41:13 -0800259static void soc_init(void *data)
260{
Lance Zhao1bd0c0c2016-04-19 18:04:21 -0700261 struct global_nvs_t *gnvs;
Andrey Petrov70efecd2016-03-04 21:41:13 -0800262
Andrey Petrov868679f2016-05-12 19:11:48 -0700263 /* Save VBT info and mapping */
Abhay Kumarec2947f2016-07-14 18:43:54 -0700264 vbt = vbt_get(&vbt_rdev);
Andrey Petrov868679f2016-05-12 19:11:48 -0700265
Aaron Durbin81d1e092016-07-13 01:49:10 -0500266 /* Snapshot the current GPIO IRQ polarities. FSP is setting a
267 * default policy that doesn't honor boards' requirements. */
268 itss_snapshot_irq_polarities(GPIO_IRQ_START, GPIO_IRQ_END);
269
Lee Leahy9671faa2016-07-24 18:18:52 -0700270 fsp_silicon_init();
Lance Zhao1bd0c0c2016-04-19 18:04:21 -0700271
Aaron Durbin81d1e092016-07-13 01:49:10 -0500272 /* Restore GPIO IRQ polarities back to previous settings. */
273 itss_restore_irq_polarities(GPIO_IRQ_START, GPIO_IRQ_END);
274
Kane Chend7796052016-07-11 12:17:13 +0800275 /* override 'enabled' setting in device tree if needed */
276 pcie_override_devicetree_after_silicon_init();
277
Aaron Durbinfadfc2e2016-07-01 16:36:03 -0500278 /*
279 * Keep the P2SB device visible so it and the other devices are
280 * visible in coreboot for driver support and PCI resource allocation.
281 * There is a UPD setting for this, but it's more consistent to use
282 * hide and unhide symmetrically.
283 */
284 p2sb_unhide();
285
Lance Zhao1bd0c0c2016-04-19 18:04:21 -0700286 /* Allocate ACPI NVS in CBMEM */
287 gnvs = cbmem_add(CBMEM_ID_ACPI_GNVS, sizeof(*gnvs));
Sumeet Pawnikar35240eb2016-08-23 11:20:20 +0530288
Sumeet Pawnikara247d8e2016-09-27 23:18:35 +0530289 /* Set RAPL MSR for Package power limits*/
290 set_power_limits();
Andrey Petrov70efecd2016-03-04 21:41:13 -0800291}
292
Andrey Petrov868679f2016-05-12 19:11:48 -0700293static void soc_final(void *data)
294{
295 if (vbt)
296 rdev_munmap(&vbt_rdev, vbt);
Andrey Petrov3dbea292016-06-14 22:20:28 -0700297
298 /* Disable global reset, just in case */
299 global_reset_enable(0);
300 /* Make sure payload/OS can't trigger global reset */
301 global_reset_lock();
Andrey Petrov868679f2016-05-12 19:11:48 -0700302}
303
Brandon Breitensteinc31ba0e2016-07-27 17:34:45 -0700304static void disable_dev(struct device *dev, FSP_S_CONFIG *silconfig) {
Jagadish Krishnamoorthyb023e5e2016-06-22 18:32:17 -0700305
306 switch (dev->path.pci.devfn) {
307 case ISH_DEVFN:
308 silconfig->IshEnable = 0;
309 break;
310 case SATA_DEVFN:
311 silconfig->EnableSata = 0;
312 break;
Jagadish Krishnamoorthyb023e5e2016-06-22 18:32:17 -0700313 case PCIEB0_DEVFN:
Kane Chend7796052016-07-11 12:17:13 +0800314 silconfig->PcieRootPortEn[0] = 0;
315 silconfig->PcieRpHotPlug[0] = 0;
Jagadish Krishnamoorthyb023e5e2016-06-22 18:32:17 -0700316 break;
317 case PCIEB1_DEVFN:
Kane Chend7796052016-07-11 12:17:13 +0800318 silconfig->PcieRootPortEn[1] = 0;
319 silconfig->PcieRpHotPlug[1] = 0;
320 break;
321 case PCIEA0_DEVFN:
322 silconfig->PcieRootPortEn[2] = 0;
323 silconfig->PcieRpHotPlug[2] = 0;
324 break;
325 case PCIEA1_DEVFN:
326 silconfig->PcieRootPortEn[3] = 0;
327 silconfig->PcieRpHotPlug[3] = 0;
328 break;
329 case PCIEA2_DEVFN:
330 silconfig->PcieRootPortEn[4] = 0;
331 silconfig->PcieRpHotPlug[4] = 0;
332 break;
333 case PCIEA3_DEVFN:
Jagadish Krishnamoorthyb023e5e2016-06-22 18:32:17 -0700334 silconfig->PcieRootPortEn[5] = 0;
Kane Chend7796052016-07-11 12:17:13 +0800335 silconfig->PcieRpHotPlug[5] = 0;
Jagadish Krishnamoorthyb023e5e2016-06-22 18:32:17 -0700336 break;
337 case XHCI_DEVFN:
338 silconfig->Usb30Mode = 0;
339 break;
340 case XDCI_DEVFN:
341 silconfig->UsbOtg = 0;
342 break;
Andrey Petrov78461a92016-06-28 12:14:33 -0700343 case LPSS_DEVFN_I2C0:
Jagadish Krishnamoorthyb023e5e2016-06-22 18:32:17 -0700344 silconfig->I2c0Enable = 0;
345 break;
Andrey Petrov78461a92016-06-28 12:14:33 -0700346 case LPSS_DEVFN_I2C1:
Jagadish Krishnamoorthyb023e5e2016-06-22 18:32:17 -0700347 silconfig->I2c1Enable = 0;
348 break;
Andrey Petrov78461a92016-06-28 12:14:33 -0700349 case LPSS_DEVFN_I2C2:
Jagadish Krishnamoorthyb023e5e2016-06-22 18:32:17 -0700350 silconfig->I2c2Enable = 0;
351 break;
Andrey Petrov78461a92016-06-28 12:14:33 -0700352 case LPSS_DEVFN_I2C3:
Jagadish Krishnamoorthyb023e5e2016-06-22 18:32:17 -0700353 silconfig->I2c3Enable = 0;
354 break;
Andrey Petrov78461a92016-06-28 12:14:33 -0700355 case LPSS_DEVFN_I2C4:
Jagadish Krishnamoorthyb023e5e2016-06-22 18:32:17 -0700356 silconfig->I2c4Enable = 0;
357 break;
Andrey Petrov78461a92016-06-28 12:14:33 -0700358 case LPSS_DEVFN_I2C5:
Jagadish Krishnamoorthyb023e5e2016-06-22 18:32:17 -0700359 silconfig->I2c5Enable = 0;
360 break;
Andrey Petrov78461a92016-06-28 12:14:33 -0700361 case LPSS_DEVFN_I2C6:
Jagadish Krishnamoorthyb023e5e2016-06-22 18:32:17 -0700362 silconfig->I2c6Enable = 0;
363 break;
Andrey Petrov78461a92016-06-28 12:14:33 -0700364 case LPSS_DEVFN_I2C7:
Jagadish Krishnamoorthyb023e5e2016-06-22 18:32:17 -0700365 silconfig->I2c7Enable = 0;
366 break;
Andrey Petrov78461a92016-06-28 12:14:33 -0700367 case LPSS_DEVFN_UART0:
Jagadish Krishnamoorthyb023e5e2016-06-22 18:32:17 -0700368 silconfig->Hsuart0Enable = 0;
369 break;
Andrey Petrov78461a92016-06-28 12:14:33 -0700370 case LPSS_DEVFN_UART1:
Jagadish Krishnamoorthyb023e5e2016-06-22 18:32:17 -0700371 silconfig->Hsuart1Enable = 0;
372 break;
Andrey Petrov78461a92016-06-28 12:14:33 -0700373 case LPSS_DEVFN_UART2:
Jagadish Krishnamoorthyb023e5e2016-06-22 18:32:17 -0700374 silconfig->Hsuart2Enable = 0;
375 break;
Andrey Petrov78461a92016-06-28 12:14:33 -0700376 case LPSS_DEVFN_UART3:
Jagadish Krishnamoorthyb023e5e2016-06-22 18:32:17 -0700377 silconfig->Hsuart3Enable = 0;
378 break;
Andrey Petrov78461a92016-06-28 12:14:33 -0700379 case LPSS_DEVFN_SPI0:
Jagadish Krishnamoorthyb023e5e2016-06-22 18:32:17 -0700380 silconfig->Spi0Enable = 0;
381 break;
Andrey Petrov78461a92016-06-28 12:14:33 -0700382 case LPSS_DEVFN_SPI1:
Jagadish Krishnamoorthyb023e5e2016-06-22 18:32:17 -0700383 silconfig->Spi1Enable = 0;
384 break;
Andrey Petrov78461a92016-06-28 12:14:33 -0700385 case LPSS_DEVFN_SPI2:
Jagadish Krishnamoorthyb023e5e2016-06-22 18:32:17 -0700386 silconfig->Spi2Enable = 0;
387 break;
388 case SDCARD_DEVFN:
389 silconfig->SdcardEnabled = 0;
390 break;
391 case EMMC_DEVFN:
392 silconfig->eMMCEnabled = 0;
393 break;
394 case SDIO_DEVFN:
395 silconfig->SdioEnabled = 0;
396 break;
397 case SMBUS_DEVFN:
398 silconfig->SmbusEnable = 0;
399 break;
400 default:
401 printk(BIOS_WARNING, "PCI:%02x.%01x: Could not disable the device\n",
402 PCI_SLOT(dev->path.pci.devfn),
403 PCI_FUNC(dev->path.pci.devfn));
404 break;
405 }
406}
407
Brandon Breitensteinc31ba0e2016-07-27 17:34:45 -0700408static void parse_devicetree(FSP_S_CONFIG *silconfig)
Jagadish Krishnamoorthyb023e5e2016-06-22 18:32:17 -0700409{
Andrey Petrov78461a92016-06-28 12:14:33 -0700410 struct device *dev = NB_DEV_ROOT;
Jagadish Krishnamoorthyb023e5e2016-06-22 18:32:17 -0700411
412 if (!dev) {
413 printk(BIOS_ERR, "Could not find root device\n");
414 return;
415 }
416 /* Only disable bus 0 devices. */
417 for (dev = dev->bus->children; dev; dev = dev->sibling) {
418 if (!dev->enabled)
419 disable_dev(dev, silconfig);
420 }
421}
422
Brandon Breitensteinc31ba0e2016-07-27 17:34:45 -0700423void platform_fsp_silicon_init_params_cb(FSPS_UPD *silupd)
Andrey Petrov70efecd2016-03-04 21:41:13 -0800424{
Brandon Breitensteinc31ba0e2016-07-27 17:34:45 -0700425 FSP_S_CONFIG *silconfig = &silupd->FspsConfig;
Andrey Petrov70efecd2016-03-04 21:41:13 -0800426 static struct soc_intel_apollolake_config *cfg;
427
428 /* Load VBT before devicetree-specific config. */
Andrey Petrov868679f2016-05-12 19:11:48 -0700429 silconfig->GraphicsConfigPtr = (uintptr_t)vbt;
Andrey Petrov70efecd2016-03-04 21:41:13 -0800430
Andrey Petrov78461a92016-06-28 12:14:33 -0700431 struct device *dev = NB_DEV_ROOT;
432
Patrick Georgi831d65d2016-04-14 11:53:48 +0200433 if (!dev || !dev->chip_info) {
Andrey Petrov70efecd2016-03-04 21:41:13 -0800434 printk(BIOS_ERR, "BUG! Could not find SOC devicetree config\n");
435 return;
436 }
437
438 cfg = dev->chip_info;
439
Jagadish Krishnamoorthyb023e5e2016-06-22 18:32:17 -0700440 /* Parse device tree and disable unused device*/
441 parse_devicetree(silconfig);
442
Andrey Petrov70efecd2016-03-04 21:41:13 -0800443 silconfig->PcieRpClkReqNumber[0] = cfg->pcie_rp0_clkreq_pin;
444 silconfig->PcieRpClkReqNumber[1] = cfg->pcie_rp1_clkreq_pin;
445 silconfig->PcieRpClkReqNumber[2] = cfg->pcie_rp2_clkreq_pin;
446 silconfig->PcieRpClkReqNumber[3] = cfg->pcie_rp3_clkreq_pin;
447 silconfig->PcieRpClkReqNumber[4] = cfg->pcie_rp4_clkreq_pin;
448 silconfig->PcieRpClkReqNumber[5] = cfg->pcie_rp5_clkreq_pin;
Andrey Petrove07e13d2016-03-18 14:43:00 -0700449
Zhao, Lijian1b8ee0b2016-05-17 19:01:34 -0700450 if (cfg->emmc_tx_cmd_cntl != 0)
451 silconfig->EmmcTxCmdCntl = cfg->emmc_tx_cmd_cntl;
452 if (cfg->emmc_tx_data_cntl1 != 0)
453 silconfig->EmmcTxDataCntl1 = cfg->emmc_tx_data_cntl1;
454 if (cfg->emmc_tx_data_cntl2 != 0)
455 silconfig->EmmcTxDataCntl2 = cfg->emmc_tx_data_cntl2;
456 if (cfg->emmc_rx_cmd_data_cntl1 != 0)
457 silconfig->EmmcRxCmdDataCntl1 = cfg->emmc_rx_cmd_data_cntl1;
458 if (cfg->emmc_rx_strobe_cntl != 0)
459 silconfig->EmmcRxStrobeCntl = cfg->emmc_rx_strobe_cntl;
460 if (cfg->emmc_rx_cmd_data_cntl2 != 0)
461 silconfig->EmmcRxCmdDataCntl2 = cfg->emmc_rx_cmd_data_cntl2;
462
Saurabh Satijae46dbcc2016-05-03 15:15:31 -0700463 silconfig->LPSS_S0ixEnable = cfg->lpss_s0ix_enable;
464
Bora Guvendik60cc75d2016-07-25 14:44:51 -0700465 /* Disable monitor mwait since it is broken due to a hardware bug without a fix */
466 silconfig->MonitorMwaitEnable = 0;
467
Venkateswarlu Vinjamuri1a5e32c2016-10-31 17:15:30 -0700468 silconfig->SkipMpInit = 1;
469
Furquan Shaikhcad9b632016-06-20 16:08:42 -0700470 /* Disable setting of EISS bit in FSP. */
471 silconfig->SpiEiss = 0;
Ravi Sarawadi3a21d0f2016-08-10 11:33:56 -0700472
473 /* Disable FSP from locking access to the RTC NVRAM */
474 silconfig->RtcLock = 0;
Venkateswarlu Vinjamuri88df48c2016-09-02 16:04:27 -0700475
476 /* Enable Audio clk gate and power gate */
477 silconfig->HDAudioClkGate = cfg->hdaudio_clk_gate_enable;
478 silconfig->HDAudioPwrGate = cfg->hdaudio_pwr_gate_enable;
479 /* Bios config lockdown Audio clk and power gate */
480 silconfig->BiosCfgLockDown = cfg->hdaudio_bios_config_lockdown;
481
Andrey Petrov70efecd2016-03-04 21:41:13 -0800482}
483
484struct chip_operations soc_intel_apollolake_ops = {
485 CHIP_NAME("Intel Apollolake SOC")
486 .enable_dev = &enable_dev,
Andrey Petrov868679f2016-05-12 19:11:48 -0700487 .init = &soc_init,
488 .final = &soc_final
Andrey Petrov70efecd2016-03-04 21:41:13 -0800489};
490
Lee Leahy806fa242016-08-01 13:55:02 -0700491void platform_fsp_notify_status(enum fsp_notify_phase phase)
Andrey Petrov70efecd2016-03-04 21:41:13 -0800492{
Lee Leahy806fa242016-08-01 13:55:02 -0700493 /* Hide the P2SB device to align with previous behavior. */
494 if (phase == END_OF_FIRMWARE)
Aaron Durbinfadfc2e2016-07-01 16:36:03 -0500495 p2sb_hide();
Andrey Petrov70efecd2016-03-04 21:41:13 -0800496}
497
Furquan Shaikh6ac226d2016-06-15 17:13:20 -0700498/*
499 * spi_init() needs to run unconditionally on every boot (including resume) to
500 * allow write protect to be disabled for eventlog and nvram updates. This needs
501 * to be done as early as possible in ramstage. Thus, add a callback for entry
502 * into BS_PRE_DEVICE.
503 */
504static void spi_init_cb(void *unused)
505{
506 spi_init();
507}
508
509BOOT_STATE_INIT_ENTRY(BS_PRE_DEVICE, BS_ON_ENTRY, spi_init_cb, NULL);