blob: b6b61cda1334452fb5172d790d2bf4d0098bb109 [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>
Tim Crawfordc6529c72022-11-01 11:42:28 -06007#include <drivers/intel/gma/gma.h>
Sumeet Pawnikareaf87a92021-08-31 17:01:02 +05308#include <device/pci_ids.h>
Dinesh Gehlotd910fec2022-12-25 13:00:04 +00009#include <gpio.h>
Subrata Banik292afef2020-09-09 13:34:18 +053010#include <intelblocks/cfg.h>
Subrata Banik292afef2020-09-09 13:34:18 +053011#include <intelblocks/gspi.h>
Sumeet R Pawnikar77298c62021-03-10 21:09:37 +053012#include <intelblocks/power_limit.h>
Eric Laide2ab412021-01-11 16:14:14 +080013#include <intelblocks/pcie_rp.h>
Maulik V Vaghela69353502021-04-14 14:01:02 +053014#include <intelblocks/tcss.h>
Subrata Banik292afef2020-09-09 13:34:18 +053015#include <soc/gpe.h>
Subrata Banik292afef2020-09-09 13:34:18 +053016#include <soc/pci_devs.h>
17#include <soc/pmc.h>
Subrata Banik2871e0e2020-09-27 11:30:58 +053018#include <soc/serialio.h>
19#include <soc/usb.h>
V Sowmyac6d71662021-07-15 08:11:08 +053020#include <soc/vr_config.h>
Subrata Banik292afef2020-09-09 13:34:18 +053021#include <stdint.h>
22
Maximilian Brune2c984882022-10-24 20:31:18 +020023/* Define config parameters for In-Band ECC (IBECC). */
24#define MAX_IBECC_REGIONS 8
25
26/* In-Band ECC Operation Mode */
27enum ibecc_mode {
28 IBECC_MODE_PER_REGION,
29 IBECC_MODE_NONE,
30 IBECC_MODE_ALL
31};
32
33struct ibecc_config {
34 bool enable;
35 enum ibecc_mode mode;
36 bool range_enable[MAX_IBECC_REGIONS];
37 uint16_t range_base[MAX_IBECC_REGIONS];
38 uint16_t range_mask[MAX_IBECC_REGIONS];
39 /* add ECC error injection if needed by a mainboard */
40};
41
Sumeet Pawnikaraa496082021-05-07 20:11:53 +053042/* Types of different SKUs */
43enum soc_intel_alderlake_power_limits {
Curtis Chen150fee62021-12-21 11:51:33 +080044 ADL_P_142_242_282_15W_CORE,
Patrick Rudolphf7f7b3b2023-03-29 15:34:07 +020045 ADL_P_282_442_482_28W_CORE,
Sumeet Pawnikareaf87a92021-08-31 17:01:02 +053046 ADL_P_682_28W_CORE,
Curtis Chen150fee62021-12-21 11:51:33 +080047 ADL_P_442_482_45W_CORE,
48 ADL_P_642_682_45W_CORE,
Sumeet Pawnikar21c431b2021-09-30 10:04:41 +053049 ADL_M_282_12W_CORE,
50 ADL_M_282_15W_CORE,
Sumeet Pawnikareaf87a92021-08-31 17:01:02 +053051 ADL_M_242_CORE,
Curtis Chen0c544612021-11-19 11:38:12 +080052 ADL_P_442_45W_CORE,
Simon Yanga16ed342022-09-06 18:30:51 +080053 ADL_N_081_7W_CORE,
Vidya Gopalakrishnan596d5bc2022-05-18 20:17:40 +053054 ADL_N_081_15W_CORE,
55 ADL_N_041_6W_CORE,
56 ADL_N_021_6W_CORE,
Michał Kopeć75a49fe2022-04-08 11:28:45 +020057 ADL_S_882_35W_CORE,
58 ADL_S_882_65W_CORE,
59 ADL_S_882_125W_CORE,
Michał Żygowski82043f52022-07-21 18:11:14 +020060 ADL_S_882_150W_CORE,
Michał Kopeć75a49fe2022-04-08 11:28:45 +020061 ADL_S_842_35W_CORE,
62 ADL_S_842_65W_CORE,
63 ADL_S_842_125W_CORE,
64 ADL_S_642_125W_CORE,
65 ADL_S_602_35W_CORE,
66 ADL_S_602_65W_CORE,
Michał Żygowski82043f52022-07-21 18:11:14 +020067 ADL_S_402_60W_CORE,
68 ADL_S_402_58W_CORE,
69 ADL_S_402_35W_CORE,
70 ADL_S_202_46W_CORE,
71 ADL_S_202_35W_CORE,
Jeremy Compostella1b44c812022-06-17 15:18:02 -070072 RPL_P_682_642_482_45W_CORE,
73 RPL_P_682_482_282_28W_CORE,
74 RPL_P_282_242_142_15W_CORE,
Max Fritz573e6de2022-11-19 01:54:44 +010075 RPL_S_8161_35W_CORE,
76 RPL_S_8161_65W_CORE,
77 RPL_S_8161_95W_CORE,
78 RPL_S_8161_125W_CORE,
79 RPL_S_8161_150W_CORE,
80 RPL_S_881_35W_CORE,
81 RPL_S_881_65W_CORE,
82 RPL_S_881_125W_CORE,
83 RPL_S_681_35W_CORE,
84 RPL_S_681_65W_CORE,
85 RPL_S_681_125W_CORE,
86 RPL_S_641_35W_CORE,
87 RPL_S_641_65W_CORE,
88 RPL_S_641_125W_CORE,
89 RPL_S_801_80W_CORE,
90 RPL_S_801_95W_CORE,
91 RPL_S_401_35W_CORE,
92 RPL_S_401_58W_CORE,
93 RPL_S_401_60W_CORE,
94 RPL_S_401_65W_CORE,
95 RPL_S_201_35W_CORE,
96 RPL_S_201_46W_CORE,
97 RPL_S_201_65W_CORE,
Sumeet Pawnikaraa496082021-05-07 20:11:53 +053098 ADL_POWER_LIMITS_COUNT
99};
100
Sumeet Pawnikareaf87a92021-08-31 17:01:02 +0530101/* TDP values for different SKUs */
102enum soc_intel_alderlake_cpu_tdps {
Vidya Gopalakrishnan596d5bc2022-05-18 20:17:40 +0530103 TDP_6W = 6,
Simon Yanga16ed342022-09-06 18:30:51 +0800104 TDP_7W = 7,
Sumeet Pawnikareaf87a92021-08-31 17:01:02 +0530105 TDP_9W = 9,
Sumeet Pawnikar21c431b2021-09-30 10:04:41 +0530106 TDP_12W = 12,
Sumeet Pawnikareaf87a92021-08-31 17:01:02 +0530107 TDP_15W = 15,
108 TDP_28W = 28,
Michał Kopeć75a49fe2022-04-08 11:28:45 +0200109 TDP_35W = 35,
110 TDP_45W = 45,
Michał Żygowski82043f52022-07-21 18:11:14 +0200111 TDP_46W = 46,
112 TDP_58W = 58,
113 TDP_60W = 60,
Michał Kopeć75a49fe2022-04-08 11:28:45 +0200114 TDP_65W = 65,
Max Fritz573e6de2022-11-19 01:54:44 +0100115 TDP_80W = 80,
116 TDP_90W = 90,
117 TDP_95W = 95,
Michał Żygowski82043f52022-07-21 18:11:14 +0200118 TDP_125W = 125,
119 TDP_150W = 150
Sumeet Pawnikareaf87a92021-08-31 17:01:02 +0530120};
121
122/* Mapping of different SKUs based on CPU ID and TDP values */
123static const struct {
124 unsigned int cpu_id;
125 enum soc_intel_alderlake_power_limits limits;
126 enum soc_intel_alderlake_cpu_tdps cpu_tdp;
127} cpuid_to_adl[] = {
Felix Singer43b7f412022-03-07 04:34:52 +0100128 { PCI_DID_INTEL_ADL_P_ID_10, ADL_P_142_242_282_15W_CORE, TDP_15W },
129 { PCI_DID_INTEL_ADL_P_ID_7, ADL_P_142_242_282_15W_CORE, TDP_15W },
130 { PCI_DID_INTEL_ADL_P_ID_6, ADL_P_142_242_282_15W_CORE, TDP_15W },
Patrick Rudolphf7f7b3b2023-03-29 15:34:07 +0200131 { PCI_DID_INTEL_ADL_P_ID_7, ADL_P_282_442_482_28W_CORE, TDP_28W },
132 { PCI_DID_INTEL_ADL_P_ID_5, ADL_P_282_442_482_28W_CORE, TDP_28W },
Felix Singer43b7f412022-03-07 04:34:52 +0100133 { PCI_DID_INTEL_ADL_P_ID_3, ADL_P_682_28W_CORE, TDP_28W },
134 { PCI_DID_INTEL_ADL_P_ID_5, ADL_P_442_482_45W_CORE, TDP_45W },
135 { PCI_DID_INTEL_ADL_P_ID_4, ADL_P_642_682_45W_CORE, TDP_45W },
136 { PCI_DID_INTEL_ADL_P_ID_3, ADL_P_642_682_45W_CORE, TDP_45W },
137 { PCI_DID_INTEL_ADL_P_ID_1, ADL_P_442_482_45W_CORE, TDP_45W },
Patrick Rudolphf7f7b3b2023-03-29 15:34:07 +0200138 { PCI_DID_INTEL_ADL_P_ID_1, ADL_P_282_442_482_28W_CORE, TDP_28W },
Felix Singer43b7f412022-03-07 04:34:52 +0100139 { PCI_DID_INTEL_ADL_M_ID_1, ADL_M_282_12W_CORE, TDP_12W },
140 { PCI_DID_INTEL_ADL_M_ID_1, ADL_M_282_15W_CORE, TDP_15W },
141 { PCI_DID_INTEL_ADL_M_ID_2, ADL_M_242_CORE, TDP_9W },
Simon Yanga16ed342022-09-06 18:30:51 +0800142 { PCI_DID_INTEL_ADL_N_ID_1, ADL_N_081_7W_CORE, TDP_7W },
Vidya Gopalakrishnan596d5bc2022-05-18 20:17:40 +0530143 { PCI_DID_INTEL_ADL_N_ID_1, ADL_N_081_15W_CORE, TDP_15W },
144 { PCI_DID_INTEL_ADL_N_ID_2, ADL_N_041_6W_CORE, TDP_6W },
145 { PCI_DID_INTEL_ADL_N_ID_3, ADL_N_041_6W_CORE, TDP_6W },
146 { PCI_DID_INTEL_ADL_N_ID_4, ADL_N_021_6W_CORE, TDP_6W },
Michał Kopeć75a49fe2022-04-08 11:28:45 +0200147 { PCI_DID_INTEL_ADL_S_ID_1, ADL_S_882_35W_CORE, TDP_35W },
148 { PCI_DID_INTEL_ADL_S_ID_1, ADL_S_882_65W_CORE, TDP_65W },
149 { PCI_DID_INTEL_ADL_S_ID_1, ADL_S_882_125W_CORE, TDP_125W },
Michał Żygowski82043f52022-07-21 18:11:14 +0200150 { PCI_DID_INTEL_ADL_S_ID_1, ADL_S_882_150W_CORE, TDP_150W },
Michał Kopeć75a49fe2022-04-08 11:28:45 +0200151 { PCI_DID_INTEL_ADL_S_ID_3, ADL_S_842_35W_CORE, TDP_35W },
152 { PCI_DID_INTEL_ADL_S_ID_3, ADL_S_842_65W_CORE, TDP_65W },
153 { PCI_DID_INTEL_ADL_S_ID_3, ADL_S_842_125W_CORE, TDP_125W },
154 { PCI_DID_INTEL_ADL_S_ID_8, ADL_S_642_125W_CORE, TDP_125W },
155 { PCI_DID_INTEL_ADL_S_ID_10, ADL_S_602_35W_CORE, TDP_35W },
156 { PCI_DID_INTEL_ADL_S_ID_10, ADL_S_602_65W_CORE, TDP_65W },
Michał Żygowski82043f52022-07-21 18:11:14 +0200157 { PCI_DID_INTEL_ADL_S_ID_11, ADL_S_402_35W_CORE, TDP_35W },
158 { PCI_DID_INTEL_ADL_S_ID_11, ADL_S_402_58W_CORE, TDP_58W },
159 { PCI_DID_INTEL_ADL_S_ID_11, ADL_S_402_60W_CORE, TDP_60W },
160 { PCI_DID_INTEL_ADL_S_ID_12, ADL_S_202_35W_CORE, TDP_35W },
161 { PCI_DID_INTEL_ADL_S_ID_12, ADL_S_202_46W_CORE, TDP_46W },
Jeremy Compostella1b44c812022-06-17 15:18:02 -0700162 { PCI_DID_INTEL_RPL_P_ID_1, RPL_P_682_642_482_45W_CORE, TDP_45W },
Jeremy Compostella8c127ec2023-02-02 16:53:50 -0700163 { PCI_DID_INTEL_RPL_P_ID_1, RPL_P_682_482_282_28W_CORE, TDP_28W },
Jeremy Compostella1b44c812022-06-17 15:18:02 -0700164 { PCI_DID_INTEL_RPL_P_ID_2, RPL_P_682_482_282_28W_CORE, TDP_28W },
165 { PCI_DID_INTEL_RPL_P_ID_3, RPL_P_282_242_142_15W_CORE, TDP_15W },
Lawrence Chang0a5da512022-10-19 14:38:41 +0800166 { PCI_DID_INTEL_RPL_P_ID_4, RPL_P_282_242_142_15W_CORE, TDP_15W },
Marx Wang39ede0a2022-12-20 10:48:33 +0800167 { PCI_DID_INTEL_RPL_P_ID_5, RPL_P_282_242_142_15W_CORE, TDP_15W },
Max Fritz573e6de2022-11-19 01:54:44 +0100168 { PCI_DID_INTEL_RPL_S_ID_1, RPL_S_8161_35W_CORE, TDP_35W },
169 { PCI_DID_INTEL_RPL_S_ID_1, RPL_S_8161_65W_CORE, TDP_65W },
170 { PCI_DID_INTEL_RPL_S_ID_1, RPL_S_8161_95W_CORE, TDP_95W },
171 { PCI_DID_INTEL_RPL_S_ID_1, RPL_S_8161_125W_CORE, TDP_125W },
172 { PCI_DID_INTEL_RPL_S_ID_1, RPL_S_8161_150W_CORE, TDP_150W },
173 { PCI_DID_INTEL_RPL_S_ID_3, RPL_S_881_35W_CORE, TDP_35W },
174 { PCI_DID_INTEL_RPL_S_ID_3, RPL_S_881_65W_CORE, TDP_65W },
175 { PCI_DID_INTEL_RPL_S_ID_3, RPL_S_881_125W_CORE, TDP_125W },
176 { PCI_DID_INTEL_RPL_S_ID_4, RPL_S_681_35W_CORE, TDP_35W },
177 { PCI_DID_INTEL_RPL_S_ID_4, RPL_S_681_65W_CORE, TDP_65W },
178 { PCI_DID_INTEL_RPL_S_ID_4, RPL_S_681_125W_CORE, TDP_125W },
179 { PCI_DID_INTEL_RPL_S_ID_5, RPL_S_641_35W_CORE, TDP_35W },
180 { PCI_DID_INTEL_RPL_S_ID_5, RPL_S_641_65W_CORE, TDP_65W },
181 { PCI_DID_INTEL_RPL_S_ID_5, RPL_S_641_125W_CORE, TDP_125W },
182 { PCI_DID_INTEL_RPL_S_ID_2, RPL_S_801_80W_CORE, TDP_80W },
183 { PCI_DID_INTEL_RPL_S_ID_2, RPL_S_801_95W_CORE, TDP_90W },
184 { PCI_DID_INTEL_ADL_S_ID_11, RPL_S_401_35W_CORE, TDP_35W },
185 { PCI_DID_INTEL_ADL_S_ID_11, RPL_S_401_58W_CORE, TDP_58W },
186 { PCI_DID_INTEL_ADL_S_ID_11, RPL_S_401_60W_CORE, TDP_60W },
187 { PCI_DID_INTEL_ADL_S_ID_11, RPL_S_401_65W_CORE, TDP_65W },
188 { PCI_DID_INTEL_ADL_S_ID_12, RPL_S_201_35W_CORE, TDP_35W },
189 { PCI_DID_INTEL_ADL_S_ID_12, RPL_S_201_46W_CORE, TDP_46W },
190 { PCI_DID_INTEL_ADL_S_ID_12, RPL_S_201_65W_CORE, TDP_65W },
Sumeet Pawnikareaf87a92021-08-31 17:01:02 +0530191};
192
Subrata Banik8a18bd82021-06-09 21:57:49 +0530193/* Types of display ports */
194enum ddi_ports {
195 DDI_PORT_A,
196 DDI_PORT_B,
197 DDI_PORT_C,
198 DDI_PORT_1,
199 DDI_PORT_2,
200 DDI_PORT_3,
201 DDI_PORT_4,
202 DDI_PORT_COUNT,
203};
204
205enum ddi_port_flags {
Maximilian Brune27900ea2023-01-04 19:22:35 +0100206 DDI_ENABLE_DDC = 1 << 0, // Display Data Channel
207 DDI_ENABLE_HPD = 1 << 1, // Hot Plug Detect
Subrata Banik8a18bd82021-06-09 21:57:49 +0530208};
209
V Sowmya418d37e2021-06-21 08:47:17 +0530210/*
211 * Enable External V1P05/Vnn/VnnSx Rail in: BIT0:S0i1/S0i2,
V Sowmyaee449452022-04-08 14:36:13 +0530212 * BIT1:S0i3, BIT2:S3, BIT3:S4, BIT4:S5, BIT5:S0.
V Sowmya418d37e2021-06-21 08:47:17 +0530213 */
214enum fivr_enable_states {
215 FIVR_ENABLE_S0i1_S0i2 = BIT(0),
216 FIVR_ENABLE_S0i3 = BIT(1),
217 FIVR_ENABLE_S3 = BIT(2),
218 FIVR_ENABLE_S4 = BIT(3),
219 FIVR_ENABLE_S5 = BIT(4),
V Sowmyaee449452022-04-08 14:36:13 +0530220 FIVR_ENABLE_S0 = BIT(5),
V Sowmya418d37e2021-06-21 08:47:17 +0530221};
222
223/*
224 * Enable the following for External V1p05 rail
225 * BIT0: Retention active switch support
226 * BIT1: Normal Active voltage supported
227 * BIT2: Minimum active voltage supported
228 * BIT3: Minimum Retention voltage supported
229 */
230enum fivr_voltage_supported {
231 FIVR_RET_ACTIVE_SWITCH_SUPPORT = BIT(0),
232 FIVR_VOLTAGE_NORMAL = BIT(1),
233 FIVR_VOLTAGE_MIN_ACTIVE = BIT(2),
234 FIVR_VOLTAGE_MIN_RETENTION = BIT(3),
235};
236
237#define FIVR_ENABLE_ALL_SX (FIVR_ENABLE_S0i1_S0i2 | FIVR_ENABLE_S0i3 | \
V Sowmyaee449452022-04-08 14:36:13 +0530238 FIVR_ENABLE_S3 | FIVR_ENABLE_S4 | FIVR_ENABLE_S5 | FIVR_ENABLE_S0)
V Sowmyaaf429062021-06-21 10:23:33 +0530239/*
240 * The Max Pkg Cstate
241 * Values 0 - C0/C1, 1 - C2, 2 - C3, 3 - C6, 4 - C7, 5 - C7S, 6 - C8, 7 - C9, 8 - C10,
242 * 254 - CPU Default , 255 - Auto.
243 */
244enum pkgcstate_limit {
245 LIMIT_C0_C1 = 0,
246 LIMIT_C2 = 1,
247 LIMIT_C3 = 2,
248 LIMIT_C6 = 3,
249 LIMIT_C7 = 4,
250 LIMIT_C7S = 5,
251 LIMIT_C8 = 6,
252 LIMIT_C9 = 7,
253 LIMIT_C10 = 8,
254 LIMIT_CPUDEFAULT = 254,
255 LIMIT_AUTO = 255,
256};
V Sowmya418d37e2021-06-21 08:47:17 +0530257
Tim Wawrzynczake2b8f302021-07-19 15:35:47 -0600258/* Bit values for use in LpmStateEnableMask. */
259enum lpm_state_mask {
260 LPM_S0i2_0 = BIT(0),
261 LPM_S0i2_1 = BIT(1),
262 LPM_S0i2_2 = BIT(2),
263 LPM_S0i3_0 = BIT(3),
264 LPM_S0i3_1 = BIT(4),
265 LPM_S0i3_2 = BIT(5),
266 LPM_S0i3_3 = BIT(6),
267 LPM_S0i3_4 = BIT(7),
268 LPM_S0iX_ALL = LPM_S0i2_0 | LPM_S0i2_1 | LPM_S0i2_2
269 | LPM_S0i3_0 | LPM_S0i3_1 | LPM_S0i3_2 | LPM_S0i3_3 | LPM_S0i3_4,
270};
271
Wisley Chend0cef2a2021-11-01 16:13:55 +0600272/*
273 * FivrSpreadSpectrum:
274 * Values
275 * 0 - 0.5%, 3 - 1%, 8 - 1.5%, 18 - 2%, 28 - 3%, 34 - 4%, 39 - 5%, 44 - 6%
276 */
277enum fivr_spread_spectrum_ratio {
278 FIVR_SS_0_5 = 0,
279 FIVR_SS_1 = 3,
280 FIVR_SS_1_5 = 8,
281 FIVR_SS_2 = 18,
282 FIVR_SS_3 = 28,
283 FIVR_SS_4 = 34,
284 FIVR_SS_5 = 39,
285 FIVR_SS_6 = 44,
286};
287
Wisley Chenc5103462021-11-04 18:12:58 +0600288/*
289 * Slew Rate configuration for Deep Package C States for VR domain.
290 * They are fast time divided by 2.
291 * 0 - Fast/2
292 * 1 - Fast/4
293 * 2 - Fast/8
294 * 3 - Fast/16
295 */
296enum slew_rate {
297 SLEW_FAST_2,
298 SLEW_FAST_4,
299 SLEW_FAST_8,
300 SLEW_FAST_16
301};
302
Subrata Banik292afef2020-09-09 13:34:18 +0530303struct soc_intel_alderlake_config {
304
305 /* Common struct containing soc config data required by common code */
306 struct soc_intel_common_config common_soc_config;
307
Sumeet R Pawnikar77298c62021-03-10 21:09:37 +0530308 /* Common struct containing power limits configuration information */
Sumeet Pawnikaraa496082021-05-07 20:11:53 +0530309 struct soc_power_limits_config power_limits_config[ADL_POWER_LIMITS_COUNT];
Sumeet R Pawnikar77298c62021-03-10 21:09:37 +0530310
Subrata Banik292afef2020-09-09 13:34:18 +0530311 /* Gpio group routed to each dword of the GPE0 block. Values are
312 * of the form PMC_GPP_[A:U] or GPD. */
313 uint8_t pmc_gpe0_dw0; /* GPE0_31_0 STS/EN */
314 uint8_t pmc_gpe0_dw1; /* GPE0_63_32 STS/EN */
315 uint8_t pmc_gpe0_dw2; /* GPE0_95_64 STS/EN */
316
317 /* Generic IO decode ranges */
318 uint32_t gen1_dec;
319 uint32_t gen2_dec;
320 uint32_t gen3_dec;
321 uint32_t gen4_dec;
322
323 /* Enable S0iX support */
324 int s0ix_enable;
325 /* Support for TCSS xhci, xdci, TBT PCIe root ports and DMA controllers */
MAULIK V VAGHELA215a97e2022-03-07 18:39:17 +0530326 uint8_t tcss_d3_hot_disable;
Subrata Banik292afef2020-09-09 13:34:18 +0530327 /* Enable DPTF support */
328 int dptf_enable;
329
330 /* Deep SX enable for both AC and DC */
331 int deep_s3_enable_ac;
332 int deep_s3_enable_dc;
333 int deep_s5_enable_ac;
334 int deep_s5_enable_dc;
335
336 /* Deep Sx Configuration
337 * DSX_EN_WAKE_PIN - Enable WAKE# pin
338 * DSX_EN_LAN_WAKE_PIN - Enable LAN_WAKE# pin
339 * DSX_DIS_AC_PRESENT_PD - Disable pull-down on AC_PRESENT pin */
340 uint32_t deep_sx_config;
341
342 /* TCC activation offset */
343 uint32_t tcc_offset;
344
Maximilian Brune2c984882022-10-24 20:31:18 +0200345 /* In-Band ECC (IBECC) configuration */
346 struct ibecc_config ibecc;
347
Subrata Banik292afef2020-09-09 13:34:18 +0530348 /* System Agent dynamic frequency support. Only effects ULX/ULT CPUs.
349 * When enabled memory will be training at two different frequencies.
350 * 0:Disabled, 1:FixedPoint0, 2:FixedPoint1, 3:FixedPoint2,
351 * 4:FixedPoint3, 5:Enabled */
352 enum {
353 SaGv_Disabled,
354 SaGv_FixedPoint0,
355 SaGv_FixedPoint1,
356 SaGv_FixedPoint2,
357 SaGv_FixedPoint3,
358 SaGv_Enabled,
MAULIK V VAGHELA215a97e2022-03-07 18:39:17 +0530359 } sagv;
Subrata Banik292afef2020-09-09 13:34:18 +0530360
361 /* Rank Margin Tool. 1:Enable, 0:Disable */
362 uint8_t RMT;
363
364 /* USB related */
365 struct usb2_port_config usb2_ports[16];
366 struct usb3_port_config usb3_ports[10];
367 /* Wake Enable Bitmap for USB2 ports */
368 uint16_t usb2_wake_enable_bitmap;
369 /* Wake Enable Bitmap for USB3 ports */
370 uint16_t usb3_wake_enable_bitmap;
Maulik V Vaghela69353502021-04-14 14:01:02 +0530371 /* Program OC pins for TCSS */
372 struct tcss_port_config tcss_ports[MAX_TYPE_C_PORTS];
Subrata Banik292afef2020-09-09 13:34:18 +0530373
374 /* SATA related */
MAULIK V VAGHELA215a97e2022-03-07 18:39:17 +0530375 uint8_t sata_mode;
376 uint8_t sata_salp_support;
377 uint8_t sata_ports_enable[8];
378 uint8_t sata_ports_dev_slp[8];
Subrata Banik292afef2020-09-09 13:34:18 +0530379
380 /*
381 * Enable(0)/Disable(1) SATA Power Optimizer on PCH side.
382 * Default 0. Setting this to 1 disables the SATA Power Optimizer.
383 */
MAULIK V VAGHELA215a97e2022-03-07 18:39:17 +0530384 uint8_t sata_pwr_optimize_disable;
Subrata Banik292afef2020-09-09 13:34:18 +0530385
386 /*
387 * SATA Port Enable Dito Config.
388 * Enable DEVSLP Idle Timeout settings (DmVal, DitoVal).
389 */
MAULIK V VAGHELA215a97e2022-03-07 18:39:17 +0530390 uint8_t sata_ports_enable_dito_config[8];
Subrata Banik292afef2020-09-09 13:34:18 +0530391
392 /* SataPortsDmVal is the DITO multiplier. Default is 15. */
MAULIK V VAGHELA215a97e2022-03-07 18:39:17 +0530393 uint8_t sata_ports_dm_val[8];
394
Subrata Banik292afef2020-09-09 13:34:18 +0530395 /* SataPortsDitoVal is the DEVSLP Idle Timeout, default is 625ms */
MAULIK V VAGHELA215a97e2022-03-07 18:39:17 +0530396 uint16_t sata_ports_dito_val[8];
Subrata Banik292afef2020-09-09 13:34:18 +0530397
398 /* Audio related */
Sean Rhodes7bfc2562023-01-06 10:50:53 +0000399 uint8_t pch_hda_audio_link_hda_enable;
MAULIK V VAGHELA215a97e2022-03-07 18:39:17 +0530400 uint8_t pch_hda_dsp_enable;
Sugnan Prabhu S50f8b4e2021-03-18 22:08:22 +0530401
402 /* iDisp-Link T-Mode 0: 2T, 2: 4T, 3: 8T, 4: 16T */
403 enum {
404 HDA_TMODE_2T = 0,
405 HDA_TMODE_4T = 2,
406 HDA_TMODE_8T = 3,
407 HDA_TMODE_16T = 4,
MAULIK V VAGHELA215a97e2022-03-07 18:39:17 +0530408 } pch_hda_idisp_link_tmode;
Sugnan Prabhu S50f8b4e2021-03-18 22:08:22 +0530409
410 /* iDisp-Link Freq 4: 96MHz, 3: 48MHz. */
411 enum {
412 HDA_LINKFREQ_48MHZ = 3,
413 HDA_LINKFREQ_96MHZ = 4,
MAULIK V VAGHELA215a97e2022-03-07 18:39:17 +0530414 } pch_hda_idisp_link_frequency;
Sugnan Prabhu S50f8b4e2021-03-18 22:08:22 +0530415
MAULIK V VAGHELA215a97e2022-03-07 18:39:17 +0530416 bool pch_hda_idisp_codec_enable;
Subrata Banik292afef2020-09-09 13:34:18 +0530417
Eric Lai5b302b22020-12-05 16:49:43 +0800418 struct pcie_rp_config pch_pcie_rp[CONFIG_MAX_PCH_ROOT_PORTS];
419 struct pcie_rp_config cpu_pcie_rp[CONFIG_MAX_CPU_ROOT_PORTS];
420 uint8_t pcie_clk_config_flag[CONFIG_MAX_PCIE_CLOCK_SRC];
Subrata Banik292afef2020-09-09 13:34:18 +0530421
Subrata Banik292afef2020-09-09 13:34:18 +0530422 /* Gfx related */
423 enum {
424 IGD_SM_0MB = 0x00,
425 IGD_SM_32MB = 0x01,
426 IGD_SM_64MB = 0x02,
427 IGD_SM_96MB = 0x03,
428 IGD_SM_128MB = 0x04,
429 IGD_SM_160MB = 0x05,
430 IGD_SM_4MB = 0xF0,
431 IGD_SM_8MB = 0xF1,
432 IGD_SM_12MB = 0xF2,
433 IGD_SM_16MB = 0xF3,
434 IGD_SM_20MB = 0xF4,
435 IGD_SM_24MB = 0xF5,
436 IGD_SM_28MB = 0xF6,
437 IGD_SM_36MB = 0xF8,
438 IGD_SM_40MB = 0xF9,
439 IGD_SM_44MB = 0xFA,
440 IGD_SM_48MB = 0xFB,
441 IGD_SM_52MB = 0xFC,
442 IGD_SM_56MB = 0xFD,
443 IGD_SM_60MB = 0xFE,
MAULIK V VAGHELA215a97e2022-03-07 18:39:17 +0530444 } igd_dvmt50_pre_alloc;
445 uint8_t skip_ext_gfx_scan;
Subrata Banik292afef2020-09-09 13:34:18 +0530446
Subrata Banik292afef2020-09-09 13:34:18 +0530447 /* Enable/Disable EIST. 1b:Enabled, 0b:Disabled */
448 uint8_t eist_enable;
449
450 /* Enable C6 DRAM */
451 uint8_t enable_c6dram;
Michael Niewöhnerd2fadda2021-09-27 19:26:20 +0200452
Subrata Banik292afef2020-09-09 13:34:18 +0530453 /*
454 * SerialIO device mode selection:
455 * PchSerialIoDisabled,
456 * PchSerialIoPci,
457 * PchSerialIoHidden,
458 * PchSerialIoLegacyUart,
459 * PchSerialIoSkipInit
460 */
MAULIK V VAGHELA215a97e2022-03-07 18:39:17 +0530461 uint8_t serial_io_i2c_mode[CONFIG_SOC_INTEL_I2C_DEV_MAX];
462 uint8_t serial_io_gspi_mode[CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX];
463 uint8_t serial_io_uart_mode[CONFIG_SOC_INTEL_UART_DEV_MAX];
Subrata Banik292afef2020-09-09 13:34:18 +0530464 /*
465 * GSPIn Default Chip Select Mode:
466 * 0:Hardware Mode,
467 * 1:Software Mode
468 */
MAULIK V VAGHELA215a97e2022-03-07 18:39:17 +0530469 uint8_t serial_io_gspi_cs_mode[CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX];
Subrata Banik292afef2020-09-09 13:34:18 +0530470 /*
471 * GSPIn Default Chip Select State:
472 * 0: Low,
473 * 1: High
474 */
MAULIK V VAGHELA215a97e2022-03-07 18:39:17 +0530475 uint8_t serial_io_gspi_cs_state[CONFIG_SOC_INTEL_COMMON_BLOCK_GSPI_MAX];
Subrata Banik292afef2020-09-09 13:34:18 +0530476
Subrata Banik292afef2020-09-09 13:34:18 +0530477 /* Enable Pch iSCLK */
478 uint8_t pch_isclk;
479
Cliff Huangbc1941f2021-02-10 17:41:41 -0800480 /* CNVi BT Core Enable/Disable */
MAULIK V VAGHELA215a97e2022-03-07 18:39:17 +0530481 bool cnvi_bt_core;
Cliff Huangbc1941f2021-02-10 17:41:41 -0800482
Subrata Banik292afef2020-09-09 13:34:18 +0530483 /* CNVi BT Audio Offload: Enable/Disable BT Audio Offload. */
MAULIK V VAGHELA215a97e2022-03-07 18:39:17 +0530484 bool cnvi_bt_audio_offload;
Subrata Banik292afef2020-09-09 13:34:18 +0530485
486 /*
Deepti Deshatty8e7facf2021-05-12 17:45:37 +0530487 * These GPIOs will be programmed by the IOM to handle biasing of the
488 * Type-C aux (SBU) signals when certain alternate modes are used.
489 * `pad_auxn_dc` should be assigned to the GPIO pad providing negative
490 * bias (name usually contains `AUXN_DC` or `AUX_N`); similarly,
491 * `pad_auxp_dc` should be assigned to the GPIO providing positive bias
492 * (name often contains `AUXP_DC` or `_AUX_P`).
Subrata Banik2871e0e2020-09-27 11:30:58 +0530493 */
Deepti Deshatty8e7facf2021-05-12 17:45:37 +0530494 struct typec_aux_bias_pads typec_aux_bias_pads[MAX_TYPE_C_PORTS];
Subrata Banik2871e0e2020-09-27 11:30:58 +0530495
496 /*
Subrata Banik292afef2020-09-09 13:34:18 +0530497 * SOC Aux orientation override:
498 * This is a bitfield that corresponds to up to 4 TCSS ports on ADL.
499 * Even numbered bits (0, 2, 4, 6) control the retimer being handled by SOC.
500 * Odd numbered bits (1, 3, 5, 7) control the orientation of the physical aux lines
501 * on the motherboard.
502 */
MAULIK V VAGHELA215a97e2022-03-07 18:39:17 +0530503 uint16_t tcss_aux_ori;
Subrata Banik292afef2020-09-09 13:34:18 +0530504
505 /*
506 * Override GPIO PM configuration:
507 * 0: Use FSP default GPIO PM program,
508 * 1: coreboot to override GPIO PM program
509 */
510 uint8_t gpio_override_pm;
511
512 /*
513 * GPIO PM configuration: 0 to disable, 1 to enable power gating
514 * Bit 6-7: Reserved
515 * Bit 5: MISCCFG_GPSIDEDPCGEN
516 * Bit 4: MISCCFG_GPRCOMPCDLCGEN
517 * Bit 3: MISCCFG_GPRTCDLCGEN
518 * Bit 2: MISCCFG_GSXLCGEN
519 * Bit 1: MISCCFG_GPDPCGEN
520 * Bit 0: MISCCFG_GPDLCGEN
521 */
522 uint8_t gpio_pm[TOTAL_GPIO_COMM];
523
524 /* DP config */
525 /*
526 * Port config
527 * 0:Disabled, 1:eDP, 2:MIPI DSI
528 */
MAULIK V VAGHELA215a97e2022-03-07 18:39:17 +0530529 uint8_t ddi_portA_config;
530 uint8_t ddi_portB_config;
Subrata Banik292afef2020-09-09 13:34:18 +0530531
Subrata Banik8a18bd82021-06-09 21:57:49 +0530532 /* Enable(1)/Disable(0) HPD/DDC */
533 uint8_t ddi_ports_config[DDI_PORT_COUNT];
Subrata Banik292afef2020-09-09 13:34:18 +0530534
535 /* Hybrid storage mode enable (1) / disable (0)
536 * This mode makes FSP detect Optane and NVME and set PCIe lane mode
537 * accordingly */
MAULIK V VAGHELA215a97e2022-03-07 18:39:17 +0530538 uint8_t hybrid_storage_mode;
Subrata Banik292afef2020-09-09 13:34:18 +0530539
Krishna Prasad Bhata6d642f2022-01-16 23:16:24 +0530540#if CONFIG(SOC_INTEL_ALDERLAKE_PCH_N)
541 /* eMMC HS400 mode */
542 uint8_t emmc_enable_hs400_mode;
543#endif
544
Subrata Banik292afef2020-09-09 13:34:18 +0530545 /*
546 * Override CPU flex ratio value:
547 * CPU ratio value controls the maximum processor non-turbo ratio.
548 * Valid Range 0 to 63.
549 *
550 * In general descriptor provides option to set default cpu flex ratio.
551 * Default cpu flex ratio is 0 ensures booting with non-turbo max frequency.
552 * That's the reason FSP skips cpu_ratio override if cpu_ratio is 0.
553 *
554 * Only override CPU flex ratio if don't want to boot with non-turbo max.
555 */
556 uint8_t cpu_ratio_override;
557
558 /*
559 * Enable(0)/Disable(1) DMI Power Optimizer on PCH side.
560 * Default 0. Setting this to 1 disables the DMI Power Optimizer.
561 */
MAULIK V VAGHELA215a97e2022-03-07 18:39:17 +0530562 uint8_t dmi_power_optimize_disable;
Subrata Banik292afef2020-09-09 13:34:18 +0530563
564 /*
Lean Sheng Tan4b45d4c2022-04-01 19:01:59 +0200565 * Used to communicate the power delivery design capability of the board. This
566 * value is an enum of the available power delivery segments that are defined in
567 * the Platform Design Guide.
568 */
569 uint8_t vr_power_delivery_design;
570
571 /*
Subrata Banik292afef2020-09-09 13:34:18 +0530572 * Enable(1)/Disable(0) CPU Replacement check.
573 * Default 0. Setting this to 1 to check CPU replacement.
574 */
MAULIK V VAGHELA215a97e2022-03-07 18:39:17 +0530575 uint8_t cpu_replacement_check;
Subrata Banik292afef2020-09-09 13:34:18 +0530576
577 /* ISA Serial Base selection. */
578 enum {
579 ISA_SERIAL_BASE_ADDR_3F8,
580 ISA_SERIAL_BASE_ADDR_2F8,
MAULIK V VAGHELA215a97e2022-03-07 18:39:17 +0530581 } isa_serial_uart_base;
V Sowmya418d37e2021-06-21 08:47:17 +0530582
583 /* structure containing various settings for PCH FIVRs */
584 struct {
585 bool configure_ext_fivr;
586 enum fivr_enable_states v1p05_enable_bitmap;
587 enum fivr_enable_states vnn_enable_bitmap;
588 enum fivr_enable_states vnn_sx_enable_bitmap;
589 enum fivr_voltage_supported v1p05_supported_voltage_bitmap;
590 enum fivr_voltage_supported vnn_supported_voltage_bitmap;
591 /* V1p05 Rail Voltage in mv */
592 int v1p05_voltage_mv;
593 /* Vnn Rail Voltage in mv */
594 int vnn_voltage_mv;
595 /* VnnSx Rail Voltage in mv */
596 int vnn_sx_voltage_mv;
597 /* External Icc Max for V1p05 rail in mA */
598 int v1p05_icc_max_ma;
599 /* External Icc Max for VnnSx rail in mA */
600 int vnn_icc_max_ma;
601 } ext_fivr_settings;
V Sowmyac6d71662021-07-15 08:11:08 +0530602
603 /* VrConfig Settings.
604 * 0 = VR_DOMAIN_IA Core 1 = VR_DOMAIN_GT.
605 */
606 struct vr_config domain_vr_config[NUM_VR_DOMAINS];
Casper Chang8fcefd32021-09-22 22:35:54 -0400607
Scott Chaoab638c12022-04-20 15:16:06 +0800608 uint16_t max_dram_speed_mts;
Tim Wawrzynczakab0e0812021-09-21 10:28:16 -0600609
610 enum {
611 SLP_S3_ASSERTION_DEFAULT,
612 SLP_S3_ASSERTION_60_US,
613 SLP_S3_ASSERTION_1_MS,
614 SLP_S3_ASSERTION_50_MS,
615 SLP_S3_ASSERTION_2_S,
616 } pch_slp_s3_min_assertion_width;
617
618 enum {
619 SLP_S4_ASSERTION_DEFAULT,
620 SLP_S4_ASSERTION_1S,
621 SLP_S4_ASSERTION_2S,
622 SLP_S4_ASSERTION_3S,
623 SLP_S4_ASSERTION_4S,
624 } pch_slp_s4_min_assertion_width;
625
626 enum {
627 SLP_SUS_ASSERTION_DEFAULT,
628 SLP_SUS_ASSERTION_0_MS,
629 SLP_SUS_ASSERTION_500_MS,
630 SLP_SUS_ASSERTION_1_S,
631 SLP_SUS_ASSERTION_4_S,
632 } pch_slp_sus_min_assertion_width;
633
634 enum {
635 SLP_A_ASSERTION_DEFAULT,
636 SLP_A_ASSERTION_0_MS,
637 SLP_A_ASSERTION_4_S,
638 SLP_A_ASSERTION_98_MS,
639 SLP_A_ASSERTION_2_S,
640 } pch_slp_a_min_assertion_width;
641
642 /*
643 * PCH PM Reset Power Cycle Duration
644 * NOTE: Duration programmed in the PchPmPwrCycDur should never be smaller than the
645 * stretch duration programmed in the following registers:
646 * - GEN_PMCON_A.SLP_S3_MIN_ASST_WDTH (PchPmSlpS3MinAssert)
647 * - GEN_PMCON_A.S4MAW (PchPmSlpS4MinAssert)
648 * - PM_CFG.SLP_A_MIN_ASST_WDTH (PchPmSlpAMinAssert)
649 * - PM_CFG.SLP_LAN_MIN_ASST_WDTH
650 */
651 enum {
652 POWER_CYCLE_DURATION_DEFAULT,
653 POWER_CYCLE_DURATION_1S,
654 POWER_CYCLE_DURATION_2S,
655 POWER_CYCLE_DURATION_3S,
656 POWER_CYCLE_DURATION_4S,
657 } pch_reset_power_cycle_duration;
Ryan Lin4a48dbe2021-09-28 15:59:34 +0800658
659 /* Platform Power Pmax */
MAULIK V VAGHELA215a97e2022-03-07 18:39:17 +0530660 uint16_t platform_pmax;
Wisley Chend0cef2a2021-11-01 16:13:55 +0600661 /*
662 * FivrRfiFrequency
663 * PCODE MMIO Mailbox: Set the desired RFI frequency, in increments of 100KHz.
664 * 0: Auto
665 * Range varies based on XTAL clock:
666 * 0-1918*100 KHz (Up to 191.8MHz) for 24MHz clock
667 * 0-1535*100 KHz (Up to 153.5MHz) for 19MHz clock
668 */
MAULIK V VAGHELA215a97e2022-03-07 18:39:17 +0530669 uint32_t fivr_rfi_frequency;
Wisley Chend0cef2a2021-11-01 16:13:55 +0600670 /*
671 * FivrSpreadSpectrum
672 * Set the Spread Spectrum Range.
673 * Range: 0.5%, 1%, 1.5%, 2%, 3%, 4%, 5%, 6%.
674 * Each Range is translated to an encoded value for FIVR register.
675 * 0.5% = 0, 1% = 3, 1.5% = 8, 2% = 18, 3% = 28, 4% = 34, 5% = 39, 6% = 44.
676 */
MAULIK V VAGHELA215a97e2022-03-07 18:39:17 +0530677 uint8_t fivr_spread_spectrum;
Wisley Chenc5103462021-11-04 18:12:58 +0600678 /* Enable or Disable Acoustic Noise Mitigation feature */
MAULIK V VAGHELA215a97e2022-03-07 18:39:17 +0530679 uint8_t acoustic_noise_mitigation;
leo.chouaef916a2022-05-13 10:41:03 +0800680 /*
681 * Acoustic Noise Mitigation Range. Defines the maximum Pre-Wake
682 * randomization time in micro ticks. This can be programmed only
683 * if AcousticNoiseMitigation is enabled.
684 * Range 0-255
685 */
686 uint8_t PreWake;
Wisley Chenc5103462021-11-04 18:12:58 +0600687 /* Disable Fast Slew Rate for Deep Package C States for VR domains */
MAULIK V VAGHELA215a97e2022-03-07 18:39:17 +0530688 uint8_t fast_pkg_c_ramp_disable[NUM_VR_DOMAINS];
Wisley Chenc5103462021-11-04 18:12:58 +0600689 /*
690 * Slew Rate configuration for Deep Package C States for VR domains
691 * 0: Fast/2, 1: Fast/4, 2: Fast/8, 3: Fast/16; see enum slew_rate for values
692 */
MAULIK V VAGHELA215a97e2022-03-07 18:39:17 +0530693 uint8_t slow_slew_rate[NUM_VR_DOMAINS];
Cliff Huang0bb22252022-03-07 18:42:13 -0800694
695 /* Energy-Performance Preference (HWP feature) */
696 bool enable_energy_perf_pref;
697 uint8_t energy_perf_pref_value;
MAULIK V VAGHELA99356382022-03-03 13:07:57 +0530698
699 /*
700 * Enable or Disable C1 Cstate Demotion.
701 * Default 0. Set this to 1 in order to disable C state demotion.
702 */
703 bool disable_c1_state_auto_demotion;
Sridhar Siricilla37c33052022-04-02 10:33:00 +0530704
705 /*
706 * Enable or Disable PCH USB2 Phy power gating.
707 * Default 0. Set this to 1 in order to disable PCH USB2 Phy Power gating.
708 * Workaround for Intel TA# 723158 to prevent possible display flicker.
709 */
710 bool usb2_phy_sus_pg_disable;
V Sowmya4be8d9e2022-07-05 20:49:57 +0530711
712 /*
713 * Enable or Disable Package C-state Demotion.
714 * Default is set to 0.
715 * Set this to 1 in order to disable Package C-state demotion.
716 */
717 bool disable_package_c_state_demotion;
V Sowmya2bc54e72022-08-04 22:50:51 +0530718
Tim Crawfordc6529c72022-11-01 11:42:28 -0600719 /* i915 struct for GMA backlight control */
720 struct i915_gpu_controller_info gfx;
Jeremy Compostella9df11972022-12-02 10:59:49 -0700721
722 /*
723 * IGD panel configuration
724 */
725 struct i915_gpu_panel_config panel_cfg;
Kane Chen8327a7e2022-09-27 09:54:30 +0800726
727 /*
728 * Enable or Disable Tccold Handshake
729 * Default is set to 0.
730 * Set this to 1 in order to disable Tccold Handshake
731 */
732 bool disable_dynamic_tccold_handshake;
Subrata Banik292afef2020-09-09 13:34:18 +0530733};
734
735typedef struct soc_intel_alderlake_config config_t;
736
737#endif