blob: 201150e8fcd3e20fc3d9abaa25f38bccd81a3af6 [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;
165 /* PL2 Override value in Watts */
166 uint32_t tdp_pl2_override;
Subrata Banik292afef2020-09-09 13:34:18 +0530167
168 /* Enable/Disable EIST. 1b:Enabled, 0b:Disabled */
169 uint8_t eist_enable;
170
171 /* Enable C6 DRAM */
172 uint8_t enable_c6dram;
Subrata Banik292afef2020-09-09 13:34:18 +0530173 uint8_t PmTimerDisabled;
174 /*
175 * SerialIO device mode selection:
176 * PchSerialIoDisabled,
177 * PchSerialIoPci,
178 * PchSerialIoHidden,
179 * PchSerialIoLegacyUart,
180 * PchSerialIoSkipInit
181 */
182 uint8_t SerialIoI2cMode[CONFIG_SOC_INTEL_I2C_DEV_MAX];
183 uint8_t SerialIoGSpiMode[CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX];
184 uint8_t SerialIoUartMode[CONFIG_SOC_INTEL_UART_DEV_MAX];
185 /*
186 * GSPIn Default Chip Select Mode:
187 * 0:Hardware Mode,
188 * 1:Software Mode
189 */
190 uint8_t SerialIoGSpiCsMode[CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX];
191 /*
192 * GSPIn Default Chip Select State:
193 * 0: Low,
194 * 1: High
195 */
196 uint8_t SerialIoGSpiCsState[CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX];
197
198 /* Debug interface selection */
199 enum {
200 DEBUG_INTERFACE_RAM = (1 << 0),
201 DEBUG_INTERFACE_UART_8250IO = (1 << 1),
202 DEBUG_INTERFACE_USB3 = (1 << 3),
203 DEBUG_INTERFACE_LPSS_SERIAL_IO = (1 << 4),
204 DEBUG_INTERFACE_TRACEHUB = (1 << 5),
205 } debug_interface_flag;
206
207 /* Enable Pch iSCLK */
208 uint8_t pch_isclk;
209
Cliff Huangbc1941f2021-02-10 17:41:41 -0800210 /* CNVi BT Core Enable/Disable */
211 bool CnviBtCore;
212
Subrata Banik292afef2020-09-09 13:34:18 +0530213 /* CNVi BT Audio Offload: Enable/Disable BT Audio Offload. */
Angel Pons98521c52021-03-01 21:16:49 +0100214 bool CnviBtAudioOffload;
Subrata Banik292afef2020-09-09 13:34:18 +0530215
216 /*
Subrata Banik2871e0e2020-09-27 11:30:58 +0530217 * IOM Port Config
218 * If a port orientation needs to be controlled by the SOC this setting must be
219 * updated to reflect the correct GPIOs being used for the SOC port flipping.
220 * There are 4 ports each with a pair of GPIOs for Pull Up and Pull Down
221 * 0,1 are pull up and pull down for port 0
222 * 2,3 are pull up and pull down for port 1
223 * 4,5 are pull up and pull down for port 2
224 * 6,7 are pull up and pull down for port 3
225 * values to be programmed correspond to the GPIO family and offsets
226 */
227 uint32_t IomTypeCPortPadCfg[8];
228
229 /*
Subrata Banik292afef2020-09-09 13:34:18 +0530230 * SOC Aux orientation override:
231 * This is a bitfield that corresponds to up to 4 TCSS ports on ADL.
232 * Even numbered bits (0, 2, 4, 6) control the retimer being handled by SOC.
233 * Odd numbered bits (1, 3, 5, 7) control the orientation of the physical aux lines
234 * on the motherboard.
235 */
236 uint16_t TcssAuxOri;
237
238 /* Connect Topology Command timeout value */
239 uint16_t ITbtConnectTopologyTimeoutInMs;
240
241 /*
242 * Override GPIO PM configuration:
243 * 0: Use FSP default GPIO PM program,
244 * 1: coreboot to override GPIO PM program
245 */
246 uint8_t gpio_override_pm;
247
248 /*
249 * GPIO PM configuration: 0 to disable, 1 to enable power gating
250 * Bit 6-7: Reserved
251 * Bit 5: MISCCFG_GPSIDEDPCGEN
252 * Bit 4: MISCCFG_GPRCOMPCDLCGEN
253 * Bit 3: MISCCFG_GPRTCDLCGEN
254 * Bit 2: MISCCFG_GSXLCGEN
255 * Bit 1: MISCCFG_GPDPCGEN
256 * Bit 0: MISCCFG_GPDLCGEN
257 */
258 uint8_t gpio_pm[TOTAL_GPIO_COMM];
259
260 /* DP config */
261 /*
262 * Port config
263 * 0:Disabled, 1:eDP, 2:MIPI DSI
264 */
265 uint8_t DdiPortAConfig;
266 uint8_t DdiPortBConfig;
267
268 /* Enable(1)/Disable(0) HPD */
269 uint8_t DdiPortAHpd;
270 uint8_t DdiPortBHpd;
271 uint8_t DdiPortCHpd;
272 uint8_t DdiPort1Hpd;
273 uint8_t DdiPort2Hpd;
274 uint8_t DdiPort3Hpd;
275 uint8_t DdiPort4Hpd;
276
277 /* Enable(1)/Disable(0) DDC */
278 uint8_t DdiPortADdc;
279 uint8_t DdiPortBDdc;
280 uint8_t DdiPortCDdc;
281 uint8_t DdiPort1Ddc;
282 uint8_t DdiPort2Ddc;
283 uint8_t DdiPort3Ddc;
284 uint8_t DdiPort4Ddc;
285
286 /* Hybrid storage mode enable (1) / disable (0)
287 * This mode makes FSP detect Optane and NVME and set PCIe lane mode
288 * accordingly */
289 uint8_t HybridStorageMode;
290
291 /*
292 * Override CPU flex ratio value:
293 * CPU ratio value controls the maximum processor non-turbo ratio.
294 * Valid Range 0 to 63.
295 *
296 * In general descriptor provides option to set default cpu flex ratio.
297 * Default cpu flex ratio is 0 ensures booting with non-turbo max frequency.
298 * That's the reason FSP skips cpu_ratio override if cpu_ratio is 0.
299 *
300 * Only override CPU flex ratio if don't want to boot with non-turbo max.
301 */
302 uint8_t cpu_ratio_override;
303
304 /*
305 * Enable(0)/Disable(1) DMI Power Optimizer on PCH side.
306 * Default 0. Setting this to 1 disables the DMI Power Optimizer.
307 */
308 uint8_t DmiPwrOptimizeDisable;
309
310 /*
311 * Enable(1)/Disable(0) CPU Replacement check.
312 * Default 0. Setting this to 1 to check CPU replacement.
313 */
314 uint8_t CpuReplacementCheck;
315
316 /* ISA Serial Base selection. */
317 enum {
318 ISA_SERIAL_BASE_ADDR_3F8,
319 ISA_SERIAL_BASE_ADDR_2F8,
320 } IsaSerialUartBase;
321};
322
323typedef struct soc_intel_alderlake_config config_t;
324
325#endif