Received: by 10.223.176.46 with SMTP id f43csp751310wra; Fri, 19 Jan 2018 01:08:05 -0800 (PST) X-Google-Smtp-Source: ACJfBovb8agcCbAsop6GW2GPWGJaovBkCvfwofSaJ9BaIlzA44Hrjh7uxJvpd9MY7fkZHqIda0uL X-Received: by 10.99.135.195 with SMTP id i186mr3843314pge.418.1516352885530; Fri, 19 Jan 2018 01:08:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516352885; cv=none; d=google.com; s=arc-20160816; b=bn8/hwrcioqWfOBChS3reaeLXup/8A5ps5XqK6srekvqPdJ3jGqPWjHZVrfbP9K/wW wTskvIf7NjqSE+M5/obGIVVGTBsZVQwHLGqTXChekGmQfcwdWUAHDqtrZIyD9ksY+eF3 JUOjaOvPXZSrE7r53nCBlKiZ8HzK+Xh1d3euWtfXcYsNk/4NRPRTzr2UOGGxuDQPFrSv lpcs3xg1+ykMLmjf/t8KRFVXFDxJC0+yuNW4r8fQdW3CQUjTEdsVRDDKnYLiP1wylRoN rHct7CdP+ltqMkd5oXZiNf6dDvdHpfZB5D+KOvv1rqihYEwT++6SHjtz8Gof8TTqJGrO Go1A== 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=p+8TYyqPAGWes0nthXacykM1Z/+XKfDx8EXusq1Ufak=; b=wm9vjpeauVGO4eFCOMtl9IsK+o1Z51grpjwWtB0dXHONvcS9dAI51i3vN45+6I22/x cpEmBcngmv0LeU5YNddvs6RRgyPJj/P8mWSVg4Dkn81pwc8B30jWMK/vh8Eu7H7dpapL 5UxAyDttRzuUHBIHsjyxiEVSOUqm6YHZZfuq/bBJ4EP/9qoZKuMLBOY9Mbpas+ZcIORI 8tVIAsoJSoVmyTQcBeFSReOA9RrjMY0+bH4wf8KDrbigepCcFjYTKCn2eeBPddb5GewT P2F8qgIY6osw2EznHVro+N1wR3MVUOCjOI5+bWP0YUEYKmCl/WTUhis3CHDdKPMvkQgU tetw== 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 b17si8955396pfl.222.2018.01.19.01.07.51; Fri, 19 Jan 2018 01:08:05 -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 S1755387AbeASJGh (ORCPT + 99 others); Fri, 19 Jan 2018 04:06:37 -0500 Received: from mga06.intel.com ([134.134.136.31]:52690 "EHLO mga06.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755542AbeASJEZ (ORCPT ); Fri, 19 Jan 2018 04:04:25 -0500 X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Jan 2018 01:04:10 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,381,1511856000"; d="scan'208";a="197007779" Received: from raj-desk2.iind.intel.com ([10.223.107.30]) by fmsmga006.fm.intel.com with ESMTP; 19 Jan 2018 01:04: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 v1 8/8] platform/x86: intel_pmc_core: Special case for Coffeelake Date: Fri, 19 Jan 2018 14:28:27 +0530 Message-Id: <1516352307-20123-9-git-send-email-rajneesh.bhardwaj@intel.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1516352307-20123-1-git-send-email-rajneesh.bhardwaj@intel.com> References: <1516352307-20123-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 f0d067a33a56..67e85ee4ab32 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 @@ -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