blob: 3bee09d01fb2608ec8a250dbacf29ccef1b05428 [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>
Subrata Banik292afef2020-09-09 13:34:18 +053012#include <soc/gpe.h>
Subrata Banik292afef2020-09-09 13:34:18 +053013#include <soc/pci_devs.h>
14#include <soc/pmc.h>
Subrata Banik2871e0e2020-09-27 11:30:58 +053015#include <soc/serialio.h>
16#include <soc/usb.h>
Subrata Banik292afef2020-09-09 13:34:18 +053017#include <stdint.h>
18
19#define MAX_HD_AUDIO_DMIC_LINKS 2
20#define MAX_HD_AUDIO_SNDW_LINKS 4
21#define MAX_HD_AUDIO_SSP_LINKS 6
22
23struct soc_intel_alderlake_config {
24
25 /* Common struct containing soc config data required by common code */
26 struct soc_intel_common_config common_soc_config;
27
Sumeet R Pawnikar77298c62021-03-10 21:09:37 +053028 /* Common struct containing power limits configuration information */
29 struct soc_power_limits_config power_limits_config;
30
Subrata Banik292afef2020-09-09 13:34:18 +053031 /* Gpio group routed to each dword of the GPE0 block. Values are
32 * of the form PMC_GPP_[A:U] or GPD. */
33 uint8_t pmc_gpe0_dw0; /* GPE0_31_0 STS/EN */
34 uint8_t pmc_gpe0_dw1; /* GPE0_63_32 STS/EN */
35 uint8_t pmc_gpe0_dw2; /* GPE0_95_64 STS/EN */
36
37 /* Generic IO decode ranges */
38 uint32_t gen1_dec;
39 uint32_t gen2_dec;
40 uint32_t gen3_dec;
41 uint32_t gen4_dec;
42
43 /* Enable S0iX support */
44 int s0ix_enable;
45 /* Support for TCSS xhci, xdci, TBT PCIe root ports and DMA controllers */
46 uint8_t TcssD3HotDisable;
47 /* Support for TBT PCIe root ports and DMA controllers with D3Hot->D3Cold */
48 uint8_t TcssD3ColdDisable;
49 /* Enable DPTF support */
50 int dptf_enable;
51
52 /* Deep SX enable for both AC and DC */
53 int deep_s3_enable_ac;
54 int deep_s3_enable_dc;
55 int deep_s5_enable_ac;
56 int deep_s5_enable_dc;
57
58 /* Deep Sx Configuration
59 * DSX_EN_WAKE_PIN - Enable WAKE# pin
60 * DSX_EN_LAN_WAKE_PIN - Enable LAN_WAKE# pin
61 * DSX_DIS_AC_PRESENT_PD - Disable pull-down on AC_PRESENT pin */
62 uint32_t deep_sx_config;
63
64 /* TCC activation offset */
65 uint32_t tcc_offset;
66
67 /* System Agent dynamic frequency support. Only effects ULX/ULT CPUs.
68 * When enabled memory will be training at two different frequencies.
69 * 0:Disabled, 1:FixedPoint0, 2:FixedPoint1, 3:FixedPoint2,
70 * 4:FixedPoint3, 5:Enabled */
71 enum {
72 SaGv_Disabled,
73 SaGv_FixedPoint0,
74 SaGv_FixedPoint1,
75 SaGv_FixedPoint2,
76 SaGv_FixedPoint3,
77 SaGv_Enabled,
78 } SaGv;
79
80 /* Rank Margin Tool. 1:Enable, 0:Disable */
81 uint8_t RMT;
82
83 /* USB related */
84 struct usb2_port_config usb2_ports[16];
85 struct usb3_port_config usb3_ports[10];
86 /* Wake Enable Bitmap for USB2 ports */
87 uint16_t usb2_wake_enable_bitmap;
88 /* Wake Enable Bitmap for USB3 ports */
89 uint16_t usb3_wake_enable_bitmap;
90
91 /* SATA related */
92 uint8_t SataEnable;
93 uint8_t SataMode;
94 uint8_t SataSalpSupport;
95 uint8_t SataPortsEnable[8];
96 uint8_t SataPortsDevSlp[8];
97
98 /*
99 * Enable(0)/Disable(1) SATA Power Optimizer on PCH side.
100 * Default 0. Setting this to 1 disables the SATA Power Optimizer.
101 */
102 uint8_t SataPwrOptimizeDisable;
103
104 /*
105 * SATA Port Enable Dito Config.
106 * Enable DEVSLP Idle Timeout settings (DmVal, DitoVal).
107 */
108 uint8_t SataPortsEnableDitoConfig[8];
109
110 /* SataPortsDmVal is the DITO multiplier. Default is 15. */
111 uint8_t SataPortsDmVal[8];
112 /* SataPortsDitoVal is the DEVSLP Idle Timeout, default is 625ms */
113 uint16_t SataPortsDitoVal[8];
114
115 /* Audio related */
116 uint8_t PchHdaDspEnable;
117 uint8_t PchHdaAudioLinkHdaEnable;
118 uint8_t PchHdaAudioLinkDmicEnable[MAX_HD_AUDIO_DMIC_LINKS];
119 uint8_t PchHdaAudioLinkSspEnable[MAX_HD_AUDIO_SSP_LINKS];
120 uint8_t PchHdaAudioLinkSndwEnable[MAX_HD_AUDIO_SNDW_LINKS];
121 uint8_t PchHdaIDispLinkTmode;
122 uint8_t PchHdaIDispLinkFrequency;
123 uint8_t PchHdaIDispCodecDisconnect;
124
Eric Lai5b302b22020-12-05 16:49:43 +0800125 struct pcie_rp_config pch_pcie_rp[CONFIG_MAX_PCH_ROOT_PORTS];
126 struct pcie_rp_config cpu_pcie_rp[CONFIG_MAX_CPU_ROOT_PORTS];
127 uint8_t pcie_clk_config_flag[CONFIG_MAX_PCIE_CLOCK_SRC];
Subrata Banik292afef2020-09-09 13:34:18 +0530128
Subrata Banik292afef2020-09-09 13:34:18 +0530129 /* Gfx related */
130 enum {
131 IGD_SM_0MB = 0x00,
132 IGD_SM_32MB = 0x01,
133 IGD_SM_64MB = 0x02,
134 IGD_SM_96MB = 0x03,
135 IGD_SM_128MB = 0x04,
136 IGD_SM_160MB = 0x05,
137 IGD_SM_4MB = 0xF0,
138 IGD_SM_8MB = 0xF1,
139 IGD_SM_12MB = 0xF2,
140 IGD_SM_16MB = 0xF3,
141 IGD_SM_20MB = 0xF4,
142 IGD_SM_24MB = 0xF5,
143 IGD_SM_28MB = 0xF6,
144 IGD_SM_36MB = 0xF8,
145 IGD_SM_40MB = 0xF9,
146 IGD_SM_44MB = 0xFA,
147 IGD_SM_48MB = 0xFB,
148 IGD_SM_52MB = 0xFC,
149 IGD_SM_56MB = 0xFD,
150 IGD_SM_60MB = 0xFE,
151 } IgdDvmt50PreAlloc;
152 uint8_t InternalGfx;
153 uint8_t SkipExtGfxScan;
154
Subrata Banik292afef2020-09-09 13:34:18 +0530155 /* HeciEnabled decides the state of Heci1 at end of boot
156 * Setting to 0 (default) disables Heci1 and hides the device from OS */
157 uint8_t HeciEnabled;
158 /* PL2 Override value in Watts */
159 uint32_t tdp_pl2_override;
Subrata Banik292afef2020-09-09 13:34:18 +0530160
161 /* Enable/Disable EIST. 1b:Enabled, 0b:Disabled */
162 uint8_t eist_enable;
163
164 /* Enable C6 DRAM */
165 uint8_t enable_c6dram;
166 /*
167 * PRMRR size setting with below options
168 * Disable: 0x0
169 * 32MB: 0x2000000
170 * 64MB: 0x4000000
171 * 128 MB: 0x8000000
172 * 256 MB: 0x10000000
173 * 512 MB: 0x20000000
174 */
175 uint32_t PrmrrSize;
176 uint8_t PmTimerDisabled;
177 /*
178 * SerialIO device mode selection:
179 * PchSerialIoDisabled,
180 * PchSerialIoPci,
181 * PchSerialIoHidden,
182 * PchSerialIoLegacyUart,
183 * PchSerialIoSkipInit
184 */
185 uint8_t SerialIoI2cMode[CONFIG_SOC_INTEL_I2C_DEV_MAX];
186 uint8_t SerialIoGSpiMode[CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX];
187 uint8_t SerialIoUartMode[CONFIG_SOC_INTEL_UART_DEV_MAX];
188 /*
189 * GSPIn Default Chip Select Mode:
190 * 0:Hardware Mode,
191 * 1:Software Mode
192 */
193 uint8_t SerialIoGSpiCsMode[CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX];
194 /*
195 * GSPIn Default Chip Select State:
196 * 0: Low,
197 * 1: High
198 */
199 uint8_t SerialIoGSpiCsState[CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX];
200
201 /* Debug interface selection */
202 enum {
203 DEBUG_INTERFACE_RAM = (1 << 0),
204 DEBUG_INTERFACE_UART_8250IO = (1 << 1),
205 DEBUG_INTERFACE_USB3 = (1 << 3),
206 DEBUG_INTERFACE_LPSS_SERIAL_IO = (1 << 4),
207 DEBUG_INTERFACE_TRACEHUB = (1 << 5),
208 } debug_interface_flag;
209
210 /* Enable Pch iSCLK */
211 uint8_t pch_isclk;
212
Cliff Huangbc1941f2021-02-10 17:41:41 -0800213 /* CNVi BT Core Enable/Disable */
214 bool CnviBtCore;
215
Subrata Banik292afef2020-09-09 13:34:18 +0530216 /* CNVi BT Audio Offload: Enable/Disable BT Audio Offload. */
Angel Pons98521c52021-03-01 21:16:49 +0100217 bool CnviBtAudioOffload;
Subrata Banik292afef2020-09-09 13:34:18 +0530218
219 /*
Subrata Banik2871e0e2020-09-27 11:30:58 +0530220 * IOM Port Config
221 * If a port orientation needs to be controlled by the SOC this setting must be
222 * updated to reflect the correct GPIOs being used for the SOC port flipping.
223 * There are 4 ports each with a pair of GPIOs for Pull Up and Pull Down
224 * 0,1 are pull up and pull down for port 0
225 * 2,3 are pull up and pull down for port 1
226 * 4,5 are pull up and pull down for port 2
227 * 6,7 are pull up and pull down for port 3
228 * values to be programmed correspond to the GPIO family and offsets
229 */
230 uint32_t IomTypeCPortPadCfg[8];
231
232 /*
Subrata Banik292afef2020-09-09 13:34:18 +0530233 * SOC Aux orientation override:
234 * This is a bitfield that corresponds to up to 4 TCSS ports on ADL.
235 * Even numbered bits (0, 2, 4, 6) control the retimer being handled by SOC.
236 * Odd numbered bits (1, 3, 5, 7) control the orientation of the physical aux lines
237 * on the motherboard.
238 */
239 uint16_t TcssAuxOri;
240
241 /* Connect Topology Command timeout value */
242 uint16_t ITbtConnectTopologyTimeoutInMs;
243
244 /*
245 * Override GPIO PM configuration:
246 * 0: Use FSP default GPIO PM program,
247 * 1: coreboot to override GPIO PM program
248 */
249 uint8_t gpio_override_pm;
250
251 /*
252 * GPIO PM configuration: 0 to disable, 1 to enable power gating
253 * Bit 6-7: Reserved
254 * Bit 5: MISCCFG_GPSIDEDPCGEN
255 * Bit 4: MISCCFG_GPRCOMPCDLCGEN
256 * Bit 3: MISCCFG_GPRTCDLCGEN
257 * Bit 2: MISCCFG_GSXLCGEN
258 * Bit 1: MISCCFG_GPDPCGEN
259 * Bit 0: MISCCFG_GPDLCGEN
260 */
261 uint8_t gpio_pm[TOTAL_GPIO_COMM];
262
263 /* DP config */
264 /*
265 * Port config
266 * 0:Disabled, 1:eDP, 2:MIPI DSI
267 */
268 uint8_t DdiPortAConfig;
269 uint8_t DdiPortBConfig;
270
271 /* Enable(1)/Disable(0) HPD */
272 uint8_t DdiPortAHpd;
273 uint8_t DdiPortBHpd;
274 uint8_t DdiPortCHpd;
275 uint8_t DdiPort1Hpd;
276 uint8_t DdiPort2Hpd;
277 uint8_t DdiPort3Hpd;
278 uint8_t DdiPort4Hpd;
279
280 /* Enable(1)/Disable(0) DDC */
281 uint8_t DdiPortADdc;
282 uint8_t DdiPortBDdc;
283 uint8_t DdiPortCDdc;
284 uint8_t DdiPort1Ddc;
285 uint8_t DdiPort2Ddc;
286 uint8_t DdiPort3Ddc;
287 uint8_t DdiPort4Ddc;
288
289 /* Hybrid storage mode enable (1) / disable (0)
290 * This mode makes FSP detect Optane and NVME and set PCIe lane mode
291 * accordingly */
292 uint8_t HybridStorageMode;
293
294 /*
295 * Override CPU flex ratio value:
296 * CPU ratio value controls the maximum processor non-turbo ratio.
297 * Valid Range 0 to 63.
298 *
299 * In general descriptor provides option to set default cpu flex ratio.
300 * Default cpu flex ratio is 0 ensures booting with non-turbo max frequency.
301 * That's the reason FSP skips cpu_ratio override if cpu_ratio is 0.
302 *
303 * Only override CPU flex ratio if don't want to boot with non-turbo max.
304 */
305 uint8_t cpu_ratio_override;
306
307 /*
308 * Enable(0)/Disable(1) DMI Power Optimizer on PCH side.
309 * Default 0. Setting this to 1 disables the DMI Power Optimizer.
310 */
311 uint8_t DmiPwrOptimizeDisable;
312
313 /*
314 * Enable(1)/Disable(0) CPU Replacement check.
315 * Default 0. Setting this to 1 to check CPU replacement.
316 */
317 uint8_t CpuReplacementCheck;
318
319 /* ISA Serial Base selection. */
320 enum {
321 ISA_SERIAL_BASE_ADDR_3F8,
322 ISA_SERIAL_BASE_ADDR_2F8,
323 } IsaSerialUartBase;
324};
325
326typedef struct soc_intel_alderlake_config config_t;
327
328#endif