blob: e8fd9d17b7622da01910a4bc4c04eb922755bb36 [file] [log] [blame]
Lee Leahy77ff0b12015-05-05 15:07:29 -07001/*
2 * This file is part of the coreboot project.
3 *
4 * Copyright (C) 2013 Google Inc.
Lee Leahy32471722015-04-20 15:20:28 -07005 * Copyright (C) 2015 Intel Corp.
Lee Leahy77ff0b12015-05-05 15:07:29 -07006 *
7 * This program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; version 2 of the License.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
Lee Leahy77ff0b12015-05-05 15:07:29 -070015 */
16
Lee Leahy32471722015-04-20 15:20:28 -070017#include <chip.h>
Lee Leahy77ff0b12015-05-05 15:07:29 -070018#include <console/console.h>
19#include <device/device.h>
20#include <device/pci.h>
Kyösti Mälkkif1b58b72019-03-01 13:43:02 +020021#include <device/pci_ops.h>
Aaron Durbin789f2b62015-09-09 17:05:06 -050022#include <fsp/util.h>
Lee Leahy77ff0b12015-05-05 15:07:29 -070023#include <soc/pci_devs.h>
24#include <soc/ramstage.h>
Lee Leahy77ff0b12015-05-05 15:07:29 -070025
Elyes HAOUASb13fac32018-05-24 22:29:44 +020026static void pci_domain_set_resources(struct device *dev)
Lee Leahy77ff0b12015-05-05 15:07:29 -070027{
Elyes HAOUASa342f392018-10-17 10:56:26 +020028 printk(BIOS_SPEW, "%s/%s (%s)\n",
Lee Leahy32471722015-04-20 15:20:28 -070029 __FILE__, __func__, dev_name(dev));
Lee Leahy77ff0b12015-05-05 15:07:29 -070030 assign_resources(dev->link_list);
31}
32
33static struct device_operations pci_domain_ops = {
34 .read_resources = pci_domain_read_resources,
35 .set_resources = pci_domain_set_resources,
36 .enable_resources = NULL,
37 .init = NULL,
38 .scan_bus = pci_domain_scan_bus,
Lee Leahy77ff0b12015-05-05 15:07:29 -070039};
40
41static struct device_operations cpu_bus_ops = {
Elyes HAOUASb6fa7a22018-12-07 12:21:18 +010042 .read_resources = DEVICE_NOOP,
43 .set_resources = DEVICE_NOOP,
44 .enable_resources = DEVICE_NOOP,
Lee Leahy32471722015-04-20 15:20:28 -070045 .init = soc_init_cpus
Lee Leahy77ff0b12015-05-05 15:07:29 -070046};
47
48
Elyes HAOUASb13fac32018-05-24 22:29:44 +020049static void enable_dev(struct device *dev)
Lee Leahy77ff0b12015-05-05 15:07:29 -070050{
Elyes HAOUASa342f392018-10-17 10:56:26 +020051 printk(BIOS_SPEW, "----------\n%s/%s (%s), type: %d\n",
Lee Leahy32471722015-04-20 15:20:28 -070052 __FILE__, __func__,
53 dev_name(dev), dev->path.type);
54 printk(BIOS_SPEW, "vendor: 0x%04x. device: 0x%04x\n",
55 pci_read_config16(dev, PCI_VENDOR_ID),
56 pci_read_config16(dev, PCI_DEVICE_ID));
57 printk(BIOS_SPEW, "class: 0x%02x %s\n"
58 "subclass: 0x%02x %s\n"
59 "prog: 0x%02x\n"
60 "revision: 0x%02x\n",
61 pci_read_config16(dev, PCI_CLASS_DEVICE) >> 8,
62 get_pci_class_name(dev),
63 pci_read_config16(dev, PCI_CLASS_DEVICE) & 0xff,
64 get_pci_subclass_name(dev),
65 pci_read_config8(dev, PCI_CLASS_PROG),
66 pci_read_config8(dev, PCI_REVISION_ID));
67
Lee Leahy77ff0b12015-05-05 15:07:29 -070068 /* Set the operations if it is a special bus type */
69 if (dev->path.type == DEVICE_PATH_DOMAIN) {
70 dev->ops = &pci_domain_ops;
71 } else if (dev->path.type == DEVICE_PATH_CPU_CLUSTER) {
72 dev->ops = &cpu_bus_ops;
73 } else if (dev->path.type == DEVICE_PATH_PCI) {
74 /* Handle south cluster enablement. */
75 if (PCI_SLOT(dev->path.pci.devfn) > GFX_DEV &&
76 (dev->ops == NULL || dev->ops->enable == NULL)) {
77 southcluster_enable_dev(dev);
78 }
79 }
80}
81
Aaron Durbin64031672018-04-21 14:45:32 -060082__weak void board_silicon_USB2_override(SILICON_INIT_UPD *params)
Matt DeVillier2c8ac222017-08-26 04:53:35 -050083{
84}
85
Lee Leahy32471722015-04-20 15:20:28 -070086void soc_silicon_init_params(SILICON_INIT_UPD *params)
87{
Kyösti Mälkkic70eed12018-05-22 02:18:00 +030088 struct device *dev = pcidev_on_root(LPC_DEV, LPC_FUNC);
Ravi Sarawadid077b582015-09-09 14:12:16 -070089 struct soc_intel_braswell_config *config;
90
91 if (!dev) {
92 printk(BIOS_ERR,
93 "Error! Device (%s) not found, "
94 "soc_silicon_init_params!\n", dev_path(dev));
95 return;
96 }
97
98 config = dev->chip_info;
Lee Leahy32471722015-04-20 15:20:28 -070099
100 /* Set the parameters for SiliconInit */
101 printk(BIOS_DEBUG, "Updating UPD values for SiliconInit\n");
102 params->PcdSdcardMode = config->PcdSdcardMode;
103 params->PcdEnableHsuart0 = config->PcdEnableHsuart0;
104 params->PcdEnableHsuart1 = config->PcdEnableHsuart1;
105 params->PcdEnableAzalia = config->PcdEnableAzalia;
Lee Leahy32471722015-04-20 15:20:28 -0700106 params->PcdEnableSata = config->PcdEnableSata;
107 params->PcdEnableXhci = config->PcdEnableXhci;
108 params->PcdEnableLpe = config->PcdEnableLpe;
109 params->PcdEnableDma0 = config->PcdEnableDma0;
110 params->PcdEnableDma1 = config->PcdEnableDma1;
111 params->PcdEnableI2C0 = config->PcdEnableI2C0;
112 params->PcdEnableI2C1 = config->PcdEnableI2C1;
113 params->PcdEnableI2C2 = config->PcdEnableI2C2;
114 params->PcdEnableI2C3 = config->PcdEnableI2C3;
115 params->PcdEnableI2C4 = config->PcdEnableI2C4;
116 params->PcdEnableI2C5 = config->PcdEnableI2C5;
117 params->PcdEnableI2C6 = config->PcdEnableI2C6;
Subrata Banik13cd3312015-08-07 18:22:54 +0530118 params->GraphicsConfigPtr = 0;
119 params->AzaliaConfigPtr = 0;
Lee Leahy32471722015-04-20 15:20:28 -0700120 params->PunitPwrConfigDisable = config->PunitPwrConfigDisable;
121 params->ChvSvidConfig = config->ChvSvidConfig;
122 params->DptfDisable = config->DptfDisable;
123 params->PcdEmmcMode = config->PcdEmmcMode;
124 params->PcdUsb3ClkSsc = config->PcdUsb3ClkSsc;
125 params->PcdDispClkSsc = config->PcdDispClkSsc;
126 params->PcdSataClkSsc = config->PcdSataClkSsc;
127 params->Usb2Port0PerPortPeTxiSet = config->Usb2Port0PerPortPeTxiSet;
128 params->Usb2Port0PerPortTxiSet = config->Usb2Port0PerPortTxiSet;
129 params->Usb2Port0IUsbTxEmphasisEn = config->Usb2Port0IUsbTxEmphasisEn;
130 params->Usb2Port0PerPortTxPeHalf = config->Usb2Port0PerPortTxPeHalf;
Kevin Chiu348a6d52016-06-30 14:50:52 +0800131 if (config->D0Usb2Port0PerPortRXISet != 0)
132 params->D0Usb2Port0PerPortRXISet = config->D0Usb2Port0PerPortRXISet;
133
Lee Leahy32471722015-04-20 15:20:28 -0700134 params->Usb2Port1PerPortPeTxiSet = config->Usb2Port1PerPortPeTxiSet;
135 params->Usb2Port1PerPortTxiSet = config->Usb2Port1PerPortTxiSet;
136 params->Usb2Port1IUsbTxEmphasisEn = config->Usb2Port1IUsbTxEmphasisEn;
137 params->Usb2Port1PerPortTxPeHalf = config->Usb2Port1PerPortTxPeHalf;
Kevin Chiu348a6d52016-06-30 14:50:52 +0800138 if (config->D0Usb2Port1PerPortRXISet != 0)
139 params->D0Usb2Port1PerPortRXISet = config->D0Usb2Port1PerPortRXISet;
140
Lee Leahy32471722015-04-20 15:20:28 -0700141 params->Usb2Port2PerPortPeTxiSet = config->Usb2Port2PerPortPeTxiSet;
142 params->Usb2Port2PerPortTxiSet = config->Usb2Port2PerPortTxiSet;
143 params->Usb2Port2IUsbTxEmphasisEn = config->Usb2Port2IUsbTxEmphasisEn;
144 params->Usb2Port2PerPortTxPeHalf = config->Usb2Port2PerPortTxPeHalf;
Kevin Chiu348a6d52016-06-30 14:50:52 +0800145 if (config->D0Usb2Port2PerPortRXISet != 0)
146 params->D0Usb2Port2PerPortRXISet = config->D0Usb2Port2PerPortRXISet;
147
Lee Leahy32471722015-04-20 15:20:28 -0700148 params->Usb2Port3PerPortPeTxiSet = config->Usb2Port3PerPortPeTxiSet;
149 params->Usb2Port3PerPortTxiSet = config->Usb2Port3PerPortTxiSet;
150 params->Usb2Port3IUsbTxEmphasisEn = config->Usb2Port3IUsbTxEmphasisEn;
151 params->Usb2Port3PerPortTxPeHalf = config->Usb2Port3PerPortTxPeHalf;
Kevin Chiu348a6d52016-06-30 14:50:52 +0800152 if (config->D0Usb2Port3PerPortRXISet != 0)
153 params->D0Usb2Port3PerPortRXISet = config->D0Usb2Port3PerPortRXISet;
154
Lee Leahy32471722015-04-20 15:20:28 -0700155 params->Usb2Port4PerPortPeTxiSet = config->Usb2Port4PerPortPeTxiSet;
156 params->Usb2Port4PerPortTxiSet = config->Usb2Port4PerPortTxiSet;
157 params->Usb2Port4IUsbTxEmphasisEn = config->Usb2Port4IUsbTxEmphasisEn;
158 params->Usb2Port4PerPortTxPeHalf = config->Usb2Port4PerPortTxPeHalf;
Kevin Chiu348a6d52016-06-30 14:50:52 +0800159 if (config->D0Usb2Port4PerPortRXISet != 0)
160 params->D0Usb2Port4PerPortRXISet = config->D0Usb2Port4PerPortRXISet;
161
Lee Leahy32471722015-04-20 15:20:28 -0700162 params->Usb3Lane0Ow2tapgen2deemph3p5 =
163 config->Usb3Lane0Ow2tapgen2deemph3p5;
164 params->Usb3Lane1Ow2tapgen2deemph3p5 =
165 config->Usb3Lane1Ow2tapgen2deemph3p5;
166 params->Usb3Lane2Ow2tapgen2deemph3p5 =
167 config->Usb3Lane2Ow2tapgen2deemph3p5;
168 params->Usb3Lane3Ow2tapgen2deemph3p5 =
169 config->Usb3Lane3Ow2tapgen2deemph3p5;
170 params->PcdSataInterfaceSpeed = config->PcdSataInterfaceSpeed;
171 params->PcdPchUsbSsicPort = config->PcdPchUsbSsicPort;
172 params->PcdPchUsbHsicPort = config->PcdPchUsbHsicPort;
173 params->PcdPcieRootPortSpeed = config->PcdPcieRootPortSpeed;
174 params->PcdPchSsicEnable = config->PcdPchSsicEnable;
175 params->PcdLogoPtr = config->PcdLogoPtr;
176 params->PcdLogoSize = config->PcdLogoSize;
177 params->PcdRtcLock = config->PcdRtcLock;
178 params->PMIC_I2CBus = config->PMIC_I2CBus;
179 params->ISPEnable = config->ISPEnable;
180 params->ISPPciDevConfig = config->ISPPciDevConfig;
Divya Sasidharan89a66852015-10-28 15:02:35 -0700181 params->PcdSdDetectChk = config->PcdSdDetectChk;
Divagar Mohandass0c685302016-02-08 16:09:21 +0530182 params->I2C0Frequency = config->I2C0Frequency;
183 params->I2C1Frequency = config->I2C1Frequency;
184 params->I2C2Frequency = config->I2C2Frequency;
185 params->I2C3Frequency = config->I2C3Frequency;
186 params->I2C4Frequency = config->I2C4Frequency;
187 params->I2C5Frequency = config->I2C5Frequency;
188 params->I2C6Frequency = config->I2C6Frequency;
Matt DeVillier143a8362017-08-26 04:47:15 -0500189
Matt DeVillier2c8ac222017-08-26 04:53:35 -0500190 board_silicon_USB2_override(params);
Lee Leahy32471722015-04-20 15:20:28 -0700191}
192
193void soc_display_silicon_init_params(const SILICON_INIT_UPD *old,
194 SILICON_INIT_UPD *new)
195{
196 /* Display the parameters for SiliconInit */
197 printk(BIOS_SPEW, "UPD values for SiliconInit:\n");
Lee Leahy66208bd2015-10-15 16:17:58 -0700198 fsp_display_upd_value("PcdSdcardMode", 1, old->PcdSdcardMode,
Lee Leahy32471722015-04-20 15:20:28 -0700199 new->PcdSdcardMode);
Lee Leahy66208bd2015-10-15 16:17:58 -0700200 fsp_display_upd_value("PcdEnableHsuart0", 1, old->PcdEnableHsuart0,
Lee Leahy32471722015-04-20 15:20:28 -0700201 new->PcdEnableHsuart0);
Lee Leahy66208bd2015-10-15 16:17:58 -0700202 fsp_display_upd_value("PcdEnableHsuart1", 1, old->PcdEnableHsuart1,
Lee Leahy32471722015-04-20 15:20:28 -0700203 new->PcdEnableHsuart1);
Lee Leahy66208bd2015-10-15 16:17:58 -0700204 fsp_display_upd_value("PcdEnableAzalia", 1, old->PcdEnableAzalia,
Lee Leahy32471722015-04-20 15:20:28 -0700205 new->PcdEnableAzalia);
Lee Leahy66208bd2015-10-15 16:17:58 -0700206 fsp_display_upd_value("AzaliaConfigPtr", 4,
Subrata Banik13cd3312015-08-07 18:22:54 +0530207 (uint32_t)old->AzaliaConfigPtr,
208 (uint32_t)new->AzaliaConfigPtr);
Lee Leahy66208bd2015-10-15 16:17:58 -0700209 fsp_display_upd_value("PcdEnableSata", 1, old->PcdEnableSata,
Lee Leahy32471722015-04-20 15:20:28 -0700210 new->PcdEnableSata);
Lee Leahy66208bd2015-10-15 16:17:58 -0700211 fsp_display_upd_value("PcdEnableXhci", 1, old->PcdEnableXhci,
Lee Leahy32471722015-04-20 15:20:28 -0700212 new->PcdEnableXhci);
Lee Leahy66208bd2015-10-15 16:17:58 -0700213 fsp_display_upd_value("PcdEnableLpe", 1, old->PcdEnableLpe,
Lee Leahy32471722015-04-20 15:20:28 -0700214 new->PcdEnableLpe);
Lee Leahy66208bd2015-10-15 16:17:58 -0700215 fsp_display_upd_value("PcdEnableDma0", 1, old->PcdEnableDma0,
Lee Leahy32471722015-04-20 15:20:28 -0700216 new->PcdEnableDma0);
Lee Leahy66208bd2015-10-15 16:17:58 -0700217 fsp_display_upd_value("PcdEnableDma1", 1, old->PcdEnableDma1,
Lee Leahy32471722015-04-20 15:20:28 -0700218 new->PcdEnableDma1);
Lee Leahy66208bd2015-10-15 16:17:58 -0700219 fsp_display_upd_value("PcdEnableI2C0", 1, old->PcdEnableI2C0,
Lee Leahy32471722015-04-20 15:20:28 -0700220 new->PcdEnableI2C0);
Lee Leahy66208bd2015-10-15 16:17:58 -0700221 fsp_display_upd_value("PcdEnableI2C1", 1, old->PcdEnableI2C1,
Lee Leahy32471722015-04-20 15:20:28 -0700222 new->PcdEnableI2C1);
Lee Leahy66208bd2015-10-15 16:17:58 -0700223 fsp_display_upd_value("PcdEnableI2C2", 1, old->PcdEnableI2C2,
Lee Leahy32471722015-04-20 15:20:28 -0700224 new->PcdEnableI2C2);
Lee Leahy66208bd2015-10-15 16:17:58 -0700225 fsp_display_upd_value("PcdEnableI2C3", 1, old->PcdEnableI2C3,
Lee Leahy32471722015-04-20 15:20:28 -0700226 new->PcdEnableI2C3);
Lee Leahy66208bd2015-10-15 16:17:58 -0700227 fsp_display_upd_value("PcdEnableI2C4", 1, old->PcdEnableI2C4,
Lee Leahy32471722015-04-20 15:20:28 -0700228 new->PcdEnableI2C4);
Lee Leahy66208bd2015-10-15 16:17:58 -0700229 fsp_display_upd_value("PcdEnableI2C5", 1, old->PcdEnableI2C5,
Lee Leahy32471722015-04-20 15:20:28 -0700230 new->PcdEnableI2C5);
Lee Leahy66208bd2015-10-15 16:17:58 -0700231 fsp_display_upd_value("PcdEnableI2C6", 1, old->PcdEnableI2C6,
Lee Leahy32471722015-04-20 15:20:28 -0700232 new->PcdEnableI2C6);
Lee Leahy66208bd2015-10-15 16:17:58 -0700233 fsp_display_upd_value("PcdGraphicsConfigPtr", 4,
Subrata Banik13cd3312015-08-07 18:22:54 +0530234 old->GraphicsConfigPtr, new->GraphicsConfigPtr);
Lee Leahy66208bd2015-10-15 16:17:58 -0700235 fsp_display_upd_value("GpioFamilyInitTablePtr", 4,
Lee Leahy32471722015-04-20 15:20:28 -0700236 (uint32_t)old->GpioFamilyInitTablePtr,
237 (uint32_t)new->GpioFamilyInitTablePtr);
Lee Leahy66208bd2015-10-15 16:17:58 -0700238 fsp_display_upd_value("GpioPadInitTablePtr", 4,
Lee Leahy32471722015-04-20 15:20:28 -0700239 (uint32_t)old->GpioPadInitTablePtr,
240 (uint32_t)new->GpioPadInitTablePtr);
Lee Leahy66208bd2015-10-15 16:17:58 -0700241 fsp_display_upd_value("PunitPwrConfigDisable", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700242 old->PunitPwrConfigDisable,
243 new->PunitPwrConfigDisable);
Lee Leahy66208bd2015-10-15 16:17:58 -0700244 fsp_display_upd_value("ChvSvidConfig", 1, old->ChvSvidConfig,
Lee Leahy32471722015-04-20 15:20:28 -0700245 new->ChvSvidConfig);
Lee Leahy66208bd2015-10-15 16:17:58 -0700246 fsp_display_upd_value("DptfDisable", 1, old->DptfDisable,
Lee Leahy32471722015-04-20 15:20:28 -0700247 new->DptfDisable);
Lee Leahy66208bd2015-10-15 16:17:58 -0700248 fsp_display_upd_value("PcdEmmcMode", 1, old->PcdEmmcMode,
Lee Leahy32471722015-04-20 15:20:28 -0700249 new->PcdEmmcMode);
Lee Leahy66208bd2015-10-15 16:17:58 -0700250 fsp_display_upd_value("PcdUsb3ClkSsc", 1, old->PcdUsb3ClkSsc,
Lee Leahy32471722015-04-20 15:20:28 -0700251 new->PcdUsb3ClkSsc);
Lee Leahy66208bd2015-10-15 16:17:58 -0700252 fsp_display_upd_value("PcdDispClkSsc", 1, old->PcdDispClkSsc,
Lee Leahy32471722015-04-20 15:20:28 -0700253 new->PcdDispClkSsc);
Lee Leahy66208bd2015-10-15 16:17:58 -0700254 fsp_display_upd_value("PcdSataClkSsc", 1, old->PcdSataClkSsc,
Lee Leahy32471722015-04-20 15:20:28 -0700255 new->PcdSataClkSsc);
Lee Leahy66208bd2015-10-15 16:17:58 -0700256 fsp_display_upd_value("Usb2Port0PerPortPeTxiSet", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700257 old->Usb2Port0PerPortPeTxiSet,
258 new->Usb2Port0PerPortPeTxiSet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700259 fsp_display_upd_value("Usb2Port0PerPortTxiSet", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700260 old->Usb2Port0PerPortTxiSet,
261 new->Usb2Port0PerPortTxiSet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700262 fsp_display_upd_value("Usb2Port0IUsbTxEmphasisEn", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700263 old->Usb2Port0IUsbTxEmphasisEn,
264 new->Usb2Port0IUsbTxEmphasisEn);
Lee Leahy66208bd2015-10-15 16:17:58 -0700265 fsp_display_upd_value("Usb2Port0PerPortTxPeHalf", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700266 old->Usb2Port0PerPortTxPeHalf,
267 new->Usb2Port0PerPortTxPeHalf);
Kevin Chiu348a6d52016-06-30 14:50:52 +0800268 fsp_display_upd_value("D0Usb2Port0PerPortRXISet", 1,
269 old->D0Usb2Port0PerPortRXISet,
270 new->D0Usb2Port0PerPortRXISet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700271 fsp_display_upd_value("Usb2Port1PerPortPeTxiSet", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700272 old->Usb2Port1PerPortPeTxiSet,
273 new->Usb2Port1PerPortPeTxiSet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700274 fsp_display_upd_value("Usb2Port1PerPortTxiSet", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700275 old->Usb2Port1PerPortTxiSet,
276 new->Usb2Port1PerPortTxiSet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700277 fsp_display_upd_value("Usb2Port1IUsbTxEmphasisEn", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700278 old->Usb2Port1IUsbTxEmphasisEn,
279 new->Usb2Port1IUsbTxEmphasisEn);
Lee Leahy66208bd2015-10-15 16:17:58 -0700280 fsp_display_upd_value("Usb2Port1PerPortTxPeHalf", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700281 old->Usb2Port1PerPortTxPeHalf,
282 new->Usb2Port1PerPortTxPeHalf);
Kevin Chiu348a6d52016-06-30 14:50:52 +0800283 fsp_display_upd_value("D0Usb2Port1PerPortRXISet", 1,
284 old->D0Usb2Port1PerPortRXISet,
285 new->D0Usb2Port1PerPortRXISet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700286 fsp_display_upd_value("Usb2Port2PerPortPeTxiSet", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700287 old->Usb2Port2PerPortPeTxiSet,
288 new->Usb2Port2PerPortPeTxiSet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700289 fsp_display_upd_value("Usb2Port2PerPortTxiSet", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700290 old->Usb2Port2PerPortTxiSet,
291 new->Usb2Port2PerPortTxiSet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700292 fsp_display_upd_value("Usb2Port2IUsbTxEmphasisEn", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700293 old->Usb2Port2IUsbTxEmphasisEn,
294 new->Usb2Port2IUsbTxEmphasisEn);
Lee Leahy66208bd2015-10-15 16:17:58 -0700295 fsp_display_upd_value("Usb2Port2PerPortTxPeHalf", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700296 old->Usb2Port2PerPortTxPeHalf,
297 new->Usb2Port2PerPortTxPeHalf);
Kevin Chiu348a6d52016-06-30 14:50:52 +0800298 fsp_display_upd_value("D0Usb2Port2PerPortRXISet", 1,
299 old->D0Usb2Port2PerPortRXISet,
300 new->D0Usb2Port2PerPortRXISet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700301 fsp_display_upd_value("Usb2Port3PerPortPeTxiSet", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700302 old->Usb2Port3PerPortPeTxiSet,
303 new->Usb2Port3PerPortPeTxiSet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700304 fsp_display_upd_value("Usb2Port3PerPortTxiSet", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700305 old->Usb2Port3PerPortTxiSet,
306 new->Usb2Port3PerPortTxiSet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700307 fsp_display_upd_value("Usb2Port3IUsbTxEmphasisEn", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700308 old->Usb2Port3IUsbTxEmphasisEn,
309 new->Usb2Port3IUsbTxEmphasisEn);
Lee Leahy66208bd2015-10-15 16:17:58 -0700310 fsp_display_upd_value("Usb2Port3PerPortTxPeHalf", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700311 old->Usb2Port3PerPortTxPeHalf,
312 new->Usb2Port3PerPortTxPeHalf);
Kevin Chiu348a6d52016-06-30 14:50:52 +0800313 fsp_display_upd_value("D0Usb2Port3PerPortRXISet", 1,
314 old->D0Usb2Port3PerPortRXISet,
315 new->D0Usb2Port3PerPortRXISet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700316 fsp_display_upd_value("Usb2Port4PerPortPeTxiSet", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700317 old->Usb2Port4PerPortPeTxiSet,
318 new->Usb2Port4PerPortPeTxiSet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700319 fsp_display_upd_value("Usb2Port4PerPortTxiSet", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700320 old->Usb2Port4PerPortTxiSet,
321 new->Usb2Port4PerPortTxiSet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700322 fsp_display_upd_value("Usb2Port4IUsbTxEmphasisEn", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700323 old->Usb2Port4IUsbTxEmphasisEn,
324 new->Usb2Port4IUsbTxEmphasisEn);
Lee Leahy66208bd2015-10-15 16:17:58 -0700325 fsp_display_upd_value("Usb2Port4PerPortTxPeHalf", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700326 old->Usb2Port4PerPortTxPeHalf,
327 new->Usb2Port4PerPortTxPeHalf);
Kevin Chiu348a6d52016-06-30 14:50:52 +0800328 fsp_display_upd_value("D0Usb2Port4PerPortRXISet", 1,
329 old->D0Usb2Port4PerPortRXISet,
330 new->D0Usb2Port4PerPortRXISet);
Lee Leahy66208bd2015-10-15 16:17:58 -0700331 fsp_display_upd_value("Usb3Lane0Ow2tapgen2deemph3p5", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700332 old->Usb3Lane0Ow2tapgen2deemph3p5,
333 new->Usb3Lane0Ow2tapgen2deemph3p5);
Lee Leahy66208bd2015-10-15 16:17:58 -0700334 fsp_display_upd_value("Usb3Lane1Ow2tapgen2deemph3p5", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700335 old->Usb3Lane1Ow2tapgen2deemph3p5,
336 new->Usb3Lane1Ow2tapgen2deemph3p5);
Lee Leahy66208bd2015-10-15 16:17:58 -0700337 fsp_display_upd_value("Usb3Lane2Ow2tapgen2deemph3p5", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700338 old->Usb3Lane2Ow2tapgen2deemph3p5,
339 new->Usb3Lane2Ow2tapgen2deemph3p5);
Lee Leahy66208bd2015-10-15 16:17:58 -0700340 fsp_display_upd_value("Usb3Lane3Ow2tapgen2deemph3p5", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700341 old->Usb3Lane3Ow2tapgen2deemph3p5,
342 new->Usb3Lane3Ow2tapgen2deemph3p5);
Lee Leahy66208bd2015-10-15 16:17:58 -0700343 fsp_display_upd_value("PcdSataInterfaceSpeed", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700344 old->PcdSataInterfaceSpeed,
345 new->PcdSataInterfaceSpeed);
Lee Leahy66208bd2015-10-15 16:17:58 -0700346 fsp_display_upd_value("PcdPchUsbSsicPort", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700347 old->PcdPchUsbSsicPort, new->PcdPchUsbSsicPort);
Lee Leahy66208bd2015-10-15 16:17:58 -0700348 fsp_display_upd_value("PcdPchUsbHsicPort", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700349 old->PcdPchUsbHsicPort, new->PcdPchUsbHsicPort);
Lee Leahy66208bd2015-10-15 16:17:58 -0700350 fsp_display_upd_value("PcdPcieRootPortSpeed", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700351 old->PcdPcieRootPortSpeed, new->PcdPcieRootPortSpeed);
Lee Leahy66208bd2015-10-15 16:17:58 -0700352 fsp_display_upd_value("PcdPchSsicEnable", 1, old->PcdPchSsicEnable,
Lee Leahy32471722015-04-20 15:20:28 -0700353 new->PcdPchSsicEnable);
Lee Leahy66208bd2015-10-15 16:17:58 -0700354 fsp_display_upd_value("PcdLogoPtr", 4, old->PcdLogoPtr,
Lee Leahy32471722015-04-20 15:20:28 -0700355 new->PcdLogoPtr);
Lee Leahy66208bd2015-10-15 16:17:58 -0700356 fsp_display_upd_value("PcdLogoSize", 4, old->PcdLogoSize,
Lee Leahy32471722015-04-20 15:20:28 -0700357 new->PcdLogoSize);
Lee Leahy66208bd2015-10-15 16:17:58 -0700358 fsp_display_upd_value("PcdRtcLock", 1, old->PcdRtcLock,
Lee Leahy32471722015-04-20 15:20:28 -0700359 new->PcdRtcLock);
Lee Leahy66208bd2015-10-15 16:17:58 -0700360 fsp_display_upd_value("PMIC_I2CBus", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700361 old->PMIC_I2CBus, new->PMIC_I2CBus);
Lee Leahy66208bd2015-10-15 16:17:58 -0700362 fsp_display_upd_value("ISPEnable", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700363 old->ISPEnable, new->ISPEnable);
Lee Leahy66208bd2015-10-15 16:17:58 -0700364 fsp_display_upd_value("ISPPciDevConfig", 1,
Lee Leahy32471722015-04-20 15:20:28 -0700365 old->ISPPciDevConfig, new->ISPPciDevConfig);
Divya Sasidharan89a66852015-10-28 15:02:35 -0700366 fsp_display_upd_value("PcdSdDetectChk", 1,
367 old->PcdSdDetectChk, new->PcdSdDetectChk);
Lee Leahy32471722015-04-20 15:20:28 -0700368}
369
Lee Leahy77ff0b12015-05-05 15:07:29 -0700370/* Called at BS_DEV_INIT_CHIPS time -- very early. Just after BS_PRE_DEVICE. */
371static void soc_init(void *chip_info)
372{
Lee Leahy32471722015-04-20 15:20:28 -0700373 printk(BIOS_SPEW, "%s/%s\n", __FILE__, __func__);
374 soc_init_pre_device(chip_info);
Lee Leahy77ff0b12015-05-05 15:07:29 -0700375}
376
Lee Leahy32471722015-04-20 15:20:28 -0700377struct chip_operations soc_intel_braswell_ops = {
378 CHIP_NAME("Intel Braswell SoC")
Lee Leahy77ff0b12015-05-05 15:07:29 -0700379 .enable_dev = enable_dev,
380 .init = soc_init,
381};
382
Elyes HAOUASb13fac32018-05-24 22:29:44 +0200383static void pci_set_subsystem(struct device *dev, unsigned int vendor,
Lee Leahy1072e7d2017-03-16 17:35:32 -0700384 unsigned int device)
Lee Leahy77ff0b12015-05-05 15:07:29 -0700385{
Elyes HAOUASa342f392018-10-17 10:56:26 +0200386 printk(BIOS_SPEW, "%s/%s (%s, 0x%04x, 0x%04x)\n",
Lee Leahy32471722015-04-20 15:20:28 -0700387 __FILE__, __func__, dev_name(dev), vendor, device);
Lee Leahy77ff0b12015-05-05 15:07:29 -0700388 if (!vendor || !device) {
389 pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
390 pci_read_config32(dev, PCI_VENDOR_ID));
391 } else {
392 pci_write_config32(dev, PCI_SUBSYSTEM_VENDOR_ID,
393 ((device & 0xffff) << 16) | (vendor & 0xffff));
394 }
395}
396
397struct pci_operations soc_pci_ops = {
398 .set_subsystem = &pci_set_subsystem,
399};
Matt DeVillier143a8362017-08-26 04:47:15 -0500400
401/**
402 Return SoC stepping type
403
404 @retval SOC_STEPPING SoC stepping type
405**/
406int SocStepping(void)
407{
Kyösti Mälkkic70eed12018-05-22 02:18:00 +0300408 struct device *dev = pcidev_on_root(LPC_DEV, LPC_FUNC);
Matt DeVillier143a8362017-08-26 04:47:15 -0500409 u8 revid = pci_read_config8(dev, 0x8);
410
411 switch (revid & B_PCH_LPC_RID_STEPPING_MASK) {
412 case V_PCH_LPC_RID_A0:
413 return SocA0;
414 case V_PCH_LPC_RID_A1:
415 return SocA1;
416 case V_PCH_LPC_RID_A2:
417 return SocA2;
418 case V_PCH_LPC_RID_A3:
419 return SocA3;
420 case V_PCH_LPC_RID_A4:
421 return SocA4;
422 case V_PCH_LPC_RID_A5:
423 return SocA5;
424 case V_PCH_LPC_RID_A6:
425 return SocA6;
426 case V_PCH_LPC_RID_A7:
427 return SocA7;
428 case V_PCH_LPC_RID_B0:
429 return SocB0;
430 case V_PCH_LPC_RID_B1:
431 return SocB1;
432 case V_PCH_LPC_RID_B2:
433 return SocB2;
434 case V_PCH_LPC_RID_B3:
435 return SocB3;
436 case V_PCH_LPC_RID_B4:
437 return SocB4;
438 case V_PCH_LPC_RID_B5:
439 return SocB5;
440 case V_PCH_LPC_RID_B6:
441 return SocB6;
442 case V_PCH_LPC_RID_B7:
443 return SocB7;
444 case V_PCH_LPC_RID_C0:
445 return SocC0;
446 case V_PCH_LPC_RID_C1:
447 return SocC1;
448 case V_PCH_LPC_RID_C2:
449 return SocC2;
450 case V_PCH_LPC_RID_C3:
451 return SocC3;
452 case V_PCH_LPC_RID_C4:
453 return SocC4;
454 case V_PCH_LPC_RID_C5:
455 return SocC5;
456 case V_PCH_LPC_RID_C6:
457 return SocC6;
458 case V_PCH_LPC_RID_C7:
459 return SocC7;
460 case V_PCH_LPC_RID_D0:
461 return SocD0;
462 case V_PCH_LPC_RID_D1:
463 return SocD1;
464 case V_PCH_LPC_RID_D2:
465 return SocD2;
466 case V_PCH_LPC_RID_D3:
467 return SocD3;
468 case V_PCH_LPC_RID_D4:
469 return SocD4;
470 case V_PCH_LPC_RID_D5:
471 return SocD5;
472 case V_PCH_LPC_RID_D6:
473 return SocD6;
474 case V_PCH_LPC_RID_D7:
475 return SocD7;
476 default:
477 return SocSteppingMax;
478 }
479}