blob: aaf03f510fbb6a5741a47cd2f63b5e5d899d3a1c [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>
10#include <soc/gpe.h>
11#include <soc/pch.h>
12#include <soc/pci_devs.h>
13#include <soc/pmc.h>
Subrata Banik2871e0e2020-09-27 11:30:58 +053014#include <soc/serialio.h>
15#include <soc/usb.h>
Subrata Banik292afef2020-09-09 13:34:18 +053016#include <stdint.h>
17
18#define MAX_HD_AUDIO_DMIC_LINKS 2
19#define MAX_HD_AUDIO_SNDW_LINKS 4
20#define MAX_HD_AUDIO_SSP_LINKS 6
21
22struct soc_intel_alderlake_config {
23
24 /* Common struct containing soc config data required by common code */
25 struct soc_intel_common_config common_soc_config;
26
27 /* Gpio group routed to each dword of the GPE0 block. Values are
28 * of the form PMC_GPP_[A:U] or GPD. */
29 uint8_t pmc_gpe0_dw0; /* GPE0_31_0 STS/EN */
30 uint8_t pmc_gpe0_dw1; /* GPE0_63_32 STS/EN */
31 uint8_t pmc_gpe0_dw2; /* GPE0_95_64 STS/EN */
32
33 /* Generic IO decode ranges */
34 uint32_t gen1_dec;
35 uint32_t gen2_dec;
36 uint32_t gen3_dec;
37 uint32_t gen4_dec;
38
39 /* Enable S0iX support */
40 int s0ix_enable;
41 /* Support for TCSS xhci, xdci, TBT PCIe root ports and DMA controllers */
42 uint8_t TcssD3HotDisable;
43 /* Support for TBT PCIe root ports and DMA controllers with D3Hot->D3Cold */
44 uint8_t TcssD3ColdDisable;
45 /* Enable DPTF support */
46 int dptf_enable;
47
48 /* Deep SX enable for both AC and DC */
49 int deep_s3_enable_ac;
50 int deep_s3_enable_dc;
51 int deep_s5_enable_ac;
52 int deep_s5_enable_dc;
53
54 /* Deep Sx Configuration
55 * DSX_EN_WAKE_PIN - Enable WAKE# pin
56 * DSX_EN_LAN_WAKE_PIN - Enable LAN_WAKE# pin
57 * DSX_DIS_AC_PRESENT_PD - Disable pull-down on AC_PRESENT pin */
58 uint32_t deep_sx_config;
59
60 /* TCC activation offset */
61 uint32_t tcc_offset;
62
63 /* System Agent dynamic frequency support. Only effects ULX/ULT CPUs.
64 * When enabled memory will be training at two different frequencies.
65 * 0:Disabled, 1:FixedPoint0, 2:FixedPoint1, 3:FixedPoint2,
66 * 4:FixedPoint3, 5:Enabled */
67 enum {
68 SaGv_Disabled,
69 SaGv_FixedPoint0,
70 SaGv_FixedPoint1,
71 SaGv_FixedPoint2,
72 SaGv_FixedPoint3,
73 SaGv_Enabled,
74 } SaGv;
75
76 /* Rank Margin Tool. 1:Enable, 0:Disable */
77 uint8_t RMT;
78
79 /* USB related */
80 struct usb2_port_config usb2_ports[16];
81 struct usb3_port_config usb3_ports[10];
82 /* Wake Enable Bitmap for USB2 ports */
83 uint16_t usb2_wake_enable_bitmap;
84 /* Wake Enable Bitmap for USB3 ports */
85 uint16_t usb3_wake_enable_bitmap;
86
87 /* SATA related */
88 uint8_t SataEnable;
89 uint8_t SataMode;
90 uint8_t SataSalpSupport;
91 uint8_t SataPortsEnable[8];
92 uint8_t SataPortsDevSlp[8];
93
94 /*
95 * Enable(0)/Disable(1) SATA Power Optimizer on PCH side.
96 * Default 0. Setting this to 1 disables the SATA Power Optimizer.
97 */
98 uint8_t SataPwrOptimizeDisable;
99
100 /*
101 * SATA Port Enable Dito Config.
102 * Enable DEVSLP Idle Timeout settings (DmVal, DitoVal).
103 */
104 uint8_t SataPortsEnableDitoConfig[8];
105
106 /* SataPortsDmVal is the DITO multiplier. Default is 15. */
107 uint8_t SataPortsDmVal[8];
108 /* SataPortsDitoVal is the DEVSLP Idle Timeout, default is 625ms */
109 uint16_t SataPortsDitoVal[8];
110
111 /* Audio related */
112 uint8_t PchHdaDspEnable;
113 uint8_t PchHdaAudioLinkHdaEnable;
114 uint8_t PchHdaAudioLinkDmicEnable[MAX_HD_AUDIO_DMIC_LINKS];
115 uint8_t PchHdaAudioLinkSspEnable[MAX_HD_AUDIO_SSP_LINKS];
116 uint8_t PchHdaAudioLinkSndwEnable[MAX_HD_AUDIO_SNDW_LINKS];
117 uint8_t PchHdaIDispLinkTmode;
118 uint8_t PchHdaIDispLinkFrequency;
119 uint8_t PchHdaIDispCodecDisconnect;
120
121 /* PCIe Root Ports */
122 uint8_t PcieRpEnable[CONFIG_MAX_ROOT_PORTS];
123 uint8_t PcieRpHotPlug[CONFIG_MAX_ROOT_PORTS];
124 /* PCIe output clocks type to PCIe devices.
125 * 0-23: PCH rootport, 0x70: LAN, 0x80: unspecified but in use,
126 * 0xFF: not used */
127 uint8_t PcieClkSrcUsage[CONFIG_MAX_PCIE_CLOCKS];
128 /* PCIe ClkReq-to-ClkSrc mapping, number of clkreq signal assigned to
129 * clksrc. */
130 uint8_t PcieClkSrcClkReq[CONFIG_MAX_PCIE_CLOCKS];
131
132 /* Probe CLKREQ# signal before enabling CLKREQ# based power management.*/
133 uint8_t PcieRpClkReqDetect[CONFIG_MAX_ROOT_PORTS];
134
135 /* PCIe RP L1 substate */
136 enum L1_substates_control {
137 L1_SS_FSP_DEFAULT,
138 L1_SS_DISABLED,
139 L1_SS_L1_1,
140 L1_SS_L1_2,
141 } PcieRpL1Substates[CONFIG_MAX_ROOT_PORTS];
142
143 /* PCIe LTR: Enable (1) / Disable (0) */
144 uint8_t PcieRpLtrEnable[CONFIG_MAX_ROOT_PORTS];
145
146 /* PCIE RP Advanced Error Report: Enable (1) / Disable (0) */
147 uint8_t PcieRpAdvancedErrorReporting[CONFIG_MAX_ROOT_PORTS];
148
149 /* Integrated Sensor */
150 uint8_t PchIshEnable;
151
152 /* Heci related */
153 uint8_t Heci3Enabled;
154
155 /* Gfx related */
156 enum {
157 IGD_SM_0MB = 0x00,
158 IGD_SM_32MB = 0x01,
159 IGD_SM_64MB = 0x02,
160 IGD_SM_96MB = 0x03,
161 IGD_SM_128MB = 0x04,
162 IGD_SM_160MB = 0x05,
163 IGD_SM_4MB = 0xF0,
164 IGD_SM_8MB = 0xF1,
165 IGD_SM_12MB = 0xF2,
166 IGD_SM_16MB = 0xF3,
167 IGD_SM_20MB = 0xF4,
168 IGD_SM_24MB = 0xF5,
169 IGD_SM_28MB = 0xF6,
170 IGD_SM_36MB = 0xF8,
171 IGD_SM_40MB = 0xF9,
172 IGD_SM_44MB = 0xFA,
173 IGD_SM_48MB = 0xFB,
174 IGD_SM_52MB = 0xFC,
175 IGD_SM_56MB = 0xFD,
176 IGD_SM_60MB = 0xFE,
177 } IgdDvmt50PreAlloc;
178 uint8_t InternalGfx;
179 uint8_t SkipExtGfxScan;
180
181 uint32_t GraphicsConfigPtr;
Subrata Banik292afef2020-09-09 13:34:18 +0530182
183 /* HeciEnabled decides the state of Heci1 at end of boot
184 * Setting to 0 (default) disables Heci1 and hides the device from OS */
185 uint8_t HeciEnabled;
186 /* PL2 Override value in Watts */
187 uint32_t tdp_pl2_override;
188 /* Intel Speed Shift Technology */
189 uint8_t speed_shift_enable;
190
191 /* Enable/Disable EIST. 1b:Enabled, 0b:Disabled */
192 uint8_t eist_enable;
193
194 /* Enable C6 DRAM */
195 uint8_t enable_c6dram;
196 /*
197 * PRMRR size setting with below options
198 * Disable: 0x0
199 * 32MB: 0x2000000
200 * 64MB: 0x4000000
201 * 128 MB: 0x8000000
202 * 256 MB: 0x10000000
203 * 512 MB: 0x20000000
204 */
205 uint32_t PrmrrSize;
206 uint8_t PmTimerDisabled;
207 /*
208 * SerialIO device mode selection:
209 * PchSerialIoDisabled,
210 * PchSerialIoPci,
211 * PchSerialIoHidden,
212 * PchSerialIoLegacyUart,
213 * PchSerialIoSkipInit
214 */
215 uint8_t SerialIoI2cMode[CONFIG_SOC_INTEL_I2C_DEV_MAX];
216 uint8_t SerialIoGSpiMode[CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX];
217 uint8_t SerialIoUartMode[CONFIG_SOC_INTEL_UART_DEV_MAX];
218 /*
219 * GSPIn Default Chip Select Mode:
220 * 0:Hardware Mode,
221 * 1:Software Mode
222 */
223 uint8_t SerialIoGSpiCsMode[CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX];
224 /*
225 * GSPIn Default Chip Select State:
226 * 0: Low,
227 * 1: High
228 */
229 uint8_t SerialIoGSpiCsState[CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX];
230
231 /* Debug interface selection */
232 enum {
233 DEBUG_INTERFACE_RAM = (1 << 0),
234 DEBUG_INTERFACE_UART_8250IO = (1 << 1),
235 DEBUG_INTERFACE_USB3 = (1 << 3),
236 DEBUG_INTERFACE_LPSS_SERIAL_IO = (1 << 4),
237 DEBUG_INTERFACE_TRACEHUB = (1 << 5),
238 } debug_interface_flag;
239
240 /* Enable Pch iSCLK */
241 uint8_t pch_isclk;
242
Subrata Banik292afef2020-09-09 13:34:18 +0530243 /* CNVi BT Audio Offload: Enable/Disable BT Audio Offload. */
244 enum {
245 FORCE_DISABLE,
246 FORCE_ENABLE,
247 } CnviBtAudioOffload;
248
249 /*
Subrata Banik2871e0e2020-09-27 11:30:58 +0530250 * IOM Port Config
251 * If a port orientation needs to be controlled by the SOC this setting must be
252 * updated to reflect the correct GPIOs being used for the SOC port flipping.
253 * There are 4 ports each with a pair of GPIOs for Pull Up and Pull Down
254 * 0,1 are pull up and pull down for port 0
255 * 2,3 are pull up and pull down for port 1
256 * 4,5 are pull up and pull down for port 2
257 * 6,7 are pull up and pull down for port 3
258 * values to be programmed correspond to the GPIO family and offsets
259 */
260 uint32_t IomTypeCPortPadCfg[8];
261
262 /*
Subrata Banik292afef2020-09-09 13:34:18 +0530263 * SOC Aux orientation override:
264 * This is a bitfield that corresponds to up to 4 TCSS ports on ADL.
265 * Even numbered bits (0, 2, 4, 6) control the retimer being handled by SOC.
266 * Odd numbered bits (1, 3, 5, 7) control the orientation of the physical aux lines
267 * on the motherboard.
268 */
269 uint16_t TcssAuxOri;
270
271 /* Connect Topology Command timeout value */
272 uint16_t ITbtConnectTopologyTimeoutInMs;
273
274 /*
275 * Override GPIO PM configuration:
276 * 0: Use FSP default GPIO PM program,
277 * 1: coreboot to override GPIO PM program
278 */
279 uint8_t gpio_override_pm;
280
281 /*
282 * GPIO PM configuration: 0 to disable, 1 to enable power gating
283 * Bit 6-7: Reserved
284 * Bit 5: MISCCFG_GPSIDEDPCGEN
285 * Bit 4: MISCCFG_GPRCOMPCDLCGEN
286 * Bit 3: MISCCFG_GPRTCDLCGEN
287 * Bit 2: MISCCFG_GSXLCGEN
288 * Bit 1: MISCCFG_GPDPCGEN
289 * Bit 0: MISCCFG_GPDLCGEN
290 */
291 uint8_t gpio_pm[TOTAL_GPIO_COMM];
292
293 /* DP config */
294 /*
295 * Port config
296 * 0:Disabled, 1:eDP, 2:MIPI DSI
297 */
298 uint8_t DdiPortAConfig;
299 uint8_t DdiPortBConfig;
300
301 /* Enable(1)/Disable(0) HPD */
302 uint8_t DdiPortAHpd;
303 uint8_t DdiPortBHpd;
304 uint8_t DdiPortCHpd;
305 uint8_t DdiPort1Hpd;
306 uint8_t DdiPort2Hpd;
307 uint8_t DdiPort3Hpd;
308 uint8_t DdiPort4Hpd;
309
310 /* Enable(1)/Disable(0) DDC */
311 uint8_t DdiPortADdc;
312 uint8_t DdiPortBDdc;
313 uint8_t DdiPortCDdc;
314 uint8_t DdiPort1Ddc;
315 uint8_t DdiPort2Ddc;
316 uint8_t DdiPort3Ddc;
317 uint8_t DdiPort4Ddc;
318
319 /* Hybrid storage mode enable (1) / disable (0)
320 * This mode makes FSP detect Optane and NVME and set PCIe lane mode
321 * accordingly */
322 uint8_t HybridStorageMode;
323
324 /*
325 * Override CPU flex ratio value:
326 * CPU ratio value controls the maximum processor non-turbo ratio.
327 * Valid Range 0 to 63.
328 *
329 * In general descriptor provides option to set default cpu flex ratio.
330 * Default cpu flex ratio is 0 ensures booting with non-turbo max frequency.
331 * That's the reason FSP skips cpu_ratio override if cpu_ratio is 0.
332 *
333 * Only override CPU flex ratio if don't want to boot with non-turbo max.
334 */
335 uint8_t cpu_ratio_override;
336
337 /*
338 * Enable(0)/Disable(1) DMI Power Optimizer on PCH side.
339 * Default 0. Setting this to 1 disables the DMI Power Optimizer.
340 */
341 uint8_t DmiPwrOptimizeDisable;
342
343 /*
344 * Enable(1)/Disable(0) CPU Replacement check.
345 * Default 0. Setting this to 1 to check CPU replacement.
346 */
347 uint8_t CpuReplacementCheck;
348
349 /* ISA Serial Base selection. */
350 enum {
351 ISA_SERIAL_BASE_ADDR_3F8,
352 ISA_SERIAL_BASE_ADDR_2F8,
353 } IsaSerialUartBase;
354};
355
356typedef struct soc_intel_alderlake_config config_t;
357
358#endif