xref: /openbmc/linux/drivers/platform/x86/intel/pmc/cnp.c (revision d6cd0cc8)
1*d6cd0cc8SXi Pardee // SPDX-License-Identifier: GPL-2.0
2*d6cd0cc8SXi Pardee /*
3*d6cd0cc8SXi Pardee  * This file contains platform specific structure definitions
4*d6cd0cc8SXi Pardee  * and init function used by Cannon Lake Point PCH.
5*d6cd0cc8SXi Pardee  *
6*d6cd0cc8SXi Pardee  * Copyright (c) 2022, Intel Corporation.
7*d6cd0cc8SXi Pardee  * All Rights Reserved.
8*d6cd0cc8SXi Pardee  *
9*d6cd0cc8SXi Pardee  */
10*d6cd0cc8SXi Pardee 
11*d6cd0cc8SXi Pardee #include "core.h"
12*d6cd0cc8SXi Pardee 
13*d6cd0cc8SXi Pardee /* Cannon Lake: PGD PFET Enable Ack Status Register(s) bitmap */
14*d6cd0cc8SXi Pardee const struct pmc_bit_map cnp_pfear_map[] = {
15*d6cd0cc8SXi Pardee 	{"PMC",                 BIT(0)},
16*d6cd0cc8SXi Pardee 	{"OPI-DMI",             BIT(1)},
17*d6cd0cc8SXi Pardee 	{"SPI/eSPI",            BIT(2)},
18*d6cd0cc8SXi Pardee 	{"XHCI",                BIT(3)},
19*d6cd0cc8SXi Pardee 	{"SPA",                 BIT(4)},
20*d6cd0cc8SXi Pardee 	{"SPB",                 BIT(5)},
21*d6cd0cc8SXi Pardee 	{"SPC",                 BIT(6)},
22*d6cd0cc8SXi Pardee 	{"GBE",                 BIT(7)},
23*d6cd0cc8SXi Pardee 
24*d6cd0cc8SXi Pardee 	{"SATA",                BIT(0)},
25*d6cd0cc8SXi Pardee 	{"HDA_PGD0",            BIT(1)},
26*d6cd0cc8SXi Pardee 	{"HDA_PGD1",            BIT(2)},
27*d6cd0cc8SXi Pardee 	{"HDA_PGD2",            BIT(3)},
28*d6cd0cc8SXi Pardee 	{"HDA_PGD3",            BIT(4)},
29*d6cd0cc8SXi Pardee 	{"SPD",                 BIT(5)},
30*d6cd0cc8SXi Pardee 	{"LPSS",                BIT(6)},
31*d6cd0cc8SXi Pardee 	{"LPC",                 BIT(7)},
32*d6cd0cc8SXi Pardee 
33*d6cd0cc8SXi Pardee 	{"SMB",                 BIT(0)},
34*d6cd0cc8SXi Pardee 	{"ISH",                 BIT(1)},
35*d6cd0cc8SXi Pardee 	{"P2SB",                BIT(2)},
36*d6cd0cc8SXi Pardee 	{"NPK_VNN",             BIT(3)},
37*d6cd0cc8SXi Pardee 	{"SDX",                 BIT(4)},
38*d6cd0cc8SXi Pardee 	{"SPE",                 BIT(5)},
39*d6cd0cc8SXi Pardee 	{"Fuse",                BIT(6)},
40*d6cd0cc8SXi Pardee 	{"SBR8",		BIT(7)},
41*d6cd0cc8SXi Pardee 
42*d6cd0cc8SXi Pardee 	{"CSME_FSC",            BIT(0)},
43*d6cd0cc8SXi Pardee 	{"USB3_OTG",            BIT(1)},
44*d6cd0cc8SXi Pardee 	{"EXI",                 BIT(2)},
45*d6cd0cc8SXi Pardee 	{"CSE",                 BIT(3)},
46*d6cd0cc8SXi Pardee 	{"CSME_KVM",            BIT(4)},
47*d6cd0cc8SXi Pardee 	{"CSME_PMT",            BIT(5)},
48*d6cd0cc8SXi Pardee 	{"CSME_CLINK",          BIT(6)},
49*d6cd0cc8SXi Pardee 	{"CSME_PTIO",           BIT(7)},
50*d6cd0cc8SXi Pardee 
51*d6cd0cc8SXi Pardee 	{"CSME_USBR",           BIT(0)},
52*d6cd0cc8SXi Pardee 	{"CSME_SUSRAM",         BIT(1)},
53*d6cd0cc8SXi Pardee 	{"CSME_SMT1",           BIT(2)},
54*d6cd0cc8SXi Pardee 	{"CSME_SMT4",           BIT(3)},
55*d6cd0cc8SXi Pardee 	{"CSME_SMS2",           BIT(4)},
56*d6cd0cc8SXi Pardee 	{"CSME_SMS1",           BIT(5)},
57*d6cd0cc8SXi Pardee 	{"CSME_RTC",            BIT(6)},
58*d6cd0cc8SXi Pardee 	{"CSME_PSF",            BIT(7)},
59*d6cd0cc8SXi Pardee 
60*d6cd0cc8SXi Pardee 	{"SBR0",                BIT(0)},
61*d6cd0cc8SXi Pardee 	{"SBR1",                BIT(1)},
62*d6cd0cc8SXi Pardee 	{"SBR2",                BIT(2)},
63*d6cd0cc8SXi Pardee 	{"SBR3",                BIT(3)},
64*d6cd0cc8SXi Pardee 	{"SBR4",                BIT(4)},
65*d6cd0cc8SXi Pardee 	{"SBR5",                BIT(5)},
66*d6cd0cc8SXi Pardee 	{"CSME_PECI",           BIT(6)},
67*d6cd0cc8SXi Pardee 	{"PSF1",                BIT(7)},
68*d6cd0cc8SXi Pardee 
69*d6cd0cc8SXi Pardee 	{"PSF2",                BIT(0)},
70*d6cd0cc8SXi Pardee 	{"PSF3",                BIT(1)},
71*d6cd0cc8SXi Pardee 	{"PSF4",                BIT(2)},
72*d6cd0cc8SXi Pardee 	{"CNVI",                BIT(3)},
73*d6cd0cc8SXi Pardee 	{"UFS0",                BIT(4)},
74*d6cd0cc8SXi Pardee 	{"EMMC",                BIT(5)},
75*d6cd0cc8SXi Pardee 	{"SPF",			BIT(6)},
76*d6cd0cc8SXi Pardee 	{"SBR6",                BIT(7)},
77*d6cd0cc8SXi Pardee 
78*d6cd0cc8SXi Pardee 	{"SBR7",                BIT(0)},
79*d6cd0cc8SXi Pardee 	{"NPK_AON",             BIT(1)},
80*d6cd0cc8SXi Pardee 	{"HDA_PGD4",            BIT(2)},
81*d6cd0cc8SXi Pardee 	{"HDA_PGD5",            BIT(3)},
82*d6cd0cc8SXi Pardee 	{"HDA_PGD6",            BIT(4)},
83*d6cd0cc8SXi Pardee 	{"PSF6",		BIT(5)},
84*d6cd0cc8SXi Pardee 	{"PSF7",		BIT(6)},
85*d6cd0cc8SXi Pardee 	{"PSF8",		BIT(7)},
86*d6cd0cc8SXi Pardee 	{}
87*d6cd0cc8SXi Pardee };
88*d6cd0cc8SXi Pardee 
89*d6cd0cc8SXi Pardee const struct pmc_bit_map *ext_cnp_pfear_map[] = {
90*d6cd0cc8SXi Pardee 	/*
91*d6cd0cc8SXi Pardee 	 * Check intel_pmc_core_ids[] users of cnp_reg_map for
92*d6cd0cc8SXi Pardee 	 * a list of core SoCs using this.
93*d6cd0cc8SXi Pardee 	 */
94*d6cd0cc8SXi Pardee 	cnp_pfear_map,
95*d6cd0cc8SXi Pardee 	NULL
96*d6cd0cc8SXi Pardee };
97*d6cd0cc8SXi Pardee 
98*d6cd0cc8SXi Pardee const struct pmc_bit_map cnp_slps0_dbg0_map[] = {
99*d6cd0cc8SXi Pardee 	{"AUDIO_D3",		BIT(0)},
100*d6cd0cc8SXi Pardee 	{"OTG_D3",		BIT(1)},
101*d6cd0cc8SXi Pardee 	{"XHCI_D3",		BIT(2)},
102*d6cd0cc8SXi Pardee 	{"LPIO_D3",		BIT(3)},
103*d6cd0cc8SXi Pardee 	{"SDX_D3",		BIT(4)},
104*d6cd0cc8SXi Pardee 	{"SATA_D3",		BIT(5)},
105*d6cd0cc8SXi Pardee 	{"UFS0_D3",		BIT(6)},
106*d6cd0cc8SXi Pardee 	{"UFS1_D3",		BIT(7)},
107*d6cd0cc8SXi Pardee 	{"EMMC_D3",		BIT(8)},
108*d6cd0cc8SXi Pardee 	{}
109*d6cd0cc8SXi Pardee };
110*d6cd0cc8SXi Pardee 
111*d6cd0cc8SXi Pardee const struct pmc_bit_map cnp_slps0_dbg1_map[] = {
112*d6cd0cc8SXi Pardee 	{"SDIO_PLL_OFF",	BIT(0)},
113*d6cd0cc8SXi Pardee 	{"USB2_PLL_OFF",	BIT(1)},
114*d6cd0cc8SXi Pardee 	{"AUDIO_PLL_OFF",	BIT(2)},
115*d6cd0cc8SXi Pardee 	{"OC_PLL_OFF",		BIT(3)},
116*d6cd0cc8SXi Pardee 	{"MAIN_PLL_OFF",	BIT(4)},
117*d6cd0cc8SXi Pardee 	{"XOSC_OFF",		BIT(5)},
118*d6cd0cc8SXi Pardee 	{"LPC_CLKS_GATED",	BIT(6)},
119*d6cd0cc8SXi Pardee 	{"PCIE_CLKREQS_IDLE",	BIT(7)},
120*d6cd0cc8SXi Pardee 	{"AUDIO_ROSC_OFF",	BIT(8)},
121*d6cd0cc8SXi Pardee 	{"HPET_XOSC_CLK_REQ",	BIT(9)},
122*d6cd0cc8SXi Pardee 	{"PMC_ROSC_SLOW_CLK",	BIT(10)},
123*d6cd0cc8SXi Pardee 	{"AON2_ROSC_GATED",	BIT(11)},
124*d6cd0cc8SXi Pardee 	{"CLKACKS_DEASSERTED",	BIT(12)},
125*d6cd0cc8SXi Pardee 	{}
126*d6cd0cc8SXi Pardee };
127*d6cd0cc8SXi Pardee 
128*d6cd0cc8SXi Pardee const struct pmc_bit_map cnp_slps0_dbg2_map[] = {
129*d6cd0cc8SXi Pardee 	{"MPHY_CORE_GATED",	BIT(0)},
130*d6cd0cc8SXi Pardee 	{"CSME_GATED",		BIT(1)},
131*d6cd0cc8SXi Pardee 	{"USB2_SUS_GATED",	BIT(2)},
132*d6cd0cc8SXi Pardee 	{"DYN_FLEX_IO_IDLE",	BIT(3)},
133*d6cd0cc8SXi Pardee 	{"GBE_NO_LINK",		BIT(4)},
134*d6cd0cc8SXi Pardee 	{"THERM_SEN_DISABLED",	BIT(5)},
135*d6cd0cc8SXi Pardee 	{"PCIE_LOW_POWER",	BIT(6)},
136*d6cd0cc8SXi Pardee 	{"ISH_VNNAON_REQ_ACT",	BIT(7)},
137*d6cd0cc8SXi Pardee 	{"ISH_VNN_REQ_ACT",	BIT(8)},
138*d6cd0cc8SXi Pardee 	{"CNV_VNNAON_REQ_ACT",	BIT(9)},
139*d6cd0cc8SXi Pardee 	{"CNV_VNN_REQ_ACT",	BIT(10)},
140*d6cd0cc8SXi Pardee 	{"NPK_VNNON_REQ_ACT",	BIT(11)},
141*d6cd0cc8SXi Pardee 	{"PMSYNC_STATE_IDLE",	BIT(12)},
142*d6cd0cc8SXi Pardee 	{"ALST_GT_THRES",	BIT(13)},
143*d6cd0cc8SXi Pardee 	{"PMC_ARC_PG_READY",	BIT(14)},
144*d6cd0cc8SXi Pardee 	{}
145*d6cd0cc8SXi Pardee };
146*d6cd0cc8SXi Pardee 
147*d6cd0cc8SXi Pardee const struct pmc_bit_map *cnp_slps0_dbg_maps[] = {
148*d6cd0cc8SXi Pardee 	cnp_slps0_dbg0_map,
149*d6cd0cc8SXi Pardee 	cnp_slps0_dbg1_map,
150*d6cd0cc8SXi Pardee 	cnp_slps0_dbg2_map,
151*d6cd0cc8SXi Pardee 	NULL
152*d6cd0cc8SXi Pardee };
153*d6cd0cc8SXi Pardee 
154*d6cd0cc8SXi Pardee const struct pmc_bit_map cnp_ltr_show_map[] = {
155*d6cd0cc8SXi Pardee 	{"SOUTHPORT_A",		CNP_PMC_LTR_SPA},
156*d6cd0cc8SXi Pardee 	{"SOUTHPORT_B",		CNP_PMC_LTR_SPB},
157*d6cd0cc8SXi Pardee 	{"SATA",		CNP_PMC_LTR_SATA},
158*d6cd0cc8SXi Pardee 	{"GIGABIT_ETHERNET",	CNP_PMC_LTR_GBE},
159*d6cd0cc8SXi Pardee 	{"XHCI",		CNP_PMC_LTR_XHCI},
160*d6cd0cc8SXi Pardee 	{"Reserved",		CNP_PMC_LTR_RESERVED},
161*d6cd0cc8SXi Pardee 	{"ME",			CNP_PMC_LTR_ME},
162*d6cd0cc8SXi Pardee 	/* EVA is Enterprise Value Add, doesn't really exist on PCH */
163*d6cd0cc8SXi Pardee 	{"EVA",			CNP_PMC_LTR_EVA},
164*d6cd0cc8SXi Pardee 	{"SOUTHPORT_C",		CNP_PMC_LTR_SPC},
165*d6cd0cc8SXi Pardee 	{"HD_AUDIO",		CNP_PMC_LTR_AZ},
166*d6cd0cc8SXi Pardee 	{"CNV",			CNP_PMC_LTR_CNV},
167*d6cd0cc8SXi Pardee 	{"LPSS",		CNP_PMC_LTR_LPSS},
168*d6cd0cc8SXi Pardee 	{"SOUTHPORT_D",		CNP_PMC_LTR_SPD},
169*d6cd0cc8SXi Pardee 	{"SOUTHPORT_E",		CNP_PMC_LTR_SPE},
170*d6cd0cc8SXi Pardee 	{"CAMERA",		CNP_PMC_LTR_CAM},
171*d6cd0cc8SXi Pardee 	{"ESPI",		CNP_PMC_LTR_ESPI},
172*d6cd0cc8SXi Pardee 	{"SCC",			CNP_PMC_LTR_SCC},
173*d6cd0cc8SXi Pardee 	{"ISH",			CNP_PMC_LTR_ISH},
174*d6cd0cc8SXi Pardee 	{"UFSX2",		CNP_PMC_LTR_UFSX2},
175*d6cd0cc8SXi Pardee 	{"EMMC",		CNP_PMC_LTR_EMMC},
176*d6cd0cc8SXi Pardee 	/*
177*d6cd0cc8SXi Pardee 	 * Check intel_pmc_core_ids[] users of cnp_reg_map for
178*d6cd0cc8SXi Pardee 	 * a list of core SoCs using this.
179*d6cd0cc8SXi Pardee 	 */
180*d6cd0cc8SXi Pardee 	{"WIGIG",		ICL_PMC_LTR_WIGIG},
181*d6cd0cc8SXi Pardee 	{"THC0",                TGL_PMC_LTR_THC0},
182*d6cd0cc8SXi Pardee 	{"THC1",                TGL_PMC_LTR_THC1},
183*d6cd0cc8SXi Pardee 	/* Below two cannot be used for LTR_IGNORE */
184*d6cd0cc8SXi Pardee 	{"CURRENT_PLATFORM",	CNP_PMC_LTR_CUR_PLT},
185*d6cd0cc8SXi Pardee 	{"AGGREGATED_SYSTEM",	CNP_PMC_LTR_CUR_ASLT},
186*d6cd0cc8SXi Pardee 	{}
187*d6cd0cc8SXi Pardee };
188*d6cd0cc8SXi Pardee 
189*d6cd0cc8SXi Pardee const struct pmc_reg_map cnp_reg_map = {
190*d6cd0cc8SXi Pardee 	.pfear_sts = ext_cnp_pfear_map,
191*d6cd0cc8SXi Pardee 	.slp_s0_offset = CNP_PMC_SLP_S0_RES_COUNTER_OFFSET,
192*d6cd0cc8SXi Pardee 	.slp_s0_res_counter_step = SPT_PMC_SLP_S0_RES_COUNTER_STEP,
193*d6cd0cc8SXi Pardee 	.slps0_dbg_maps = cnp_slps0_dbg_maps,
194*d6cd0cc8SXi Pardee 	.ltr_show_sts = cnp_ltr_show_map,
195*d6cd0cc8SXi Pardee 	.msr_sts = msr_map,
196*d6cd0cc8SXi Pardee 	.slps0_dbg_offset = CNP_PMC_SLPS0_DBG_OFFSET,
197*d6cd0cc8SXi Pardee 	.ltr_ignore_offset = CNP_PMC_LTR_IGNORE_OFFSET,
198*d6cd0cc8SXi Pardee 	.regmap_length = CNP_PMC_MMIO_REG_LEN,
199*d6cd0cc8SXi Pardee 	.ppfear0_offset = CNP_PMC_HOST_PPFEAR0A,
200*d6cd0cc8SXi Pardee 	.ppfear_buckets = CNP_PPFEAR_NUM_ENTRIES,
201*d6cd0cc8SXi Pardee 	.pm_cfg_offset = CNP_PMC_PM_CFG_OFFSET,
202*d6cd0cc8SXi Pardee 	.pm_read_disable_bit = CNP_PMC_READ_DISABLE_BIT,
203*d6cd0cc8SXi Pardee 	.ltr_ignore_max = CNP_NUM_IP_IGN_ALLOWED,
204*d6cd0cc8SXi Pardee 	.etr3_offset = ETR3_OFFSET,
205*d6cd0cc8SXi Pardee };
206*d6cd0cc8SXi Pardee 
207*d6cd0cc8SXi Pardee void cnp_core_init(struct pmc_dev *pmcdev)
208*d6cd0cc8SXi Pardee {
209*d6cd0cc8SXi Pardee 	pmcdev->map = &cnp_reg_map;
210*d6cd0cc8SXi Pardee }
211