blob: 853de1cccb0ae624952d84e52f4556bacf062bb2 [file] [log] [blame]
Subrata Banik292afef2020-09-09 13:34:18 +05301/* SPDX-License-Identifier: GPL-2.0-only */
2
3#ifndef _SOC_CHIP_H_
4#define _SOC_CHIP_H_
5
6#include <drivers/i2c/designware/dw_i2c.h>
7#include <intelblocks/cfg.h>
8#include <intelblocks/gpio.h>
9#include <intelblocks/gspi.h>
Sumeet R Pawnikar77298c62021-03-10 21:09:37 +053010#include <intelblocks/power_limit.h>
Eric Laide2ab412021-01-11 16:14:14 +080011#include <intelblocks/pcie_rp.h>
Maulik V Vaghela69353502021-04-14 14:01:02 +053012#include <intelblocks/tcss.h>
Subrata Banik292afef2020-09-09 13:34:18 +053013#include <soc/gpe.h>
Subrata Banik292afef2020-09-09 13:34:18 +053014#include <soc/pci_devs.h>
15#include <soc/pmc.h>
Subrata Banik2871e0e2020-09-27 11:30:58 +053016#include <soc/serialio.h>
17#include <soc/usb.h>
Subrata Banik292afef2020-09-09 13:34:18 +053018#include <stdint.h>
19
Sumeet Pawnikaraa496082021-05-07 20:11:53 +053020/* Types of different SKUs */
21enum soc_intel_alderlake_power_limits {
22 ADL_P_POWER_LIMITS_282_CORE,
23 ADL_P_POWER_LIMITS_482_CORE,
24 ADL_P_POWER_LIMITS_682_CORE,
25 ADL_M_POWER_LIMITS_282_CORE,
26 ADL_POWER_LIMITS_COUNT
27};
28
Subrata Banik292afef2020-09-09 13:34:18 +053029struct soc_intel_alderlake_config {
30
31 /* Common struct containing soc config data required by common code */
32 struct soc_intel_common_config common_soc_config;
33
Sumeet R Pawnikar77298c62021-03-10 21:09:37 +053034 /* Common struct containing power limits configuration information */
Sumeet Pawnikaraa496082021-05-07 20:11:53 +053035 struct soc_power_limits_config power_limits_config[ADL_POWER_LIMITS_COUNT];
Sumeet R Pawnikar77298c62021-03-10 21:09:37 +053036
Subrata Banik292afef2020-09-09 13:34:18 +053037 /* Gpio group routed to each dword of the GPE0 block. Values are
38 * of the form PMC_GPP_[A:U] or GPD. */
39 uint8_t pmc_gpe0_dw0; /* GPE0_31_0 STS/EN */
40 uint8_t pmc_gpe0_dw1; /* GPE0_63_32 STS/EN */
41 uint8_t pmc_gpe0_dw2; /* GPE0_95_64 STS/EN */
42
43 /* Generic IO decode ranges */
44 uint32_t gen1_dec;
45 uint32_t gen2_dec;
46 uint32_t gen3_dec;
47 uint32_t gen4_dec;
48
49 /* Enable S0iX support */
50 int s0ix_enable;
51 /* Support for TCSS xhci, xdci, TBT PCIe root ports and DMA controllers */
52 uint8_t TcssD3HotDisable;
53 /* Support for TBT PCIe root ports and DMA controllers with D3Hot->D3Cold */
54 uint8_t TcssD3ColdDisable;
55 /* Enable DPTF support */
56 int dptf_enable;
57
58 /* Deep SX enable for both AC and DC */
59 int deep_s3_enable_ac;
60 int deep_s3_enable_dc;
61 int deep_s5_enable_ac;
62 int deep_s5_enable_dc;
63
64 /* Deep Sx Configuration
65 * DSX_EN_WAKE_PIN - Enable WAKE# pin
66 * DSX_EN_LAN_WAKE_PIN - Enable LAN_WAKE# pin
67 * DSX_DIS_AC_PRESENT_PD - Disable pull-down on AC_PRESENT pin */
68 uint32_t deep_sx_config;
69
70 /* TCC activation offset */
71 uint32_t tcc_offset;
72
73 /* System Agent dynamic frequency support. Only effects ULX/ULT CPUs.
74 * When enabled memory will be training at two different frequencies.
75 * 0:Disabled, 1:FixedPoint0, 2:FixedPoint1, 3:FixedPoint2,
76 * 4:FixedPoint3, 5:Enabled */
77 enum {
78 SaGv_Disabled,
79 SaGv_FixedPoint0,
80 SaGv_FixedPoint1,
81 SaGv_FixedPoint2,
82 SaGv_FixedPoint3,
83 SaGv_Enabled,
84 } SaGv;
85
86 /* Rank Margin Tool. 1:Enable, 0:Disable */
87 uint8_t RMT;
88
89 /* USB related */
90 struct usb2_port_config usb2_ports[16];
91 struct usb3_port_config usb3_ports[10];
92 /* Wake Enable Bitmap for USB2 ports */
93 uint16_t usb2_wake_enable_bitmap;
94 /* Wake Enable Bitmap for USB3 ports */
95 uint16_t usb3_wake_enable_bitmap;
Maulik V Vaghela69353502021-04-14 14:01:02 +053096 /* Program OC pins for TCSS */
97 struct tcss_port_config tcss_ports[MAX_TYPE_C_PORTS];
Subrata Banik292afef2020-09-09 13:34:18 +053098
99 /* SATA related */
100 uint8_t SataEnable;
101 uint8_t SataMode;
102 uint8_t SataSalpSupport;
103 uint8_t SataPortsEnable[8];
104 uint8_t SataPortsDevSlp[8];
105
106 /*
107 * Enable(0)/Disable(1) SATA Power Optimizer on PCH side.
108 * Default 0. Setting this to 1 disables the SATA Power Optimizer.
109 */
110 uint8_t SataPwrOptimizeDisable;
111
112 /*
113 * SATA Port Enable Dito Config.
114 * Enable DEVSLP Idle Timeout settings (DmVal, DitoVal).
115 */
116 uint8_t SataPortsEnableDitoConfig[8];
117
118 /* SataPortsDmVal is the DITO multiplier. Default is 15. */
119 uint8_t SataPortsDmVal[8];
120 /* SataPortsDitoVal is the DEVSLP Idle Timeout, default is 625ms */
121 uint16_t SataPortsDitoVal[8];
122
123 /* Audio related */
124 uint8_t PchHdaDspEnable;
Sugnan Prabhu S50f8b4e2021-03-18 22:08:22 +0530125
126 /* iDisp-Link T-Mode 0: 2T, 2: 4T, 3: 8T, 4: 16T */
127 enum {
128 HDA_TMODE_2T = 0,
129 HDA_TMODE_4T = 2,
130 HDA_TMODE_8T = 3,
131 HDA_TMODE_16T = 4,
132 } PchHdaIDispLinkTmode;
133
134 /* iDisp-Link Freq 4: 96MHz, 3: 48MHz. */
135 enum {
136 HDA_LINKFREQ_48MHZ = 3,
137 HDA_LINKFREQ_96MHZ = 4,
138 } PchHdaIDispLinkFrequency;
139
140 bool PchHdaIDispCodecEnable;
Subrata Banik292afef2020-09-09 13:34:18 +0530141
Eric Lai5b302b22020-12-05 16:49:43 +0800142 struct pcie_rp_config pch_pcie_rp[CONFIG_MAX_PCH_ROOT_PORTS];
143 struct pcie_rp_config cpu_pcie_rp[CONFIG_MAX_CPU_ROOT_PORTS];
144 uint8_t pcie_clk_config_flag[CONFIG_MAX_PCIE_CLOCK_SRC];
Subrata Banik292afef2020-09-09 13:34:18 +0530145
Subrata Banik292afef2020-09-09 13:34:18 +0530146 /* Gfx related */
147 enum {
148 IGD_SM_0MB = 0x00,
149 IGD_SM_32MB = 0x01,
150 IGD_SM_64MB = 0x02,
151 IGD_SM_96MB = 0x03,
152 IGD_SM_128MB = 0x04,
153 IGD_SM_160MB = 0x05,
154 IGD_SM_4MB = 0xF0,
155 IGD_SM_8MB = 0xF1,
156 IGD_SM_12MB = 0xF2,
157 IGD_SM_16MB = 0xF3,
158 IGD_SM_20MB = 0xF4,
159 IGD_SM_24MB = 0xF5,
160 IGD_SM_28MB = 0xF6,
161 IGD_SM_36MB = 0xF8,
162 IGD_SM_40MB = 0xF9,
163 IGD_SM_44MB = 0xFA,
164 IGD_SM_48MB = 0xFB,
165 IGD_SM_52MB = 0xFC,
166 IGD_SM_56MB = 0xFD,
167 IGD_SM_60MB = 0xFE,
168 } IgdDvmt50PreAlloc;
Subrata Banik292afef2020-09-09 13:34:18 +0530169 uint8_t SkipExtGfxScan;
170
Subrata Banik292afef2020-09-09 13:34:18 +0530171 /* HeciEnabled decides the state of Heci1 at end of boot
172 * Setting to 0 (default) disables Heci1 and hides the device from OS */
173 uint8_t HeciEnabled;
Subrata Banik292afef2020-09-09 13:34:18 +0530174
175 /* Enable/Disable EIST. 1b:Enabled, 0b:Disabled */
176 uint8_t eist_enable;
177
178 /* Enable C6 DRAM */
179 uint8_t enable_c6dram;
Subrata Banik292afef2020-09-09 13:34:18 +0530180 uint8_t PmTimerDisabled;
181 /*
182 * SerialIO device mode selection:
183 * PchSerialIoDisabled,
184 * PchSerialIoPci,
185 * PchSerialIoHidden,
186 * PchSerialIoLegacyUart,
187 * PchSerialIoSkipInit
188 */
189 uint8_t SerialIoI2cMode[CONFIG_SOC_INTEL_I2C_DEV_MAX];
190 uint8_t SerialIoGSpiMode[CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX];
191 uint8_t SerialIoUartMode[CONFIG_SOC_INTEL_UART_DEV_MAX];
192 /*
193 * GSPIn Default Chip Select Mode:
194 * 0:Hardware Mode,
195 * 1:Software Mode
196 */
197 uint8_t SerialIoGSpiCsMode[CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX];
198 /*
199 * GSPIn Default Chip Select State:
200 * 0: Low,
201 * 1: High
202 */
203 uint8_t SerialIoGSpiCsState[CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX];
204
205 /* Debug interface selection */
206 enum {
207 DEBUG_INTERFACE_RAM = (1 << 0),
208 DEBUG_INTERFACE_UART_8250IO = (1 << 1),
209 DEBUG_INTERFACE_USB3 = (1 << 3),
210 DEBUG_INTERFACE_LPSS_SERIAL_IO = (1 << 4),
211 DEBUG_INTERFACE_TRACEHUB = (1 << 5),
212 } debug_interface_flag;
213
214 /* Enable Pch iSCLK */
215 uint8_t pch_isclk;
216
Cliff Huangbc1941f2021-02-10 17:41:41 -0800217 /* CNVi BT Core Enable/Disable */
218 bool CnviBtCore;
219
Subrata Banik292afef2020-09-09 13:34:18 +0530220 /* CNVi BT Audio Offload: Enable/Disable BT Audio Offload. */
Angel Pons98521c52021-03-01 21:16:49 +0100221 bool CnviBtAudioOffload;
Subrata Banik292afef2020-09-09 13:34:18 +0530222
223 /*
Deepti Deshatty8e7facf2021-05-12 17:45:37 +0530224 * These GPIOs will be programmed by the IOM to handle biasing of the
225 * Type-C aux (SBU) signals when certain alternate modes are used.
226 * `pad_auxn_dc` should be assigned to the GPIO pad providing negative
227 * bias (name usually contains `AUXN_DC` or `AUX_N`); similarly,
228 * `pad_auxp_dc` should be assigned to the GPIO providing positive bias
229 * (name often contains `AUXP_DC` or `_AUX_P`).
Subrata Banik2871e0e2020-09-27 11:30:58 +0530230 */
Deepti Deshatty8e7facf2021-05-12 17:45:37 +0530231 struct typec_aux_bias_pads typec_aux_bias_pads[MAX_TYPE_C_PORTS];
Subrata Banik2871e0e2020-09-27 11:30:58 +0530232
233 /*
Subrata Banik292afef2020-09-09 13:34:18 +0530234 * SOC Aux orientation override:
235 * This is a bitfield that corresponds to up to 4 TCSS ports on ADL.
236 * Even numbered bits (0, 2, 4, 6) control the retimer being handled by SOC.
237 * Odd numbered bits (1, 3, 5, 7) control the orientation of the physical aux lines
238 * on the motherboard.
239 */
240 uint16_t TcssAuxOri;
241
242 /* Connect Topology Command timeout value */
243 uint16_t ITbtConnectTopologyTimeoutInMs;
244
245 /*
246 * Override GPIO PM configuration:
247 * 0: Use FSP default GPIO PM program,
248 * 1: coreboot to override GPIO PM program
249 */
250 uint8_t gpio_override_pm;
251
252 /*
253 * GPIO PM configuration: 0 to disable, 1 to enable power gating
254 * Bit 6-7: Reserved
255 * Bit 5: MISCCFG_GPSIDEDPCGEN
256 * Bit 4: MISCCFG_GPRCOMPCDLCGEN
257 * Bit 3: MISCCFG_GPRTCDLCGEN
258 * Bit 2: MISCCFG_GSXLCGEN
259 * Bit 1: MISCCFG_GPDPCGEN
260 * Bit 0: MISCCFG_GPDLCGEN
261 */
262 uint8_t gpio_pm[TOTAL_GPIO_COMM];
263
264 /* DP config */
265 /*
266 * Port config
267 * 0:Disabled, 1:eDP, 2:MIPI DSI
268 */
269 uint8_t DdiPortAConfig;
270 uint8_t DdiPortBConfig;
271
272 /* Enable(1)/Disable(0) HPD */
273 uint8_t DdiPortAHpd;
274 uint8_t DdiPortBHpd;
275 uint8_t DdiPortCHpd;
276 uint8_t DdiPort1Hpd;
277 uint8_t DdiPort2Hpd;
278 uint8_t DdiPort3Hpd;
279 uint8_t DdiPort4Hpd;
280
281 /* Enable(1)/Disable(0) DDC */
282 uint8_t DdiPortADdc;
283 uint8_t DdiPortBDdc;
284 uint8_t DdiPortCDdc;
285 uint8_t DdiPort1Ddc;
286 uint8_t DdiPort2Ddc;
287 uint8_t DdiPort3Ddc;
288 uint8_t DdiPort4Ddc;
289
290 /* Hybrid storage mode enable (1) / disable (0)
291 * This mode makes FSP detect Optane and NVME and set PCIe lane mode
292 * accordingly */
293 uint8_t HybridStorageMode;
294
295 /*
296 * Override CPU flex ratio value:
297 * CPU ratio value controls the maximum processor non-turbo ratio.
298 * Valid Range 0 to 63.
299 *
300 * In general descriptor provides option to set default cpu flex ratio.
301 * Default cpu flex ratio is 0 ensures booting with non-turbo max frequency.
302 * That's the reason FSP skips cpu_ratio override if cpu_ratio is 0.
303 *
304 * Only override CPU flex ratio if don't want to boot with non-turbo max.
305 */
306 uint8_t cpu_ratio_override;
307
308 /*
309 * Enable(0)/Disable(1) DMI Power Optimizer on PCH side.
310 * Default 0. Setting this to 1 disables the DMI Power Optimizer.
311 */
312 uint8_t DmiPwrOptimizeDisable;
313
314 /*
315 * Enable(1)/Disable(0) CPU Replacement check.
316 * Default 0. Setting this to 1 to check CPU replacement.
317 */
318 uint8_t CpuReplacementCheck;
319
320 /* ISA Serial Base selection. */
321 enum {
322 ISA_SERIAL_BASE_ADDR_3F8,
323 ISA_SERIAL_BASE_ADDR_2F8,
324 } IsaSerialUartBase;
325};
326
327typedef struct soc_intel_alderlake_config config_t;
328
329#endif