1 /* SPDX-License-Identifier: GPL-2.0-only */
6 #include <drivers/i2c/designware/dw_i2c.h>
7 #include <drivers/intel/gma/gma.h>
8 #include <device/pci_ids.h>
10 #include <intelblocks/cfg.h>
11 #include <intelblocks/gspi.h>
12 #include <intelblocks/power_limit.h>
13 #include <intelblocks/pcie_rp.h>
14 #include <intelblocks/tcss.h>
16 #include <soc/pci_devs.h>
18 #include <soc/serialio.h>
23 /* Define config parameters for In-Band ECC (IBECC). */
24 #define MAX_IBECC_REGIONS 8
26 #define MAX_SAGV_POINTS 4
27 #define MAX_HD_AUDIO_SDI_LINKS 2
29 /* In-Band ECC Operation Mode */
31 IBECC_MODE_PER_REGION
,
40 bool region_enable
[MAX_IBECC_REGIONS
];
41 uint16_t region_base
[MAX_IBECC_REGIONS
];
42 uint16_t region_mask
[MAX_IBECC_REGIONS
];
45 /* Types of different SKUs */
46 enum soc_intel_meteorlake_power_limits
{
49 MTL_POWER_LIMITS_COUNT
52 /* TDP values for different SKUs */
53 enum soc_intel_meteorlake_cpu_tdps
{
58 /* Mapping of different SKUs based on CPU ID and TDP values */
61 enum soc_intel_meteorlake_power_limits limits
;
62 enum soc_intel_meteorlake_cpu_tdps cpu_tdp
;
64 { PCI_DID_INTEL_MTL_P_ID_5
, MTL_P_282_242_CORE
, TDP_15W
},
65 { PCI_DID_INTEL_MTL_P_ID_2
, MTL_P_282_242_CORE
, TDP_15W
},
66 { PCI_DID_INTEL_MTL_P_ID_3
, MTL_P_682_482_CORE
, TDP_28W
},
67 { PCI_DID_INTEL_MTL_P_ID_1
, MTL_P_682_482_CORE
, TDP_28W
},
70 /* Types of display ports */
83 DDI_ENABLE_DDC
= 1 << 0, // Display Data Channel
84 DDI_ENABLE_HPD
= 1 << 1, // Hot Plug Detect
89 * Values 0 - C0/C1, 1 - C2, 2 - C3, 3 - C6, 4 - C7, 5 - C7S, 6 - C8, 7 - C9, 8 - C10,
90 * 254 - CPU Default , 255 - Auto.
92 enum pkgcstate_limit
{
102 LIMIT_CPUDEFAULT
= 254,
106 /* Bit values for use in LpmStateEnableMask. */
107 enum lpm_state_mask
{
116 LPM_S0iX_ALL
= LPM_S0i2_0
| LPM_S0i2_1
| LPM_S0i2_2
117 | LPM_S0i3_0
| LPM_S0i3_1
| LPM_S0i3_2
| LPM_S0i3_3
| LPM_S0i3_4
,
121 * As per definition from FSP header:
125 * - [3] through [5] are reserved
135 * Slew Rate configuration for Deep Package C States for VR domain.
136 * They are fast time divided by 2.
150 struct soc_intel_meteorlake_config
{
151 /* Common struct containing soc config data required by common code */
152 struct soc_intel_common_config common_soc_config
;
154 /* Common struct containing power limits configuration information */
155 struct soc_power_limits_config power_limits_config
[MTL_POWER_LIMITS_COUNT
];
157 /* Gpio group routed to each dword of the GPE0 block. Values are
158 * of the form PMC_GPP_[A:U] or GPD. */
159 uint8_t pmc_gpe0_dw0
; /* GPE0_31_0 STS/EN */
160 uint8_t pmc_gpe0_dw1
; /* GPE0_63_32 STS/EN */
161 uint8_t pmc_gpe0_dw2
; /* GPE0_95_64 STS/EN */
163 /* Generic IO decode ranges */
169 /* Enable S0iX support */
171 /* Support for TCSS xhci, xdci, TBT PCIe root ports and DMA controllers */
172 bool tcss_d3_hot_disable
;
173 /* Enable DPTF support */
176 /* Deep SX enable for both AC and DC */
177 bool deep_s3_enable_ac
;
178 bool deep_s3_enable_dc
;
179 bool deep_s5_enable_ac
;
180 bool deep_s5_enable_dc
;
182 /* Deep Sx Configuration
183 * DSX_EN_WAKE_PIN - Enable WAKE# pin
184 * DSX_EN_LAN_WAKE_PIN - Enable LAN_WAKE# pin
185 * DSX_DIS_AC_PRESENT_PD - Disable pull-down on AC_PRESENT pin */
186 uint32_t deep_sx_config
;
188 /* TCC activation offset */
191 /* In-Band ECC (IBECC) configuration */
192 struct ibecc_config ibecc
;
194 /* System Agent dynamic frequency support. Only effects ULX/ULT CPUs.
195 * When enabled memory will be training at two different frequencies.
196 * 0:Disabled, 1:Enabled
203 /* System Agent dynamic frequency work points that memory will be training
204 * at the enabled frequencies. Possible work points are:
205 * 0x3:Points0_1, 0x7:Points0_1_2, 0xF:AllPoints0_1_2_3
208 SAGV_POINTS_0_1
= 0x03,
209 SAGV_POINTS_0_1_2
= 0x07,
210 SAGV_POINTS_0_1_2_3
= 0x0f,
213 /* Rank Margin Tool. */
217 struct usb2_port_config usb2_ports
[CONFIG_SOC_INTEL_USB2_DEV_MAX
];
218 struct usb3_port_config usb3_ports
[CONFIG_SOC_INTEL_USB3_DEV_MAX
];
219 /* Wake Enable Bitmap for USB2 ports */
220 uint16_t usb2_wake_enable_bitmap
;
221 /* Wake Enable Bitmap for USB3 ports */
222 uint16_t usb3_wake_enable_bitmap
;
223 /* Program OC pins for TCSS */
224 struct tcss_port_config tcss_ports
[MAX_TYPE_C_PORTS
];
225 /* Validate TBT firmware authenticated and loaded into IMR */
226 bool tbt_authentication
;
230 bool sata_salp_support
;
231 bool sata_ports_enable
[8];
232 bool sata_ports_dev_slp
[8];
235 * Enable(false)/Disable(true) SATA Power Optimizer on PCH side.
236 * Default false. Setting this to true disables the SATA Power Optimizer.
238 bool sata_pwr_optimize_disable
;
241 * SATA Port Enable Dito Config.
242 * Enable DEVSLP Idle Timeout settings (DmVal, DitoVal).
244 bool sata_ports_enable_dito_config
[8];
246 /* SataPortsDmVal is the DITO multiplier. Default is 15. */
247 uint8_t sata_ports_dm_val
[8];
248 /* SataPortsDitoVal is the DEVSLP Idle Timeout, default is 625ms */
249 uint16_t sata_ports_dito_val
[8];
252 bool pch_hda_audio_link_hda_enable
;
253 bool pch_hda_dsp_enable
;
255 bool pch_hda_sdi_enable
[MAX_HD_AUDIO_SDI_LINKS
];
257 /* iDisp-Link T-Mode 0: 2T, 2: 4T, 3: 8T, 4: 16T */
263 } pch_hda_idisp_link_tmode
;
265 /* iDisp-Link Freq 4: 96MHz, 3: 48MHz. */
267 HDA_LINKFREQ_48MHZ
= 3,
268 HDA_LINKFREQ_96MHZ
= 4,
269 } pch_hda_idisp_link_frequency
;
271 bool pch_hda_idisp_codec_enable
;
273 struct pcie_rp_config pcie_rp
[CONFIG_MAX_ROOT_PORTS
];
274 uint8_t pcie_clk_config_flag
[CONFIG_MAX_PCIE_CLOCK_SRC
];
298 } igd_dvmt50_pre_alloc
;
300 bool skip_ext_gfx_scan
;
304 * When enabled, this feature makes the SoC throttle when the power
305 * consumption exceeds the I_TRIP threshold.
307 * FSPs sets a by default I_TRIP threshold adapted to the current SoC
308 * and assuming a Voltage Regulator error accuracy of 6.5%.
310 bool enable_fast_vmode
[NUM_VR_DOMAINS
];
313 * Current Excursion Protection needs to be set for each VR domain
314 * in order to be able to enable fast Vmode.
316 bool cep_enable
[NUM_VR_DOMAINS
];
319 * VR Fast Vmode I_TRIP threshold.
320 * 0-255A in 1/4 A units. Example: 400 = 100A
321 * This setting overrides the default value set by FSPs when Fast VMode
324 uint16_t fast_vmode_i_trip
[NUM_VR_DOMAINS
];
327 * Power state current threshold 1.
328 * Defined in 1/4 A increments. A value of 400 = 100A. Range 0-512,
329 * which translates to 0-128A. 0 = AUTO. [0] for IA, [1] for GT, [2] for
330 * SA, [3] through [5] are Reserved.
332 uint16_t ps_cur_1_threshold
[NUM_VR_DOMAINS
];
335 * Power state current threshold 2.
336 * Defined in 1/4 A increments. A value of 400 = 100A. Range 0-512,
337 * which translates to 0-128A. 0 = AUTO. [0] for IA, [1] for GT, [2] for
338 * SA, [3] through [5] are Reserved.
340 uint16_t ps_cur_2_threshold
[NUM_VR_DOMAINS
];
343 * Power state current threshold 3.
344 * Defined in 1/4 A increments. A value of 400 = 100A. Range 0-512,
345 * which translates to 0-128A. 0 = AUTO. [0] for IA, [1] for GT, [2] for
346 * SA, [3] through [5] are Reserved.
348 uint16_t ps_cur_3_threshold
[NUM_VR_DOMAINS
];
351 * SerialIO device mode selection:
352 * PchSerialIoDisabled,
355 * PchSerialIoLegacyUart,
356 * PchSerialIoSkipInit
358 uint8_t serial_io_i2c_mode
[CONFIG_SOC_INTEL_I2C_DEV_MAX
];
359 uint8_t serial_io_gspi_mode
[CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX
];
360 uint8_t serial_io_uart_mode
[CONFIG_SOC_INTEL_UART_DEV_MAX
];
362 * GSPIn Default Chip Select Mode:
366 uint8_t serial_io_gspi_cs_mode
[CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX
];
368 * GSPIn Default Chip Select State:
372 uint8_t serial_io_gspi_cs_state
[CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX
];
374 /* CNVi WiFi Core Enable/Disable */
377 /* CNVi BT Core Enable/Disable */
380 /* CNVi BT Audio Offload: Enable/Disable BT Audio Offload. */
381 bool cnvi_bt_audio_offload
;
384 * These GPIOs will be programmed by the IOM to handle biasing of the
385 * Type-C aux (SBU) signals when certain alternate modes are used.
386 * `pad_auxn_dc` should be assigned to the GPIO pad providing negative
387 * bias (name usually contains `AUXN_DC` or `AUX_N`); similarly,
388 * `pad_auxp_dc` should be assigned to the GPIO providing positive bias
389 * (name often contains `AUXP_DC` or `_AUX_P`).
391 struct typec_aux_bias_pads typec_aux_bias_pads
[MAX_TYPE_C_PORTS
];
394 * SOC Aux orientation override:
395 * This is a bitfield that corresponds to up to 4 TCSS ports on MTL.
396 * Even numbered bits (0, 2, 4, 6) control the retimer being handled by SOC.
397 * Odd numbered bits (1, 3, 5, 7) control the orientation of the physical aux lines
398 * on the motherboard.
400 uint16_t tcss_aux_ori
;
402 /* Connect Topology Command timeout value */
403 uint16_t itbt_connect_topology_timeout_in_ms
;
406 * Override GPIO PM configuration:
407 * 0: Use FSP default GPIO PM program,
408 * 1: coreboot to override GPIO PM program
410 uint8_t gpio_override_pm
;
413 * GPIO PM configuration: 0 to disable, 1 to enable power gating
415 * Bit 5: MISCCFG_GPSIDEDPCGEN
416 * Bit 4: MISCCFG_GPRCOMPCDLCGEN
417 * Bit 3: MISCCFG_GPRTCDLCGEN
418 * Bit 2: MISCCFG_GSXLCGEN
419 * Bit 1: MISCCFG_GPDPCGEN
420 * Bit 0: MISCCFG_GPDLCGEN
422 uint8_t gpio_pm
[TOTAL_GPIO_COMM
];
427 * 0:Disabled, 1:eDP, 2:MIPI DSI
429 uint8_t ddi_port_A_config
;
430 uint8_t ddi_port_B_config
;
432 /* Enable(1)/Disable(0) HPD/DDC */
433 uint8_t ddi_ports_config
[DDI_PORT_COUNT
];
436 * Override CPU flex ratio value:
437 * CPU ratio value controls the maximum processor non-turbo ratio.
438 * Valid Range 0 to 63.
440 * In general descriptor provides option to set default cpu flex ratio.
441 * Default cpu flex ratio is 0 ensures booting with non-turbo max frequency.
442 * That's the reason FSP skips cpu_ratio override if cpu_ratio is 0.
444 * Only override CPU flex ratio if don't want to boot with non-turbo max.
446 uint8_t cpu_ratio_override
;
449 * Enable(true)/Disable(false) DMI Power Optimizer on PCH side.
450 * Default false. Setting this to true disables the DMI Power Optimizer.
452 bool dmi_pwr_optimize_disable
;
455 * Enable(true)/Disable(false) CPU Replacement check.
456 * Default false. Setting this to true to check CPU replacement.
458 bool cpu_replacement_check
;
460 /* ISA Serial Base selection. */
462 ISA_SERIAL_BASE_ADDR_3F8
,
463 ISA_SERIAL_BASE_ADDR_2F8
,
464 } isa_serial_uart_base
;
467 * Assign clock source port for GbE. 0: Disable, N-1: port number
473 * Enable or Disable C1 C-state Auto Demotion & un-demotion
474 * The algorithm looks at the behavior of the wake up tracker, how
475 * often it is waking up, and based on that it demote the c-state.
476 * Default false. Set this to true in order to disable C1-state auto
478 * NOTE: Un-Demotion from Demoted C1 needs to be disabled when
479 * C1 C-state Auto Demotion is disabled.
481 bool disable_c1_state_auto_demotion
;
484 * Enable or Disable Package C-state Demotion.
485 * Default is set to false.
486 * Set this to true in order to disable Package C-state demotion.
487 * NOTE: Un-Demotion from demoted Package C-state needs to be disabled
488 * when auto demotion is disabled.
490 bool disable_package_c_state_demotion
;
492 /* Enable PCH to CPU energy report feature. */
493 bool pch_pm_energy_report_enable
;
495 /* Energy-Performance Preference (HWP feature) */
496 bool enable_energy_perf_pref
;
497 uint8_t energy_perf_pref_value
;
502 * SAGV Frequency per point in Mhz. 0 is Auto, otherwise holds the
503 * frequency value expressed as an integer. For example: 1867
505 uint16_t sagv_freq_mhz
[MAX_SAGV_POINTS
];
507 /* Gear Selection for SAGV points. 0: Auto, 1: Gear 1, 2: Gear 2, 4: Gear 4 */
508 uint8_t sagv_gear
[MAX_SAGV_POINTS
];
511 * Enable or Disable Reduced BasicMemoryTest size.
512 * Default is set to false.
513 * Set this to true in order to reduce BasicMemoryTest size
515 bool lower_basic_mem_test_size
;
517 /* Platform Power Pmax in Watts. Zero means automatic. */
518 uint16_t psys_pmax_watts
;
520 /* Platform Power Limit 2 in Watts. */
521 uint16_t psys_pl2_watts
;
523 /* Enable or Disable Acoustic Noise Mitigation feature */
524 bool enable_acoustic_noise_mitigation
;
525 /* Disable Fast Slew Rate for Deep Package C States for VR domains */
526 bool disable_fast_pkgc_ramp
[NUM_VR_DOMAINS
];
528 * Slew Rate configuration for Deep Package C States for VR domains
529 * as per `enum slew_rate` data type.
531 uint8_t slow_slew_rate_config
[NUM_VR_DOMAINS
];
533 /* i915 struct for GMA backlight control */
534 struct i915_gpu_controller_info gfx
;
537 typedef struct soc_intel_meteorlake_config config_t
;