[linux-yocto] [4.12][PATCH 14/19] platform/x86: intel_pmc_core: Read base address from LPIT

2018-03-22 Thread Liwei Song
From: Srinivas Pandruvada 

commit 745698c37c08f48fb5ad3c0cb7ee955bd5701d4a upstream.

Read SLP_S0 address from ACPI LPIT table when present and use PMC
specific SLP_S0 offset to get the base address of PMC MMIO.

Signed-off-by: Rajneesh Bhardwaj 
Signed-off-by: Srinivas Pandruvada 
Signed-off-by: Andy Shevchenko 
Signed-off-by: Liwei Song 
---
 drivers/platform/x86/intel_pmc_core.c | 9 -
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/platform/x86/intel_pmc_core.c 
b/drivers/platform/x86/intel_pmc_core.c
index 5c401e17cfb6..bb80aed4c3c1 100644
--- a/drivers/platform/x86/intel_pmc_core.c
+++ b/drivers/platform/x86/intel_pmc_core.c
@@ -20,6 +20,7 @@
 
 #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
 
+#include 
 #include 
 #include 
 #include 
@@ -455,6 +456,7 @@ static int __init pmc_core_probe(void)
 {
struct pmc_dev *pmcdev = 
const struct x86_cpu_id *cpu_id;
+   u64 slp_s0_addr;
int err;
 
cpu_id = x86_match_cpu(intel_pmc_core_ids);
@@ -462,7 +464,12 @@ static int __init pmc_core_probe(void)
return -ENODEV;
 
pmcdev->map = (struct pmc_reg_map *)cpu_id->driver_data;
-   pmcdev->base_addr = PMC_BASE_ADDR_DEFAULT;
+
+   if (lpit_read_residency_count_address(_s0_addr))
+   pmcdev->base_addr = PMC_BASE_ADDR_DEFAULT;
+   else
+   pmcdev->base_addr = slp_s0_addr - pmcdev->map->slp_s0_offset;
+
pmcdev->regbase = ioremap(pmcdev->base_addr,
  pmcdev->map->regmap_length);
if (!pmcdev->regbase)
-- 
2.7.4

-- 
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto


[linux-yocto] [4.12][PATCH 15/19] platform/x86: intel_pmc_core: Add CannonLake PCH support

2018-03-22 Thread Liwei Song
From: Rajneesh Bhardwaj 

commit 291101f6a73566f5d1ab597784288c5bc85906fd upstream.

This adds support for Cannonlake PCH which is used by Cannonlake and
Coffeelake SoCs.

Signed-off-by: Srinivas Pandruvada 
Signed-off-by: Rajneesh Bhardwaj 
Signed-off-by: Andy Shevchenko 
Signed-off-by: Liwei Song 
---
 drivers/platform/x86/intel_pmc_core.c | 85 +++
 drivers/platform/x86/intel_pmc_core.h | 11 +
 2 files changed, 96 insertions(+)

diff --git a/drivers/platform/x86/intel_pmc_core.c 
b/drivers/platform/x86/intel_pmc_core.c
index bb80aed4c3c1..a255c4b0f7a8 100644
--- a/drivers/platform/x86/intel_pmc_core.c
+++ b/drivers/platform/x86/intel_pmc_core.c
@@ -122,6 +122,90 @@ static const struct pmc_reg_map spt_reg_map = {
.pm_read_disable_bit = SPT_PMC_READ_DISABLE_BIT,
 };
 
+/* Cannonlake: PGD PFET Enable Ack Status Register(s) bitmap */
+static const struct pmc_bit_map cnp_pfear_map[] = {
+   {"PMC", BIT(0)},
+   {"OPI-DMI", BIT(1)},
+   {"SPI/eSPI",BIT(2)},
+   {"XHCI",BIT(3)},
+   {"SPA", BIT(4)},
+   {"SPB", BIT(5)},
+   {"SPC", BIT(6)},
+   {"GBE", BIT(7)},
+
+   {"SATA",BIT(0)},
+   {"HDA_PGD0",BIT(1)},
+   {"HDA_PGD1",BIT(2)},
+   {"HDA_PGD2",BIT(3)},
+   {"HDA_PGD3",BIT(4)},
+   {"SPD", BIT(5)},
+   {"LPSS",BIT(6)},
+   {"LPC", BIT(7)},
+
+   {"SMB", BIT(0)},
+   {"ISH", BIT(1)},
+   {"P2SB",BIT(2)},
+   {"NPK_VNN", BIT(3)},
+   {"SDX", BIT(4)},
+   {"SPE", BIT(5)},
+   {"Fuse",BIT(6)},
+   {"Res_23",  BIT(7)},
+
+   {"CSME_FSC",BIT(0)},
+   {"USB3_OTG",BIT(1)},
+   {"EXI", BIT(2)},
+   {"CSE", BIT(3)},
+   {"csme_kvm",BIT(4)},
+   {"csme_pmt",BIT(5)},
+   {"csme_clink",  BIT(6)},
+   {"csme_ptio",   BIT(7)},
+
+   {"csme_usbr",   BIT(0)},
+   {"csme_susram", BIT(1)},
+   {"csme_smt1",   BIT(2)},
+   {"CSME_SMT4",   BIT(3)},
+   {"csme_sms2",   BIT(4)},
+   {"csme_sms1",   BIT(5)},
+   {"csme_rtc",BIT(6)},
+   {"csme_psf",BIT(7)},
+
+   {"SBR0",BIT(0)},
+   {"SBR1",BIT(1)},
+   {"SBR2",BIT(2)},
+   {"SBR3",BIT(3)},
+   {"SBR4",BIT(4)},
+   {"SBR5",BIT(5)},
+   {"CSME_PECI",   BIT(6)},
+   {"PSF1",BIT(7)},
+
+   {"PSF2",BIT(0)},
+   {"PSF3",BIT(1)},
+   {"PSF4",BIT(2)},
+   {"CNVI",BIT(3)},
+   {"UFS0",BIT(4)},
+   {"EMMC",BIT(5)},
+   {"Res_6",   BIT(6)},
+   {"SBR6",BIT(7)},
+
+   {"SBR7",BIT(0)},
+   {"NPK_AON", BIT(1)},
+   {"HDA_PGD4",BIT(2)},
+   {"HDA_PGD5",BIT(3)},
+   {"HDA_PGD6",BIT(4)},
+   {}
+};
+
+static const struct pmc_reg_map cnp_reg_map = {
+   .pfear_sts = cnp_pfear_map,
+   .slp_s0_offset = CNP_PMC_SLP_S0_RES_COUNTER_OFFSET,
+   .ltr_ignore_offset = CNP_PMC_LTR_IGNORE_OFFSET,
+   .regmap_length = CNP_PMC_MMIO_REG_LEN,
+   .ppfear0_offset = CNP_PMC_HOST_PPFEAR0A,
+   .ppfear_buckets = CNP_PPFEAR_NUM_ENTRIES,
+   .pm_cfg_offset = CNP_PMC_PM_CFG_OFFSET,
+   .pm_read_disable_bit = CNP_PMC_READ_DISABLE_BIT,
+};
+
 static inline u8 pmc_core_reg_read_byte(struct pmc_dev *pmcdev, int offset)
 {
return readb(pmcdev->regbase + offset);
@@ -447,6 +531,7 @@ static const struct x86_cpu_id intel_pmc_core_ids[] = {
ICPU(INTEL_FAM6_SKYLAKE_DESKTOP, _reg_map),
ICPU(INTEL_FAM6_KABYLAKE_MOBILE, _reg_map),
ICPU(INTEL_FAM6_KABYLAKE_DESKTOP, _reg_map),
+   ICPU(INTEL_FAM6_CANNONLAKE_MOBILE, _reg_map),
{}
 };
 
diff --git a/drivers/platform/x86/intel_pmc_core.h 
b/drivers/platform/x86/intel_pmc_core.h
index 9df4a60a179f..8b7731e6dea2 100644
--- a/drivers/platform/x86/intel_pmc_core.h
+++ b/drivers/platform/x86/intel_pmc_core.h
@@ -121,6 +121,17 @@ enum ppfear_regs {
 #define SPT_PMC_BIT_MPHY_CMN_LANE2 BIT(2)
 #define SPT_PMC_BIT_MPHY_CMN_LANE3 BIT(3)
 
+/* Cannonlake Power Management Controller register offsets */
+#define CNP_PMC_SLP_S0_RES_COUNTER_OFFSET   

[linux-yocto] [4.12][PATCH 17/19] ACPI / LPIT: Add Low Power Idle Table (LPIT) support

2018-03-22 Thread Liwei Song
From: Srinivas Pandruvada 

commit eeb2d80d502af28e5660ff4bbe00f90ceb82c2db upstream.

Add functionality to read LPIT table, which provides:

 - Sysfs interface to read residency counters via
   /sys/devices/system/cpu/cpuidle/low_power_idle_cpu_residency_us
   /sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us

Here the count "low_power_idle_cpu_residency_us" shows the time spent
by CPU package in low power state.  This is read via MSR interface,
which points to MSR for PKG C10.

Here the count "low_power_idle_system_residency_us" show the count the
system was in low power state. This is read via MMIO interface. This
is mapped to SLP_S0 residency on modern Intel systems. This residency
is achieved only when CPU is in PKG C10 and all functional blocks are
in low power state.

It is possible that none of the above counters present or anyone of the
counter present or all counters present.

For example: On my Kabylake system both of the above counters present.
After suspend to idle these counts updated and prints:

 6916179
 6998564

This counter can be read by tools like turbostat to display. Or it can
be used to debug, if modern systems are reaching desired low power state.

 - Provides an interface to read residency counter memory address

   This address can be used to get the base address of PMC memory
   mapped IO.  This is utilized by intel_pmc_core driver to print
   more debug information.

In addition, to avoid code duplication to read iomem, removed the read of
iomem from acpi_os_read_memory() in osl.c and made a common function
acpi_os_read_iomem(). This new function is used for reading iomem in
in both osl.c and acpi_lpit.c.

Link: 
http://www.uefi.org/sites/default/files/resources/Intel_ACPI_Low_Power_S0_Idle.pdf
Signed-off-by: Srinivas Pandruvada 
Signed-off-by: Rafael J. Wysocki 
Signed-off-by: Liwei Song 
---
 Documentation/acpi/lpit.txt |  25 +++
 drivers/acpi/Kconfig|   5 ++
 drivers/acpi/Makefile   |   1 +
 drivers/acpi/acpi_lpit.c| 162 
 drivers/acpi/internal.h |   6 ++
 drivers/acpi/osl.c  |  42 +++-
 drivers/acpi/scan.c |   1 +
 include/acpi/acpiosxf.h |   2 +
 include/linux/acpi.h|   9 +++
 9 files changed, 237 insertions(+), 16 deletions(-)
 create mode 100644 Documentation/acpi/lpit.txt
 create mode 100644 drivers/acpi/acpi_lpit.c

diff --git a/Documentation/acpi/lpit.txt b/Documentation/acpi/lpit.txt
new file mode 100644
index ..b426398d2e97
--- /dev/null
+++ b/Documentation/acpi/lpit.txt
@@ -0,0 +1,25 @@
+To enumerate platform Low Power Idle states, Intel platforms are using
+“Low Power Idle Table” (LPIT). More details about this table can be
+downloaded from:
+http://www.uefi.org/sites/default/files/resources/Intel_ACPI_Low_Power_S0_Idle.pdf
+
+Residencies for each low power state can be read via FFH
+(Function fixed hardware) or a memory mapped interface.
+
+On platforms supporting S0ix sleep states, there can be two types of
+residencies:
+- CPU PKG C10 (Read via FFH interface)
+- Platform Controller Hub (PCH) SLP_S0 (Read via memory mapped interface)
+
+The following attributes are added dynamically to the cpuidle
+sysfs attribute group:
+   /sys/devices/system/cpu/cpuidle/low_power_idle_cpu_residency_us
+   /sys/devices/system/cpu/cpuidle/low_power_idle_system_residency_us
+
+The "low_power_idle_cpu_residency_us" attribute shows time spent
+by the CPU package in PKG C10
+
+The "low_power_idle_system_residency_us" attribute shows SLP_S0
+residency, or system time spent with the SLP_S0# signal asserted.
+This is the lowest possible system power state, achieved only when CPU is in
+PKG C10 and all functional blocks in PCH are in a low power state.
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig
index 1ce52f84dc23..4bfef0f78cde 100644
--- a/drivers/acpi/Kconfig
+++ b/drivers/acpi/Kconfig
@@ -80,6 +80,11 @@ endif
 config ACPI_SPCR_TABLE
bool
 
+config ACPI_LPIT
+   bool
+   depends on X86_64
+   default y
+
 config ACPI_SLEEP
bool
depends on SUSPEND || HIBERNATION
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile
index b1aacfc62b1f..db713f157e33 100644
--- a/drivers/acpi/Makefile
+++ b/drivers/acpi/Makefile
@@ -55,6 +55,7 @@ acpi-$(CONFIG_DEBUG_FS)   += debugfs.o
 acpi-$(CONFIG_ACPI_NUMA)   += numa.o
 acpi-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o
 acpi-y += acpi_lpat.o
+acpi-$(CONFIG_ACPI_LPIT)   += acpi_lpit.o
 acpi-$(CONFIG_ACPI_GENERIC_GSI) += irq.o
 acpi-$(CONFIG_ACPI_WATCHDOG)   += acpi_watchdog.o
 
diff --git a/drivers/acpi/acpi_lpit.c b/drivers/acpi/acpi_lpit.c
new file mode 100644
index ..e94e478dd18b
--- /dev/null
+++ b/drivers/acpi/acpi_lpit.c
@@ -0,0 +1,162 @@
+
+/*
+ * acpi_lpit.c - LPIT table 

[linux-yocto] [4.12][PATCH 18/19] ACPI / LPIT: Export lpit_read_residency_count_address()

2018-03-22 Thread Liwei Song
From: Srinivas Pandruvada 

commit 9383bbadfe29fe8319e2245b75a508db9abd7b87 upstream.

Export lpit_read_residency_count_address(), so that it can be used from
drivers built as module. With the recent changes, the builtin_pci
functionality of the intel_pmc_core driver is removed and now it can be
built as a module to read this exported interface to calculate the PMC base
address.

Cc: Rafael J. Wysocki 
Cc: Len Brown 
Cc: linux-a...@vger.kernel.org

Acked-by: Rafael J. Wysocki 
Tested-by: Rajneesh Bhardwaj 
Signed-off-by: Srinivas Pandruvada 
Signed-off-by: Andy Shevchenko 
Signed-off-by: Liwei Song 
---
 drivers/acpi/acpi_lpit.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/drivers/acpi/acpi_lpit.c b/drivers/acpi/acpi_lpit.c
index e94e478dd18b..cf4fc0161164 100644
--- a/drivers/acpi/acpi_lpit.c
+++ b/drivers/acpi/acpi_lpit.c
@@ -100,6 +100,7 @@ int lpit_read_residency_count_address(u64 *address)
 
return 0;
 }
+EXPORT_SYMBOL_GPL(lpit_read_residency_count_address);
 
 static void lpit_update_residency(struct lpit_residency_info *info,
 struct acpi_lpit_native *lpit_native)
-- 
2.7.4

-- 
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto


[linux-yocto] [4.12][PATCH 16/19] platform/x86: intel_pmc_core: Special case for Coffeelake

2018-03-22 Thread Liwei Song
From: Rajneesh Bhardwaj 

commit 661405bd817b209ac9bd4812c63d90873a7f2993 upstream.

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 
Signed-off-by: Andy Shevchenko 

Signed-off-by: Liwei Song 
---
 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..43bbe74743d9 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 = 
@@ -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 = _reg_map;
+
if (lpit_read_residency_count_address(_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  0xFE00
 
+/* 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

-- 
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto


[linux-yocto] [4.12][PATCH 13/19] platform/x86: intel_pmc_core: Remove unused header file

2018-03-22 Thread Liwei Song
From: Rajneesh Bhardwaj 

commit 941691ef2197944a202d7870dcd7da3fb0391c65 upstream.

Recently sent patch 'platform/x86: intel_pmc_core: Remove unused EXPORTED
API' missed to remove the header file 'arch/x86/include/asm/pmc_core.h'
which was solely used to declare the EXPORTED API
'intel_pmc_slp_s0_counter_read'. This patch provides the errata fix for the
same.

Signed-off-by: Rajneesh Bhardwaj 
Signed-off-by: Andy Shevchenko 
Signed-off-by: Liwei Song 
---
 arch/x86/include/asm/pmc_core.h   | 27 ---
 drivers/platform/x86/intel_pmc_core.c |  1 -
 2 files changed, 28 deletions(-)
 delete mode 100644 arch/x86/include/asm/pmc_core.h

diff --git a/arch/x86/include/asm/pmc_core.h b/arch/x86/include/asm/pmc_core.h
deleted file mode 100644
index d4855f11136d..
--- a/arch/x86/include/asm/pmc_core.h
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * Intel Core SoC Power Management Controller Header File
- *
- * Copyright (c) 2016, Intel Corporation.
- * All Rights Reserved.
- *
- * Authors: Rajneesh Bhardwaj 
- *  Vishwanath Somayaji 
- *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms and conditions of the GNU General Public License,
- * version 2, as published by the Free Software Foundation.
- *
- * This program is distributed in the hope it will be useful, but WITHOUT
- * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License for
- * more details.
- *
- */
-
-#ifndef _ASM_PMC_CORE_H
-#define _ASM_PMC_CORE_H
-
-/* API to read SLP_S0_RESIDENCY counter */
-int intel_pmc_slp_s0_counter_read(u32 *data);
-
-#endif /* _ASM_PMC_CORE_H */
diff --git a/drivers/platform/x86/intel_pmc_core.c 
b/drivers/platform/x86/intel_pmc_core.c
index f971ca1a6ed2..5c401e17cfb6 100644
--- a/drivers/platform/x86/intel_pmc_core.c
+++ b/drivers/platform/x86/intel_pmc_core.c
@@ -28,7 +28,6 @@
 
 #include 
 #include 
-#include 
 
 #include "intel_pmc_core.h"
 
-- 
2.7.4

-- 
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto


[linux-yocto] [4.12][PATCH 12/19] platform/x86: intel_pmc_core: Convert to ICPU macro

2018-03-22 Thread Liwei Song
From: Rajneesh Bhardwaj 

commit 00f8b2fce4da2296bafc1de6a46510a13ef60938 upstream.

Use ICPU macro to refactor code related to x86_cpu_id for better
readability.

Suggested-by: Andy Shevchenko 
Signed-off-by: Srinivas Pandruvada 
Signed-off-by: Rajneesh Bhardwaj 
Signed-off-by: Andy Shevchenko 
Signed-off-by: Liwei Song 
---
 drivers/platform/x86/intel_pmc_core.c | 15 +++
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/drivers/platform/x86/intel_pmc_core.c 
b/drivers/platform/x86/intel_pmc_core.c
index e3b98fcceb57..f971ca1a6ed2 100644
--- a/drivers/platform/x86/intel_pmc_core.c
+++ b/drivers/platform/x86/intel_pmc_core.c
@@ -32,6 +32,9 @@
 
 #include "intel_pmc_core.h"
 
+#define ICPU(model, data) \
+   { X86_VENDOR_INTEL, 6, model, X86_FEATURE_MWAIT, (kernel_ulong_t)data }
+
 static struct pmc_dev pmc;
 
 static const struct pmc_bit_map spt_pll_map[] = {
@@ -440,14 +443,10 @@ static inline void pmc_core_dbgfs_unregister(struct 
pmc_dev *pmcdev)
 #endif /* CONFIG_DEBUG_FS */
 
 static const struct x86_cpu_id intel_pmc_core_ids[] = {
-   { X86_VENDOR_INTEL, 6, INTEL_FAM6_SKYLAKE_MOBILE, X86_FEATURE_MWAIT,
-   (kernel_ulong_t)_reg_map},
-   { X86_VENDOR_INTEL, 6, INTEL_FAM6_SKYLAKE_DESKTOP, X86_FEATURE_MWAIT,
-   (kernel_ulong_t)_reg_map},
-   { X86_VENDOR_INTEL, 6, INTEL_FAM6_KABYLAKE_MOBILE, X86_FEATURE_MWAIT,
-   (kernel_ulong_t)_reg_map},
-   { X86_VENDOR_INTEL, 6, INTEL_FAM6_KABYLAKE_DESKTOP, X86_FEATURE_MWAIT,
-   (kernel_ulong_t)_reg_map},
+   ICPU(INTEL_FAM6_SKYLAKE_MOBILE, _reg_map),
+   ICPU(INTEL_FAM6_SKYLAKE_DESKTOP, _reg_map),
+   ICPU(INTEL_FAM6_KABYLAKE_MOBILE, _reg_map),
+   ICPU(INTEL_FAM6_KABYLAKE_DESKTOP, _reg_map),
{}
 };
 
-- 
2.7.4

-- 
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto


[linux-yocto] [4.12][PATCH 10/19] platform/x86: intel_pmc_core: Refactor debugfs entries

2018-03-22 Thread Liwei Song
From: Rajneesh Bhardwaj 

commit 750e0f570b7145870d40f07337f3356c18e0abd4 upstream.

When on a platform if we can't show MPHY and PLL status, don't even bother
to create a debugfs entry as it will fail anyway. In fact unless OEM builds
a special BIOS for test, it will fail on every production system.

This will help to add future platform support where we can't support these
entries.

Suggested-by: Andy Shevchenko 
Signed-off-by: Srinivas Pandruvada 
Signed-off-by: Rajneesh Bhardwaj 
Signed-off-by: Andy Shevchenko 
Signed-off-by: Liwei Song 
---
 drivers/platform/x86/intel_pmc_core.c | 38 +--
 1 file changed, 14 insertions(+), 24 deletions(-)

diff --git a/drivers/platform/x86/intel_pmc_core.c 
b/drivers/platform/x86/intel_pmc_core.c
index cf8b3b34a979..da924d3bb3e5 100644
--- a/drivers/platform/x86/intel_pmc_core.c
+++ b/drivers/platform/x86/intel_pmc_core.c
@@ -407,43 +407,33 @@ static void pmc_core_dbgfs_unregister(struct pmc_dev 
*pmcdev)
 
 static int pmc_core_dbgfs_register(struct pmc_dev *pmcdev)
 {
-   struct dentry *dir, *file;
+   struct dentry *dir;
 
dir = debugfs_create_dir("pmc_core", NULL);
if (!dir)
return -ENOMEM;
 
pmcdev->dbgfs_dir = dir;
-   file = debugfs_create_file("slp_s0_residency_usec", 0444,
-  dir, pmcdev, _core_dev_state);
-   if (!file)
-   goto err;
 
-   file = debugfs_create_file("pch_ip_power_gating_status", 0444,
-  dir, pmcdev, _core_ppfear_ops);
-   if (!file)
-   goto err;
+   debugfs_create_file("slp_s0_residency_usec", 0444, dir, pmcdev,
+   _core_dev_state);
 
-   file = debugfs_create_file("mphy_core_lanes_power_gating_status", 0444,
-  dir, pmcdev, _core_mphy_pg_ops);
-   if (!file)
-   goto err;
+   debugfs_create_file("pch_ip_power_gating_status", 0444, dir, pmcdev,
+   _core_ppfear_ops);
 
-   file = debugfs_create_file("pll_status", 0444, dir, pmcdev,
-  _core_pll_ops);
-   if (!file)
-   goto err;
+   debugfs_create_file("ltr_ignore", 0644, dir, pmcdev,
+   _core_ltr_ignore_ops);
 
-   file = debugfs_create_file("ltr_ignore", 0644, dir, pmcdev,
-  _core_ltr_ignore_ops);
+   if (pmcdev->map->pll_sts)
+   debugfs_create_file("pll_status", 0444, dir, pmcdev,
+   _core_pll_ops);
 
-   if (!file)
-   goto err;
+   if (pmcdev->map->mphy_sts)
+   debugfs_create_file("mphy_core_lanes_power_gating_status",
+   0444, dir, pmcdev,
+   _core_mphy_pg_ops);
 
return 0;
-err:
-   pmc_core_dbgfs_unregister(pmcdev);
-   return -ENODEV;
 }
 #else
 static inline int pmc_core_dbgfs_register(struct pmc_dev *pmcdev)
-- 
2.7.4

-- 
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto


[linux-yocto] [4.12][PATCH 11/19] platform/x86: intel_pmc_core: Substitute PCI with CPUID enumeration

2018-03-22 Thread Liwei Song
From: Srinivas Pandruvada 

commit 21ae43570940f8393a80369f62a3880bd64daad8 upstream.

The Only use of PCI device enumeration here is to get the PMC base address
which is a fixed value i.e. 0xFE00. On some platforms this can be read
through a non standard PCI BAR. But after Kabylake, PMC is not exposed as a
PCI device anymore. There are other non standard methods like ACPI LPIT
which can also be used for obtaining this value.

For simplicity, this value can be hardcoded as it won't change.

Since we don't have a PMC PCI device on any platform after Kabylake, this
creates a foundation for future SoC support.

Signed-off-by: Rajneesh Bhardwaj 
Signed-off-by: Srinivas Pandruvada 
Signed-off-by: Andy Shevchenko 
Signed-off-by: Liwei Song 
---
 drivers/platform/x86/intel_pmc_core.c | 89 ---
 drivers/platform/x86/intel_pmc_core.h |  3 +-
 2 files changed, 32 insertions(+), 60 deletions(-)

diff --git a/drivers/platform/x86/intel_pmc_core.c 
b/drivers/platform/x86/intel_pmc_core.c
index da924d3bb3e5..e3b98fcceb57 100644
--- a/drivers/platform/x86/intel_pmc_core.c
+++ b/drivers/platform/x86/intel_pmc_core.c
@@ -18,12 +18,12 @@
  *
  */
 
+#define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
+
 #include 
 #include 
-#include 
 #include 
 #include 
-#include 
 #include 
 
 #include 
@@ -119,13 +119,6 @@ static const struct pmc_reg_map spt_reg_map = {
.pm_read_disable_bit = SPT_PMC_READ_DISABLE_BIT,
 };
 
-static const struct pci_device_id pmc_pci_ids[] = {
-   { PCI_VDEVICE(INTEL, SPT_PMC_PCI_DEVICE_ID),
-   (kernel_ulong_t)_reg_map },
-   { 0, },
-};
-MODULE_DEVICE_TABLE(pci, pmc_pci_ids);
-
 static inline u8 pmc_core_reg_read_byte(struct pmc_dev *pmcdev, int offset)
 {
return readb(pmcdev->regbase + offset);
@@ -448,79 +441,59 @@ static inline void pmc_core_dbgfs_unregister(struct 
pmc_dev *pmcdev)
 
 static const struct x86_cpu_id intel_pmc_core_ids[] = {
{ X86_VENDOR_INTEL, 6, INTEL_FAM6_SKYLAKE_MOBILE, X86_FEATURE_MWAIT,
-   (kernel_ulong_t)NULL},
+   (kernel_ulong_t)_reg_map},
{ X86_VENDOR_INTEL, 6, INTEL_FAM6_SKYLAKE_DESKTOP, X86_FEATURE_MWAIT,
-   (kernel_ulong_t)NULL},
+   (kernel_ulong_t)_reg_map},
{ X86_VENDOR_INTEL, 6, INTEL_FAM6_KABYLAKE_MOBILE, X86_FEATURE_MWAIT,
-   (kernel_ulong_t)NULL},
+   (kernel_ulong_t)_reg_map},
{ X86_VENDOR_INTEL, 6, INTEL_FAM6_KABYLAKE_DESKTOP, X86_FEATURE_MWAIT,
-   (kernel_ulong_t)NULL},
+   (kernel_ulong_t)_reg_map},
{}
 };
 
-static int pmc_core_probe(struct pci_dev *dev, const struct pci_device_id *id)
+MODULE_DEVICE_TABLE(x86cpu, intel_pmc_core_ids);
+
+static int __init pmc_core_probe(void)
 {
-   struct device *ptr_dev = >dev;
struct pmc_dev *pmcdev = 
const struct x86_cpu_id *cpu_id;
-   const struct pmc_reg_map *map = (struct pmc_reg_map *)id->driver_data;
int err;
 
cpu_id = x86_match_cpu(intel_pmc_core_ids);
-   if (!cpu_id) {
-   dev_dbg(>dev, "PMC Core: cpuid mismatch.\n");
-   return -EINVAL;
-   }
-
-   err = pcim_enable_device(dev);
-   if (err < 0) {
-   dev_dbg(>dev, "PMC Core: failed to enable Power Management 
Controller.\n");
-   return err;
-   }
-
-   err = pci_read_config_dword(dev,
-   SPT_PMC_BASE_ADDR_OFFSET,
-   >base_addr);
-   if (err < 0) {
-   dev_dbg(>dev, "PMC Core: failed to read PCI config 
space.\n");
-   return err;
-   }
-   pmcdev->base_addr &= PMC_BASE_ADDR_MASK;
-   dev_dbg(>dev, "PMC Core: PWRMBASE is %#x\n", pmcdev->base_addr);
-
-   pmcdev->regbase = devm_ioremap_nocache(ptr_dev,
- pmcdev->base_addr,
- SPT_PMC_MMIO_REG_LEN);
-   if (!pmcdev->regbase) {
-   dev_dbg(>dev, "PMC Core: ioremap failed.\n");
+   if (!cpu_id)
+   return -ENODEV;
+
+   pmcdev->map = (struct pmc_reg_map *)cpu_id->driver_data;
+   pmcdev->base_addr = PMC_BASE_ADDR_DEFAULT;
+   pmcdev->regbase = ioremap(pmcdev->base_addr,
+ pmcdev->map->regmap_length);
+   if (!pmcdev->regbase)
return -ENOMEM;
-   }
 
mutex_init(>lock);
-   pmcdev->map = map;
pmcdev->pmc_xram_read_bit = pmc_core_check_read_lock_bit();
 
err = pmc_core_dbgfs_register(pmcdev);
-   if (err < 0)
-   dev_warn(>dev, "PMC Core: debugfs register failed.\n");
+   if (err < 0) {
+   pr_warn(" debugfs register failed.\n");
+   iounmap(pmcdev->regbase);

[linux-yocto] [4.12][PATCH 05/19] platform/x86: intel_pmc_core: Remove unused EXPORTED API

2018-03-22 Thread Liwei Song
From: Rajneesh Bhardwaj 

commit 12d614a0dcaee9668c641fcaa9f524da861a765e upstream.

Though ChromeOs uses the exported API as part of their S0ix failsafe
mechanism, there is no active consumer of this API in upstream kernel.

We can revisit this when ChromeOs kernel team is able to get their S0ix
failsafe framework in mainline.

Cc: Derek Basehore 
Cc: Rajat Jain 
Link: https://patchwork.kernel.org/patch/9831229/

Suggested-by: Andriy Shevchenko 
Signed-off-by: Srinivas Pandruvada 
Signed-off-by: Rajneesh Bhardwaj 
Signed-off-by: Andy Shevchenko 
Signed-off-by: Liwei Song 
---
 drivers/platform/x86/intel_pmc_core.c | 32 
 drivers/platform/x86/intel_pmc_core.h |  1 -
 2 files changed, 33 deletions(-)

diff --git a/drivers/platform/x86/intel_pmc_core.c 
b/drivers/platform/x86/intel_pmc_core.c
index 17e08b42b0a9..00748472a55e 100644
--- a/drivers/platform/x86/intel_pmc_core.c
+++ b/drivers/platform/x86/intel_pmc_core.c
@@ -146,37 +146,6 @@ static inline u32 pmc_core_adjust_slp_s0_step(u32 value)
return value * SPT_PMC_SLP_S0_RES_COUNTER_STEP;
 }
 
-/**
- * intel_pmc_slp_s0_counter_read() - Read SLP_S0 residency.
- * @data: Out param that contains current SLP_S0 count.
- *
- * This API currently supports Intel Skylake SoC and Sunrise
- * Point Platform Controller Hub. Future platform support
- * should be added for platforms that support low power modes
- * beyond Package C10 state.
- *
- * SLP_S0_RESIDENCY counter counts in 100 us granularity per
- * step hence function populates the multiplied value in out
- * parameter @data.
- *
- * Return: an error code or 0 on success.
- */
-int intel_pmc_slp_s0_counter_read(u32 *data)
-{
-   struct pmc_dev *pmcdev = 
-   const struct pmc_reg_map *map = pmcdev->map;
-   u32 value;
-
-   if (!pmcdev->has_slp_s0_res)
-   return -EACCES;
-
-   value = pmc_core_reg_read(pmcdev, map->slp_s0_offset);
-   *data = pmc_core_adjust_slp_s0_step(value);
-
-   return 0;
-}
-EXPORT_SYMBOL_GPL(intel_pmc_slp_s0_counter_read);
-
 static int pmc_core_dev_state_get(void *data, u64 *val)
 {
struct pmc_dev *pmcdev = data;
@@ -548,7 +517,6 @@ static int pmc_core_probe(struct pci_dev *dev, const struct 
pci_device_id *id)
if (err < 0)
dev_warn(>dev, "PMC Core: debugfs register failed.\n");
 
-   pmc.has_slp_s0_res = true;
return 0;
 }
 
diff --git a/drivers/platform/x86/intel_pmc_core.h 
b/drivers/platform/x86/intel_pmc_core.h
index 3d225a9cc09f..ecff50356c71 100644
--- a/drivers/platform/x86/intel_pmc_core.h
+++ b/drivers/platform/x86/intel_pmc_core.h
@@ -178,7 +178,6 @@ struct pmc_dev {
 #if IS_ENABLED(CONFIG_DEBUG_FS)
struct dentry *dbgfs_dir;
 #endif /* CONFIG_DEBUG_FS */
-   bool has_slp_s0_res;
int pmc_xram_read_bit;
struct mutex lock; /* generic mutex lock for PMC Core */
 };
-- 
2.7.4

-- 
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto


[linux-yocto] [4.12][PATCH 06/19] platform/x86: intel_pmc_core: Remove unused variable

2018-03-22 Thread Liwei Song
From: Rajneesh Bhardwaj 

commit 8c9180dd2c2a5f1356121cd87b373d9881b41c65 upstream.

base_address field is redundant and unused in the driver so get rid of it.

Signed-off-by: Srinivas Pandruvada 
Signed-off-by: Rajneesh Bhardwaj 
Signed-off-by: Andy Shevchenko 
Signed-off-by: Liwei Song 
---
 drivers/platform/x86/intel_pmc_core.h | 2 --
 1 file changed, 2 deletions(-)

diff --git a/drivers/platform/x86/intel_pmc_core.h 
b/drivers/platform/x86/intel_pmc_core.h
index ecff50356c71..c6169fe0edf2 100644
--- a/drivers/platform/x86/intel_pmc_core.h
+++ b/drivers/platform/x86/intel_pmc_core.h
@@ -135,7 +135,6 @@ struct pmc_bit_map {
  * @pll_sts:   Maps name of PLL to corresponding bit status
  * @slp_s0_offset: PWRMBASE offset to read SLP_S0 residency
  * @ltr_ignore_offset: PWRMBASE offset to read/write LTR ignore bit
- * @base_address:  Base address of PWRMBASE defined in BIOS writer guide
  * @regmap_length: Length of memory to map from PWRMBASE address to access
  * @ppfear0_offset:PWRMBASE offset to to read PPFEAR*
  * @ppfear_buckets:Number of 8 bits blocks to read all IP blocks from
@@ -152,7 +151,6 @@ struct pmc_reg_map {
const struct pmc_bit_map *pll_sts;
const u32 slp_s0_offset;
const u32 ltr_ignore_offset;
-   const u32 base_address;
const int regmap_length;
const u32 ppfear0_offset;
const int ppfear_buckets;
-- 
2.7.4

-- 
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto


[linux-yocto] [kernel-cache 4.12][PATCH] features/intel-pmc: add Intel pmc core support

2018-03-22 Thread Liwei Song
Add PMC Driver support for Intel Core SoC.

Signed-off-by: Liwei Song 
---
 features/intel-pmc/intel-pmc-core.cfg | 1 +
 features/intel-pmc/intel-pmc-core.scc | 4 
 2 files changed, 5 insertions(+)
 create mode 100644 features/intel-pmc/intel-pmc-core.cfg
 create mode 100644 features/intel-pmc/intel-pmc-core.scc

diff --git a/features/intel-pmc/intel-pmc-core.cfg 
b/features/intel-pmc/intel-pmc-core.cfg
new file mode 100644
index ..55f71325a996
--- /dev/null
+++ b/features/intel-pmc/intel-pmc-core.cfg
@@ -0,0 +1 @@
+CONFIG_INTEL_PMC_CORE=m
diff --git a/features/intel-pmc/intel-pmc-core.scc 
b/features/intel-pmc/intel-pmc-core.scc
new file mode 100644
index ..f82208695be6
--- /dev/null
+++ b/features/intel-pmc/intel-pmc-core.scc
@@ -0,0 +1,4 @@
+define KFEATURE_DESCRIPTION "Intel Core SoC Power Management Controller 
feature"
+define KFEATURE_COMPATIBILITY board
+
+kconf hardware intel-pmc-core.cfg
-- 
2.7.4

-- 
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto


[linux-yocto] [4.12][PATCH 01/19] HID: intel-ish-hid: Enable Cannon Lake ish driver

2018-03-22 Thread Liwei Song
From: Song Hongyan 

commit 1e3b74a2f844c3fcd8b3206178b8c6524aa34d05 upstream.

Added PCI ID for Cannon Lake ISH.

Signed-off-by: Song Hongyan 
Acked-by: Srinivas Pandruvada 
Signed-off-by: Jiri Kosina 
Signed-off-by: Liwei Song 
---
 drivers/hid/intel-ish-hid/ipc/hw-ish.h  | 1 +
 drivers/hid/intel-ish-hid/ipc/pci-ish.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/hid/intel-ish-hid/ipc/hw-ish.h 
b/drivers/hid/intel-ish-hid/ipc/hw-ish.h
index fd34307a7a70..ddc826347917 100644
--- a/drivers/hid/intel-ish-hid/ipc/hw-ish.h
+++ b/drivers/hid/intel-ish-hid/ipc/hw-ish.h
@@ -26,6 +26,7 @@
 #define BXT_Bx_DEVICE_ID   0x1AA2
 #define APL_Ax_DEVICE_ID   0x5AA2
 #define SPT_Ax_DEVICE_ID   0x9D35
+#define CNL_Ax_DEVICE_ID   0x9DFC
 
 #defineREVISION_ID_CHT_A0  0x6
 #defineREVISION_ID_CHT_Ax_SI   0x0
diff --git a/drivers/hid/intel-ish-hid/ipc/pci-ish.c 
b/drivers/hid/intel-ish-hid/ipc/pci-ish.c
index 8df81dc84529..878e96a89d9d 100644
--- a/drivers/hid/intel-ish-hid/ipc/pci-ish.c
+++ b/drivers/hid/intel-ish-hid/ipc/pci-ish.c
@@ -35,6 +35,7 @@ static const struct pci_device_id ish_pci_tbl[] = {
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, BXT_Bx_DEVICE_ID)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, APL_Ax_DEVICE_ID)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, SPT_Ax_DEVICE_ID)},
+   {PCI_DEVICE(PCI_VENDOR_ID_INTEL, CNL_Ax_DEVICE_ID)},
{0, }
 };
 MODULE_DEVICE_TABLE(pci, ish_pci_tbl);
-- 
2.7.4

-- 
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto


[linux-yocto] [4.12][PATCH 04/19] platform/x86: intel_pmc_core: Make the driver PCH family agnostic

2018-03-22 Thread Liwei Song
From: Srinivas Pandruvada 

commit c977b98bbef5898ed3d30b08ea67622e9e82082a upstream.

Although this driver did pretty good job in abstracting PCH specific
interfaces, but still there are some loose ends. For example
SLP_S0 counter (for reading SLP_S0 residency), PM config offset (for
checking permissions to read XRAM) and PPFEAR offset (for reading IP
status) is still hardcoded for a specific family of PCH.

This change extended the struct pmc_reg_map to allow per family
configuration of offsets and bits.

No functional change is expected with this change. This change allows
seamless additions to new PCH and create a baseline for other platform
specific extensions.

Signed-off-by: Srinivas Pandruvada 
Signed-off-by: Andy Shevchenko 
Signed-off-by: Liwei Song 
---
 drivers/platform/x86/intel_pmc_core.c | 31 +--
 drivers/platform/x86/intel_pmc_core.h | 30 +-
 2 files changed, 50 insertions(+), 11 deletions(-)

diff --git a/drivers/platform/x86/intel_pmc_core.c 
b/drivers/platform/x86/intel_pmc_core.c
index 914bcd2edbde..17e08b42b0a9 100644
--- a/drivers/platform/x86/intel_pmc_core.c
+++ b/drivers/platform/x86/intel_pmc_core.c
@@ -110,6 +110,13 @@ static const struct pmc_reg_map spt_reg_map = {
.pfear_sts = spt_pfear_map,
.mphy_sts = spt_mphy_map,
.pll_sts = spt_pll_map,
+   .slp_s0_offset = SPT_PMC_SLP_S0_RES_COUNTER_OFFSET,
+   .ltr_ignore_offset = SPT_PMC_LTR_IGNORE_OFFSET,
+   .regmap_length = SPT_PMC_MMIO_REG_LEN,
+   .ppfear0_offset = SPT_PMC_XRAM_PPFEAR0A,
+   .ppfear_buckets = SPT_PPFEAR_NUM_ENTRIES,
+   .pm_cfg_offset = SPT_PMC_PM_CFG_OFFSET,
+   .pm_read_disable_bit = SPT_PMC_READ_DISABLE_BIT,
 };
 
 static const struct pci_device_id pmc_pci_ids[] = {
@@ -157,12 +164,13 @@ static inline u32 pmc_core_adjust_slp_s0_step(u32 value)
 int intel_pmc_slp_s0_counter_read(u32 *data)
 {
struct pmc_dev *pmcdev = 
+   const struct pmc_reg_map *map = pmcdev->map;
u32 value;
 
if (!pmcdev->has_slp_s0_res)
return -EACCES;
 
-   value = pmc_core_reg_read(pmcdev, SPT_PMC_SLP_S0_RES_COUNTER_OFFSET);
+   value = pmc_core_reg_read(pmcdev, map->slp_s0_offset);
*data = pmc_core_adjust_slp_s0_step(value);
 
return 0;
@@ -172,9 +180,10 @@ EXPORT_SYMBOL_GPL(intel_pmc_slp_s0_counter_read);
 static int pmc_core_dev_state_get(void *data, u64 *val)
 {
struct pmc_dev *pmcdev = data;
+   const struct pmc_reg_map *map = pmcdev->map;
u32 value;
 
-   value = pmc_core_reg_read(pmcdev, SPT_PMC_SLP_S0_RES_COUNTER_OFFSET);
+   value = pmc_core_reg_read(pmcdev, map->slp_s0_offset);
*val = pmc_core_adjust_slp_s0_step(value);
 
return 0;
@@ -187,8 +196,8 @@ static int pmc_core_check_read_lock_bit(void)
struct pmc_dev *pmcdev = 
u32 value;
 
-   value = pmc_core_reg_read(pmcdev, SPT_PMC_PM_CFG_OFFSET);
-   return value & BIT(SPT_PMC_READ_DISABLE_BIT);
+   value = pmc_core_reg_read(pmcdev, pmcdev->map->pm_cfg_offset);
+   return value & BIT(pmcdev->map->pm_read_disable_bit);
 }
 
 #if IS_ENABLED(CONFIG_DEBUG_FS)
@@ -204,12 +213,13 @@ static int pmc_core_ppfear_sts_show(struct seq_file *s, 
void *unused)
 {
struct pmc_dev *pmcdev = s->private;
const struct pmc_bit_map *map = pmcdev->map->pfear_sts;
-   u8 pf_regs[NUM_ENTRIES];
+   u8 pf_regs[PPFEAR_MAX_NUM_ENTRIES];
int index, iter;
 
-   iter = SPT_PMC_XRAM_PPFEAR0A;
+   iter = pmcdev->map->ppfear0_offset;
 
-   for (index = 0; index < NUM_ENTRIES; index++, iter++)
+   for (index = 0; index < pmcdev->map->ppfear_buckets &&
+index < PPFEAR_MAX_NUM_ENTRIES; index++, iter++)
pf_regs[index] = pmc_core_reg_read_byte(pmcdev, iter);
 
for (index = 0; map[index].name; index++)
@@ -376,6 +386,7 @@ static ssize_t pmc_core_ltr_ignore_write(struct file *file, 
const char __user
 *userbuf, size_t count, loff_t *ppos)
 {
struct pmc_dev *pmcdev = 
+   const struct pmc_reg_map *map = pmcdev->map;
u32 val, buf_size, fd;
int err = 0;
 
@@ -392,9 +403,9 @@ static ssize_t pmc_core_ltr_ignore_write(struct file *file, 
const char __user
goto out_unlock;
}
 
-   fd = pmc_core_reg_read(pmcdev, SPT_PMC_LTR_IGNORE_OFFSET);
+   fd = pmc_core_reg_read(pmcdev, map->ltr_ignore_offset);
fd |= (1U << val);
-   pmc_core_reg_write(pmcdev, SPT_PMC_LTR_IGNORE_OFFSET, fd);
+   pmc_core_reg_write(pmcdev, map->ltr_ignore_offset, fd);
 
 out_unlock:
mutex_unlock(>lock);
@@ -530,8 +541,8 @@ static int pmc_core_probe(struct pci_dev *dev, const struct 
pci_device_id *id)
}
 
mutex_init(>lock);
-   pmcdev->pmc_xram_read_bit = pmc_core_check_read_lock_bit();

[linux-yocto] [4.12][PATCH 03/19] HID: intel-ish-hid: Enable Cannon Lake and Coffee Lake laptop/desktop

2018-03-22 Thread Liwei Song
From: Srinivas Pandruvada 

commit 7103f6b23392c0a57ceba7915f72fa7bf11d2a90 upstream.

Added PCI ID for Cannon Lake and Coffee Lake laptop/desktop skews.

Signed-off-by: Srinivas Pandruvada 
Signed-off-by: Jiri Kosina 
Signed-off-by: Liwei Song 
---
 drivers/hid/intel-ish-hid/ipc/hw-ish.h  | 1 +
 drivers/hid/intel-ish-hid/ipc/pci-ish.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/hid/intel-ish-hid/ipc/hw-ish.h 
b/drivers/hid/intel-ish-hid/ipc/hw-ish.h
index 2aac097c3f70..97869b7410eb 100644
--- a/drivers/hid/intel-ish-hid/ipc/hw-ish.h
+++ b/drivers/hid/intel-ish-hid/ipc/hw-ish.h
@@ -28,6 +28,7 @@
 #define SPT_Ax_DEVICE_ID   0x9D35
 #define CNL_Ax_DEVICE_ID   0x9DFC
 #define GLK_Ax_DEVICE_ID   0x31A2
+#define CNL_H_DEVICE_ID0xA37C
 
 #defineREVISION_ID_CHT_A0  0x6
 #defineREVISION_ID_CHT_Ax_SI   0x0
diff --git a/drivers/hid/intel-ish-hid/ipc/pci-ish.c 
b/drivers/hid/intel-ish-hid/ipc/pci-ish.c
index 20d824f74f99..582e449be9fe 100644
--- a/drivers/hid/intel-ish-hid/ipc/pci-ish.c
+++ b/drivers/hid/intel-ish-hid/ipc/pci-ish.c
@@ -37,6 +37,7 @@ static const struct pci_device_id ish_pci_tbl[] = {
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, SPT_Ax_DEVICE_ID)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, CNL_Ax_DEVICE_ID)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, GLK_Ax_DEVICE_ID)},
+   {PCI_DEVICE(PCI_VENDOR_ID_INTEL, CNL_H_DEVICE_ID)},
{0, }
 };
 MODULE_DEVICE_TABLE(pci, ish_pci_tbl);
-- 
2.7.4

-- 
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto


[linux-yocto] [4.12][PATCH 00/20] Add intel-pmc-core and ish support for CoffeeLake board

2018-03-22 Thread Liwei Song
Hi Bruce,

These series patches use to add Intel PMC core and Intel ISH support
on CoffeeLake board. All patches backported from upstream.

It also include one kernel-cache patch which used to enable
CONFIG_INTEL_PMC_CORE for intel-pmc-core driver.

Thanks,
Liwei.

 

Liwei Song (1):
  features/intel-pmc: add Intel pmc core support

 features/intel-pmc/intel-pmc-core.cfg | 1 +
 features/intel-pmc/intel-pmc-core.scc | 4 
 2 files changed, 5 insertions(+)
 create mode 100644 features/intel-pmc/intel-pmc-core.cfg
 create mode 100644 features/intel-pmc/intel-pmc-core.scc

Rajneesh Bhardwaj (10):
  platform/x86: intel_pmc_core: Remove unused EXPORTED API
  platform/x86: intel_pmc_core: Remove unused variable
  platform/x86: intel_pmc_core: Fix kernel doc for pmc_dev
  platform/x86: intel_pmc_core: Fix file permission warnings
  platform/x86: intel_pmc_core: Refactor debugfs entries
  platform/x86: intel_pmc_core: Convert to ICPU macro
  platform/x86: intel_pmc_core: Remove unused header file
  platform/x86: intel_pmc_core: Add CannonLake PCH support
  platform/x86: intel_pmc_core: Special case for Coffeelake
  x86/cpu: Add Cannonlake to Intel family

Song Hongyan (2):
  HID: intel-ish-hid: Enable Cannon Lake ish driver
  HID: intel-ish-hid: Enable Gemini Lake ish driver

Srinivas Pandruvada (7):
  HID: intel-ish-hid: Enable Cannon Lake and Coffee Lake laptop/desktop
  platform/x86: intel_pmc_core: Make the driver PCH family agnostic
  platform/x86: intel_pmc_core: Change driver to a module
  platform/x86: intel_pmc_core: Substitute PCI with CPUID enumeration
  platform/x86: intel_pmc_core: Read base address from LPIT
  ACPI / LPIT: Add Low Power Idle Table (LPIT) support
  ACPI / LPIT: Export lpit_read_residency_count_address()

 Documentation/acpi/lpit.txt |  25 +++
 arch/x86/include/asm/intel-family.h |   6 +
 arch/x86/include/asm/pmc_core.h |  27 ---
 drivers/acpi/Kconfig|   5 +
 drivers/acpi/Makefile   |   1 +
 drivers/acpi/acpi_lpit.c| 163 +
 drivers/acpi/internal.h |   6 +
 drivers/acpi/osl.c  |  42 +++--
 drivers/acpi/scan.c |   1 +
 drivers/hid/intel-ish-hid/ipc/hw-ish.h  |   3 +
 drivers/hid/intel-ish-hid/ipc/pci-ish.c |   3 +
 drivers/platform/x86/Kconfig|   2 +-
 drivers/platform/x86/intel_pmc_core.c   | 305 +++-
 drivers/platform/x86/intel_pmc_core.h   |  55 +-
 include/acpi/acpiosxf.h |   2 +
 include/linux/acpi.h|   9 +
 16 files changed, 477 insertions(+), 178 deletions(-)
 create mode 100644 Documentation/acpi/lpit.txt
 delete mode 100644 arch/x86/include/asm/pmc_core.h
 create mode 100644 drivers/acpi/acpi_lpit.c

-- 
2.7.4

-- 
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto


[linux-yocto] [4.12][PATCH 02/19] HID: intel-ish-hid: Enable Gemini Lake ish driver

2018-03-22 Thread Liwei Song
From: Song Hongyan 

commit 1694130910cd654a9215fbc0244975e3cf208fc1 upstream.

Added PCI ID for Gemini Lake ISH.

Signed-off-by: Song Hongyan 
Acked-by: Srinivas Pandruvada 
Signed-off-by: Jiri Kosina 
Signed-off-by: Liwei Song 
---
 drivers/hid/intel-ish-hid/ipc/hw-ish.h  | 1 +
 drivers/hid/intel-ish-hid/ipc/pci-ish.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/drivers/hid/intel-ish-hid/ipc/hw-ish.h 
b/drivers/hid/intel-ish-hid/ipc/hw-ish.h
index ddc826347917..2aac097c3f70 100644
--- a/drivers/hid/intel-ish-hid/ipc/hw-ish.h
+++ b/drivers/hid/intel-ish-hid/ipc/hw-ish.h
@@ -27,6 +27,7 @@
 #define APL_Ax_DEVICE_ID   0x5AA2
 #define SPT_Ax_DEVICE_ID   0x9D35
 #define CNL_Ax_DEVICE_ID   0x9DFC
+#define GLK_Ax_DEVICE_ID   0x31A2
 
 #defineREVISION_ID_CHT_A0  0x6
 #defineREVISION_ID_CHT_Ax_SI   0x0
diff --git a/drivers/hid/intel-ish-hid/ipc/pci-ish.c 
b/drivers/hid/intel-ish-hid/ipc/pci-ish.c
index 878e96a89d9d..20d824f74f99 100644
--- a/drivers/hid/intel-ish-hid/ipc/pci-ish.c
+++ b/drivers/hid/intel-ish-hid/ipc/pci-ish.c
@@ -36,6 +36,7 @@ static const struct pci_device_id ish_pci_tbl[] = {
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, APL_Ax_DEVICE_ID)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, SPT_Ax_DEVICE_ID)},
{PCI_DEVICE(PCI_VENDOR_ID_INTEL, CNL_Ax_DEVICE_ID)},
+   {PCI_DEVICE(PCI_VENDOR_ID_INTEL, GLK_Ax_DEVICE_ID)},
{0, }
 };
 MODULE_DEVICE_TABLE(pci, ish_pci_tbl);
