Debian Codegraph @

src/soc/intel/jasperlake/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 <device/pci_ids.h>
7 #include <drivers/i2c/designware/dw_i2c.h>
8 #include <gpio.h>
9 #include <drivers/intel/gma/gma.h>
10 #include <intelblocks/cfg.h>
11 #include <intelblocks/gspi.h>
12 #include <intelblocks/pcie_rp.h>
13 #include <intelblocks/power_limit.h>
14 #include <intelblocks/xhci.h>
15 #include <soc/gpe.h>
16 #include <soc/pch.h>
17 #include <soc/pci_devs.h>
18 #include <soc/pcie_modphy.h>
19 #include <soc/pmc.h>
20 #include <soc/serialio.h>
21 #include <soc/usb.h>
22 #include <stdint.h>
23 #include <stdbool.h>
24
25 #define MAX_HD_AUDIO_DMIC_LINKS 2
26 #define MAX_HD_AUDIO_SNDW_LINKS 4
27 #define MAX_HD_AUDIO_SSP_LINKS 6
28
29 /* Types of different SKUs */
30 enum soc_intel_jasperlake_power_limits {
31 JSL_N4500_6W_CORE,
32 JSL_N6000_6W_CORE,
33 JSL_N5100_6W_CORE,
34 JSL_N4505_10W_CORE,
35 JSL_N5105_10W_CORE,
36 JSL_N6005_10W_CORE,
37 JSL_POWER_LIMITS_COUNT
38 };
39
40 /* TDP values for different SKUs */
41 enum soc_intel_jasperlake_cpu_tdps {
42 TDP_6W = 6,
43 TDP_10W = 10
44 };
45
46 /* Mapping of different SKUs based on CPU ID and TDP values */
47 static const struct {
48 unsigned int pci_did;
49 enum soc_intel_jasperlake_power_limits limits;
50 enum soc_intel_jasperlake_cpu_tdps cpu_tdp;
51 } cpuid_to_jsl[] = {
52 { PCI_DID_INTEL_JSL_ID_1, JSL_N4500_6W_CORE, TDP_6W },
53 { PCI_DID_INTEL_JSL_ID_2, JSL_N6000_6W_CORE, TDP_6W },
54 { PCI_DID_INTEL_JSL_ID_3, JSL_N5100_6W_CORE, TDP_6W },
55 { PCI_DID_INTEL_JSL_ID_4, JSL_N4505_10W_CORE, TDP_10W },
56 { PCI_DID_INTEL_JSL_ID_5, JSL_N5105_10W_CORE, TDP_10W },
57 { PCI_DID_INTEL_JSL_ID_6, JSL_N6005_10W_CORE, TDP_10W },
58 };
59
60 /* Gfx related */
61 enum igd_dvmt50_pre_alloc {
62 IGD_SM_0MB = 0x00,
63 IGD_SM_32MB = 0x01,
64 IGD_SM_64MB = 0x02,
65 IGD_SM_96MB = 0x03,
66 IGD_SM_128MB = 0x04,
67 IGD_SM_160MB = 0x05,
68 IGD_SM_4MB = 0xF0,
69 IGD_SM_8MB = 0xF1,
70 IGD_SM_12MB = 0xF2,
71 IGD_SM_16MB = 0xF3,
72 IGD_SM_20MB = 0xF4,
73 IGD_SM_24MB = 0xF5,
74 IGD_SM_28MB = 0xF6,
75 IGD_SM_36MB = 0xF8,
76 IGD_SM_40MB = 0xF9,
77 IGD_SM_44MB = 0xFA,
78 IGD_SM_48MB = 0xFB,
79 IGD_SM_52MB = 0xFC,
80 IGD_SM_56MB = 0xFD,
81 IGD_SM_60MB = 0xFE,
82 };
83
84 enum igd_aperture_size {
85 IGD_AP_SZ_128MB = 0x00,
86 IGD_AP_SZ_256MB = 0x01,
87 IGD_AP_SZ_512MB = 0x02,
88 };
89
90 struct soc_intel_jasperlake_config {
91 /* Common struct containing soc config data required by common code */
92 struct soc_intel_common_config common_soc_config;
93
94 /* Common struct containing power limits configuration information */
95 struct soc_power_limits_config power_limits_config[JSL_POWER_LIMITS_COUNT];
96
97 /* Gpio group routed to each dword of the GPE0 block. Values are
98 * of the form PMC_GPP_[A:U] or GPD. */
99 uint8_t pmc_gpe0_dw0; /* GPE0_31_0 STS/EN */
100 uint8_t pmc_gpe0_dw1; /* GPE0_63_32 STS/EN */
101 uint8_t pmc_gpe0_dw2; /* GPE0_95_64 STS/EN */
102
103 /* Generic IO decode ranges */
104 uint32_t gen1_dec;
105 uint32_t gen2_dec;
106 uint32_t gen3_dec;
107 uint32_t gen4_dec;
108
109 /* Enable S0iX support */
110 bool s0ix_enable;
111 /* Enable DPTF support */
112 bool dptf_enable;
113
114 /* Deep SX enable for both AC and DC */
115 bool deep_s3_enable_ac;
116 bool deep_s3_enable_dc;
117 bool deep_s5_enable_ac;
118 bool deep_s5_enable_dc;
119
120 /* Deep Sx Configuration
121 * DSX_EN_WAKE_PIN - Enable WAKE# pin
122 * DSX_EN_LAN_WAKE_PIN - Enable LAN_WAKE# pin
123 * DSX_DIS_AC_PRESENT_PD - Disable pull-down on AC_PRESENT pin */
124 uint32_t deep_sx_config;
125
126 /* TCC activation offset */
127 uint32_t tcc_offset;
128
129 /* System Agent dynamic frequency support.
130 * When enabled memory will be training at different frequencies.
131 * 0:Disabled, 1:FixedPoint0(low), 2:FixedPoint1(mid), 3:FixedPoint2
132 * (high), 4:Enabled */
133 enum {
134 SaGv_Disabled,
135 SaGv_FixedPoint0,
136 SaGv_FixedPoint1,
137 SaGv_FixedPoint2,
138 SaGv_Enabled,
139 } SaGv;
140
141 /* Rank Margin Tool */
142 bool RMT;
143
144 /* USB related */
145 struct usb2_port_config usb2_ports[16];
146 struct usb3_port_config usb3_ports[10];
147 /* Wake Enable Bitmap for USB2 ports */
148 uint16_t usb2_wake_enable_bitmap;
149 /* Wake Enable Bitmap for USB3 ports */
150 uint16_t usb3_wake_enable_bitmap;
151
152 /* Set the LFPS periodic sampling off time for USB3 Ports.
153 Default value of PMCTRL_REG bits[7:4] is 9 which means periodic
154 sampling off interval is 9ms, the range is from 0 to 15. */
155 uint8_t xhci_lfps_sampling_offtime_ms;
156
157 /* SATA related */
158 uint8_t SataMode;
159 bool SataSalpSupport;
160 bool SataPortsEnable[8];
161 bool SataPortsDevSlp[8];
162
163 /* Audio related */
164 bool PchHdaDspEnable;
165 bool PchHdaAudioLinkHdaEnable;
166 bool PchHdaAudioLinkDmicEnable[MAX_HD_AUDIO_DMIC_LINKS];
167 bool PchHdaAudioLinkSspEnable[MAX_HD_AUDIO_SSP_LINKS];
168 bool PchHdaAudioLinkSndwEnable[MAX_HD_AUDIO_SNDW_LINKS];
169 uint8_t PchHdaIDispLinkTmode;
170 uint8_t PchHdaIDispLinkFrequency;
171 bool PchHdaIDispCodecDisconnect;
172
173 /* PCIe Root Ports */
174 /* PCIe output clocks type to PCIe devices.
175 * 0-23: PCH rootport, 0x70: LAN, 0x80: unspecified but in use,
176 * 0xFF: not used */
177 uint8_t PcieClkSrcUsage[CONFIG_MAX_PCIE_CLOCK_SRC];
178 /* PCIe ClkReq-to-ClkSrc mapping, number of clkreq signal assigned to
179 * clksrc. */
180 uint8_t PcieClkSrcClkReq[CONFIG_MAX_PCIE_CLOCK_SRC];
181
182 /* Probe CLKREQ# signal before enabling CLKREQ# based power management.*/
183 bool PcieRpClkReqDetect[CONFIG_MAX_ROOT_PORTS];
184
185 /* PCIe LTR */
186 bool PcieRpLtrEnable[CONFIG_MAX_ROOT_PORTS];
187
188 /* PCIe RP L1 substate */
189 enum L1_substates_control PcieRpL1Substates[CONFIG_MAX_ROOT_PORTS];
190
191 /* PCIe ModPhy related */
192 struct pcie_modphy_config pcie_mp_cfg[CONFIG_MAX_ROOT_PORTS];
193
194 /* SMBus */
195 bool SmbusEnable;
196
197 /* eMMC and SD */
198 bool ScsEmmcHs400Enabled;
199
200 /* Enable if SD Card Power Enable Signal is Active High */
201 bool SdCardPowerEnableActiveHigh;
202
203 /* VR Config Settings for IA Core */
204 uint16_t ImonSlope;
205 uint16_t ImonOffset;
206
207 /* Gfx related */
208 bool SkipExtGfxScan;
209
210 bool eist_enable;
211
212 /* Enable C6 DRAM */
213 bool enable_c6dram;
214
215 /*
216 * SerialIO device mode selection:
217 * PchSerialIoDisabled,
218 * PchSerialIoPci,
219 * PchSerialIoHidden,
220 * PchSerialIoLegacyUart,
221 * PchSerialIoSkipInit
222 */
223 uint8_t SerialIoI2cMode[CONFIG_SOC_INTEL_I2C_DEV_MAX];
224 uint8_t SerialIoGSpiMode[CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX];
225 uint8_t SerialIoUartMode[CONFIG_SOC_INTEL_UART_DEV_MAX];
226 /*
227 * GSPIn Default Chip Select Mode:
228 * 0:Hardware Mode,
229 * 1:Software Mode
230 */
231 uint8_t SerialIoGSpiCsMode[CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX];
232 /*
233 * GSPIn Default Chip Select State:
234 * 0: Low,
235 * 1: High
236 */
237 uint8_t SerialIoGSpiCsState[CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX];
238
239 /*
240 * TraceHubMode config
241 * 0: Disable, 1: Target Debugger Mode, 2: Host Debugger Mode
242 */
243 uint8_t TraceHubMode;
244
245 /* Debug interface selection */
246 enum {
247 DEBUG_INTERFACE_RAM = (1 << 0),
248 DEBUG_INTERFACE_UART_8250IO = (1 << 1),
249 DEBUG_INTERFACE_USB3 = (1 << 3),
250 DEBUG_INTERFACE_LPSS_SERIAL_IO = (1 << 4),
251 DEBUG_INTERFACE_TRACEHUB = (1 << 5),
252 } debug_interface_flag;
253
254 /* GPIO SD card detect pin */
255 unsigned int sdcard_cd_gpio;
256
257 /* Enable Pch iSCLK */
258 bool pch_isclk;
259
260 /* Tcss */
261 bool TcssXhciEn;
262 bool TcssXdciEn;
263
264 /*
265 * Override GPIO PM configuration:
266 * false: Use FSP default GPIO PM program,
267 * true: coreboot to override GPIO PM program
268 */
269 bool gpio_override_pm;
270
271 /*
272 * GPIO PM configuration: 0 to disable, 1 to enable power gating
273 * Bit 6-7: Reserved
274 * Bit 5: MISCCFG_GPSIDEDPCGEN
275 * Bit 4: MISCCFG_GPRCOMPCDLCGEN
276 * Bit 3: MISCCFG_GPRTCDLCGEN
277 * Bit 2: MISCCFG_GSXLCGEN
278 * Bit 1: MISCCFG_GPDPCGEN
279 * Bit 0: MISCCFG_GPDLCGEN
280 */
281 uint8_t gpio_pm[TOTAL_GPIO_COMM];
282
283 /* DP config */
284 /*
285 * Port config
286 * 0:Disabled, 1:eDP, 2:MIPI DSI
287 */
288 uint8_t DdiPortAConfig;
289 uint8_t DdiPortBConfig;
290
291 /*
292 * HDP config
293 */
294 bool DdiPortAHpd;
295 bool DdiPortBHpd;
296 bool DdiPortCHpd;
297 bool DdiPort1Hpd;
298 bool DdiPort2Hpd;
299 bool DdiPort3Hpd;
300 bool DdiPort4Hpd;
301
302 /*
303 * DDC config
304 */
305 bool DdiPortADdc;
306 bool DdiPortBDdc;
307 bool DdiPortCDdc;
308 bool DdiPort1Ddc;
309 bool DdiPort2Ddc;
310 bool DdiPort3Ddc;
311 bool DdiPort4Ddc;
312
313 /* Hybrid storage mode
314 * This mode makes FSP detect Optane and NVME and set PCIe lane mode
315 * accordingly
316 *
317 * true: Enable Hybrid storage mode
318 * false Dsiable Hybrid storage mode
319 */
320 bool HybridStorageMode;
321
322 /*
323 * Override CPU flex ratio value:
324 * CPU ratio value controls the maximum processor non-turbo ratio.
325 * Valid Range 0 to 63.
326 * In general descriptor provides option to set default cpu flex ratio.
327 * Default cpu flex ratio 0 ensures booting with non-turbo max frequency.
328 * That's the reason FSP skips cpu_ratio override if cpu_ratio is 0.
329 * Only override CPU flex ratio to not boot with non-turbo max.
330 */
331 uint8_t cpu_ratio_override;
332
333 /* Skip CPU replacement check
334 *
335 * Setting this option to skip CPU replacement check to avoid the forced MRC training
336 * for the platforms with soldered down SOC.
337 *
338 * false: disable
339 * true: enable
340 */
341 bool SkipCpuReplacementCheck;
342
343 /*
344 * SLP_S3 Minimum Assertion Width Policy
345 * 1 = 60us
346 * 2 = 1ms
347 * 3 = 50ms (default)
348 * 4 = 2s
349 */
350 uint8_t PchPmSlpS3MinAssert;
351
352 /*
353 * SLP_S4 Minimum Assertion Width Policy
354 * 1 = 1s (default)
355 * 2 = 2s
356 * 3 = 3s
357 * 4 = 4s
358 */
359 uint8_t PchPmSlpS4MinAssert;
360
361 /*
362 * SLP_SUS Minimum Assertion Width Policy
363 * 1 = 0ms
364 * 2 = 500ms
365 * 3 = 1s
366 * 4 = 4s (default)
367 */
368 uint8_t PchPmSlpSusMinAssert;
369
370 /*
371 * SLP_A Minimum Assertion Width Policy
372 * 1 = 0ms
373 * 2 = 4s
374 * 3 = 98ms
375 * 4 = 2s (default)
376 */
377 uint8_t PchPmSlpAMinAssert;
378
379 /*
380 * PCH PM Reset Power Cycle Duration
381 * 0 = 4s (default)
382 * 1 = 1s
383 * 2 = 2s
384 * 3 = 3s
385 * 4 = 4s
386 *
387 * NOTE: Duration programmed in the PchPmPwrCycDur should never be smaller than the
388 * stretch duration programmed in the following registers:
389 * - GEN_PMCON_A.SLP_S3_MIN_ASST_WDTH (PchPmSlpS3MinAssert)
390 * - GEN_PMCON_A.S4MAW (PchPmSlpS4MinAssert)
391 * - PM_CFG.SLP_A_MIN_ASST_WDTH (PchPmSlpAMinAssert)
392 * - PM_CFG.SLP_LAN_MIN_ASST_WDTH
393 */
394 uint8_t PchPmPwrCycDur;
395
396 /*
397 * FIVR RFI Frequency
398 * PCODE MMIO Mailbox: Set the desired RFI frequency, in increments of 100KHz.
399 * 0: Auto.
400 * Range varies based on XTAL clock:
401 * 0-1918 (Up to 191.8HMz) for 24MHz clock;
402 * 0-1535 (Up to 153.5MHz) for 19MHz clock.
403 */
404 uint16_t FivrRfiFrequency;
405
406 /*
407 * FIVR RFI Spread Spectrum
408 * Set the Spread Spectrum Range. <b>0: 0%</b>;
409 * FIVR RFI Spread Spectrum, in 0.1% increments.
410 * Range: 0.0% to 10.0% (0-100)
411 */
412 uint8_t FivrSpreadSpectrum;
413
414 /*
415 * Disable Fast Slew Rate for Deep Package C States for VCCIN VR domain
416 * Disable Fast Slew Rate for Deep Package C States based on
417 * Acoustic Noise Mitigation feature enabled.
418 */
419 bool FastPkgCRampDisable;
420
421 /*
422 * Slew Rate configuration for Deep Package C States for VCCIN VR domain
423 * based on Acoustic Noise Mitigation feature enabled.
424 * 0: Fast/2 ; 1: Fast/4; 2: Fast/8; 3: Fast/16
425 */
426 enum {
427 SlewRateFastBy2 = 0,
428 SlewRateFastBy4,
429 SlewRateFastBy8,
430 SlewRateFastBy16
431 } SlowSlewRate;
432
433 /*
434 * Enable or Disable Acoustic Noise Mitigation feature.
435 */
436 bool AcousticNoiseMitigation;
437
438 /*
439 * Acoustic Noise Mitigation Range.Defines the maximum Pre-Wake
440 * randomization time in micro ticks.This can be programmed only
441 * if AcousticNoiseMitigation is enabled.
442 * Range 0-255
443 */
444 uint8_t PreWake;
445
446 /*
447 * Acoustic Noise Mitigation Range.Defines the maximum Ramp Up
448 * randomization time in micro ticks.This can be programmed only
449 * if AcousticNoiseMitigation is enabled.
450 * Range 0-255
451 */
452 uint8_t RampUp;
453
454 /*
455 * Acoustic Noise Mitigation Range.Defines the maximum Ramp Down
456 * randomization time in micro ticks.This can be programmed only
457 * if AcousticNoiseMitigation is enabled.
458 * Range 0-255
459 */
460 uint8_t RampDown;
461
462 /*
463 * It controls below soc variables
464 *
465 * PchFivrExtV1p05RailEnabledStates
466 * PchFivrExtVnnRailSxEnabledStates
467 * PchFivrExtVnnRailEnabledStates
468 *
469 * If your platform does not support external vnn power rail please set to 1
470 * 1: Disabled ; 0: Enabled
471 */
472 bool disable_external_bypass_vr;
473
474 /*
475 * Core Display Clock Frequency selection, FSP UPD CdClock values + 1
476 *
477 * FSP will use the value to program clock frequency for core display if GOP
478 * is not run. Ex: the Chromebook normal mode.
479 * For the cases GOP is run, GOP will be in charge of the related register
480 * settings.
481 */
482 enum {
483 CD_CLOCK_172_8_MHZ = 1,
484 CD_CLOCK_180_MHZ = 2,
485 CD_CLOCK_192_MHZ = 3,
486 CD_CLOCK_307_MHZ = 4,
487 CD_CLOCK_312_MHZ = 5,
488 CD_CLOCK_552_MHZ = 6,
489 CD_CLOCK_556_8_MHZ = 7,
490 } cd_clock;
491
492 /* Platform Power Pmax */
493 uint16_t PsysPmax;
494
495 /*
496 * This is a workaround to mitigate higher SoC power consumption in S0ix
497 * when the CNVI has background activity.
498 *
499 * Setting this on a system that supports S0i3 (set xtalsdqdis [Bit 22] in
500 * cppmvric1 register to 0) will break CNVI timing.
501 * Affected Intel wireless chipsets: AC9560 (JfP2), AC9461/AC9462 (JfP1) and
502 * AX201 (HrP2)
503 *
504 * true: Enabled (fewer wakes, lower power)
505 * false: Disabled (more wakes, higher power)
506 */
507 bool cnvi_reduce_s0ix_pwr_usage;
508
509 /* i915 struct for GMA backlight control */
510 struct i915_gpu_controller_info gfx;
511 };
512
513 typedef struct soc_intel_jasperlake_config config_t;
514
515 #endif