Debian Codegraph @

src/soc/intel/cannonlake/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 <drivers/i2c/designware/dw_i2c.h>
7 #include <drivers/intel/gma/gma.h>
8 #include <gpio.h>
9 #include <intelblocks/cfg.h>
10 #include <intelblocks/gspi.h>
11 #include <intelblocks/lpc_lib.h>
12 #include <intelblocks/power_limit.h>
13 #include <intelblocks/xhci.h>
14 #include <stdbool.h>
15 #include <stdint.h>
16 #include <soc/pch.h>
17 #include <soc/pci_devs.h>
18 #include <soc/pm.h>
19 #include <soc/pmc.h>
20 #include <soc/sata.h>
21 #include <soc/serialio.h>
22 #include <soc/usb.h>
23 #include <soc/vr_config.h>
24 #if CONFIG(SOC_INTEL_CANNONLAKE_PCH_H)
25 #include <soc/gpio_defs_cnp_h.h>
26 #else
27 #include <soc/gpio_defs.h>
28 #endif
29
30 #define SOC_INTEL_CML_UART_DEV_MAX 3
31 #define SOC_INTEL_CML_SATA_DEV_MAX 8
32
33 enum chip_pl2_4_cfg {
34 baseline,
35 performance,
36 value_not_set /* vr_config internal use only */
37 };
38
39 /* Gfx related */
40 enum igd_dvmt50_pre_alloc {
41 IGD_SM_0MB = 0x00,
42 IGD_SM_32MB = 0x01,
43 IGD_SM_64MB = 0x02,
44 IGD_SM_96MB = 0x03,
45 IGD_SM_128MB = 0x04,
46 };
47
48 enum igd_aperture_size {
49 IGD_AP_SZ_128MB = 0x00,
50 IGD_AP_SZ_256MB = 0x01,
51 IGD_AP_SZ_512MB = 0x02,
52 };
53
54 struct soc_intel_cannonlake_config {
55 /* Common struct containing soc config data required by common code */
56 struct soc_intel_common_config common_soc_config;
57
58 /* Common struct containing power limits configuration information */
59 struct soc_power_limits_config power_limits_config;
60
61 /* Gpio group routed to each dword of the GPE0 block. Values are
62 * of the form GPP_[A:G] or GPD. */
63 uint8_t gpe0_dw0; /* GPE0_31_0 STS/EN */
64 uint8_t gpe0_dw1; /* GPE0_63_32 STS/EN */
65 uint8_t gpe0_dw2; /* GPE0_95_64 STS/EN */
66
67 /* Generic IO decode ranges */
68 uint32_t gen1_dec;
69 uint32_t gen2_dec;
70 uint32_t gen3_dec;
71 uint32_t gen4_dec;
72
73 /* S0ix configuration */
74
75 /* Enable S0iX support */
76 bool s0ix_enable;
77 /* Enable Audio DSP oscillator qualification for S0ix */
78 bool cppmvric2_adsposcdis;
79
80 /* Enable DPTF support */
81 bool dptf_enable;
82
83 enum {
84 MAX_PC_DEFAULT = 0,
85 MAX_PC0_1 = 1,
86 MAX_PC2 = 2,
87 MAX_PC3 = 3,
88 MAX_PC6 = 4,
89 MAX_PC7 = 5,
90 MAX_PC7S = 6,
91 MAX_PC8 = 7,
92 MAX_PC9 = 8,
93 MAX_PC10 = 9,
94 } max_package_c_state;
95
96 /* Deep SX enable for both AC and DC */
97 bool deep_s3_enable_ac;
98 bool deep_s3_enable_dc;
99 bool deep_s5_enable_ac;
100 bool deep_s5_enable_dc;
101
102 /* Deep Sx Configuration
103 * DSX_EN_WAKE_PIN - Enable WAKE# pin
104 * DSX_EN_LAN_WAKE_PIN - Enable LAN_WAKE# pin
105 * DSX_DIS_AC_PRESENT_PD - Disable pull-down on AC_PRESENT pin */
106 uint32_t deep_sx_config;
107
108 /* TCC activation offset */
109 uint32_t tcc_offset;
110
111 /* System Agent dynamic frequency support. Only effects ULX/ULT CPUs.
112 * For CNL, options are as following
113 * When enabled, memory will be training at three different frequencies.
114 * 0:Disabled, 1:FixedLow, 2:FixedMid, 3:FixedHigh, 4:Enabled
115 * For WHL/CFL/CML options are as following
116 * When enabled, memory will be training at two different frequencies.
117 * 0:Disabled, 1:FixedLow, 2:FixedHigh, 3:Enabled*/
118 enum {
119 SaGv_Disabled,
120 SaGv_FixedLow,
121 SaGv_FixedHigh,
122 SaGv_Enabled,
123 } SaGv;
124
125 /* Rank Margin Tool. 1:Enable, 0:Disable */
126 bool RMT;
127
128 /* USB related */
129 struct usb2_port_config usb2_ports[16];
130 struct usb3_port_config usb3_ports[10];
131 /* Wake Enable Bitmap for USB2 ports */
132 uint16_t usb2_wake_enable_bitmap;
133 /* Wake Enable Bitmap for USB3 ports */
134 uint16_t usb3_wake_enable_bitmap;
135 /* USB2 PHY power gating */
136 bool PchUsb2PhySusPgDisable;
137
138 /* SATA related */
139 enum {
140 SATA_AHCI,
141 SATA_RAID,
142 } SataMode;
143
144 /* SATA devslp pad reset configuration */
145 enum {
146 SataDevSlpResumeReset = 1,
147 SataDevSlpHostDeepReset = 3,
148 SataDevSlpPlatformReset = 5,
149 SataDevSlpDswReset = 7
150 } SataDevSlpRstConfig;
151
152 bool SataSalpSupport;
153 bool SataPortsEnable[8];
154 bool SataPortsDevSlp[8];
155 uint8_t SataPortsDevSlpResetConfig[8];
156 bool SataPortsHotPlug[8];
157
158 /* Enable/Disable SLP_S0 with GBE Support. 0: disable, 1: enable */
159 bool SlpS0WithGbeSupport;
160 /* SLP_S0 Voltage Margining Policy. 0: disable, 1: enable */
161 bool PchPmSlpS0VmRuntimeControl;
162 /* SLP_S0 Voltage Margining 0.70V Policy. 0: disable, 1: enable */
163 bool PchPmSlpS0Vm070VSupport;
164 /* SLP_S0 Voltage Margining 0.75V Policy. 0: disable, 1: enable */
165 bool PchPmSlpS0Vm075VSupport;
166
167 /* Audio related */
168 bool PchHdaDspEnable;
169
170 /* Enable/Disable HD Audio Link. Muxed with SSP0/SSP1/SNDW1 */
171 bool PchHdaAudioLinkHda;
172 bool PchHdaIDispCodecDisconnect;
173 bool PchHdaAudioLinkDmic0;
174 bool PchHdaAudioLinkDmic1;
175 bool PchHdaAudioLinkSsp0;
176 bool PchHdaAudioLinkSsp1;
177 bool PchHdaAudioLinkSsp2;
178 bool PchHdaAudioLinkSndw1;
179 bool PchHdaAudioLinkSndw2;
180 bool PchHdaAudioLinkSndw3;
181 bool PchHdaAudioLinkSndw4;
182
183 /* PCIe Root Ports */
184 /* PCIe output clocks type to PCIe devices.
185 * 0-23: PCH rootport, 0x70: LAN, 0x80: unspecified but in use,
186 * 0xFF: not used */
187 uint8_t PcieClkSrcUsage[CONFIG_MAX_PCIE_CLOCK_SRC];
188 /* PCIe ClkReq-to-ClkSrc mapping, number of clkreq signal assigned to
189 * clksrc. */
190 uint8_t PcieClkSrcClkReq[CONFIG_MAX_PCIE_CLOCK_SRC];
191 /* PCIe LTR(Latency Tolerance Reporting) mechanism */
192 bool PcieRpLtrEnable[CONFIG_MAX_ROOT_PORTS];
193 /* Implemented as slot or built-in? */
194 bool PcieRpSlotImplemented[CONFIG_MAX_ROOT_PORTS];
195 /* Enable/Disable HotPlug support for Root Port */
196 bool PcieRpHotPlug[CONFIG_MAX_ROOT_PORTS];
197
198 /*
199 * Enable/Disable AER (Advanced Error Reporting) for Root Port
200 * 0: Disable AER
201 * 1: Enable AER
202 */
203 bool PcieRpAdvancedErrorReporting[CONFIG_MAX_ROOT_PORTS];
204
205 /* PCIE RP ASPM, ASPM support for the root port */
206 enum {
207 AspmDefault,
208 AspmDisabled,
209 AspmL0s,
210 AspmL1,
211 AspmL0sL1,
212 AspmAutoConfig,
213 } PcieRpAspm[CONFIG_MAX_ROOT_PORTS];
214
215 /* PCIE RP Max Payload, Max Payload Size supported */
216 enum {
217 RpMaxPayload_128,
218 RpMaxPayload_256,
219 } PcieRpMaxPayload[CONFIG_MAX_ROOT_PORTS];
220
221 /* eMMC and SD */
222 bool ScsEmmcHs400Enabled;
223 /* Need to update DLL setting to get Emmc running at HS400 speed */
224 bool EmmcHs400DllNeed;
225 /* 0-39: number of active delay for RX strobe, unit is 125 psec */
226 uint8_t EmmcHs400RxStrobeDll1;
227 /* 0-78: number of active delay for TX data, unit is 125 psec */
228 uint8_t EmmcHs400TxDataDll;
229 /* Enable/disable SD card write protect pin configuration on CML */
230 bool ScsSdCardWpPinEnabled;
231
232 /* Heci related */
233 bool DisableHeciRetry;
234
235 /* Gfx related */
236 bool SkipExtGfxScan;
237
238 /* CPU PL2/4 Config
239 * Performance: Maximum PLs for maximum performance.
240 * Baseline: Baseline PLs for balanced performance at lower power.
241 */
242 enum chip_pl2_4_cfg cpu_pl2_4_cfg;
243
244 /* VrConfig Settings for 5 domains
245 * 0 = System Agent, 1 = IA Core, 2 = Ring,
246 * 3 = GT unsliced, 4 = GT sliced */
247 struct vr_config domain_vr_config[NUM_VR_DOMAINS];
248
249 /* Enables support for Teton Glacier hybrid storage device */
250 bool TetonGlacierMode;
251
252 bool eist_enable;
253 bool enable_c6dram;
254
255 /*
256 * SLP_S3 Minimum Assertion Width Policy
257 * 1 = 60us
258 * 2 = 1ms (default)
259 * 3 = 50ms
260 * 4 = 2s
261 */
262 uint8_t PchPmSlpS3MinAssert;
263
264 /*
265 * SLP_S4 Minimum Assertion Width Policy
266 * 1 = 1s
267 * 2 = 2s
268 * 3 = 3s
269 * 4 = 4s (default)
270 */
271 uint8_t PchPmSlpS4MinAssert;
272
273 /*
274 * SLP_SUS Minimum Assertion Width Policy
275 * 1 = 0ms
276 * 2 = 500ms
277 * 3 = 1s (default)
278 * 4 = 4s
279 */
280 uint8_t PchPmSlpSusMinAssert;
281
282 /*
283 * SLP_A Minimum Assertion Width Policy
284 * 1 = 0ms
285 * 2 = 4s
286 * 3 = 98ms (default)
287 * 4 = 2s
288 */
289 uint8_t PchPmSlpAMinAssert;
290
291 /*
292 * PCH PM Reset Power Cycle Duration
293 * 0 = 4s
294 * 1 = 1s
295 * 2 = 2s
296 * 3 = 3s
297 * 4 = 4s (default)
298 *
299 * NOTE: Duration programmed in the PchPmPwrCycDur should never be smaller than the
300 * stretch duration programmed in the following registers -
301 * - GEN_PMCON_A.SLP_S3_MIN_ASST_WDTH (PchPmSlpS3MinAssert)
302 * - GEN_PMCON_A.S4MAW (PchPmSlpS4MinAssert)
303 * - PM_CFG.SLP_A_MIN_ASST_WDTH (PchPmSlpAMinAssert)
304 * - PM_CFG.SLP_LAN_MIN_ASST_WDTH
305 */
306 uint8_t PchPmPwrCycDur;
307
308 /*
309 * SerialIO device mode selection:
310 *
311 * Device index:
312 * PchSerialIoIndexI2C0
313 * PchSerialIoIndexI2C1
314 * PchSerialIoIndexI2C2
315 * PchSerialIoIndexI2C3
316 * PchSerialIoIndexI2C4
317 * PchSerialIoIndexI2C5
318 * PchSerialIoIndexSPI0
319 * PchSerialIoIndexSPI1
320 * PchSerialIoIndexSPI2
321 * PchSerialIoIndexUART0
322 * PchSerialIoIndexUART1
323 * PchSerialIoIndexUART2
324 *
325 * Mode select:
326 * For Cannonlake PCH following values are supported:
327 * PchSerialIoNotInitialized
328 * PchSerialIoDisabled
329 * PchSerialIoPci
330 * PchSerialIoAcpi
331 * PchSerialIoHidden
332 * PchSerialIoMax
333 *
334 * For Cometlake following values are supported:
335 * PchSerialIoNotInitialized
336 * PchSerialIoDisabled,
337 * PchSerialIoPci,
338 * PchSerialIoHidden,
339 * PchSerialIoLegacyUart,
340 * PchSerialIoSkipInit,
341 * PchSerialIoMax
342 *
343 * NOTE:
344 * PchSerialIoNotInitialized is not an option provided by FSP, this
345 * option is default selected in case devicetree doesn't fill this param
346 * In case PchSerialIoNotInitialized is selected or an invalid value is
347 * provided from devicetree, coreboot will configure device into PCI
348 * mode by default.
349 *
350 */
351 uint8_t SerialIoDevMode[PchSerialIoIndexMAX];
352
353 enum serirq_mode serirq_mode;
354
355 /* GPIO SD card detect pin */
356 unsigned int sdcard_cd_gpio;
357
358 /* Enable Pch iSCLK */
359 bool pch_isclk;
360
361 /*
362 * Acoustic Noise Mitigation
363 * 0b - Disable
364 * 1b - Enable noise mitigation
365 */
366 bool AcousticNoiseMitigation;
367
368 /*
369 * Disable Fast Package C-state ramping
370 * Need to set AcousticNoiseMitigation = '1' first
371 * 0b - Enabled
372 * 1b - Disabled
373 */
374 bool FastPkgCRampDisableIa;
375 bool FastPkgCRampDisableGt;
376 bool FastPkgCRampDisableSa;
377 bool FastPkgCRampDisableFivr;
378
379 /*
380 * Adjust the VR slew rates
381 * Need to set AcousticNoiseMitigation = '1' first
382 * 000b - Fast/2
383 * 001b - Fast/4
384 * 010b - Fast/8
385 * 011b - Fast/16
386 */
387 uint8_t SlowSlewRateForIa;
388 uint8_t SlowSlewRateForGt;
389 uint8_t SlowSlewRateForSa;
390 uint8_t SlowSlewRateForFivr;
391
392 /* SATA Power Optimizer */
393 bool satapwroptimize;
394
395 /* SATA Gen3 Strength */
396 struct sata_port_config sata_port[SOC_INTEL_CML_SATA_DEV_MAX];
397
398 /* Enable or disable eDP device */
399 bool DdiPortEdp;
400
401 /* Enable or disable HPD of DDI port B/C/D/F */
402 bool DdiPortBHpd;
403 bool DdiPortCHpd;
404 bool DdiPortDHpd;
405 bool DdiPortFHpd;
406
407 /* Enable or disable DDC of DDI port B/C/D/F */
408 bool DdiPortBDdc;
409 bool DdiPortCDdc;
410 bool DdiPortDDdc;
411 bool DdiPortFDdc;
412
413 /* Unlock all GPIO Pads */
414 bool PchUnlockGpioPads;
415
416 /* Enable GBE wakeup */
417 bool LanWakeFromDeepSx;
418 bool WolEnableOverride;
419
420 #if !CONFIG(SOC_INTEL_COMETLAKE)
421 uint32_t VrPowerDeliveryDesign;
422 #endif
423
424 /* CNVi BT Core Enable/Disable */
425 bool CnviBtCore;
426
427 /* CNVi BT Audio Offload: Enable/Disable BT Audio Offload. */
428 bool CnviBtAudioOffload;
429
430 /*
431 * Override GPIO PM configuration:
432 * 0: Use FSP default GPIO PM program,
433 * 1: coreboot to override GPIO PM program
434 */
435 bool gpio_override_pm;
436 /*
437 * GPIO PM configuration: 0 to disable, 1 to enable power gating
438 * Bit 6-7: Reserved
439 * Bit 5: MISCCFG_GPSIDEDPCGEN
440 * Bit 4: MISCCFG_GPRCOMPCDLCGEN
441 * Bit 3: MISCCFG_GPRTCDLCGEN
442 * Bit 2: MISCCFG_GSXLCGEN
443 * Bit 1: MISCCFG_GPDPCGEN
444 * Bit 0: MISCCFG_GPDLCGEN
445 */
446 uint8_t gpio_pm[TOTAL_GPIO_COMM];
447
448 /*
449 * Override CPU flex ratio value:
450 * CPU ratio value controls the maximum processor non-turbo ratio.
451 * Valid Range 0 to 63.
452 *
453 * In general descriptor provides option to set default cpu flex ratio.
454 * Default cpu flex ratio is 0 ensures booting with non-turbo max frequency.
455 * That's the reason FSP skips cpu_ratio override if cpu_ratio is 0.
456 *
457 * Only override CPU flex ratio if don't want to boot with non-turbo max.
458 */
459 uint8_t cpu_ratio_override;
460
461 struct i915_gpu_panel_config panel_cfg;
462
463 struct i915_gpu_controller_info gfx;
464
465 /* Disable CPU Turbo in IA32_MISC_ENABLE */
466 bool cpu_turbo_disable;
467
468 bool disable_vmx;
469 };
470
471 typedef struct soc_intel_cannonlake_config config_t;
472
473 #endif