xref: /openbmc/linux/drivers/platform/x86/intel/pmc/spt.c (revision 2612e3bbc0386368a850140a6c9b990cd496a5ec)
1f23e21a3SRajvi Jingar // SPDX-License-Identifier: GPL-2.0
2f23e21a3SRajvi Jingar /*
3f23e21a3SRajvi Jingar  * This file contains platform specific structure definitions
4f23e21a3SRajvi Jingar  * and init function used by Sunrise Point PCH.
5f23e21a3SRajvi Jingar  *
6f23e21a3SRajvi Jingar  * Copyright (c) 2022, Intel Corporation.
7f23e21a3SRajvi Jingar  * All Rights Reserved.
8f23e21a3SRajvi Jingar  *
9f23e21a3SRajvi Jingar  */
10f23e21a3SRajvi Jingar 
11f23e21a3SRajvi Jingar #include "core.h"
12f23e21a3SRajvi Jingar 
13f23e21a3SRajvi Jingar const struct pmc_bit_map spt_pll_map[] = {
14f23e21a3SRajvi Jingar 	{"MIPI PLL",			SPT_PMC_BIT_MPHY_CMN_LANE0},
15f23e21a3SRajvi Jingar 	{"GEN2 USB2PCIE2 PLL",		SPT_PMC_BIT_MPHY_CMN_LANE1},
16f23e21a3SRajvi Jingar 	{"DMIPCIE3 PLL",		SPT_PMC_BIT_MPHY_CMN_LANE2},
17f23e21a3SRajvi Jingar 	{"SATA PLL",			SPT_PMC_BIT_MPHY_CMN_LANE3},
18f23e21a3SRajvi Jingar 	{}
19f23e21a3SRajvi Jingar };
20f23e21a3SRajvi Jingar 
21f23e21a3SRajvi Jingar const struct pmc_bit_map spt_mphy_map[] = {
22f23e21a3SRajvi Jingar 	{"MPHY CORE LANE 0",           SPT_PMC_BIT_MPHY_LANE0},
23f23e21a3SRajvi Jingar 	{"MPHY CORE LANE 1",           SPT_PMC_BIT_MPHY_LANE1},
24f23e21a3SRajvi Jingar 	{"MPHY CORE LANE 2",           SPT_PMC_BIT_MPHY_LANE2},
25f23e21a3SRajvi Jingar 	{"MPHY CORE LANE 3",           SPT_PMC_BIT_MPHY_LANE3},
26f23e21a3SRajvi Jingar 	{"MPHY CORE LANE 4",           SPT_PMC_BIT_MPHY_LANE4},
27f23e21a3SRajvi Jingar 	{"MPHY CORE LANE 5",           SPT_PMC_BIT_MPHY_LANE5},
28f23e21a3SRajvi Jingar 	{"MPHY CORE LANE 6",           SPT_PMC_BIT_MPHY_LANE6},
29f23e21a3SRajvi Jingar 	{"MPHY CORE LANE 7",           SPT_PMC_BIT_MPHY_LANE7},
30f23e21a3SRajvi Jingar 	{"MPHY CORE LANE 8",           SPT_PMC_BIT_MPHY_LANE8},
31f23e21a3SRajvi Jingar 	{"MPHY CORE LANE 9",           SPT_PMC_BIT_MPHY_LANE9},
32f23e21a3SRajvi Jingar 	{"MPHY CORE LANE 10",          SPT_PMC_BIT_MPHY_LANE10},
33f23e21a3SRajvi Jingar 	{"MPHY CORE LANE 11",          SPT_PMC_BIT_MPHY_LANE11},
34f23e21a3SRajvi Jingar 	{"MPHY CORE LANE 12",          SPT_PMC_BIT_MPHY_LANE12},
35f23e21a3SRajvi Jingar 	{"MPHY CORE LANE 13",          SPT_PMC_BIT_MPHY_LANE13},
36f23e21a3SRajvi Jingar 	{"MPHY CORE LANE 14",          SPT_PMC_BIT_MPHY_LANE14},
37f23e21a3SRajvi Jingar 	{"MPHY CORE LANE 15",          SPT_PMC_BIT_MPHY_LANE15},
38f23e21a3SRajvi Jingar 	{}
39f23e21a3SRajvi Jingar };
40f23e21a3SRajvi Jingar 
41f23e21a3SRajvi Jingar const struct pmc_bit_map spt_pfear_map[] = {
42f23e21a3SRajvi Jingar 	{"PMC",				SPT_PMC_BIT_PMC},
43f23e21a3SRajvi Jingar 	{"OPI-DMI",			SPT_PMC_BIT_OPI},
44f23e21a3SRajvi Jingar 	{"SPI / eSPI",			SPT_PMC_BIT_SPI},
45f23e21a3SRajvi Jingar 	{"XHCI",			SPT_PMC_BIT_XHCI},
46f23e21a3SRajvi Jingar 	{"SPA",				SPT_PMC_BIT_SPA},
47f23e21a3SRajvi Jingar 	{"SPB",				SPT_PMC_BIT_SPB},
48f23e21a3SRajvi Jingar 	{"SPC",				SPT_PMC_BIT_SPC},
49f23e21a3SRajvi Jingar 	{"GBE",				SPT_PMC_BIT_GBE},
50f23e21a3SRajvi Jingar 	{"SATA",			SPT_PMC_BIT_SATA},
51f23e21a3SRajvi Jingar 	{"HDA-PGD0",			SPT_PMC_BIT_HDA_PGD0},
52f23e21a3SRajvi Jingar 	{"HDA-PGD1",			SPT_PMC_BIT_HDA_PGD1},
53f23e21a3SRajvi Jingar 	{"HDA-PGD2",			SPT_PMC_BIT_HDA_PGD2},
54f23e21a3SRajvi Jingar 	{"HDA-PGD3",			SPT_PMC_BIT_HDA_PGD3},
55f23e21a3SRajvi Jingar 	{"RSVD",			SPT_PMC_BIT_RSVD_0B},
56f23e21a3SRajvi Jingar 	{"LPSS",			SPT_PMC_BIT_LPSS},
57f23e21a3SRajvi Jingar 	{"LPC",				SPT_PMC_BIT_LPC},
58f23e21a3SRajvi Jingar 	{"SMB",				SPT_PMC_BIT_SMB},
59f23e21a3SRajvi Jingar 	{"ISH",				SPT_PMC_BIT_ISH},
60f23e21a3SRajvi Jingar 	{"P2SB",			SPT_PMC_BIT_P2SB},
61f23e21a3SRajvi Jingar 	{"DFX",				SPT_PMC_BIT_DFX},
62f23e21a3SRajvi Jingar 	{"SCC",				SPT_PMC_BIT_SCC},
63f23e21a3SRajvi Jingar 	{"RSVD",			SPT_PMC_BIT_RSVD_0C},
64f23e21a3SRajvi Jingar 	{"FUSE",			SPT_PMC_BIT_FUSE},
65f23e21a3SRajvi Jingar 	{"CAMERA",			SPT_PMC_BIT_CAMREA},
66f23e21a3SRajvi Jingar 	{"RSVD",			SPT_PMC_BIT_RSVD_0D},
67f23e21a3SRajvi Jingar 	{"USB3-OTG",			SPT_PMC_BIT_USB3_OTG},
68f23e21a3SRajvi Jingar 	{"EXI",				SPT_PMC_BIT_EXI},
69f23e21a3SRajvi Jingar 	{"CSE",				SPT_PMC_BIT_CSE},
70f23e21a3SRajvi Jingar 	{"CSME_KVM",			SPT_PMC_BIT_CSME_KVM},
71f23e21a3SRajvi Jingar 	{"CSME_PMT",			SPT_PMC_BIT_CSME_PMT},
72f23e21a3SRajvi Jingar 	{"CSME_CLINK",			SPT_PMC_BIT_CSME_CLINK},
73f23e21a3SRajvi Jingar 	{"CSME_PTIO",			SPT_PMC_BIT_CSME_PTIO},
74f23e21a3SRajvi Jingar 	{"CSME_USBR",			SPT_PMC_BIT_CSME_USBR},
75f23e21a3SRajvi Jingar 	{"CSME_SUSRAM",			SPT_PMC_BIT_CSME_SUSRAM},
76f23e21a3SRajvi Jingar 	{"CSME_SMT",			SPT_PMC_BIT_CSME_SMT},
77f23e21a3SRajvi Jingar 	{"RSVD",			SPT_PMC_BIT_RSVD_1A},
78f23e21a3SRajvi Jingar 	{"CSME_SMS2",			SPT_PMC_BIT_CSME_SMS2},
79f23e21a3SRajvi Jingar 	{"CSME_SMS1",			SPT_PMC_BIT_CSME_SMS1},
80f23e21a3SRajvi Jingar 	{"CSME_RTC",			SPT_PMC_BIT_CSME_RTC},
81f23e21a3SRajvi Jingar 	{"CSME_PSF",			SPT_PMC_BIT_CSME_PSF},
82f23e21a3SRajvi Jingar 	{}
83f23e21a3SRajvi Jingar };
84f23e21a3SRajvi Jingar 
85f23e21a3SRajvi Jingar const struct pmc_bit_map *ext_spt_pfear_map[] = {
86f23e21a3SRajvi Jingar 	/*
87f23e21a3SRajvi Jingar 	 * Check intel_pmc_core_ids[] users of spt_reg_map for
88f23e21a3SRajvi Jingar 	 * a list of core SoCs using this.
89f23e21a3SRajvi Jingar 	 */
90f23e21a3SRajvi Jingar 	spt_pfear_map,
91f23e21a3SRajvi Jingar 	NULL
92f23e21a3SRajvi Jingar };
93f23e21a3SRajvi Jingar 
94f23e21a3SRajvi Jingar const struct pmc_bit_map spt_ltr_show_map[] = {
95f23e21a3SRajvi Jingar 	{"SOUTHPORT_A",		SPT_PMC_LTR_SPA},
96f23e21a3SRajvi Jingar 	{"SOUTHPORT_B",		SPT_PMC_LTR_SPB},
97f23e21a3SRajvi Jingar 	{"SATA",		SPT_PMC_LTR_SATA},
98f23e21a3SRajvi Jingar 	{"GIGABIT_ETHERNET",	SPT_PMC_LTR_GBE},
99f23e21a3SRajvi Jingar 	{"XHCI",		SPT_PMC_LTR_XHCI},
100f23e21a3SRajvi Jingar 	{"Reserved",		SPT_PMC_LTR_RESERVED},
101f23e21a3SRajvi Jingar 	{"ME",			SPT_PMC_LTR_ME},
102f23e21a3SRajvi Jingar 	/* EVA is Enterprise Value Add, doesn't really exist on PCH */
103f23e21a3SRajvi Jingar 	{"EVA",			SPT_PMC_LTR_EVA},
104f23e21a3SRajvi Jingar 	{"SOUTHPORT_C",		SPT_PMC_LTR_SPC},
105f23e21a3SRajvi Jingar 	{"HD_AUDIO",		SPT_PMC_LTR_AZ},
106f23e21a3SRajvi Jingar 	{"LPSS",		SPT_PMC_LTR_LPSS},
107f23e21a3SRajvi Jingar 	{"SOUTHPORT_D",		SPT_PMC_LTR_SPD},
108f23e21a3SRajvi Jingar 	{"SOUTHPORT_E",		SPT_PMC_LTR_SPE},
109f23e21a3SRajvi Jingar 	{"CAMERA",		SPT_PMC_LTR_CAM},
110f23e21a3SRajvi Jingar 	{"ESPI",		SPT_PMC_LTR_ESPI},
111f23e21a3SRajvi Jingar 	{"SCC",			SPT_PMC_LTR_SCC},
112f23e21a3SRajvi Jingar 	{"ISH",			SPT_PMC_LTR_ISH},
113f23e21a3SRajvi Jingar 	/* Below two cannot be used for LTR_IGNORE */
114f23e21a3SRajvi Jingar 	{"CURRENT_PLATFORM",	SPT_PMC_LTR_CUR_PLT},
115f23e21a3SRajvi Jingar 	{"AGGREGATED_SYSTEM",	SPT_PMC_LTR_CUR_ASLT},
116f23e21a3SRajvi Jingar 	{}
117f23e21a3SRajvi Jingar };
118f23e21a3SRajvi Jingar 
119f23e21a3SRajvi Jingar const struct pmc_reg_map spt_reg_map = {
120f23e21a3SRajvi Jingar 	.pfear_sts = ext_spt_pfear_map,
121f23e21a3SRajvi Jingar 	.mphy_sts = spt_mphy_map,
122f23e21a3SRajvi Jingar 	.pll_sts = spt_pll_map,
123f23e21a3SRajvi Jingar 	.ltr_show_sts = spt_ltr_show_map,
124f23e21a3SRajvi Jingar 	.msr_sts = msr_map,
125f23e21a3SRajvi Jingar 	.slp_s0_offset = SPT_PMC_SLP_S0_RES_COUNTER_OFFSET,
126f23e21a3SRajvi Jingar 	.slp_s0_res_counter_step = SPT_PMC_SLP_S0_RES_COUNTER_STEP,
127f23e21a3SRajvi Jingar 	.ltr_ignore_offset = SPT_PMC_LTR_IGNORE_OFFSET,
128f23e21a3SRajvi Jingar 	.regmap_length = SPT_PMC_MMIO_REG_LEN,
129f23e21a3SRajvi Jingar 	.ppfear0_offset = SPT_PMC_XRAM_PPFEAR0A,
130f23e21a3SRajvi Jingar 	.ppfear_buckets = SPT_PPFEAR_NUM_ENTRIES,
131f23e21a3SRajvi Jingar 	.pm_cfg_offset = SPT_PMC_PM_CFG_OFFSET,
132f23e21a3SRajvi Jingar 	.pm_read_disable_bit = SPT_PMC_READ_DISABLE_BIT,
133f23e21a3SRajvi Jingar 	.ltr_ignore_max = SPT_NUM_IP_IGN_ALLOWED,
134f23e21a3SRajvi Jingar 	.pm_vric1_offset = SPT_PMC_VRIC1_OFFSET,
135f23e21a3SRajvi Jingar };
136f23e21a3SRajvi Jingar 
spt_core_init(struct pmc_dev * pmcdev)13780495120SXi Pardee int spt_core_init(struct pmc_dev *pmcdev)
138f23e21a3SRajvi Jingar {
139*1c709ae1SXi Pardee 	struct pmc *pmc = pmcdev->pmcs[PMC_IDX_MAIN];
140*1c709ae1SXi Pardee 
141*1c709ae1SXi Pardee 	pmc->map = &spt_reg_map;
142*1c709ae1SXi Pardee 	return get_primary_reg_base(pmc);
143f23e21a3SRajvi Jingar }
144