1 // SPDX-License-Identifier: GPL-2.0 2 /* 3 * This file contains platform specific structure definitions 4 * and init function used by Meteor Lake PCH. 5 * 6 * Copyright (c) 2022, Intel Corporation. 7 * All Rights Reserved. 8 * 9 */ 10 11 #include <linux/pci.h> 12 #include "core.h" 13 14 /* 15 * Die Mapping to Product. 16 * Product SOCDie IOEDie PCHDie 17 * MTL-M SOC-M IOE-M None 18 * MTL-P SOC-M IOE-P None 19 * MTL-S SOC-S IOE-P PCH-S 20 */ 21 22 const struct pmc_bit_map mtl_socm_pfear_map[] = { 23 {"PMC", BIT(0)}, 24 {"OPI", BIT(1)}, 25 {"SPI", BIT(2)}, 26 {"XHCI", BIT(3)}, 27 {"SPA", BIT(4)}, 28 {"SPB", BIT(5)}, 29 {"SPC", BIT(6)}, 30 {"GBE", BIT(7)}, 31 32 {"SATA", BIT(0)}, 33 {"DSP0", BIT(1)}, 34 {"DSP1", BIT(2)}, 35 {"DSP2", BIT(3)}, 36 {"DSP3", BIT(4)}, 37 {"SPD", BIT(5)}, 38 {"LPSS", BIT(6)}, 39 {"LPC", BIT(7)}, 40 41 {"SMB", BIT(0)}, 42 {"ISH", BIT(1)}, 43 {"P2SB", BIT(2)}, 44 {"NPK_VNN", BIT(3)}, 45 {"SDX", BIT(4)}, 46 {"SPE", BIT(5)}, 47 {"FUSE", BIT(6)}, 48 {"SBR8", BIT(7)}, 49 50 {"RSVD24", BIT(0)}, 51 {"OTG", BIT(1)}, 52 {"EXI", BIT(2)}, 53 {"CSE", BIT(3)}, 54 {"CSME_KVM", BIT(4)}, 55 {"CSME_PMT", BIT(5)}, 56 {"CSME_CLINK", BIT(6)}, 57 {"CSME_PTIO", BIT(7)}, 58 59 {"CSME_USBR", BIT(0)}, 60 {"CSME_SUSRAM", BIT(1)}, 61 {"CSME_SMT1", BIT(2)}, 62 {"RSVD35", BIT(3)}, 63 {"CSME_SMS2", BIT(4)}, 64 {"CSME_SMS", BIT(5)}, 65 {"CSME_RTC", BIT(6)}, 66 {"CSME_PSF", BIT(7)}, 67 68 {"SBR0", BIT(0)}, 69 {"SBR1", BIT(1)}, 70 {"SBR2", BIT(2)}, 71 {"SBR3", BIT(3)}, 72 {"SBR4", BIT(4)}, 73 {"SBR5", BIT(5)}, 74 {"RSVD46", BIT(6)}, 75 {"PSF1", BIT(7)}, 76 77 {"PSF2", BIT(0)}, 78 {"PSF3", BIT(1)}, 79 {"PSF4", BIT(2)}, 80 {"CNVI", BIT(3)}, 81 {"UFSX2", BIT(4)}, 82 {"EMMC", BIT(5)}, 83 {"SPF", BIT(6)}, 84 {"SBR6", BIT(7)}, 85 86 {"SBR7", BIT(0)}, 87 {"NPK_AON", BIT(1)}, 88 {"HDA4", BIT(2)}, 89 {"HDA5", BIT(3)}, 90 {"HDA6", BIT(4)}, 91 {"PSF6", BIT(5)}, 92 {"RSVD62", BIT(6)}, 93 {"RSVD63", BIT(7)}, 94 {} 95 }; 96 97 const struct pmc_bit_map *ext_mtl_socm_pfear_map[] = { 98 mtl_socm_pfear_map, 99 NULL 100 }; 101 102 const struct pmc_bit_map mtl_socm_ltr_show_map[] = { 103 {"SOUTHPORT_A", CNP_PMC_LTR_SPA}, 104 {"SOUTHPORT_B", CNP_PMC_LTR_SPB}, 105 {"SATA", CNP_PMC_LTR_SATA}, 106 {"GIGABIT_ETHERNET", CNP_PMC_LTR_GBE}, 107 {"XHCI", CNP_PMC_LTR_XHCI}, 108 {"SOUTHPORT_F", ADL_PMC_LTR_SPF}, 109 {"ME", CNP_PMC_LTR_ME}, 110 {"SATA1", CNP_PMC_LTR_EVA}, 111 {"SOUTHPORT_C", CNP_PMC_LTR_SPC}, 112 {"HD_AUDIO", CNP_PMC_LTR_AZ}, 113 {"CNV", CNP_PMC_LTR_CNV}, 114 {"LPSS", CNP_PMC_LTR_LPSS}, 115 {"SOUTHPORT_D", CNP_PMC_LTR_SPD}, 116 {"SOUTHPORT_E", CNP_PMC_LTR_SPE}, 117 {"SATA2", CNP_PMC_LTR_CAM}, 118 {"ESPI", CNP_PMC_LTR_ESPI}, 119 {"SCC", CNP_PMC_LTR_SCC}, 120 {"ISH", CNP_PMC_LTR_ISH}, 121 {"UFSX2", CNP_PMC_LTR_UFSX2}, 122 {"EMMC", CNP_PMC_LTR_EMMC}, 123 {"WIGIG", ICL_PMC_LTR_WIGIG}, 124 {"THC0", TGL_PMC_LTR_THC0}, 125 {"THC1", TGL_PMC_LTR_THC1}, 126 {"SOUTHPORT_G", MTL_PMC_LTR_SPG}, 127 {"ESE", MTL_PMC_LTR_ESE}, 128 {"IOE_PMC", MTL_PMC_LTR_IOE_PMC}, 129 130 /* Below two cannot be used for LTR_IGNORE */ 131 {"CURRENT_PLATFORM", CNP_PMC_LTR_CUR_PLT}, 132 {"AGGREGATED_SYSTEM", CNP_PMC_LTR_CUR_ASLT}, 133 {} 134 }; 135 136 const struct pmc_bit_map mtl_socm_clocksource_status_map[] = { 137 {"AON2_OFF_STS", BIT(0)}, 138 {"AON3_OFF_STS", BIT(1)}, 139 {"AON4_OFF_STS", BIT(2)}, 140 {"AON5_OFF_STS", BIT(3)}, 141 {"AON1_OFF_STS", BIT(4)}, 142 {"XTAL_LVM_OFF_STS", BIT(5)}, 143 {"MPFPW1_0_PLL_OFF_STS", BIT(6)}, 144 {"MPFPW1_1_PLL_OFF_STS", BIT(7)}, 145 {"USB3_PLL_OFF_STS", BIT(8)}, 146 {"AON3_SPL_OFF_STS", BIT(9)}, 147 {"MPFPW2_0_PLL_OFF_STS", BIT(12)}, 148 {"MPFPW3_0_PLL_OFF_STS", BIT(13)}, 149 {"XTAL_AGGR_OFF_STS", BIT(17)}, 150 {"USB2_PLL_OFF_STS", BIT(18)}, 151 {"FILTER_PLL_OFF_STS", BIT(22)}, 152 {"ACE_PLL_OFF_STS", BIT(24)}, 153 {"FABRIC_PLL_OFF_STS", BIT(25)}, 154 {"SOC_PLL_OFF_STS", BIT(26)}, 155 {"PCIFAB_PLL_OFF_STS", BIT(27)}, 156 {"REF_PLL_OFF_STS", BIT(28)}, 157 {"IMG_PLL_OFF_STS", BIT(29)}, 158 {"RTC_PLL_OFF_STS", BIT(31)}, 159 {} 160 }; 161 162 const struct pmc_bit_map mtl_socm_power_gating_status_0_map[] = { 163 {"PMC_PGD0_PG_STS", BIT(0)}, 164 {"DMI_PGD0_PG_STS", BIT(1)}, 165 {"ESPISPI_PGD0_PG_STS", BIT(2)}, 166 {"XHCI_PGD0_PG_STS", BIT(3)}, 167 {"SPA_PGD0_PG_STS", BIT(4)}, 168 {"SPB_PGD0_PG_STS", BIT(5)}, 169 {"SPC_PGD0_PG_STS", BIT(6)}, 170 {"GBE_PGD0_PG_STS", BIT(7)}, 171 {"SATA_PGD0_PG_STS", BIT(8)}, 172 {"PSF13_PGD0_PG_STS", BIT(9)}, 173 {"SOC_D2D_PGD3_PG_STS", BIT(10)}, 174 {"MPFPW3_PGD0_PG_STS", BIT(11)}, 175 {"ESE_PGD0_PG_STS", BIT(12)}, 176 {"SPD_PGD0_PG_STS", BIT(13)}, 177 {"LPSS_PGD0_PG_STS", BIT(14)}, 178 {"LPC_PGD0_PG_STS", BIT(15)}, 179 {"SMB_PGD0_PG_STS", BIT(16)}, 180 {"ISH_PGD0_PG_STS", BIT(17)}, 181 {"P2S_PGD0_PG_STS", BIT(18)}, 182 {"NPK_PGD0_PG_STS", BIT(19)}, 183 {"DBG_SBR_PGD0_PG_STS", BIT(20)}, 184 {"SBRG_PGD0_PG_STS", BIT(21)}, 185 {"FUSE_PGD0_PG_STS", BIT(22)}, 186 {"SBR8_PGD0_PG_STS", BIT(23)}, 187 {"SOC_D2D_PGD2_PG_STS", BIT(24)}, 188 {"XDCI_PGD0_PG_STS", BIT(25)}, 189 {"EXI_PGD0_PG_STS", BIT(26)}, 190 {"CSE_PGD0_PG_STS", BIT(27)}, 191 {"KVMCC_PGD0_PG_STS", BIT(28)}, 192 {"PMT_PGD0_PG_STS", BIT(29)}, 193 {"CLINK_PGD0_PG_STS", BIT(30)}, 194 {"PTIO_PGD0_PG_STS", BIT(31)}, 195 {} 196 }; 197 198 const struct pmc_bit_map mtl_socm_power_gating_status_1_map[] = { 199 {"USBR0_PGD0_PG_STS", BIT(0)}, 200 {"SUSRAM_PGD0_PG_STS", BIT(1)}, 201 {"SMT1_PGD0_PG_STS", BIT(2)}, 202 {"FIACPCB_U_PGD0_PG_STS", BIT(3)}, 203 {"SMS2_PGD0_PG_STS", BIT(4)}, 204 {"SMS1_PGD0_PG_STS", BIT(5)}, 205 {"CSMERTC_PGD0_PG_STS", BIT(6)}, 206 {"CSMEPSF_PGD0_PG_STS", BIT(7)}, 207 {"SBR0_PGD0_PG_STS", BIT(8)}, 208 {"SBR1_PGD0_PG_STS", BIT(9)}, 209 {"SBR2_PGD0_PG_STS", BIT(10)}, 210 {"SBR3_PGD0_PG_STS", BIT(11)}, 211 {"U3FPW1_PGD0_PG_STS", BIT(12)}, 212 {"SBR5_PGD0_PG_STS", BIT(13)}, 213 {"MPFPW1_PGD0_PG_STS", BIT(14)}, 214 {"UFSPW1_PGD0_PG_STS", BIT(15)}, 215 {"FIA_X_PGD0_PG_STS", BIT(16)}, 216 {"SOC_D2D_PGD0_PG_STS", BIT(17)}, 217 {"MPFPW2_PGD0_PG_STS", BIT(18)}, 218 {"CNVI_PGD0_PG_STS", BIT(19)}, 219 {"UFSX2_PGD0_PG_STS", BIT(20)}, 220 {"ENDBG_PGD0_PG_STS", BIT(21)}, 221 {"DBG_PSF_PGD0_PG_STS", BIT(22)}, 222 {"SBR6_PGD0_PG_STS", BIT(23)}, 223 {"SBR7_PGD0_PG_STS", BIT(24)}, 224 {"NPK_PGD1_PG_STS", BIT(25)}, 225 {"FIACPCB_X_PGD0_PG_STS", BIT(26)}, 226 {"DBC_PGD0_PG_STS", BIT(27)}, 227 {"FUSEGPSB_PGD0_PG_STS", BIT(28)}, 228 {"PSF6_PGD0_PG_STS", BIT(29)}, 229 {"PSF7_PGD0_PG_STS", BIT(30)}, 230 {"GBETSN1_PGD0_PG_STS", BIT(31)}, 231 {} 232 }; 233 234 const struct pmc_bit_map mtl_socm_power_gating_status_2_map[] = { 235 {"PSF8_PGD0_PG_STS", BIT(0)}, 236 {"FIA_PGD0_PG_STS", BIT(1)}, 237 {"SOC_D2D_PGD1_PG_STS", BIT(2)}, 238 {"FIA_U_PGD0_PG_STS", BIT(3)}, 239 {"TAM_PGD0_PG_STS", BIT(4)}, 240 {"GBETSN_PGD0_PG_STS", BIT(5)}, 241 {"TBTLSX_PGD0_PG_STS", BIT(6)}, 242 {"THC0_PGD0_PG_STS", BIT(7)}, 243 {"THC1_PGD0_PG_STS", BIT(8)}, 244 {"PMC_PGD1_PG_STS", BIT(9)}, 245 {"GNA_PGD0_PG_STS", BIT(10)}, 246 {"ACE_PGD0_PG_STS", BIT(11)}, 247 {"ACE_PGD1_PG_STS", BIT(12)}, 248 {"ACE_PGD2_PG_STS", BIT(13)}, 249 {"ACE_PGD3_PG_STS", BIT(14)}, 250 {"ACE_PGD4_PG_STS", BIT(15)}, 251 {"ACE_PGD5_PG_STS", BIT(16)}, 252 {"ACE_PGD6_PG_STS", BIT(17)}, 253 {"ACE_PGD7_PG_STS", BIT(18)}, 254 {"ACE_PGD8_PG_STS", BIT(19)}, 255 {"FIA_PGS_PGD0_PG_STS", BIT(20)}, 256 {"FIACPCB_PGS_PGD0_PG_STS", BIT(21)}, 257 {"FUSEPMSB_PGD0_PG_STS", BIT(22)}, 258 {} 259 }; 260 261 const struct pmc_bit_map mtl_socm_d3_status_0_map[] = { 262 {"LPSS_D3_STS", BIT(3)}, 263 {"XDCI_D3_STS", BIT(4)}, 264 {"XHCI_D3_STS", BIT(5)}, 265 {"SPA_D3_STS", BIT(12)}, 266 {"SPB_D3_STS", BIT(13)}, 267 {"SPC_D3_STS", BIT(14)}, 268 {"SPD_D3_STS", BIT(15)}, 269 {"ESPISPI_D3_STS", BIT(18)}, 270 {"SATA_D3_STS", BIT(20)}, 271 {"PSTH_D3_STS", BIT(21)}, 272 {"DMI_D3_STS", BIT(22)}, 273 {} 274 }; 275 276 const struct pmc_bit_map mtl_socm_d3_status_1_map[] = { 277 {"GBETSN1_D3_STS", BIT(14)}, 278 {"GBE_D3_STS", BIT(19)}, 279 {"ITSS_D3_STS", BIT(23)}, 280 {"P2S_D3_STS", BIT(24)}, 281 {"CNVI_D3_STS", BIT(27)}, 282 {"UFSX2_D3_STS", BIT(28)}, 283 {} 284 }; 285 286 const struct pmc_bit_map mtl_socm_d3_status_2_map[] = { 287 {"GNA_D3_STS", BIT(0)}, 288 {"CSMERTC_D3_STS", BIT(1)}, 289 {"SUSRAM_D3_STS", BIT(2)}, 290 {"CSE_D3_STS", BIT(4)}, 291 {"KVMCC_D3_STS", BIT(5)}, 292 {"USBR0_D3_STS", BIT(6)}, 293 {"ISH_D3_STS", BIT(7)}, 294 {"SMT1_D3_STS", BIT(8)}, 295 {"SMT2_D3_STS", BIT(9)}, 296 {"SMT3_D3_STS", BIT(10)}, 297 {"CLINK_D3_STS", BIT(14)}, 298 {"PTIO_D3_STS", BIT(16)}, 299 {"PMT_D3_STS", BIT(17)}, 300 {"SMS1_D3_STS", BIT(18)}, 301 {"SMS2_D3_STS", BIT(19)}, 302 {} 303 }; 304 305 const struct pmc_bit_map mtl_socm_d3_status_3_map[] = { 306 {"ESE_D3_STS", BIT(2)}, 307 {"GBETSN_D3_STS", BIT(13)}, 308 {"THC0_D3_STS", BIT(14)}, 309 {"THC1_D3_STS", BIT(15)}, 310 {"ACE_D3_STS", BIT(23)}, 311 {} 312 }; 313 314 const struct pmc_bit_map mtl_socm_vnn_req_status_0_map[] = { 315 {"LPSS_VNN_REQ_STS", BIT(3)}, 316 {"FIA_VNN_REQ_STS", BIT(17)}, 317 {"ESPISPI_VNN_REQ_STS", BIT(18)}, 318 {} 319 }; 320 321 const struct pmc_bit_map mtl_socm_vnn_req_status_1_map[] = { 322 {"NPK_VNN_REQ_STS", BIT(4)}, 323 {"DFXAGG_VNN_REQ_STS", BIT(8)}, 324 {"EXI_VNN_REQ_STS", BIT(9)}, 325 {"P2D_VNN_REQ_STS", BIT(18)}, 326 {"GBE_VNN_REQ_STS", BIT(19)}, 327 {"SMB_VNN_REQ_STS", BIT(25)}, 328 {"LPC_VNN_REQ_STS", BIT(26)}, 329 {} 330 }; 331 332 const struct pmc_bit_map mtl_socm_vnn_req_status_2_map[] = { 333 {"CSMERTC_VNN_REQ_STS", BIT(1)}, 334 {"CSE_VNN_REQ_STS", BIT(4)}, 335 {"ISH_VNN_REQ_STS", BIT(7)}, 336 {"SMT1_VNN_REQ_STS", BIT(8)}, 337 {"CLINK_VNN_REQ_STS", BIT(14)}, 338 {"SMS1_VNN_REQ_STS", BIT(18)}, 339 {"SMS2_VNN_REQ_STS", BIT(19)}, 340 {"GPIOCOM4_VNN_REQ_STS", BIT(20)}, 341 {"GPIOCOM3_VNN_REQ_STS", BIT(21)}, 342 {"GPIOCOM2_VNN_REQ_STS", BIT(22)}, 343 {"GPIOCOM1_VNN_REQ_STS", BIT(23)}, 344 {"GPIOCOM0_VNN_REQ_STS", BIT(24)}, 345 {} 346 }; 347 348 const struct pmc_bit_map mtl_socm_vnn_req_status_3_map[] = { 349 {"ESE_VNN_REQ_STS", BIT(2)}, 350 {"DTS0_VNN_REQ_STS", BIT(7)}, 351 {"GPIOCOM5_VNN_REQ_STS", BIT(11)}, 352 {} 353 }; 354 355 const struct pmc_bit_map mtl_socm_vnn_misc_status_map[] = { 356 {"CPU_C10_REQ_STS", BIT(0)}, 357 {"TS_OFF_REQ_STS", BIT(1)}, 358 {"PNDE_MET_REQ_STS", BIT(2)}, 359 {"PCIE_DEEP_PM_REQ_STS", BIT(3)}, 360 {"PMC_CLK_THROTTLE_EN_REQ_STS", BIT(4)}, 361 {"NPK_VNNAON_REQ_STS", BIT(5)}, 362 {"VNN_SOC_REQ_STS", BIT(6)}, 363 {"ISH_VNNAON_REQ_STS", BIT(7)}, 364 {"IOE_COND_MET_S02I2_0_REQ_STS", BIT(8)}, 365 {"IOE_COND_MET_S02I2_1_REQ_STS", BIT(9)}, 366 {"IOE_COND_MET_S02I2_2_REQ_STS", BIT(10)}, 367 {"PLT_GREATER_REQ_STS", BIT(11)}, 368 {"PCIE_CLKREQ_REQ_STS", BIT(12)}, 369 {"PMC_IDLE_FB_OCP_REQ_STS", BIT(13)}, 370 {"PM_SYNC_STATES_REQ_STS", BIT(14)}, 371 {"EA_REQ_STS", BIT(15)}, 372 {"MPHY_CORE_OFF_REQ_STS", BIT(16)}, 373 {"BRK_EV_EN_REQ_STS", BIT(17)}, 374 {"AUTO_DEMO_EN_REQ_STS", BIT(18)}, 375 {"ITSS_CLK_SRC_REQ_STS", BIT(19)}, 376 {"LPC_CLK_SRC_REQ_STS", BIT(20)}, 377 {"ARC_IDLE_REQ_STS", BIT(21)}, 378 {"MPHY_SUS_REQ_STS", BIT(22)}, 379 {"FIA_DEEP_PM_REQ_STS", BIT(23)}, 380 {"UXD_CONNECTED_REQ_STS", BIT(24)}, 381 {"ARC_INTERRUPT_WAKE_REQ_STS", BIT(25)}, 382 {"USB2_VNNAON_ACT_REQ_STS", BIT(26)}, 383 {"PRE_WAKE0_REQ_STS", BIT(27)}, 384 {"PRE_WAKE1_REQ_STS", BIT(28)}, 385 {"PRE_WAKE2_EN_REQ_STS", BIT(29)}, 386 {"WOV_REQ_STS", BIT(30)}, 387 {"CNVI_V1P05_REQ_STS", BIT(31)}, 388 {} 389 }; 390 391 const struct pmc_bit_map mtl_socm_signal_status_map[] = { 392 {"LSX_Wake0_En_STS", BIT(0)}, 393 {"LSX_Wake0_Pol_STS", BIT(1)}, 394 {"LSX_Wake1_En_STS", BIT(2)}, 395 {"LSX_Wake1_Pol_STS", BIT(3)}, 396 {"LSX_Wake2_En_STS", BIT(4)}, 397 {"LSX_Wake2_Pol_STS", BIT(5)}, 398 {"LSX_Wake3_En_STS", BIT(6)}, 399 {"LSX_Wake3_Pol_STS", BIT(7)}, 400 {"LSX_Wake4_En_STS", BIT(8)}, 401 {"LSX_Wake4_Pol_STS", BIT(9)}, 402 {"LSX_Wake5_En_STS", BIT(10)}, 403 {"LSX_Wake5_Pol_STS", BIT(11)}, 404 {"LSX_Wake6_En_STS", BIT(12)}, 405 {"LSX_Wake6_Pol_STS", BIT(13)}, 406 {"LSX_Wake7_En_STS", BIT(14)}, 407 {"LSX_Wake7_Pol_STS", BIT(15)}, 408 {"LPSS_Wake0_En_STS", BIT(16)}, 409 {"LPSS_Wake0_Pol_STS", BIT(17)}, 410 {"LPSS_Wake1_En_STS", BIT(18)}, 411 {"LPSS_Wake1_Pol_STS", BIT(19)}, 412 {"Int_Timer_SS_Wake0_En_STS", BIT(20)}, 413 {"Int_Timer_SS_Wake0_Pol_STS", BIT(21)}, 414 {"Int_Timer_SS_Wake1_En_STS", BIT(22)}, 415 {"Int_Timer_SS_Wake1_Pol_STS", BIT(23)}, 416 {"Int_Timer_SS_Wake2_En_STS", BIT(24)}, 417 {"Int_Timer_SS_Wake2_Pol_STS", BIT(25)}, 418 {"Int_Timer_SS_Wake3_En_STS", BIT(26)}, 419 {"Int_Timer_SS_Wake3_Pol_STS", BIT(27)}, 420 {"Int_Timer_SS_Wake4_En_STS", BIT(28)}, 421 {"Int_Timer_SS_Wake4_Pol_STS", BIT(29)}, 422 {"Int_Timer_SS_Wake5_En_STS", BIT(30)}, 423 {"Int_Timer_SS_Wake5_Pol_STS", BIT(31)}, 424 {} 425 }; 426 427 const struct pmc_bit_map *mtl_socm_lpm_maps[] = { 428 mtl_socm_clocksource_status_map, 429 mtl_socm_power_gating_status_0_map, 430 mtl_socm_power_gating_status_1_map, 431 mtl_socm_power_gating_status_2_map, 432 mtl_socm_d3_status_0_map, 433 mtl_socm_d3_status_1_map, 434 mtl_socm_d3_status_2_map, 435 mtl_socm_d3_status_3_map, 436 mtl_socm_vnn_req_status_0_map, 437 mtl_socm_vnn_req_status_1_map, 438 mtl_socm_vnn_req_status_2_map, 439 mtl_socm_vnn_req_status_3_map, 440 mtl_socm_vnn_misc_status_map, 441 mtl_socm_signal_status_map, 442 NULL 443 }; 444 445 const struct pmc_reg_map mtl_socm_reg_map = { 446 .pfear_sts = ext_mtl_socm_pfear_map, 447 .slp_s0_offset = CNP_PMC_SLP_S0_RES_COUNTER_OFFSET, 448 .slp_s0_res_counter_step = TGL_PMC_SLP_S0_RES_COUNTER_STEP, 449 .ltr_show_sts = mtl_socm_ltr_show_map, 450 .msr_sts = msr_map, 451 .ltr_ignore_offset = CNP_PMC_LTR_IGNORE_OFFSET, 452 .regmap_length = MTL_SOC_PMC_MMIO_REG_LEN, 453 .ppfear0_offset = CNP_PMC_HOST_PPFEAR0A, 454 .ppfear_buckets = MTL_SOCM_PPFEAR_NUM_ENTRIES, 455 .pm_cfg_offset = CNP_PMC_PM_CFG_OFFSET, 456 .pm_read_disable_bit = CNP_PMC_READ_DISABLE_BIT, 457 .lpm_num_maps = ADL_LPM_NUM_MAPS, 458 .ltr_ignore_max = MTL_SOCM_NUM_IP_IGN_ALLOWED, 459 .lpm_res_counter_step_x2 = TGL_PMC_LPM_RES_COUNTER_STEP_X2, 460 .etr3_offset = ETR3_OFFSET, 461 .lpm_sts_latch_en_offset = MTL_LPM_STATUS_LATCH_EN_OFFSET, 462 .lpm_priority_offset = MTL_LPM_PRI_OFFSET, 463 .lpm_en_offset = MTL_LPM_EN_OFFSET, 464 .lpm_residency_offset = MTL_LPM_RESIDENCY_OFFSET, 465 .lpm_sts = mtl_socm_lpm_maps, 466 .lpm_status_offset = MTL_LPM_STATUS_OFFSET, 467 .lpm_live_status_offset = MTL_LPM_LIVE_STATUS_OFFSET, 468 }; 469 470 static struct pmc_info mtl_pmc_info_list[] = { 471 {} 472 }; 473 474 #define MTL_GNA_PCI_DEV 0x7e4c 475 #define MTL_IPU_PCI_DEV 0x7d19 476 #define MTL_VPU_PCI_DEV 0x7d1d 477 static void mtl_set_device_d3(unsigned int device) 478 { 479 struct pci_dev *pcidev; 480 481 pcidev = pci_get_device(PCI_VENDOR_ID_INTEL, device, NULL); 482 if (pcidev) { 483 if (!device_trylock(&pcidev->dev)) { 484 pci_dev_put(pcidev); 485 return; 486 } 487 if (!pcidev->dev.driver) { 488 dev_info(&pcidev->dev, "Setting to D3hot\n"); 489 pci_set_power_state(pcidev, PCI_D3hot); 490 } 491 device_unlock(&pcidev->dev); 492 pci_dev_put(pcidev); 493 } 494 } 495 496 /* 497 * Set power state of select devices that do not have drivers to D3 498 * so that they do not block Package C entry. 499 */ 500 static void mtl_d3_fixup(void) 501 { 502 mtl_set_device_d3(MTL_GNA_PCI_DEV); 503 mtl_set_device_d3(MTL_IPU_PCI_DEV); 504 mtl_set_device_d3(MTL_VPU_PCI_DEV); 505 } 506 507 static int mtl_resume(struct pmc_dev *pmcdev) 508 { 509 mtl_d3_fixup(); 510 return pmc_core_resume_common(pmcdev); 511 } 512 513 int mtl_core_init(struct pmc_dev *pmcdev) 514 { 515 struct pmc *pmc = pmcdev->pmcs[PMC_IDX_SOC]; 516 int ret; 517 518 pmc->map = &mtl_socm_reg_map; 519 520 mtl_d3_fixup(); 521 522 pmcdev->resume = mtl_resume; 523 524 pmcdev->regmap_list = mtl_pmc_info_list; 525 pmc_core_ssram_init(pmcdev); 526 527 ret = get_primary_reg_base(pmc); 528 if (ret) 529 return ret; 530 531 /* Due to a hardware limitation, the GBE LTR blocks PC10 532 * when a cable is attached. Tell the PMC to ignore it. 533 */ 534 dev_dbg(&pmcdev->pdev->dev, "ignoring GBE LTR\n"); 535 pmc_core_send_ltr_ignore(pmcdev, 3); 536 537 return 0; 538 } 539