mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rajneesh Bhardwaj <rajneesh.bhardwaj@intel.com>
To: platform-driver-x86@vger.kernel.org
Cc: dvhart@infradead.org, andy@infradead.org,
	linux-kernel@vger.kernel.org, vishwanath.somayaji@intel.com,
	srinivas.pandruvada@linux.intel.com,
	Rajneesh Bhardwaj <rajneesh.bhardwaj@intel.com>
Subject: [Patch v1 8/8] platform/x86: intel_pmc_core: Special case for Coffeelake
Date: Fri, 19 Jan 2018 14:28:27 +0530	[thread overview]
Message-ID: <1516352307-20123-9-git-send-email-rajneesh.bhardwaj@intel.com> (raw)
In-Reply-To: <1516352307-20123-1-git-send-email-rajneesh.bhardwaj@intel.com>

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>
---
 drivers/platform/x86/intel_pmc_core.c | 14 ++++++++++++++
 drivers/platform/x86/intel_pmc_core.h |  2 ++
 2 files changed, 16 insertions(+)

diff --git a/drivers/platform/x86/intel_pmc_core.c b/drivers/platform/x86/intel_pmc_core.c
index f0d067a33a56..67e85ee4ab32 100644
--- a/drivers/platform/x86/intel_pmc_core.c
+++ b/drivers/platform/x86/intel_pmc_core.c
@@ -25,6 +25,7 @@
 #include <linux/delay.h>
 #include <linux/io.h>
 #include <linux/module.h>
+#include <linux/pci.h>
 #include <linux/uaccess.h>
 
 #include <asm/cpu_device_id.h>
@@ -536,6 +537,11 @@ static const struct x86_cpu_id intel_pmc_core_ids[] = {
 
 MODULE_DEVICE_TABLE(x86cpu, intel_pmc_core_ids);
 
+static const struct pci_device_id pmc_pci_ids[] = {
+	{ PCI_VDEVICE(INTEL, SPT_PMC_PCI_DEVICE_ID), 0},
+	{ 0, },
+};
+
 static int __init pmc_core_probe(void)
 {
 	const struct x86_cpu_id *cpu_id;
@@ -549,6 +555,14 @@ static int __init pmc_core_probe(void)
 
 	pmcdev->map = (struct pmc_reg_map *)cpu_id->driver_data;
 
+	/*
+	 * Coffeelake has CPU ID of Kabylake and Cannonlake PCH. So here
+	 * Sunrisepoint PCH regmap can't be used. Use Cannonlake PCH regmap
+	 * in this case.
+	 */
+	if (!pci_dev_present(pmc_pci_ids))
+		pmcdev->map = (struct pmc_reg_map *)&cnp_reg_map;
+
 	if (lpit_read_residency_count_address(&slp_s0_addr))
 		pmcdev->base_addr = PMC_BASE_ADDR_DEFAULT;
 	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 @@
 
 #define PMC_BASE_ADDR_DEFAULT			0xFE000000
 
+/* Sunrise Point Power Management Controller PCI Device ID */
+#define SPT_PMC_PCI_DEVICE_ID			0x9d21
 #define SPT_PMC_BASE_ADDR_OFFSET		0x48
 #define SPT_PMC_SLP_S0_RES_COUNTER_OFFSET	0x13c
 #define SPT_PMC_PM_CFG_OFFSET			0x18
-- 
2.7.4

  parent reply	other threads:[~2018-01-19  9:06 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-01-19  8:58 [Patch v1 0/8] platform/x86: intel_pmc_core: Add CFL/CNL Support Rajneesh Bhardwaj
2018-01-19  8:58 ` [Patch v1 1/8] platform/x86: intel_pmc_core: Refactor debugfs entries Rajneesh Bhardwaj
2018-01-19  8:58 ` [Patch v1 2/8] platform/x86: intel_pmc_core: Substitute PCI with CPUID enumeration Rajneesh Bhardwaj
2018-01-19  8:58 ` [Patch v1 3/8] ACPI / LPIT: Export lpit_read_residency_count_address() Rajneesh Bhardwaj
2018-01-26  9:48   ` Andy Shevchenko
2018-01-29  3:09     ` Rafael J. Wysocki
2018-01-31 16:47       ` Andy Shevchenko
2018-01-19  8:58 ` [Patch v1 4/8] platform/x86: intel_pmc_core: Read base address from LPIT Rajneesh Bhardwaj
2018-01-19  8:58 ` [Patch v1 5/8] platform/x86: intel_pmc_core: Convert to ICPU macro Rajneesh Bhardwaj
2018-01-19  8:58 ` [Patch v1 6/8] x86/cpu: Add Cannonlake to Intel family Rajneesh Bhardwaj
2018-01-26 12:39   ` Andy Shevchenko
2018-01-31 17:27     ` Rajneesh Bhardwaj
2018-01-31 17:44       ` Thomas Gleixner
2018-01-31 18:31         ` Andy Shevchenko
2018-01-19  8:58 ` [Patch v1 7/8] platform/x86: intel_pmc_core: Add CannonLake PCH support Rajneesh Bhardwaj
2018-01-19  8:58 ` Rajneesh Bhardwaj [this message]
2018-01-26 12:45 ` [Patch v1 0/8] platform/x86: intel_pmc_core: Add CFL/CNL Support Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1516352307-20123-9-git-send-email-rajneesh.bhardwaj@intel.com \
    --to=rajneesh.bhardwaj@intel.com \
    --cc=andy@infradead.org \
    --cc=dvhart@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=platform-driver-x86@vger.kernel.org \
    --cc=srinivas.pandruvada@linux.intel.com \
    --cc=vishwanath.somayaji@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®