-- 
2.7.4

-- 
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto


[linux-yocto] : [yocto-4.12]: intel-socfpga: driver: clk: socfpga: remove unused variable

2018-03-22 Thread Meng.Li
From: Limeng 


Hi Bruce,

Please help to meger below patch into linux-yocto, kernel 4.12, branch is 
standard/base
 
0001-driver-clk-socfpga-remove-unused-variable.patch

 clk-pll-s10.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

thanks,
Limeng


-- 
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto


[linux-yocto] [PATCH] driver: clk: socfpga: remove unused variable

2018-03-22 Thread Meng.Li
From: Limeng 

commit f826ccc79752(“FogBugz #488843-2: add clock driver
for Stratix10 SOC”) introduce reg2, but it is not used.
So, remove it.

Signed-off-by: Meng Li 
---
 drivers/clk/socfpga/clk-pll-s10.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/clk/socfpga/clk-pll-s10.c 
b/drivers/clk/socfpga/clk-pll-s10.c
index 52a7637..231c798 100644
--- a/drivers/clk/socfpga/clk-pll-s10.c
+++ b/drivers/clk/socfpga/clk-pll-s10.c
@@ -93,7 +93,7 @@ static struct clk_ops clk_pll_ops = {
 static struct clk * __init __socfpga_pll_init(struct device_node *node,
  const struct clk_ops *ops)
 {
-   u32 reg, reg2;
+   u32 reg;
struct clk *clk;
struct socfpga_pll *pll_clk;
const char *clk_name = node->name;
-- 
2.9.3

-- 
___
linux-yocto mailing list
linux-yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/linux-yocto


Re: [linux-yocto] [kernel-cache][PATCH] features/wifi: Add WiFi driver fragments for various vendors/interfaces

2018-03-22 Thread Bruce Ashfield

On 03/22/2018 12:00 PM, Bruce Ashfield wrote:

On 03/22/2018 04:49 AM, Nathan Rossi wrote:
On 22 March 2018 at 15:33, Bruce Ashfield 
 wrote:

On 03/20/2018 10:10 AM, Nathan Rossi wrote:


This change adds WiFi driver configuration fragments. The fragments are
split into vendor and interface files to allow for easy selection of
drivers for specific interface types (USB, PCI, SDIO) which is useful
for BSPs with specific interfaces. The specific vendor/interface config
fragments can be included by specific BSPs in its .scc files.

However .scc files (wifi-*.scc) are provided to allow enabling 
interface

specific or all interfaces drivers via KERNEL_FEATURES or inclusion via
other .scc files. And wifi-common.scc is provided to enable the base
config options required for all WiFi drivers, which is done to ensure
correct configuration for default no config setups (e.g.
linux-yocto-tiny).

This patch only enables a limited set of drivers, which is based on 
what
the common-pc-wifi.cfg fragment sets as well as some additional 
drivers,

that primarily appear in USB WiFi devices.



These changes look good to me. I'll let them sit on the list for
another day or so, and see if anyone else has any comments.



Signed-off-by: Nathan Rossi 
---
These changes are very similar to a set of configuration fragments that
were included (?) in minnow branches in ~2013. However they never made
it into the current set of configuration fragments.


https://lists.yoctoproject.org/pipermail/linux-yocto/2013-November/001393.html 




Interesting. I'm not sure how they ended up getting dropped or
lost, but when I merge this, it will go into the versioned
branches and master, so it can't be lost again.



Also whilst not in this patch, if accepted these fragments could 
replace

the common-pc-wifi.cfg to reduce duplication.



Indeed. We can look at that in follow up commits.



For completeness I have tested these fragments on linux-yocto version
v4.14 and v4.15 for qemux86, qemux86-64 and qemuarm builds as well as
for the beaglebone-yocto target. For v4.12 compatibility, due to the
iwlwifi fragments adding patches (which do not apply correctly to
standard/base) the fragments would need to be modified.



What configuration were you building to trigger those errors ? Just
qemux86-64 ? something else ? The patches should have been ignored,
as long as the fragment wasn't directly on the SRC_URI.


Just adding iwlwifi.scc to KERNEL_FEATURES either directly or via the
include in one of the .scc files of this patch causes the iwlwifi
patches to apply.

KERNEL_FEATURES_append = " features/iwlwifi/iwlwifi.scc"

| DEBUG: Executing shell function do_patch
| (1/310) iwlwifi-mvm-support-getting-nvm-data-from-firmware.patch
| [INFO]: check of
.kernel-meta//patches//features/iwlwifi/iwlwifi-mvm-support-getting-nvm-data-from-firmware.patch 


with "git am" did not pass, trying reduced context.
| [INFO]: Context reduced git-am of
.kernel-meta//patches//features/iwlwifi/iwlwifi-mvm-support-getting-nvm-data-from-firmware.patch 


with "git am" did not work, trying "apply".
| 
/storage/nathan/build/test-wifi/tmp-glibc/work-shared/qemux86-64/kernel-source/.git/rebase-apply/patch:26: 


indent with spaces.
|  * struct iwl_nvm_get_info - request to get NVM data
| 
/storage/nathan/build/test-wifi/tmp-glibc/work-shared/qemux86-64/kernel-source/.git/rebase-apply/patch:27: 


indent with spaces.
|  */
| 
/storage/nathan/build/test-wifi/tmp-glibc/work-shared/qemux86-64/kernel-source/.git/rebase-apply/patch:33: 


indent with spaces.
|  * struct iwl_nvm_get_info_general - general NVM data
| 
/storage/nathan/build/test-wifi/tmp-glibc/work-shared/qemux86-64/kernel-source/.git/rebase-apply/patch:34: 


indent with spaces.
|  * @flags: 1 - empty, 0 - valid
| 
/storage/nathan/build/test-wifi/tmp-glibc/work-shared/qemux86-64/kernel-source/.git/rebase-apply/patch:35: 


indent with spaces.
|  * @nvm_version: nvm version
| error: patch failed: 
drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h:345
| error: drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h: patch does 
not apply

| error: patch failed: drivers/net/wireless/intel/iwlwifi/mvm/fw.c:738
| error: drivers/net/wireless/intel/iwlwifi/mvm/fw.c: patch does not 
apply

| error: patch failed: drivers/net/wireless/intel/iwlwifi/mvm/mvm.h:1390
| error: drivers/net/wireless/intel/iwlwifi/mvm/mvm.h: patch does not 
apply

| error: patch failed: drivers/net/wireless/intel/iwlwifi/mvm/nvm.c:374
| error: drivers/net/wireless/intel/iwlwifi/mvm/nvm.c: patch does not 
apply

| error: patch failed: drivers/net/wireless/intel/iwlwifi/mvm/ops.c:483
| error: drivers/net/wireless/intel/iwlwifi/mvm/ops.c: patch does not 
apply

| [ERROR]: Application of
.kernel-meta//patches//features/iwlwifi/iwlwifi-mvm-support-getting-nvm-data-from-firmware.patch 


failed.
|  Patch needs to be refreshed. Sample resolution script:
|  .git/rebase-apply/resolve_rejects
| 

Re: [linux-yocto] [kernel-cache][PATCH] features/wifi: Add WiFi driver fragments for various vendors/interfaces

2018-03-22 Thread Bruce Ashfield

On 03/22/2018 04:49 AM, Nathan Rossi wrote:

On 22 March 2018 at 15:33, Bruce Ashfield  wrote:

On 03/20/2018 10:10 AM, Nathan Rossi wrote:


This change adds WiFi driver configuration fragments. The fragments are
split into vendor and interface files to allow for easy selection of
drivers for specific interface types (USB, PCI, SDIO) which is useful
for BSPs with specific interfaces. The specific vendor/interface config
fragments can be included by specific BSPs in its .scc files.

However .scc files (wifi-*.scc) are provided to allow enabling interface
specific or all interfaces drivers via KERNEL_FEATURES or inclusion via
other .scc files. And wifi-common.scc is provided to enable the base
config options required for all WiFi drivers, which is done to ensure
correct configuration for default no config setups (e.g.
linux-yocto-tiny).

This patch only enables a limited set of drivers, which is based on what
the common-pc-wifi.cfg fragment sets as well as some additional drivers,
that primarily appear in USB WiFi devices.



These changes look good to me. I'll let them sit on the list for
another day or so, and see if anyone else has any comments.



Signed-off-by: Nathan Rossi 
---
These changes are very similar to a set of configuration fragments that
were included (?) in minnow branches in ~2013. However they never made
it into the current set of configuration fragments.


https://lists.yoctoproject.org/pipermail/linux-yocto/2013-November/001393.html



Interesting. I'm not sure how they ended up getting dropped or
lost, but when I merge this, it will go into the versioned
branches and master, so it can't be lost again.



Also whilst not in this patch, if accepted these fragments could replace
the common-pc-wifi.cfg to reduce duplication.



Indeed. We can look at that in follow up commits.



For completeness I have tested these fragments on linux-yocto version
v4.14 and v4.15 for qemux86, qemux86-64 and qemuarm builds as well as
for the beaglebone-yocto target. For v4.12 compatibility, due to the
iwlwifi fragments adding patches (which do not apply correctly to
standard/base) the fragments would need to be modified.



What configuration were you building to trigger those errors ? Just
qemux86-64 ? something else ? The patches should have been ignored,
as long as the fragment wasn't directly on the SRC_URI.


Just adding iwlwifi.scc to KERNEL_FEATURES either directly or via the
include in one of the .scc files of this patch causes the iwlwifi
patches to apply.

KERNEL_FEATURES_append = " features/iwlwifi/iwlwifi.scc"

| DEBUG: Executing shell function do_patch
| (1/310) iwlwifi-mvm-support-getting-nvm-data-from-firmware.patch
| [INFO]: check of
.kernel-meta//patches//features/iwlwifi/iwlwifi-mvm-support-getting-nvm-data-from-firmware.patch
with "git am" did not pass, trying reduced context.
| [INFO]: Context reduced git-am of
.kernel-meta//patches//features/iwlwifi/iwlwifi-mvm-support-getting-nvm-data-from-firmware.patch
with "git am" did not work, trying "apply".
| 
/storage/nathan/build/test-wifi/tmp-glibc/work-shared/qemux86-64/kernel-source/.git/rebase-apply/patch:26:
indent with spaces.
|  * struct iwl_nvm_get_info - request to get NVM data
| 
/storage/nathan/build/test-wifi/tmp-glibc/work-shared/qemux86-64/kernel-source/.git/rebase-apply/patch:27:
indent with spaces.
|  */
| 
/storage/nathan/build/test-wifi/tmp-glibc/work-shared/qemux86-64/kernel-source/.git/rebase-apply/patch:33:
indent with spaces.
|  * struct iwl_nvm_get_info_general - general NVM data
| 
/storage/nathan/build/test-wifi/tmp-glibc/work-shared/qemux86-64/kernel-source/.git/rebase-apply/patch:34:
indent with spaces.
|  * @flags: 1 - empty, 0 - valid
| 
/storage/nathan/build/test-wifi/tmp-glibc/work-shared/qemux86-64/kernel-source/.git/rebase-apply/patch:35:
indent with spaces.
|  * @nvm_version: nvm version
| error: patch failed: drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h:345
| error: drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h: patch does not apply
| error: patch failed: drivers/net/wireless/intel/iwlwifi/mvm/fw.c:738
| error: drivers/net/wireless/intel/iwlwifi/mvm/fw.c: patch does not apply
| error: patch failed: drivers/net/wireless/intel/iwlwifi/mvm/mvm.h:1390
| error: drivers/net/wireless/intel/iwlwifi/mvm/mvm.h: patch does not apply
| error: patch failed: drivers/net/wireless/intel/iwlwifi/mvm/nvm.c:374
| error: drivers/net/wireless/intel/iwlwifi/mvm/nvm.c: patch does not apply
| error: patch failed: drivers/net/wireless/intel/iwlwifi/mvm/ops.c:483
| error: drivers/net/wireless/intel/iwlwifi/mvm/ops.c: patch does not apply
| [ERROR]: Application of
.kernel-meta//patches//features/iwlwifi/iwlwifi-mvm-support-getting-nvm-data-from-firmware.patch
failed.
|  Patch needs to be refreshed. Sample resolution script:
|  .git/rebase-apply/resolve_rejects
| ERROR: Could not apply patches for qemux86-64.

I thought this behaviour was intentional 

Re: [yocto] how to "compute" path to install module file

2018-03-22 Thread Stephano Cetola
On 3/22/18 12:31 AM, Vincent Daanen wrote:
> Hi, 
> 
> I’m porting the makefile to build SocketCan for Ixxat on yocto. At this
> time I successfully build the module file.

Have you checked out the CANopen drivers?
https://github.com/ros-industrial/ros_canopen
https://github.com/bmwcarit/meta-ros/tree/master/recipes-ros/ros-canopen

There are already recipes for this if it happens to work for your part.

Just figured I'd mention it :)

For adding the Ixxat driver, this documentation might help:
https://www.yoctoproject.org/docs/current/kernel-dev/kernel-dev.html#working-with-out-of-tree-modules

> 
> Build fails with the following error:
> 
> nothing provides kernel-module-ixx-pci-4.12.14-yocto-standard needed by
> kernel-module-ixxat-candriver-1.0-r0.qemux86_64

Do you have a recipe that provides ixx-pci? If so it needs to say:

PROVIDES = "ixx-pci"

https://www.yoctoproject.org/docs/latest/mega-manual/mega-manual.html#var-PROVIDES

Also, you need to be sure that it is being built, so I would add that
recipe into some RDEPENDS variable, for example:

MACHINE_ESSENTIAL_EXTRA_RDEPENDS += "ixx-pci"

(in this case in your machine conf, assuming the package name is "ixx-pci")

> 
> I don’t understand how yocto computes to module filename. It adds the
> kernel-version to the default filename…

check out the "module_pattern" variables in:
meta/classes/kernel-module-split.bbclass

I believe this is done during packaging.

Cheers,
Stephano

-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


[yocto] TR: how to "compute" path to install module file

2018-03-22 Thread Vincent Daanen
Hi,

I'm porting the makefile to build SocketCan for Ixxat on yocto. At this time I 
successfully build the module file.
I now have to install it in the target image.

The "install" procedure from the original makefile does not work 
out-of-the-box. It copies files in the following directories starting by /lib 
and thus it tries to install in the host system, not the target system..

In order to install in the target image, the installation is performed in a 
customized do_install function in the bb file, and the problem starts here !

In the original makefile, installation process copies a file in the following 
directory : /lib/modules/$(shell uname -r)/kernel/drivers/net/.

In the bb file, I "compute" the kernel version using ${KERNEL_VERSION}

Thus the bb file contains the following lines:

#MODDIR = Module file destination directory
MODDIR 
="${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel/drivers/net/can/ixxat"

do_install() {
install -d ${D}${base_libdir}/firmware
install -m 0755 ${WORKDIR}/can-ibxxx_socketcan/ixx-can-ib-1.9.3.fw 
${D}${base_libdir}/firmware
install -d ${D}${MODDIR}
install -m 0755 ${WORKDIR}/can-ibxxx_socketcan/ixx_pci.ko ${D}${MODDIR}
}
FILES_${PN} += " ${base_libdir}/firmware ${MODDIR}"

Build fails with the following error:
nothing provides kernel-module-ixx-pci-4.12.14-yocto-standard needed by 
kernel-module-ixxat-candriver-1.0-r0.qemux86_64

I don't understand how yocto computes to module filename. It adds the 
kernel-version to the default filename...
Is it the standard way for computing module filename with yocto (I searched and 
did not find any info about this) or could it be a side-effect of my bb file 
(and in this case, how can I identify where this side-effect occurs) or .. 
maybe if bug in bitbake ??

Thanks for helping

Vincent

-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto
-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto


Re: [linux-yocto] [kernel-cache][PATCH] features/wifi: Add WiFi driver fragments for various vendors/interfaces

2018-03-22 Thread Nathan Rossi
On 22 March 2018 at 15:33, Bruce Ashfield  wrote:
> On 03/20/2018 10:10 AM, Nathan Rossi wrote:
>>
>> This change adds WiFi driver configuration fragments. The fragments are
>> split into vendor and interface files to allow for easy selection of
>> drivers for specific interface types (USB, PCI, SDIO) which is useful
>> for BSPs with specific interfaces. The specific vendor/interface config
>> fragments can be included by specific BSPs in its .scc files.
>>
>> However .scc files (wifi-*.scc) are provided to allow enabling interface
>> specific or all interfaces drivers via KERNEL_FEATURES or inclusion via
>> other .scc files. And wifi-common.scc is provided to enable the base
>> config options required for all WiFi drivers, which is done to ensure
>> correct configuration for default no config setups (e.g.
>> linux-yocto-tiny).
>>
>> This patch only enables a limited set of drivers, which is based on what
>> the common-pc-wifi.cfg fragment sets as well as some additional drivers,
>> that primarily appear in USB WiFi devices.
>>
>
> These changes look good to me. I'll let them sit on the list for
> another day or so, and see if anyone else has any comments.
>
>
>> Signed-off-by: Nathan Rossi 
>> ---
>> These changes are very similar to a set of configuration fragments that
>> were included (?) in minnow branches in ~2013. However they never made
>> it into the current set of configuration fragments.
>>
>>
>> https://lists.yoctoproject.org/pipermail/linux-yocto/2013-November/001393.html
>
>
> Interesting. I'm not sure how they ended up getting dropped or
> lost, but when I merge this, it will go into the versioned
> branches and master, so it can't be lost again.
>
>>
>> Also whilst not in this patch, if accepted these fragments could replace
>> the common-pc-wifi.cfg to reduce duplication.
>
>
> Indeed. We can look at that in follow up commits.
>
>>
>> For completeness I have tested these fragments on linux-yocto version
>> v4.14 and v4.15 for qemux86, qemux86-64 and qemuarm builds as well as
>> for the beaglebone-yocto target. For v4.12 compatibility, due to the
>> iwlwifi fragments adding patches (which do not apply correctly to
>> standard/base) the fragments would need to be modified.
>
>
> What configuration were you building to trigger those errors ? Just
> qemux86-64 ? something else ? The patches should have been ignored,
> as long as the fragment wasn't directly on the SRC_URI.

Just adding iwlwifi.scc to KERNEL_FEATURES either directly or via the
include in one of the .scc files of this patch causes the iwlwifi
patches to apply.

KERNEL_FEATURES_append = " features/iwlwifi/iwlwifi.scc"

| DEBUG: Executing shell function do_patch
| (1/310) iwlwifi-mvm-support-getting-nvm-data-from-firmware.patch
| [INFO]: check of
.kernel-meta//patches//features/iwlwifi/iwlwifi-mvm-support-getting-nvm-data-from-firmware.patch
with "git am" did not pass, trying reduced context.
| [INFO]: Context reduced git-am of
.kernel-meta//patches//features/iwlwifi/iwlwifi-mvm-support-getting-nvm-data-from-firmware.patch
with "git am" did not work, trying "apply".
| 
/storage/nathan/build/test-wifi/tmp-glibc/work-shared/qemux86-64/kernel-source/.git/rebase-apply/patch:26:
indent with spaces.
|  * struct iwl_nvm_get_info - request to get NVM data
| 
/storage/nathan/build/test-wifi/tmp-glibc/work-shared/qemux86-64/kernel-source/.git/rebase-apply/patch:27:
indent with spaces.
|  */
| 
/storage/nathan/build/test-wifi/tmp-glibc/work-shared/qemux86-64/kernel-source/.git/rebase-apply/patch:33:
indent with spaces.
|  * struct iwl_nvm_get_info_general - general NVM data
| 
/storage/nathan/build/test-wifi/tmp-glibc/work-shared/qemux86-64/kernel-source/.git/rebase-apply/patch:34:
indent with spaces.
|  * @flags: 1 - empty, 0 - valid
| 
/storage/nathan/build/test-wifi/tmp-glibc/work-shared/qemux86-64/kernel-source/.git/rebase-apply/patch:35:
indent with spaces.
|  * @nvm_version: nvm version
| error: patch failed: drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h:345
| error: drivers/net/wireless/intel/iwlwifi/mvm/fw-api.h: patch does not apply
| error: patch failed: drivers/net/wireless/intel/iwlwifi/mvm/fw.c:738
| error: drivers/net/wireless/intel/iwlwifi/mvm/fw.c: patch does not apply
| error: patch failed: drivers/net/wireless/intel/iwlwifi/mvm/mvm.h:1390
| error: drivers/net/wireless/intel/iwlwifi/mvm/mvm.h: patch does not apply
| error: patch failed: drivers/net/wireless/intel/iwlwifi/mvm/nvm.c:374
| error: drivers/net/wireless/intel/iwlwifi/mvm/nvm.c: patch does not apply
| error: patch failed: drivers/net/wireless/intel/iwlwifi/mvm/ops.c:483
| error: drivers/net/wireless/intel/iwlwifi/mvm/ops.c: patch does not apply
| [ERROR]: Application of
.kernel-meta//patches//features/iwlwifi/iwlwifi-mvm-support-getting-nvm-data-from-firmware.patch
failed.
|  Patch needs to be refreshed. Sample resolution script:
|  .git/rebase-apply/resolve_rejects
| ERROR: Could not 

[yocto] how to "compute" path to install module file

2018-03-22 Thread Vincent Daanen
Hi,

I'm porting the makefile to build SocketCan for Ixxat on yocto. At this time I 
successfully build the module file.
I now have to install it in the target image.

The "install" procedure from the original makefile does not work 
out-of-the-box. It copies files in the following directories starting by /lib 
and thus it tries to install in the host system, not the target system..

In order to install in the target image, the installation is performed in a 
customized do_install function in the bb file, and the problem starts here !

In the original makefile, installation process copies a file in the following 
directory : /lib/modules/$(shell uname -r)/kernel/drivers/net/.

In the bb file, I "compute" the kernel version using ${KERNEL_VERSION}

Thus the bb file contains the following lines:

#MODDIR = Module file destination directory
MODDIR 
="${nonarch_base_libdir}/modules/${KERNEL_VERSION}/kernel/drivers/net/can/ixxat"

do_install() {
install -d ${D}${base_libdir}/firmware
install -m 0755 ${WORKDIR}/can-ibxxx_socketcan/ixx-can-ib-1.9.3.fw 
${D}${base_libdir}/firmware
install -d ${D}${MODDIR}
install -m 0755 ${WORKDIR}/can-ibxxx_socketcan/ixx_pci.ko ${D}${MODDIR}
}
FILES_${PN} += " ${base_libdir}/firmware ${MODDIR}"

Build fails with the following error:
nothing provides kernel-module-ixx-pci-4.12.14-yocto-standard needed by 
kernel-module-ixxat-candriver-1.0-r0.qemux86_64

I don't understand how yocto computes to module filename. It adds the 
kernel-version to the default filename...
Is it the standard way for computing module filename with yocto (I searched and 
did not find any info about this) or could it be a side-effect of my bb file 
(and in this case, how can I identify where this side-effect occurs) or .. 
maybe if bug in bitbake ??

Thanks for helping

Vincent

-- 
___
yocto mailing list
yocto@yoctoproject.org
https://lists.yoctoproject.org/listinfo/yocto