blob: 97b3c5b3636f3a225691e440092a29d48a6ee6b2 [file] [log] [blame]
Ravi Sarawadi8069b5d2022-04-10 23:36:52 -07001/* 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>
Dinesh Gehlot166c75c72023-01-03 05:26:19 +00007#include <gpio.h>
Ravi Sarawadi8069b5d2022-04-10 23:36:52 -07008#include <intelblocks/cfg.h>
Ravi Sarawadi8069b5d2022-04-10 23:36:52 -07009#include <intelblocks/gspi.h>
10#include <intelblocks/power_limit.h>
11#include <intelblocks/pcie_rp.h>
12#include <intelblocks/tcss.h>
13#include <soc/gpe.h>
14#include <soc/pci_devs.h>
15#include <soc/pmc.h>
16#include <soc/serialio.h>
17#include <soc/usb.h>
18#include <stdint.h>
19
20/* Types of different SKUs */
21enum soc_intel_meteorlake_power_limits {
22 MTL_P_POWER_LIMITS_1,
23 MTL_P_POWER_LIMITS_2,
24 MTL_P_POWER_LIMITS_3,
Sridhar Siricillace4dc662022-11-14 08:47:34 +053025 MTL_P_POWER_LIMITS_4,
Ravi Sarawadi8069b5d2022-04-10 23:36:52 -070026 MTL_POWER_LIMITS_COUNT
27};
28
29/* Types of display ports */
30enum ddi_ports {
31 DDI_PORT_A,
32 DDI_PORT_B,
33 DDI_PORT_C,
34 DDI_PORT_1,
35 DDI_PORT_2,
36 DDI_PORT_3,
37 DDI_PORT_4,
38 DDI_PORT_COUNT,
39};
40
41enum ddi_port_flags {
42 DDI_ENABLE_DDC = 1 << 0,
43 DDI_ENABLE_HPD = 1 << 1,
44};
45
Kapil Porwalae5ba372023-01-04 21:49:36 +053046/*
47 * The Max Pkg Cstate
48 * Values 0 - C0/C1, 1 - C2, 2 - C3, 3 - C6, 4 - C7, 5 - C7S, 6 - C8, 7 - C9, 8 - C10,
49 * 254 - CPU Default , 255 - Auto.
50 */
51enum pkgcstate_limit {
52 LIMIT_C0_C1 = 0,
53 LIMIT_C2 = 1,
54 LIMIT_C3 = 2,
55 LIMIT_C6 = 3,
56 LIMIT_C7 = 4,
57 LIMIT_C7S = 5,
58 LIMIT_C8 = 6,
59 LIMIT_C9 = 7,
60 LIMIT_C10 = 8,
61 LIMIT_CPUDEFAULT = 254,
62 LIMIT_AUTO = 255,
63};
64
Ravi Sarawadi8069b5d2022-04-10 23:36:52 -070065/* Bit values for use in LpmStateEnableMask. */
66enum lpm_state_mask {
67 LPM_S0i2_0 = BIT(0),
68 LPM_S0i2_1 = BIT(1),
69 LPM_S0i2_2 = BIT(2),
70 LPM_S0i3_0 = BIT(3),
71 LPM_S0i3_1 = BIT(4),
72 LPM_S0i3_2 = BIT(5),
73 LPM_S0i3_3 = BIT(6),
74 LPM_S0i3_4 = BIT(7),
75 LPM_S0iX_ALL = LPM_S0i2_0 | LPM_S0i2_1 | LPM_S0i2_2
76 | LPM_S0i3_0 | LPM_S0i3_1 | LPM_S0i3_2 | LPM_S0i3_3 | LPM_S0i3_4,
77};
78
79struct soc_intel_meteorlake_config {
80
81 /* Common struct containing soc config data required by common code */
82 struct soc_intel_common_config common_soc_config;
83
84 /* Common struct containing power limits configuration information */
85 struct soc_power_limits_config power_limits_config[MTL_POWER_LIMITS_COUNT];
86
87 /* Gpio group routed to each dword of the GPE0 block. Values are
88 * of the form PMC_GPP_[A:U] or GPD. */
89 uint8_t pmc_gpe0_dw0; /* GPE0_31_0 STS/EN */
90 uint8_t pmc_gpe0_dw1; /* GPE0_63_32 STS/EN */
91 uint8_t pmc_gpe0_dw2; /* GPE0_95_64 STS/EN */
92
93 /* Generic IO decode ranges */
94 uint32_t gen1_dec;
95 uint32_t gen2_dec;
96 uint32_t gen3_dec;
97 uint32_t gen4_dec;
98
99 /* Enable S0iX support */
100 int s0ix_enable;
101 /* Support for TCSS xhci, xdci, TBT PCIe root ports and DMA controllers */
102 uint8_t tcss_d3_hot_disable;
103 /* Support for TBT PCIe root ports and DMA controllers with D3Hot->D3Cold */
104 uint8_t tcss_d3_cold_disable;
105 /* Enable DPTF support */
106 int dptf_enable;
107
108 /* Deep SX enable for both AC and DC */
109 int deep_s3_enable_ac;
110 int deep_s3_enable_dc;
111 int deep_s5_enable_ac;
112 int deep_s5_enable_dc;
113
114 /* Deep Sx Configuration
115 * DSX_EN_WAKE_PIN - Enable WAKE# pin
116 * DSX_EN_LAN_WAKE_PIN - Enable LAN_WAKE# pin
117 * DSX_DIS_AC_PRESENT_PD - Disable pull-down on AC_PRESENT pin */
118 uint32_t deep_sx_config;
119
120 /* TCC activation offset */
121 uint32_t tcc_offset;
122
123 /* System Agent dynamic frequency support. Only effects ULX/ULT CPUs.
124 * When enabled memory will be training at two different frequencies.
125 * 0:Disabled, 1:FixedPoint0, 2:FixedPoint1, 3:FixedPoint2,
126 * 4:FixedPoint3, 5:Enabled */
127 enum {
128 SaGv_Disabled,
129 SaGv_FixedPoint0,
130 SaGv_FixedPoint1,
131 SaGv_FixedPoint2,
132 SaGv_FixedPoint3,
133 SaGv_Enabled,
134 } SaGv;
135
136 /* Rank Margin Tool. 1:Enable, 0:Disable */
137 uint8_t RMT;
138
139 /* USB related */
140 struct usb2_port_config usb2_ports[CONFIG_SOC_INTEL_USB2_DEV_MAX];
141 struct usb3_port_config usb3_ports[CONFIG_SOC_INTEL_USB3_DEV_MAX];
142 /* Wake Enable Bitmap for USB2 ports */
143 uint16_t usb2_wake_enable_bitmap;
144 /* Wake Enable Bitmap for USB3 ports */
145 uint16_t usb3_wake_enable_bitmap;
146 /* Program OC pins for TCSS */
147 struct tcss_port_config tcss_ports[MAX_TYPE_C_PORTS];
John Zhao54a03e42022-08-03 20:07:03 -0700148 /* Validate TBT firmware authenticated and loaded into IMR */
149 bool tbt_authentication;
Ravi Sarawadi8069b5d2022-04-10 23:36:52 -0700150
151 /* SATA related */
152 uint8_t sata_mode;
153 uint8_t sata_salp_support;
154 uint8_t sata_ports_enable[8];
155 uint8_t sata_ports_dev_slp[8];
156
157 /*
158 * Enable(0)/Disable(1) SATA Power Optimizer on PCH side.
159 * Default 0. Setting this to 1 disables the SATA Power Optimizer.
160 */
161 uint8_t sata_pwr_optimize_disable;
162
163 /*
164 * SATA Port Enable Dito Config.
165 * Enable DEVSLP Idle Timeout settings (DmVal, DitoVal).
166 */
167 uint8_t sata_ports_enable_dito_config[8];
168
169 /* SataPortsDmVal is the DITO multiplier. Default is 15. */
170 uint8_t sata_ports_dm_val[8];
171 /* SataPortsDitoVal is the DEVSLP Idle Timeout, default is 625ms */
172 uint16_t sata_ports_dito_val[8];
173
174 /* Audio related */
175 uint8_t pch_hda_dsp_enable;
176
177 /* iDisp-Link T-Mode 0: 2T, 2: 4T, 3: 8T, 4: 16T */
178 enum {
179 HDA_TMODE_2T = 0,
180 HDA_TMODE_4T = 2,
181 HDA_TMODE_8T = 3,
182 HDA_TMODE_16T = 4,
183 } pch_hda_idisp_link_tmode;
184
185 /* iDisp-Link Freq 4: 96MHz, 3: 48MHz. */
186 enum {
187 HDA_LINKFREQ_48MHZ = 3,
188 HDA_LINKFREQ_96MHZ = 4,
189 } pch_hda_idisp_link_frequency;
190
191 bool pch_hda_idisp_codec_enable;
192
193 struct pcie_rp_config pcie_rp[CONFIG_MAX_ROOT_PORTS];
194 uint8_t pcie_clk_config_flag[CONFIG_MAX_PCIE_CLOCK_SRC];
195
196 /* Gfx related */
197 enum {
198 IGD_SM_0MB = 0x00,
199 IGD_SM_32MB = 0x01,
200 IGD_SM_64MB = 0x02,
201 IGD_SM_96MB = 0x03,
202 IGD_SM_128MB = 0x04,
203 IGD_SM_160MB = 0x05,
204 IGD_SM_4MB = 0xF0,
205 IGD_SM_8MB = 0xF1,
206 IGD_SM_12MB = 0xF2,
207 IGD_SM_16MB = 0xF3,
208 IGD_SM_20MB = 0xF4,
209 IGD_SM_24MB = 0xF5,
210 IGD_SM_28MB = 0xF6,
211 IGD_SM_36MB = 0xF8,
212 IGD_SM_40MB = 0xF9,
213 IGD_SM_44MB = 0xFA,
214 IGD_SM_48MB = 0xFB,
215 IGD_SM_52MB = 0xFC,
216 IGD_SM_56MB = 0xFD,
217 IGD_SM_60MB = 0xFE,
218 } igd_dvmt50_pre_alloc;
219 uint8_t skip_ext_gfx_scan;
220
221 /* Enable/Disable EIST. 1b:Enabled, 0b:Disabled */
222 uint8_t eist_enable;
223
224 uint8_t PmTimerDisabled;
225 /*
226 * SerialIO device mode selection:
227 * PchSerialIoDisabled,
228 * PchSerialIoPci,
229 * PchSerialIoHidden,
230 * PchSerialIoLegacyUart,
231 * PchSerialIoSkipInit
232 */
233 uint8_t serial_io_i2c_mode[CONFIG_SOC_INTEL_I2C_DEV_MAX];
234 uint8_t serial_io_gspi_mode[CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX];
235 uint8_t serial_io_uart_mode[CONFIG_SOC_INTEL_UART_DEV_MAX];
236 /*
237 * GSPIn Default Chip Select Mode:
238 * 0:Hardware Mode,
239 * 1:Software Mode
240 */
241 uint8_t serial_io_gspi_cs_mode[CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX];
242 /*
243 * GSPIn Default Chip Select State:
244 * 0: Low,
245 * 1: High
246 */
247 uint8_t serial_io_gspi_cs_state[CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX];
248
249 /* CNVi BT Core Enable/Disable */
250 bool cnvi_bt_core;
251
252 /* CNVi BT Audio Offload: Enable/Disable BT Audio Offload. */
253 bool cnvi_bt_audio_offload;
254
255 /*
256 * These GPIOs will be programmed by the IOM to handle biasing of the
257 * Type-C aux (SBU) signals when certain alternate modes are used.
258 * `pad_auxn_dc` should be assigned to the GPIO pad providing negative
259 * bias (name usually contains `AUXN_DC` or `AUX_N`); similarly,
260 * `pad_auxp_dc` should be assigned to the GPIO providing positive bias
261 * (name often contains `AUXP_DC` or `_AUX_P`).
262 */
263 struct typec_aux_bias_pads typec_aux_bias_pads[MAX_TYPE_C_PORTS];
264
265 /*
266 * SOC Aux orientation override:
267 * This is a bitfield that corresponds to up to 4 TCSS ports on MTL.
268 * Even numbered bits (0, 2, 4, 6) control the retimer being handled by SOC.
269 * Odd numbered bits (1, 3, 5, 7) control the orientation of the physical aux lines
270 * on the motherboard.
271 */
272 uint16_t tcss_aux_ori;
273
274 /* Connect Topology Command timeout value */
275 uint16_t itbt_connect_topology_timeout_in_ms;
276
277 /*
278 * Override GPIO PM configuration:
279 * 0: Use FSP default GPIO PM program,
280 * 1: coreboot to override GPIO PM program
281 */
282 uint8_t gpio_override_pm;
283
284 /*
285 * GPIO PM configuration: 0 to disable, 1 to enable power gating
286 * Bit 6-7: Reserved
287 * Bit 5: MISCCFG_GPSIDEDPCGEN
288 * Bit 4: MISCCFG_GPRCOMPCDLCGEN
289 * Bit 3: MISCCFG_GPRTCDLCGEN
290 * Bit 2: MISCCFG_GSXLCGEN
291 * Bit 1: MISCCFG_GPDPCGEN
292 * Bit 0: MISCCFG_GPDLCGEN
293 */
294 uint8_t gpio_pm[TOTAL_GPIO_COMM];
295
296 /* DP config */
297 /*
298 * Port config
299 * 0:Disabled, 1:eDP, 2:MIPI DSI
300 */
301 uint8_t ddi_port_A_config;
302 uint8_t ddi_port_B_config;
303
304 /* Enable(1)/Disable(0) HPD/DDC */
305 uint8_t ddi_ports_config[DDI_PORT_COUNT];
306
307 /* Hybrid storage mode enable (1) / disable (0)
308 * This mode makes FSP detect Optane and NVME and set PCIe lane mode
309 * accordingly */
310 uint8_t hybrid_storage_mode;
311
312 /*
313 * Override CPU flex ratio value:
314 * CPU ratio value controls the maximum processor non-turbo ratio.
315 * Valid Range 0 to 63.
316 *
317 * In general descriptor provides option to set default cpu flex ratio.
318 * Default cpu flex ratio is 0 ensures booting with non-turbo max frequency.
319 * That's the reason FSP skips cpu_ratio override if cpu_ratio is 0.
320 *
321 * Only override CPU flex ratio if don't want to boot with non-turbo max.
322 */
323 uint8_t cpu_ratio_override;
324
325 /*
326 * Enable(0)/Disable(1) DMI Power Optimizer on PCH side.
327 * Default 0. Setting this to 1 disables the DMI Power Optimizer.
328 */
329 uint8_t dmi_pwr_optimize_disable;
330
331 /*
332 * Enable(1)/Disable(0) CPU Replacement check.
333 * Default 0. Setting this to 1 to check CPU replacement.
334 */
335 uint8_t cpu_replacement_check;
336
337 /* ISA Serial Base selection. */
338 enum {
339 ISA_SERIAL_BASE_ADDR_3F8,
340 ISA_SERIAL_BASE_ADDR_2F8,
341 } isa_serial_uart_base;
342
343 /*
344 * Assign clock source port for GbE. 0: Disable, N-1: port number
345 * Default 0.
346 */
347 uint8_t lan_clk;
Wonkyu Kime5f6ff82022-10-13 13:34:27 -0700348
349 /*
Kapil Porwalae5bc432023-01-04 22:03:02 +0530350 * Enable or Disable Package C-state Demotion.
351 * Default is set to 0.
352 * Set this to 1 in order to disable Package C-state demotion.
353 */
354 bool disable_package_c_state_demotion;
Ravi Sarawadi8069b5d2022-04-10 23:36:52 -0700355};
356
357typedef struct soc_intel_meteorlake_config config_t;
358
359#endif