blob: 077a58df794f7d5ec2b1dca49f328e4974208a26 [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 Banik8a18bd82021-06-09 21:57:49 +053029/* Types of display ports */
30enum ddi_ports {
31 DDI_PORT_A,
32 DDI_PORT_B,
33 DDI_PORT_C,
34 DDI_PORT_1,
35 DDI_PORT_2,
36 DDI_PORT_3,
37 DDI_PORT_4,
38 DDI_PORT_COUNT,
39};
40
41enum ddi_port_flags {
42 DDI_ENABLE_DDC = 1 << 0,
43 DDI_ENABLE_HPD = 1 << 1,
44};
45
V Sowmya418d37e2021-06-21 08:47:17 +053046/*
47 * Enable External V1P05/Vnn/VnnSx Rail in: BIT0:S0i1/S0i2,
48 * BIT1:S0i3, BIT2:S3, BIT3:S4, BIT4:S5
49 */
50enum fivr_enable_states {
51 FIVR_ENABLE_S0i1_S0i2 = BIT(0),
52 FIVR_ENABLE_S0i3 = BIT(1),
53 FIVR_ENABLE_S3 = BIT(2),
54 FIVR_ENABLE_S4 = BIT(3),
55 FIVR_ENABLE_S5 = BIT(4),
56};
57
58/*
59 * Enable the following for External V1p05 rail
60 * BIT0: Retention active switch support
61 * BIT1: Normal Active voltage supported
62 * BIT2: Minimum active voltage supported
63 * BIT3: Minimum Retention voltage supported
64 */
65enum fivr_voltage_supported {
66 FIVR_RET_ACTIVE_SWITCH_SUPPORT = BIT(0),
67 FIVR_VOLTAGE_NORMAL = BIT(1),
68 FIVR_VOLTAGE_MIN_ACTIVE = BIT(2),
69 FIVR_VOLTAGE_MIN_RETENTION = BIT(3),
70};
71
72#define FIVR_ENABLE_ALL_SX (FIVR_ENABLE_S0i1_S0i2 | FIVR_ENABLE_S0i3 | \
73 FIVR_ENABLE_S3 | FIVR_ENABLE_S4 | FIVR_ENABLE_S5)
V Sowmyaaf429062021-06-21 10:23:33 +053074/*
75 * The Max Pkg Cstate
76 * Values 0 - C0/C1, 1 - C2, 2 - C3, 3 - C6, 4 - C7, 5 - C7S, 6 - C8, 7 - C9, 8 - C10,
77 * 254 - CPU Default , 255 - Auto.
78 */
79enum pkgcstate_limit {
80 LIMIT_C0_C1 = 0,
81 LIMIT_C2 = 1,
82 LIMIT_C3 = 2,
83 LIMIT_C6 = 3,
84 LIMIT_C7 = 4,
85 LIMIT_C7S = 5,
86 LIMIT_C8 = 6,
87 LIMIT_C9 = 7,
88 LIMIT_C10 = 8,
89 LIMIT_CPUDEFAULT = 254,
90 LIMIT_AUTO = 255,
91};
V Sowmya418d37e2021-06-21 08:47:17 +053092
Subrata Banik292afef2020-09-09 13:34:18 +053093struct soc_intel_alderlake_config {
94
95 /* Common struct containing soc config data required by common code */
96 struct soc_intel_common_config common_soc_config;
97
Sumeet R Pawnikar77298c62021-03-10 21:09:37 +053098 /* Common struct containing power limits configuration information */
Sumeet Pawnikaraa496082021-05-07 20:11:53 +053099 struct soc_power_limits_config power_limits_config[ADL_POWER_LIMITS_COUNT];
Sumeet R Pawnikar77298c62021-03-10 21:09:37 +0530100
Subrata Banik292afef2020-09-09 13:34:18 +0530101 /* Gpio group routed to each dword of the GPE0 block. Values are
102 * of the form PMC_GPP_[A:U] or GPD. */
103 uint8_t pmc_gpe0_dw0; /* GPE0_31_0 STS/EN */
104 uint8_t pmc_gpe0_dw1; /* GPE0_63_32 STS/EN */
105 uint8_t pmc_gpe0_dw2; /* GPE0_95_64 STS/EN */
106
107 /* Generic IO decode ranges */
108 uint32_t gen1_dec;
109 uint32_t gen2_dec;
110 uint32_t gen3_dec;
111 uint32_t gen4_dec;
112
113 /* Enable S0iX support */
114 int s0ix_enable;
115 /* Support for TCSS xhci, xdci, TBT PCIe root ports and DMA controllers */
116 uint8_t TcssD3HotDisable;
117 /* Support for TBT PCIe root ports and DMA controllers with D3Hot->D3Cold */
118 uint8_t TcssD3ColdDisable;
119 /* Enable DPTF support */
120 int dptf_enable;
121
122 /* Deep SX enable for both AC and DC */
123 int deep_s3_enable_ac;
124 int deep_s3_enable_dc;
125 int deep_s5_enable_ac;
126 int deep_s5_enable_dc;
127
128 /* Deep Sx Configuration
129 * DSX_EN_WAKE_PIN - Enable WAKE# pin
130 * DSX_EN_LAN_WAKE_PIN - Enable LAN_WAKE# pin
131 * DSX_DIS_AC_PRESENT_PD - Disable pull-down on AC_PRESENT pin */
132 uint32_t deep_sx_config;
133
134 /* TCC activation offset */
135 uint32_t tcc_offset;
136
137 /* System Agent dynamic frequency support. Only effects ULX/ULT CPUs.
138 * When enabled memory will be training at two different frequencies.
139 * 0:Disabled, 1:FixedPoint0, 2:FixedPoint1, 3:FixedPoint2,
140 * 4:FixedPoint3, 5:Enabled */
141 enum {
142 SaGv_Disabled,
143 SaGv_FixedPoint0,
144 SaGv_FixedPoint1,
145 SaGv_FixedPoint2,
146 SaGv_FixedPoint3,
147 SaGv_Enabled,
148 } SaGv;
149
150 /* Rank Margin Tool. 1:Enable, 0:Disable */
151 uint8_t RMT;
152
153 /* USB related */
154 struct usb2_port_config usb2_ports[16];
155 struct usb3_port_config usb3_ports[10];
156 /* Wake Enable Bitmap for USB2 ports */
157 uint16_t usb2_wake_enable_bitmap;
158 /* Wake Enable Bitmap for USB3 ports */
159 uint16_t usb3_wake_enable_bitmap;
Maulik V Vaghela69353502021-04-14 14:01:02 +0530160 /* Program OC pins for TCSS */
161 struct tcss_port_config tcss_ports[MAX_TYPE_C_PORTS];
Subrata Banik292afef2020-09-09 13:34:18 +0530162
163 /* SATA related */
164 uint8_t SataEnable;
165 uint8_t SataMode;
166 uint8_t SataSalpSupport;
167 uint8_t SataPortsEnable[8];
168 uint8_t SataPortsDevSlp[8];
169
170 /*
171 * Enable(0)/Disable(1) SATA Power Optimizer on PCH side.
172 * Default 0. Setting this to 1 disables the SATA Power Optimizer.
173 */
174 uint8_t SataPwrOptimizeDisable;
175
176 /*
177 * SATA Port Enable Dito Config.
178 * Enable DEVSLP Idle Timeout settings (DmVal, DitoVal).
179 */
180 uint8_t SataPortsEnableDitoConfig[8];
181
182 /* SataPortsDmVal is the DITO multiplier. Default is 15. */
183 uint8_t SataPortsDmVal[8];
184 /* SataPortsDitoVal is the DEVSLP Idle Timeout, default is 625ms */
185 uint16_t SataPortsDitoVal[8];
186
187 /* Audio related */
188 uint8_t PchHdaDspEnable;
Sugnan Prabhu S50f8b4e2021-03-18 22:08:22 +0530189
190 /* iDisp-Link T-Mode 0: 2T, 2: 4T, 3: 8T, 4: 16T */
191 enum {
192 HDA_TMODE_2T = 0,
193 HDA_TMODE_4T = 2,
194 HDA_TMODE_8T = 3,
195 HDA_TMODE_16T = 4,
196 } PchHdaIDispLinkTmode;
197
198 /* iDisp-Link Freq 4: 96MHz, 3: 48MHz. */
199 enum {
200 HDA_LINKFREQ_48MHZ = 3,
201 HDA_LINKFREQ_96MHZ = 4,
202 } PchHdaIDispLinkFrequency;
203
204 bool PchHdaIDispCodecEnable;
Subrata Banik292afef2020-09-09 13:34:18 +0530205
Eric Lai5b302b22020-12-05 16:49:43 +0800206 struct pcie_rp_config pch_pcie_rp[CONFIG_MAX_PCH_ROOT_PORTS];
207 struct pcie_rp_config cpu_pcie_rp[CONFIG_MAX_CPU_ROOT_PORTS];
208 uint8_t pcie_clk_config_flag[CONFIG_MAX_PCIE_CLOCK_SRC];
Subrata Banik292afef2020-09-09 13:34:18 +0530209
Subrata Banik292afef2020-09-09 13:34:18 +0530210 /* Gfx related */
211 enum {
212 IGD_SM_0MB = 0x00,
213 IGD_SM_32MB = 0x01,
214 IGD_SM_64MB = 0x02,
215 IGD_SM_96MB = 0x03,
216 IGD_SM_128MB = 0x04,
217 IGD_SM_160MB = 0x05,
218 IGD_SM_4MB = 0xF0,
219 IGD_SM_8MB = 0xF1,
220 IGD_SM_12MB = 0xF2,
221 IGD_SM_16MB = 0xF3,
222 IGD_SM_20MB = 0xF4,
223 IGD_SM_24MB = 0xF5,
224 IGD_SM_28MB = 0xF6,
225 IGD_SM_36MB = 0xF8,
226 IGD_SM_40MB = 0xF9,
227 IGD_SM_44MB = 0xFA,
228 IGD_SM_48MB = 0xFB,
229 IGD_SM_52MB = 0xFC,
230 IGD_SM_56MB = 0xFD,
231 IGD_SM_60MB = 0xFE,
232 } IgdDvmt50PreAlloc;
Subrata Banik292afef2020-09-09 13:34:18 +0530233 uint8_t SkipExtGfxScan;
234
Subrata Banik292afef2020-09-09 13:34:18 +0530235 /* HeciEnabled decides the state of Heci1 at end of boot
236 * Setting to 0 (default) disables Heci1 and hides the device from OS */
237 uint8_t HeciEnabled;
Subrata Banik292afef2020-09-09 13:34:18 +0530238
239 /* Enable/Disable EIST. 1b:Enabled, 0b:Disabled */
240 uint8_t eist_enable;
241
242 /* Enable C6 DRAM */
243 uint8_t enable_c6dram;
Subrata Banik292afef2020-09-09 13:34:18 +0530244 uint8_t PmTimerDisabled;
245 /*
246 * SerialIO device mode selection:
247 * PchSerialIoDisabled,
248 * PchSerialIoPci,
249 * PchSerialIoHidden,
250 * PchSerialIoLegacyUart,
251 * PchSerialIoSkipInit
252 */
253 uint8_t SerialIoI2cMode[CONFIG_SOC_INTEL_I2C_DEV_MAX];
254 uint8_t SerialIoGSpiMode[CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX];
255 uint8_t SerialIoUartMode[CONFIG_SOC_INTEL_UART_DEV_MAX];
256 /*
257 * GSPIn Default Chip Select Mode:
258 * 0:Hardware Mode,
259 * 1:Software Mode
260 */
261 uint8_t SerialIoGSpiCsMode[CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX];
262 /*
263 * GSPIn Default Chip Select State:
264 * 0: Low,
265 * 1: High
266 */
267 uint8_t SerialIoGSpiCsState[CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX];
268
269 /* Debug interface selection */
270 enum {
271 DEBUG_INTERFACE_RAM = (1 << 0),
272 DEBUG_INTERFACE_UART_8250IO = (1 << 1),
273 DEBUG_INTERFACE_USB3 = (1 << 3),
274 DEBUG_INTERFACE_LPSS_SERIAL_IO = (1 << 4),
275 DEBUG_INTERFACE_TRACEHUB = (1 << 5),
276 } debug_interface_flag;
277
278 /* Enable Pch iSCLK */
279 uint8_t pch_isclk;
280
Cliff Huangbc1941f2021-02-10 17:41:41 -0800281 /* CNVi BT Core Enable/Disable */
282 bool CnviBtCore;
283
Subrata Banik292afef2020-09-09 13:34:18 +0530284 /* CNVi BT Audio Offload: Enable/Disable BT Audio Offload. */
Angel Pons98521c52021-03-01 21:16:49 +0100285 bool CnviBtAudioOffload;
Subrata Banik292afef2020-09-09 13:34:18 +0530286
287 /*
Deepti Deshatty8e7facf2021-05-12 17:45:37 +0530288 * These GPIOs will be programmed by the IOM to handle biasing of the
289 * Type-C aux (SBU) signals when certain alternate modes are used.
290 * `pad_auxn_dc` should be assigned to the GPIO pad providing negative
291 * bias (name usually contains `AUXN_DC` or `AUX_N`); similarly,
292 * `pad_auxp_dc` should be assigned to the GPIO providing positive bias
293 * (name often contains `AUXP_DC` or `_AUX_P`).
Subrata Banik2871e0e2020-09-27 11:30:58 +0530294 */
Deepti Deshatty8e7facf2021-05-12 17:45:37 +0530295 struct typec_aux_bias_pads typec_aux_bias_pads[MAX_TYPE_C_PORTS];
Subrata Banik2871e0e2020-09-27 11:30:58 +0530296
297 /*
Subrata Banik292afef2020-09-09 13:34:18 +0530298 * SOC Aux orientation override:
299 * This is a bitfield that corresponds to up to 4 TCSS ports on ADL.
300 * Even numbered bits (0, 2, 4, 6) control the retimer being handled by SOC.
301 * Odd numbered bits (1, 3, 5, 7) control the orientation of the physical aux lines
302 * on the motherboard.
303 */
304 uint16_t TcssAuxOri;
305
306 /* Connect Topology Command timeout value */
307 uint16_t ITbtConnectTopologyTimeoutInMs;
308
309 /*
310 * Override GPIO PM configuration:
311 * 0: Use FSP default GPIO PM program,
312 * 1: coreboot to override GPIO PM program
313 */
314 uint8_t gpio_override_pm;
315
316 /*
317 * GPIO PM configuration: 0 to disable, 1 to enable power gating
318 * Bit 6-7: Reserved
319 * Bit 5: MISCCFG_GPSIDEDPCGEN
320 * Bit 4: MISCCFG_GPRCOMPCDLCGEN
321 * Bit 3: MISCCFG_GPRTCDLCGEN
322 * Bit 2: MISCCFG_GSXLCGEN
323 * Bit 1: MISCCFG_GPDPCGEN
324 * Bit 0: MISCCFG_GPDLCGEN
325 */
326 uint8_t gpio_pm[TOTAL_GPIO_COMM];
327
328 /* DP config */
329 /*
330 * Port config
331 * 0:Disabled, 1:eDP, 2:MIPI DSI
332 */
333 uint8_t DdiPortAConfig;
334 uint8_t DdiPortBConfig;
335
Subrata Banik8a18bd82021-06-09 21:57:49 +0530336 /* Enable(1)/Disable(0) HPD/DDC */
337 uint8_t ddi_ports_config[DDI_PORT_COUNT];
Subrata Banik292afef2020-09-09 13:34:18 +0530338
339 /* Hybrid storage mode enable (1) / disable (0)
340 * This mode makes FSP detect Optane and NVME and set PCIe lane mode
341 * accordingly */
342 uint8_t HybridStorageMode;
343
344 /*
345 * Override CPU flex ratio value:
346 * CPU ratio value controls the maximum processor non-turbo ratio.
347 * Valid Range 0 to 63.
348 *
349 * In general descriptor provides option to set default cpu flex ratio.
350 * Default cpu flex ratio is 0 ensures booting with non-turbo max frequency.
351 * That's the reason FSP skips cpu_ratio override if cpu_ratio is 0.
352 *
353 * Only override CPU flex ratio if don't want to boot with non-turbo max.
354 */
355 uint8_t cpu_ratio_override;
356
357 /*
358 * Enable(0)/Disable(1) DMI Power Optimizer on PCH side.
359 * Default 0. Setting this to 1 disables the DMI Power Optimizer.
360 */
361 uint8_t DmiPwrOptimizeDisable;
362
363 /*
364 * Enable(1)/Disable(0) CPU Replacement check.
365 * Default 0. Setting this to 1 to check CPU replacement.
366 */
367 uint8_t CpuReplacementCheck;
368
369 /* ISA Serial Base selection. */
370 enum {
371 ISA_SERIAL_BASE_ADDR_3F8,
372 ISA_SERIAL_BASE_ADDR_2F8,
373 } IsaSerialUartBase;
V Sowmya418d37e2021-06-21 08:47:17 +0530374
375 /* structure containing various settings for PCH FIVRs */
376 struct {
377 bool configure_ext_fivr;
378 enum fivr_enable_states v1p05_enable_bitmap;
379 enum fivr_enable_states vnn_enable_bitmap;
380 enum fivr_enable_states vnn_sx_enable_bitmap;
381 enum fivr_voltage_supported v1p05_supported_voltage_bitmap;
382 enum fivr_voltage_supported vnn_supported_voltage_bitmap;
383 /* V1p05 Rail Voltage in mv */
384 int v1p05_voltage_mv;
385 /* Vnn Rail Voltage in mv */
386 int vnn_voltage_mv;
387 /* VnnSx Rail Voltage in mv */
388 int vnn_sx_voltage_mv;
389 /* External Icc Max for V1p05 rail in mA */
390 int v1p05_icc_max_ma;
391 /* External Icc Max for VnnSx rail in mA */
392 int vnn_icc_max_ma;
393 } ext_fivr_settings;
Subrata Banik292afef2020-09-09 13:34:18 +0530394};
395
396typedef struct soc_intel_alderlake_config config_t;
397
398#endif