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