Debian Codegraph @

src/soc/intel/skylake/chip.h

raw symbols SCIP
1 /* SPDX-License-Identifier: GPL-2.0-only */
2
3 #ifndef _SOC_CHIP_H_
4 #define _SOC_CHIP_H_
5
6 #include <acpi/acpi_device.h>
7 #include <device/i2c_simple.h>
8 #include <drivers/i2c/designware/dw_i2c.h>
9 #include <drivers/intel/gma/gma.h>
10 #include <gpio.h>
11 #include <intelblocks/cfg.h>
12 #include <intelblocks/gspi.h>
13 #include <intelblocks/lpc_lib.h>
14 #include <intelblocks/power_limit.h>
15 #include <intelblocks/xhci.h>
16 #include <stdbool.h>
17 #include <stdint.h>
18 #include <soc/gpe.h>
19 #include <soc/irq.h>
20 #include <soc/pci_devs.h>
21 #include <soc/pmc.h>
22 #include <soc/serialio.h>
23 #include <soc/usb.h>
24 #include <soc/vr_config.h>
25
26 #define MAX_PEG_PORTS 3
27
28 enum skylake_i2c_voltage {
29 I2C_VOLTAGE_3V3,
30 I2C_VOLTAGE_1V8
31 };
32
33 /* Gfx related */
34 enum igd_dvmt50_pre_alloc {
35 IGD_SM_0MB = 0x00,
36 IGD_SM_32MB = 0x01,
37 IGD_SM_64MB = 0x02,
38 IGD_SM_96MB = 0x03,
39 IGD_SM_128MB = 0x04,
40 };
41
42 enum igd_aperture_size {
43 IGD_AP_SZ_128MB = 0x00,
44 IGD_AP_SZ_256MB = 0x01,
45 IGD_AP_SZ_512MB = 0x02,
46 };
47
48 struct soc_intel_skylake_config {
49 /* Common struct containing soc config data required by common code */
50 struct soc_intel_common_config common_soc_config;
51
52 /* Common struct containing power limits configuration information */
53 struct soc_power_limits_config power_limits_config;
54
55 /* IGD panel configuration */
56 struct i915_gpu_panel_config panel_cfg;
57
58 /* Gpio group routed to each dword of the GPE0 block. Values are
59 * of the form GPP_[A:G] or GPD. */
60 uint8_t gpe0_dw0; /* GPE0_31_0 STS/EN */
61 uint8_t gpe0_dw1; /* GPE0_63_32 STS/EN */
62 uint8_t gpe0_dw2; /* GPE0_95_64 STS/EN */
63
64 /* LPC fixed enables and ranges */
65 uint16_t lpc_iod;
66 uint16_t lpc_ioe;
67
68 /* Generic IO decode ranges */
69 uint32_t gen1_dec;
70 uint32_t gen2_dec;
71 uint32_t gen3_dec;
72 uint32_t gen4_dec;
73
74 /* Enable S0iX support */
75 bool s0ix_enable;
76
77 /* Enable DPTF support */
78 bool dptf_enable;
79
80 /* Deep SX enables */
81 bool deep_s3_enable_ac;
82 bool deep_s3_enable_dc;
83 bool deep_s5_enable_ac;
84 bool deep_s5_enable_dc;
85
86 /*
87 * Deep Sx Configuration
88 * DSX_EN_WAKE_PIN - Enable WAKE# pin
89 * DSX_EN_LAN_WAKE_PIN - Enable LAN_WAKE# pin
90 * DSX_DIS_AC_PRESENT_PD - Disable pull-down on AC_PRESENT pin
91 */
92 uint32_t deep_sx_config;
93
94 /* TCC activation offset */
95 uint32_t tcc_offset;
96
97 /*
98 * System Agent dynamic frequency configuration
99 * When enabled memory will be trained at two different frequencies.
100 * 0 = Disabled
101 * 1 = FixedLow
102 * 2 = FixedHigh
103 * 3 = Enabled
104 */
105 enum {
106 SaGv_Disabled,
107 SaGv_FixedLow,
108 SaGv_FixedHigh,
109 SaGv_Enabled,
110 } SaGv;
111
112 /* Enable/disable Rank Margin Tool */
113 bool RMT;
114
115 /* Disable Command TriState */
116 bool CmdTriStateDis;
117
118 /* Lan */
119 bool EnableLanLtr;
120 bool EnableLanK1Off;
121 bool LanClkReqSupported;
122 u8 LanClkReqNumber;
123
124 /* SATA related */
125 enum {
126 SATA_AHCI = 0,
127 SATA_RAID = 1,
128 } SataMode;
129 bool SataSalpSupport;
130 bool SataPortsEnable[8];
131 bool SataPortsDevSlp[8];
132 bool SataPortsSpinUp[8];
133 bool SataPortsHotPlug[8];
134 u8 SataSpeedLimit;
135
136 /* Audio related */
137 bool DspEnable;
138
139 /* HDA Virtual Channel Type Select */
140 enum {
141 Vc0,
142 Vc1,
143 } PchHdaVcType;
144
145 /*
146 * I/O Buffer Ownership:
147 * 0: HD-A Link
148 * 1 Shared, HD-A Link and I2S Port
149 * 3: I2S Ports
150 */
151 u8 IoBufferOwnership;
152
153 /* Trace Hub function */
154 u32 TraceHubMemReg0Size;
155 u32 TraceHubMemReg1Size;
156
157 /* DCI Enable/Disable */
158 bool PchDciEn;
159
160 /*
161 * PCIe Root Port configuration:
162 * each element of array corresponds to
163 * respective PCIe root port.
164 */
165
166 /* PEG Max Link Width */
167 enum {
168 Peg0_x16,
169 Peg0_x1,
170 Peg0_x2,
171 Peg0_x4,
172 Peg0_x8,
173 } Peg0MaxLinkWidth;
174
175 enum {
176 Peg1_x8,
177 Peg1_x1,
178 Peg1_x2,
179 Peg1_x4,
180 } Peg1MaxLinkWidth;
181
182 enum {
183 Peg2_x4,
184 Peg2_x1,
185 Peg2_x2,
186 } Peg2MaxLinkWidth;
187
188 /*
189 * Enable/Disable Clk-req support for Root Port
190 * 0: Disable Clk-Req
191 * 1: Enable Clk-req
192 */
193 bool PcieRpClkReqSupport[CONFIG_MAX_ROOT_PORTS];
194
195 /*
196 * Clk-req source for Root Port
197 */
198 u8 PcieRpClkReqNumber[CONFIG_MAX_ROOT_PORTS];
199
200 /*
201 * Clk source number for Root Port
202 */
203 u8 PcieRpClkSrcNumber[CONFIG_MAX_ROOT_PORTS];
204
205 /*
206 * Enable/Disable AER (Advanced Error Reporting) for Root Port
207 * 0: Disable AER
208 * 1: Enable AER
209 */
210 bool PcieRpAdvancedErrorReporting[CONFIG_MAX_ROOT_PORTS];
211
212 /* Enable/Disable Latency Tolerance Reporting for Root Port */
213 bool PcieRpLtrEnable[CONFIG_MAX_ROOT_PORTS];
214
215 /* Enable/Disable HotPlug support for Root Port */
216 bool PcieRpHotPlug[CONFIG_MAX_ROOT_PORTS];
217
218 /* PCIE RP Max Payload, Max Payload Size supported */
219 enum {
220 RpMaxPayload_128,
221 RpMaxPayload_256,
222 } PcieRpMaxPayload[CONFIG_MAX_ROOT_PORTS];
223
224 /* PCIE RP ASPM, ASPM support for the root port */
225 enum {
226 AspmDefault,
227 AspmDisabled,
228 AspmL0s,
229 AspmL1,
230 AspmL0sL1,
231 AspmAutoConfig,
232 } pcie_rp_aspm[CONFIG_MAX_ROOT_PORTS];
233
234 /* PCIe RP L1 substate */
235 enum {
236 L1SS_Default,
237 L1SS_Disabled,
238 L1SS_L1_1,
239 L1SS_L1_2,
240 } pcie_rp_l1substates[CONFIG_MAX_ROOT_PORTS];
241
242 /* USB related */
243 struct usb2_port_config usb2_ports[16];
244 struct usb3_port_config usb3_ports[10];
245 bool SsicPortEnable;
246
247 /*
248 * SerialIO device mode selection:
249 *
250 * Device index:
251 * PchSerialIoIndexI2C0
252 * PchSerialIoIndexI2C1
253 * PchSerialIoIndexI2C2
254 * PchSerialIoIndexI2C3
255 * PchSerialIoIndexI2C4
256 * PchSerialIoIndexI2C5
257 * PchSerialIoIndexI2C6
258 * PchSerialIoIndexSpi0
259 * PchSerialIoIndexSpi1
260 * PchSerialIoIndexUart0
261 * PchSerialIoIndexUart1
262 * PchSerialIoIndexUart2
263 *
264 * Mode select:
265 * PchSerialIoDisabled
266 * PchSerialIoAcpi
267 * PchSerialIoPci
268 * PchSerialIoAcpiHidden
269 * PchSerialIoLegacyUart
270 */
271 u8 SerialIoDevMode[PchSerialIoIndexMax];
272
273 /* I2C */
274 /* Bus voltage level, default is 3.3V */
275 enum skylake_i2c_voltage i2c_voltage[CONFIG_SOC_INTEL_I2C_DEV_MAX];
276
277 /* eMMC and SD */
278 bool ScsEmmcHs400Enabled;
279 bool EmmcHs400DllNeed;
280 u8 ScsEmmcHs400RxStrobeDll1;
281 u8 ScsEmmcHs400TxDataDll;
282
283 enum {
284 Display_iGFX,
285 Display_PEG,
286 Display_PCH_PCIe,
287 Display_Auto,
288 Display_Switchable,
289 } PrimaryDisplay;
290 bool SkipExtGfxScan;
291
292 /* GPIO IRQ Route The valid values is 14 or 15*/
293 u8 GpioIrqSelect;
294 /* SCI IRQ Select The valid values is 9, 10, 11 and 20 21, 22, 23*/
295 u8 SciIrqSelect;
296 /* TCO IRQ Select The valid values is 9, 10, 11, 20 21, 22, 23*/
297 u8 TcoIrqSelect;
298 bool TcoIrqEnable;
299 /* Enable SMI_LOCK bit to prevent writes to the Global SMI Enable bit.*/
300 bool LockDownConfigGlobalSmi;
301 /*
302 * Enable RTC lower and upper 128 byte Lock bits to lock Bytes 38h-3Fh
303 * in the upper and lower 128-byte bank of RTC RAM.
304 */
305 bool LockDownConfigRtcLock;
306
307 /*
308 * Determine if WLAN wake from Sx, corresponds to the
309 * HOST_WLAN_PP_EN bit in the PWRM_CFG3 register.
310 */
311 bool PchPmWoWlanEnable;
312
313 /*
314 * Determine if WLAN wake from DeepSx, corresponds to
315 * the DSX_WLAN_PP_EN bit in the PWRM_CFG3 register.
316 */
317 bool PchPmWoWlanDeepSxEnable;
318
319 /*
320 * Corresponds to the "WOL Enable Override" bit in the General PM
321 * Configuration B (GEN_PMCON_B) register
322 */
323 bool WakeConfigWolEnableOverride;
324 /* Determine if enable PCIe to wake from deep Sx*/
325 bool WakeConfigPcieWakeFromDeepSx;
326 /* Deep Sx Policy. Values 0: PchDeepSxPolDisable,
327 * 1: PchDpS5BatteryEn, 2: PchDpS5AlwaysEn, 3: PchDpS4S5BatteryEn,
328 * 4: PchDpS4S5AlwaysEn, 5: PchDpS3S4S5BatteryEn, 6: PchDpS3S4S5AlwaysEn
329 */
330 u8 PmConfigDeepSxPol;
331
332 enum {
333 SLP_S3_MIN_ASSERT_60US = 0,
334 SLP_S3_MIN_ASSERT_1MS = 1,
335 SLP_S3_MIN_ASSERT_50MS = 2,
336 SLP_S3_MIN_ASSERT_2S = 3,
337 } PmConfigSlpS3MinAssert;
338
339 enum {
340 SLP_S4_MIN_ASSERT_PCH = 0,
341 SLP_S4_MIN_ASSERT_1S = 1,
342 SLP_S4_MIN_ASSERT_2S = 2,
343 SLP_S4_MIN_ASSERT_3S = 3,
344 SLP_S4_MIN_ASSERT_4S = 4,
345 } PmConfigSlpS4MinAssert;
346
347 /* When deep Sx enabled: Must be greater than or equal to
348 all other minimum assertion widths. */
349 enum {
350 SLP_SUS_MIN_ASSERT_0MS = 0,
351 SLP_SUS_MIN_ASSERT_500MS = 1,
352 SLP_SUS_MIN_ASSERT_1S = 2,
353 SLP_SUS_MIN_ASSERT_4S = 3,
354 } PmConfigSlpSusMinAssert;
355
356 enum {
357 SLP_A_MIN_ASSERT_0MS = 0,
358 SLP_A_MIN_ASSERT_4S = 1,
359 SLP_A_MIN_ASSERT_98MS = 2,
360 SLP_A_MIN_ASSERT_2S = 3,
361 } PmConfigSlpAMinAssert;
362
363 /*
364 * SLP_X Stretching After SUS Well Power Up. Values 0: Disabled,
365 * 1: Enabled
366 */
367 bool PmConfigSlpStrchSusUp;
368 /*
369 * PCH power button override period.
370 * Values: 0x0 - 4s, 0x1 - 6s, 0x2 - 8s, 0x3 - 10s, 0x4 - 12s, 0x5 - 14s
371 */
372 u8 PmConfigPwrBtnOverridePeriod;
373
374 /*
375 * PCH Pm Slp S0 Voltage Margining Enable
376 * Indicates platform supports VCCPrim_Core Voltage Margining
377 * in SLP_S0# asserted state.
378 */
379 bool PchPmSlpS0VmEnable;
380
381 enum {
382 RESET_POWER_CYCLE_DEFAULT = 0,
383 RESET_POWER_CYCLE_1S = 1,
384 RESET_POWER_CYCLE_2S = 2,
385 RESET_POWER_CYCLE_3S = 3,
386 RESET_POWER_CYCLE_4S = 4,
387 } PmConfigPwrCycDur;
388
389 enum serirq_mode serirq_mode;
390
391 enum {
392 SERIAL_IRQ_FRAME_PULSE_4CLK = 0,
393 SERIAL_IRQ_FRAME_PULSE_6CLK = 1,
394 SERIAL_IRQ_FRAME_PULSE_8CLK = 2,
395 } SerialIrqConfigStartFramePulse;
396
397 /*
398 * VrConfig Settings for 5 domains
399 * 0 = System Agent, 1 = IA Core, 2 = Ring,
400 * 3 = GT unsliced, 4 = GT sliced
401 */
402 struct vr_config domain_vr_config[NUM_VR_DOMAINS];
403
404 /*
405 * Enable VR specific mailbox command
406 * 000b - Don't Send any VR command
407 * 001b - VR command specifically for the MPS IMPV8 VR will be sent
408 * 010b - VR specific command sent for PS4 exit issue
409 * 011b - VR specific command sent for both MPS IMPV8 & PS4 exit issue
410 */
411 u8 SendVrMbxCmd;
412
413 /* Enable/Disable host reads to PMC XRAM registers */
414 bool PchPmPmcReadDisable;
415
416 /*
417 * Use SD card detect GPIO with default config:
418 * - Edge triggered
419 * - No internal pull
420 * - Active both (high + low)
421 * - Can wake device from D3
422 * - 100ms debounce timeout
423 *
424 * GpioInt (Edge, ActiveBoth, SharedAndWake, PullNone, 10000,
425 * "\\_SB.PCI0.GPIO", 0, ResourceConsumer)
426 * { sdcard_cd_gpio }
427 */
428 unsigned int sdcard_cd_gpio;
429
430 /* Wake Enable Bitmap for USB2 ports */
431 u16 usb2_wake_enable_bitmap;
432
433 /* Wake Enable Bitmap for USB3 ports */
434 u8 usb3_wake_enable_bitmap;
435
436 /*
437 * Acoustic Noise Mitigation
438 * 0b - Disable
439 * 1b - Enable noise mitigation
440 */
441 bool AcousticNoiseMitigation;
442
443 /*
444 * Disable Fast Package C-state ramping
445 * Need to set AcousticNoiseMitigation = '1' first
446 * 0b - Enabled
447 * 1b - Disabled
448 */
449 bool FastPkgCRampDisableIa;
450 bool FastPkgCRampDisableGt;
451 bool FastPkgCRampDisableSa;
452
453 /*
454 * Adjust the VR slew rates
455 * Need to set AcousticNoiseMitigation = '1' first
456 * 000b - Fast/2
457 * 001b - Fast/4
458 * 010b - Fast/8
459 * 011b - Fast/16
460 */
461 u8 SlowSlewRateForIa;
462 u8 SlowSlewRateForGt;
463 u8 SlowSlewRateForSa;
464
465 /* Enable/Disable EIST
466 * true - Enabled
467 * false - Disabled
468 */
469 bool eist_enable;
470
471 /*
472 * Activates VR mailbox command for Intersil VR C-state issues.
473 * 0 - no mailbox command sent.
474 * 1 - VR mailbox command sent for IA/GT rails only.
475 * 2 - VR mailbox command sent for IA/GT/SA rails.
476 */
477 u8 IslVrCmd;
478
479 /* i915 struct for GMA backlight control */
480 struct i915_gpu_controller_info gfx;
481 };
482
483 typedef struct soc_intel_skylake_config config_t;
484
485 #endif