xref: /linux/drivers/platform/x86/intel/pmc/icl.c (revision 284a2f899676407b5bed8c1fb37eb9d636e5477d)
1fd2ed6dbSXi Pardee // SPDX-License-Identifier: GPL-2.0
2fd2ed6dbSXi Pardee /*
3fd2ed6dbSXi Pardee  * This file contains platform specific structure definitions
4fd2ed6dbSXi Pardee  * and init function used by Ice Lake PCH.
5fd2ed6dbSXi Pardee  *
6fd2ed6dbSXi Pardee  * Copyright (c) 2022, Intel Corporation.
7fd2ed6dbSXi Pardee  * All Rights Reserved.
8fd2ed6dbSXi Pardee  *
9fd2ed6dbSXi Pardee  */
10fd2ed6dbSXi Pardee 
11fd2ed6dbSXi Pardee #include "core.h"
12fd2ed6dbSXi Pardee 
13fd2ed6dbSXi Pardee const struct pmc_bit_map icl_pfear_map[] = {
14fd2ed6dbSXi Pardee 	{"RES_65",		BIT(0)},
15fd2ed6dbSXi Pardee 	{"RES_66",		BIT(1)},
16fd2ed6dbSXi Pardee 	{"RES_67",		BIT(2)},
17fd2ed6dbSXi Pardee 	{"TAM",			BIT(3)},
18fd2ed6dbSXi Pardee 	{"GBETSN",		BIT(4)},
19fd2ed6dbSXi Pardee 	{"TBTLSX",		BIT(5)},
20fd2ed6dbSXi Pardee 	{"RES_71",		BIT(6)},
21fd2ed6dbSXi Pardee 	{"RES_72",		BIT(7)},
22fd2ed6dbSXi Pardee 	{}
23fd2ed6dbSXi Pardee };
24fd2ed6dbSXi Pardee 
25fd2ed6dbSXi Pardee const struct pmc_bit_map *ext_icl_pfear_map[] = {
26fd2ed6dbSXi Pardee 	/*
27fd2ed6dbSXi Pardee 	 * Check intel_pmc_core_ids[] users of icl_reg_map for
28fd2ed6dbSXi Pardee 	 * a list of core SoCs using this.
29fd2ed6dbSXi Pardee 	 */
30fd2ed6dbSXi Pardee 	cnp_pfear_map,
31fd2ed6dbSXi Pardee 	icl_pfear_map,
32fd2ed6dbSXi Pardee 	NULL
33fd2ed6dbSXi Pardee };
34fd2ed6dbSXi Pardee 
35fd2ed6dbSXi Pardee const struct pmc_reg_map icl_reg_map = {
36fd2ed6dbSXi Pardee 	.pfear_sts = ext_icl_pfear_map,
37fd2ed6dbSXi Pardee 	.slp_s0_offset = CNP_PMC_SLP_S0_RES_COUNTER_OFFSET,
38fd2ed6dbSXi Pardee 	.slp_s0_res_counter_step = ICL_PMC_SLP_S0_RES_COUNTER_STEP,
39fd2ed6dbSXi Pardee 	.slps0_dbg_maps = cnp_slps0_dbg_maps,
40fd2ed6dbSXi Pardee 	.ltr_show_sts = cnp_ltr_show_map,
41fd2ed6dbSXi Pardee 	.msr_sts = msr_map,
42fd2ed6dbSXi Pardee 	.slps0_dbg_offset = CNP_PMC_SLPS0_DBG_OFFSET,
43fd2ed6dbSXi Pardee 	.ltr_ignore_offset = CNP_PMC_LTR_IGNORE_OFFSET,
44fd2ed6dbSXi Pardee 	.regmap_length = CNP_PMC_MMIO_REG_LEN,
45fd2ed6dbSXi Pardee 	.ppfear0_offset = CNP_PMC_HOST_PPFEAR0A,
46fd2ed6dbSXi Pardee 	.ppfear_buckets = ICL_PPFEAR_NUM_ENTRIES,
47fd2ed6dbSXi Pardee 	.pm_cfg_offset = CNP_PMC_PM_CFG_OFFSET,
48fd2ed6dbSXi Pardee 	.pm_read_disable_bit = CNP_PMC_READ_DISABLE_BIT,
49fd2ed6dbSXi Pardee 	.ltr_ignore_max = ICL_NUM_IP_IGN_ALLOWED,
50fd2ed6dbSXi Pardee 	.etr3_offset = ETR3_OFFSET,
51fd2ed6dbSXi Pardee };
52fd2ed6dbSXi Pardee 
icl_core_init(struct pmc_dev * pmcdev)5380495120SXi Pardee int icl_core_init(struct pmc_dev *pmcdev)
54fd2ed6dbSXi Pardee {
551c709ae1SXi Pardee 	struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN];
56*2e35e3aaSXi Pardee 	int ret;
571c709ae1SXi Pardee 
581c709ae1SXi Pardee 	pmc->map = &icl_reg_map;
59*2e35e3aaSXi Pardee 
60*2e35e3aaSXi Pardee 	ret = get_primary_reg_base(pmc);
61*2e35e3aaSXi Pardee 	if (ret)
62*2e35e3aaSXi Pardee 		return ret;
63*2e35e3aaSXi Pardee 
64*2e35e3aaSXi Pardee 	pmc_core_get_low_power_modes(pmcdev);
65*2e35e3aaSXi Pardee 
66*2e35e3aaSXi Pardee 	return ret;
67fd2ed6dbSXi Pardee }
68