Received: by 10.223.176.5 with SMTP id f5csp765430wra; Fri, 2 Feb 2018 05:51:37 -0800 (PST) X-Google-Smtp-Source: AH8x225YAgzIkm8FLpz9ir+888ULQSQ9QtgabMALfFDpwKWF9bWXkL2lfBKz9TbkFcky706GZs53 X-Received: by 10.99.103.198 with SMTP id b189mr6815485pgc.20.1517579496708; Fri, 02 Feb 2018 05:51:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517579496; cv=none; d=google.com; s=arc-20160816; b=hgznA+V+zV1UkYwklZk5mmHmLljHSjUIWe8NUuGCJx0Pgw0ODwLqWK5RcOA7sPQPpR m8u8jfEoT9d31o0c6gwGZRA57nr3ee9RCmdmizLZCmLzLML3eXuUPFrGrHlVZjX73v2o xh40kxYRF8GpgLIzIaLwBzpLRlU9oemsFXg1ab12PQ6scUUwy3WzBO5tyMBGF+Avvspu uLdJrHk7LdT8UdkxJeT9ws73Y/G/9x7VIvwjAyi7os3S8hcpuS0QRe6OnXC1Qx7p8KFF EdWj9MYOa1yTJuOlRfsm12SF+4ZTNQpYJcjvrL/31LK+tm8D7+zU6YC98+ImHG4iQIuN siWw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=fs2/L8WB29hLvMDLo5oLjOV2dvnzsCIoyPZR7TMQrSg=; b=DoivURPQWKmQpgTkXbRPZORFdJ1f26hEm8rqNQ7bZjR/qOlr1JurIMg1deXe4B4c2I oy7BeAnrZOVMEeLg3+cTjLM/w1nZ3c/By0a34h9BbqNMXhQvvK1WOe/VQqnIIREOW98Z XrE5ghMcWgSIAX5kHLJq+aQjq/xC4X+LW9Ei/FunLWmaghKlzujCZPOZEcDPGghk5Ufk DKrS5MHQUkPAY+6QQsBe7Iunedl3DEyI9gcO6XWbUCSJHcAYQk5dC2sbc//7u/N4QJKs Y/U4S5WSa3b60DQ8GJt2C5gF9lA+Qp9H91bG7n1j28XzurP2oTtiEi6QY3BsF6o9aEry EV2w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f15-v6si1845216plr.336.2018.02.02.05.51.21; Fri, 02 Feb 2018 05:51:36 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752162AbeBBNuN (ORCPT + 99 others); Fri, 2 Feb 2018 08:50:13 -0500 Received: from mga07.intel.com ([134.134.136.100]:38331 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752007AbeBBNtL (ORCPT ); Fri, 2 Feb 2018 08:49:11 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 02 Feb 2018 05:49:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,448,1511856000"; d="scan'208";a="14968356" Received: from raj-desk2.iind.intel.com ([10.223.107.30]) by orsmga008.jf.intel.com with ESMTP; 02 Feb 2018 05:49:08 -0800 From: Rajneesh Bhardwaj 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 Subject: [Patch v2 5/5] platform/x86: intel_pmc_core: Special case for Coffeelake Date: Fri, 2 Feb 2018 19:13:37 +0530 Message-Id: <1517579017-19935-6-git-send-email-rajneesh.bhardwaj@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1517579017-19935-1-git-send-email-rajneesh.bhardwaj@intel.com> References: <1517579017-19935-1-git-send-email-rajneesh.bhardwaj@intel.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 Signed-off-by: Rajneesh Bhardwaj --- 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 a255c4b0f7a8..b89bef140c8b 100644 --- a/drivers/platform/x86/intel_pmc_core.c +++ b/drivers/platform/x86/intel_pmc_core.c @@ -25,6 +25,7 @@ #include #include #include +#include #include #include @@ -537,6 +538,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) { struct pmc_dev *pmcdev = &pmc; @@ -550,6 +556,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