summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRajneesh Bhardwaj <rajneesh.bhardwaj@intel.com>2018-02-02 08:43:37 -0500
committerAndy Shevchenko <andriy.shevchenko@linux.intel.com>2018-02-04 08:55:53 -0500
commit661405bd817b209ac9bd4812c63d90873a7f2993 (patch)
treecd836a30d362c11ac3b89d467de903f51bb1a399
parent291101f6a73566f5d1ab597784288c5bc85906fd (diff)
platform/x86: intel_pmc_core: Special case for Coffeelake
Intel CoffeeLake SoC uses CPU ID of KabyLake but has Cannonlake PCH, so in this case PMC register details from Cannonlake PCH must be used. In order to identify whether the given platform is Coffeelake, scan for the Sunrisepoint PMC PCI Id. KBL CPUID SPT PCIID ------------------------------------ KBL | Y | Y | ------------------------------------ CFL | Y | N | ------------------------------------ Signed-off-by: Srinivas Pandruvada <srinivas.pandruvada@linux.intel.com> Signed-off-by: Rajneesh Bhardwaj <rajneesh.bhardwaj@intel.com> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
-rw-r--r--drivers/platform/x86/intel_pmc_core.c14
-rw-r--r--drivers/platform/x86/intel_pmc_core.h2
2 files changed, 16 insertions, 0 deletions
diff --git a/drivers/platform/x86/intel_pmc_core.c b/drivers/platform/x86/intel_pmc_core.c
index a255c4b0f7a8..43bbe74743d9 100644
--- a/drivers/platform/x86/intel_pmc_core.c
+++ b/drivers/platform/x86/intel_pmc_core.c
@@ -25,6 +25,7 @@
25#include <linux/delay.h> 25#include <linux/delay.h>
26#include <linux/io.h> 26#include <linux/io.h>
27#include <linux/module.h> 27#include <linux/module.h>
28#include <linux/pci.h>
28#include <linux/uaccess.h> 29#include <linux/uaccess.h>
29 30
30#include <asm/cpu_device_id.h> 31#include <asm/cpu_device_id.h>
@@ -537,6 +538,11 @@ static const struct x86_cpu_id intel_pmc_core_ids[] = {
537 538
538MODULE_DEVICE_TABLE(x86cpu, intel_pmc_core_ids); 539MODULE_DEVICE_TABLE(x86cpu, intel_pmc_core_ids);
539 540
541static const struct pci_device_id pmc_pci_ids[] = {
542 { PCI_VDEVICE(INTEL, SPT_PMC_PCI_DEVICE_ID), 0},
543 { 0, },
544};
545
540static int __init pmc_core_probe(void) 546static int __init pmc_core_probe(void)
541{ 547{
542 struct pmc_dev *pmcdev = &pmc; 548 struct pmc_dev *pmcdev = &pmc;
@@ -550,6 +556,14 @@ static int __init pmc_core_probe(void)
550 556
551 pmcdev->map = (struct pmc_reg_map *)cpu_id->driver_data; 557 pmcdev->map = (struct pmc_reg_map *)cpu_id->driver_data;
552 558
559 /*
560 * Coffeelake has CPU ID of Kabylake and Cannonlake PCH. So here
561 * Sunrisepoint PCH regmap can't be used. Use Cannonlake PCH regmap
562 * in this case.
563 */
564 if (!pci_dev_present(pmc_pci_ids))
565 pmcdev->map = &cnp_reg_map;
566
553 if (lpit_read_residency_count_address(&slp_s0_addr)) 567 if (lpit_read_residency_count_address(&slp_s0_addr))
554 pmcdev->base_addr = PMC_BASE_ADDR_DEFAULT; 568 pmcdev->base_addr = PMC_BASE_ADDR_DEFAULT;
555 else 569 else
diff --git a/drivers/platform/x86/intel_pmc_core.h b/drivers/platform/x86/intel_pmc_core.h
index 8b7731e6dea2..5fa5f97870aa 100644
--- a/drivers/platform/x86/intel_pmc_core.h
+++ b/drivers/platform/x86/intel_pmc_core.h
@@ -23,6 +23,8 @@
23 23
24#define PMC_BASE_ADDR_DEFAULT 0xFE000000 24#define PMC_BASE_ADDR_DEFAULT 0xFE000000
25 25
26/* Sunrise Point Power Management Controller PCI Device ID */
27#define SPT_PMC_PCI_DEVICE_ID 0x9d21
26#define SPT_PMC_BASE_ADDR_OFFSET 0x48 28#define SPT_PMC_BASE_ADDR_OFFSET 0x48
27#define SPT_PMC_SLP_S0_RES_COUNTER_OFFSET 0x13c 29#define SPT_PMC_SLP_S0_RES_COUNTER_OFFSET 0x13c
28#define SPT_PMC_PM_CFG_OFFSET 0x18 30#define SPT_PMC_PM_CFG_OFFSET 0x18