blob: 57b78688ee4aa4e142eed00fa306a5fc3342604f [file] [log] [blame]
Subrata Banik292afef2020-09-09 13:34:18 +05301/* 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 <intelblocks/cfg.h>
8#include <intelblocks/gpio.h>
9#include <intelblocks/gspi.h>
Sumeet R Pawnikar77298c62021-03-10 21:09:37 +053010#include <intelblocks/power_limit.h>
Eric Laide2ab412021-01-11 16:14:14 +080011#include <intelblocks/pcie_rp.h>
Maulik V Vaghela69353502021-04-14 14:01:02 +053012#include <intelblocks/tcss.h>
Subrata Banik292afef2020-09-09 13:34:18 +053013#include <soc/gpe.h>
Subrata Banik292afef2020-09-09 13:34:18 +053014#include <soc/pci_devs.h>
15#include <soc/pmc.h>
Subrata Banik2871e0e2020-09-27 11:30:58 +053016#include <soc/serialio.h>
17#include <soc/usb.h>
Subrata Banik292afef2020-09-09 13:34:18 +053018#include <stdint.h>
19
Subrata Banik292afef2020-09-09 13:34:18 +053020struct soc_intel_alderlake_config {
21
22 /* Common struct containing soc config data required by common code */
23 struct soc_intel_common_config common_soc_config;
24
Sumeet R Pawnikar77298c62021-03-10 21:09:37 +053025 /* Common struct containing power limits configuration information */
26 struct soc_power_limits_config power_limits_config;
27
Subrata Banik292afef2020-09-09 13:34:18 +053028 /* Gpio group routed to each dword of the GPE0 block. Values are
29 * of the form PMC_GPP_[A:U] or GPD. */
30 uint8_t pmc_gpe0_dw0; /* GPE0_31_0 STS/EN */
31 uint8_t pmc_gpe0_dw1; /* GPE0_63_32 STS/EN */
32 uint8_t pmc_gpe0_dw2; /* GPE0_95_64 STS/EN */
33
34 /* Generic IO decode ranges */
35 uint32_t gen1_dec;
36 uint32_t gen2_dec;
37 uint32_t gen3_dec;
38 uint32_t gen4_dec;
39
40 /* Enable S0iX support */
41 int s0ix_enable;
42 /* Support for TCSS xhci, xdci, TBT PCIe root ports and DMA controllers */
43 uint8_t TcssD3HotDisable;
44 /* Support for TBT PCIe root ports and DMA controllers with D3Hot->D3Cold */
45 uint8_t TcssD3ColdDisable;
46 /* Enable DPTF support */
47 int dptf_enable;
48
49 /* Deep SX enable for both AC and DC */
50 int deep_s3_enable_ac;
51 int deep_s3_enable_dc;
52 int deep_s5_enable_ac;
53 int deep_s5_enable_dc;
54
55 /* Deep Sx Configuration
56 * DSX_EN_WAKE_PIN - Enable WAKE# pin
57 * DSX_EN_LAN_WAKE_PIN - Enable LAN_WAKE# pin
58 * DSX_DIS_AC_PRESENT_PD - Disable pull-down on AC_PRESENT pin */
59 uint32_t deep_sx_config;
60
61 /* TCC activation offset */
62 uint32_t tcc_offset;
63
64 /* System Agent dynamic frequency support. Only effects ULX/ULT CPUs.
65 * When enabled memory will be training at two different frequencies.
66 * 0:Disabled, 1:FixedPoint0, 2:FixedPoint1, 3:FixedPoint2,
67 * 4:FixedPoint3, 5:Enabled */
68 enum {
69 SaGv_Disabled,
70 SaGv_FixedPoint0,
71 SaGv_FixedPoint1,
72 SaGv_FixedPoint2,
73 SaGv_FixedPoint3,
74 SaGv_Enabled,
75 } SaGv;
76
77 /* Rank Margin Tool. 1:Enable, 0:Disable */
78 uint8_t RMT;
79
80 /* USB related */
81 struct usb2_port_config usb2_ports[16];
82 struct usb3_port_config usb3_ports[10];
83 /* Wake Enable Bitmap for USB2 ports */
84 uint16_t usb2_wake_enable_bitmap;
85 /* Wake Enable Bitmap for USB3 ports */
86 uint16_t usb3_wake_enable_bitmap;
Maulik V Vaghela69353502021-04-14 14:01:02 +053087 /* Program OC pins for TCSS */
88 struct tcss_port_config tcss_ports[MAX_TYPE_C_PORTS];
Subrata Banik292afef2020-09-09 13:34:18 +053089
90 /* SATA related */
91 uint8_t SataEnable;
92 uint8_t SataMode;
93 uint8_t SataSalpSupport;
94 uint8_t SataPortsEnable[8];
95 uint8_t SataPortsDevSlp[8];
96
97 /*
98 * Enable(0)/Disable(1) SATA Power Optimizer on PCH side.
99 * Default 0. Setting this to 1 disables the SATA Power Optimizer.
100 */
101 uint8_t SataPwrOptimizeDisable;
102
103 /*
104 * SATA Port Enable Dito Config.
105 * Enable DEVSLP Idle Timeout settings (DmVal, DitoVal).
106 */
107 uint8_t SataPortsEnableDitoConfig[8];
108
109 /* SataPortsDmVal is the DITO multiplier. Default is 15. */
110 uint8_t SataPortsDmVal[8];
111 /* SataPortsDitoVal is the DEVSLP Idle Timeout, default is 625ms */
112 uint16_t SataPortsDitoVal[8];
113
114 /* Audio related */
115 uint8_t PchHdaDspEnable;
Sugnan Prabhu S50f8b4e2021-03-18 22:08:22 +0530116
117 /* iDisp-Link T-Mode 0: 2T, 2: 4T, 3: 8T, 4: 16T */
118 enum {
119 HDA_TMODE_2T = 0,
120 HDA_TMODE_4T = 2,
121 HDA_TMODE_8T = 3,
122 HDA_TMODE_16T = 4,
123 } PchHdaIDispLinkTmode;
124
125 /* iDisp-Link Freq 4: 96MHz, 3: 48MHz. */
126 enum {
127 HDA_LINKFREQ_48MHZ = 3,
128 HDA_LINKFREQ_96MHZ = 4,
129 } PchHdaIDispLinkFrequency;
130
131 bool PchHdaIDispCodecEnable;
Subrata Banik292afef2020-09-09 13:34:18 +0530132
Eric Lai5b302b22020-12-05 16:49:43 +0800133 struct pcie_rp_config pch_pcie_rp[CONFIG_MAX_PCH_ROOT_PORTS];
134 struct pcie_rp_config cpu_pcie_rp[CONFIG_MAX_CPU_ROOT_PORTS];
135 uint8_t pcie_clk_config_flag[CONFIG_MAX_PCIE_CLOCK_SRC];
Subrata Banik292afef2020-09-09 13:34:18 +0530136
Subrata Banik292afef2020-09-09 13:34:18 +0530137 /* Gfx related */
138 enum {
139 IGD_SM_0MB = 0x00,
140 IGD_SM_32MB = 0x01,
141 IGD_SM_64MB = 0x02,
142 IGD_SM_96MB = 0x03,
143 IGD_SM_128MB = 0x04,
144 IGD_SM_160MB = 0x05,
145 IGD_SM_4MB = 0xF0,
146 IGD_SM_8MB = 0xF1,
147 IGD_SM_12MB = 0xF2,
148 IGD_SM_16MB = 0xF3,
149 IGD_SM_20MB = 0xF4,
150 IGD_SM_24MB = 0xF5,
151 IGD_SM_28MB = 0xF6,
152 IGD_SM_36MB = 0xF8,
153 IGD_SM_40MB = 0xF9,
154 IGD_SM_44MB = 0xFA,
155 IGD_SM_48MB = 0xFB,
156 IGD_SM_52MB = 0xFC,
157 IGD_SM_56MB = 0xFD,
158 IGD_SM_60MB = 0xFE,
159 } IgdDvmt50PreAlloc;
Subrata Banik292afef2020-09-09 13:34:18 +0530160 uint8_t SkipExtGfxScan;
161
Subrata Banik292afef2020-09-09 13:34:18 +0530162 /* HeciEnabled decides the state of Heci1 at end of boot
163 * Setting to 0 (default) disables Heci1 and hides the device from OS */
164 uint8_t HeciEnabled;
Subrata Banik292afef2020-09-09 13:34:18 +0530165
166 /* Enable/Disable EIST. 1b:Enabled, 0b:Disabled */
167 uint8_t eist_enable;
168
169 /* Enable C6 DRAM */
170 uint8_t enable_c6dram;
Subrata Banik292afef2020-09-09 13:34:18 +0530171 uint8_t PmTimerDisabled;
172 /*
173 * SerialIO device mode selection:
174 * PchSerialIoDisabled,
175 * PchSerialIoPci,
176 * PchSerialIoHidden,
177 * PchSerialIoLegacyUart,
178 * PchSerialIoSkipInit
179 */
180 uint8_t SerialIoI2cMode[CONFIG_SOC_INTEL_I2C_DEV_MAX];
181 uint8_t SerialIoGSpiMode[CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX];
182 uint8_t SerialIoUartMode[CONFIG_SOC_INTEL_UART_DEV_MAX];
183 /*
184 * GSPIn Default Chip Select Mode:
185 * 0:Hardware Mode,
186 * 1:Software Mode
187 */
188 uint8_t SerialIoGSpiCsMode[CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX];
189 /*
190 * GSPIn Default Chip Select State:
191 * 0: Low,
192 * 1: High
193 */
194 uint8_t SerialIoGSpiCsState[CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX];
195
196 /* Debug interface selection */
197 enum {
198 DEBUG_INTERFACE_RAM = (1 << 0),
199 DEBUG_INTERFACE_UART_8250IO = (1 << 1),
200 DEBUG_INTERFACE_USB3 = (1 << 3),
201 DEBUG_INTERFACE_LPSS_SERIAL_IO = (1 << 4),
202 DEBUG_INTERFACE_TRACEHUB = (1 << 5),
203 } debug_interface_flag;
204
205 /* Enable Pch iSCLK */
206 uint8_t pch_isclk;
207
Cliff Huangbc1941f2021-02-10 17:41:41 -0800208 /* CNVi BT Core Enable/Disable */
209 bool CnviBtCore;
210
Subrata Banik292afef2020-09-09 13:34:18 +0530211 /* CNVi BT Audio Offload: Enable/Disable BT Audio Offload. */
Angel Pons98521c52021-03-01 21:16:49 +0100212 bool CnviBtAudioOffload;
Subrata Banik292afef2020-09-09 13:34:18 +0530213
214 /*
Deepti Deshatty8e7facf2021-05-12 17:45:37 +0530215 * These GPIOs will be programmed by the IOM to handle biasing of the
216 * Type-C aux (SBU) signals when certain alternate modes are used.
217 * `pad_auxn_dc` should be assigned to the GPIO pad providing negative
218 * bias (name usually contains `AUXN_DC` or `AUX_N`); similarly,
219 * `pad_auxp_dc` should be assigned to the GPIO providing positive bias
220 * (name often contains `AUXP_DC` or `_AUX_P`).
Subrata Banik2871e0e2020-09-27 11:30:58 +0530221 */
Deepti Deshatty8e7facf2021-05-12 17:45:37 +0530222 struct typec_aux_bias_pads typec_aux_bias_pads[MAX_TYPE_C_PORTS];
Subrata Banik2871e0e2020-09-27 11:30:58 +0530223
224 /*
Subrata Banik292afef2020-09-09 13:34:18 +0530225 * SOC Aux orientation override:
226 * This is a bitfield that corresponds to up to 4 TCSS ports on ADL.
227 * Even numbered bits (0, 2, 4, 6) control the retimer being handled by SOC.
228 * Odd numbered bits (1, 3, 5, 7) control the orientation of the physical aux lines
229 * on the motherboard.
230 */
231 uint16_t TcssAuxOri;
232
233 /* Connect Topology Command timeout value */
234 uint16_t ITbtConnectTopologyTimeoutInMs;
235
236 /*
237 * Override GPIO PM configuration:
238 * 0: Use FSP default GPIO PM program,
239 * 1: coreboot to override GPIO PM program
240 */
241 uint8_t gpio_override_pm;
242
243 /*
244 * GPIO PM configuration: 0 to disable, 1 to enable power gating
245 * Bit 6-7: Reserved
246 * Bit 5: MISCCFG_GPSIDEDPCGEN
247 * Bit 4: MISCCFG_GPRCOMPCDLCGEN
248 * Bit 3: MISCCFG_GPRTCDLCGEN
249 * Bit 2: MISCCFG_GSXLCGEN
250 * Bit 1: MISCCFG_GPDPCGEN
251 * Bit 0: MISCCFG_GPDLCGEN
252 */
253 uint8_t gpio_pm[TOTAL_GPIO_COMM];
254
255 /* DP config */
256 /*
257 * Port config
258 * 0:Disabled, 1:eDP, 2:MIPI DSI
259 */
260 uint8_t DdiPortAConfig;
261 uint8_t DdiPortBConfig;
262
263 /* Enable(1)/Disable(0) HPD */
264 uint8_t DdiPortAHpd;
265 uint8_t DdiPortBHpd;
266 uint8_t DdiPortCHpd;
267 uint8_t DdiPort1Hpd;
268 uint8_t DdiPort2Hpd;
269 uint8_t DdiPort3Hpd;
270 uint8_t DdiPort4Hpd;
271
272 /* Enable(1)/Disable(0) DDC */
273 uint8_t DdiPortADdc;
274 uint8_t DdiPortBDdc;
275 uint8_t DdiPortCDdc;
276 uint8_t DdiPort1Ddc;
277 uint8_t DdiPort2Ddc;
278 uint8_t DdiPort3Ddc;
279 uint8_t DdiPort4Ddc;
280
281 /* Hybrid storage mode enable (1) / disable (0)
282 * This mode makes FSP detect Optane and NVME and set PCIe lane mode
283 * accordingly */
284 uint8_t HybridStorageMode;
285
286 /*
287 * Override CPU flex ratio value:
288 * CPU ratio value controls the maximum processor non-turbo ratio.
289 * Valid Range 0 to 63.
290 *
291 * In general descriptor provides option to set default cpu flex ratio.
292 * Default cpu flex ratio is 0 ensures booting with non-turbo max frequency.
293 * That's the reason FSP skips cpu_ratio override if cpu_ratio is 0.
294 *
295 * Only override CPU flex ratio if don't want to boot with non-turbo max.
296 */
297 uint8_t cpu_ratio_override;
298
299 /*
300 * Enable(0)/Disable(1) DMI Power Optimizer on PCH side.
301 * Default 0. Setting this to 1 disables the DMI Power Optimizer.
302 */
303 uint8_t DmiPwrOptimizeDisable;
304
305 /*
306 * Enable(1)/Disable(0) CPU Replacement check.
307 * Default 0. Setting this to 1 to check CPU replacement.
308 */
309 uint8_t CpuReplacementCheck;
310
311 /* ISA Serial Base selection. */
312 enum {
313 ISA_SERIAL_BASE_ADDR_3F8,
314 ISA_SERIAL_BASE_ADDR_2F8,
315 } IsaSerialUartBase;
316};
317
318typedef struct soc_intel_alderlake_config config_t;
319
320#endif