aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amdfalconx86/recipes-kernel/linux/files/0004-yocto-amd-temperature-monitoring-support-for-F15h-M60h-processor.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amdfalconx86/recipes-kernel/linux/files/0004-yocto-amd-temperature-monitoring-support-for-F15h-M60h-processor.patch')
-rw-r--r--meta-amdfalconx86/recipes-kernel/linux/files/0004-yocto-amd-temperature-monitoring-support-for-F15h-M60h-processor.patch94
1 files changed, 94 insertions, 0 deletions
diff --git a/meta-amdfalconx86/recipes-kernel/linux/files/0004-yocto-amd-temperature-monitoring-support-for-F15h-M60h-processor.patch b/meta-amdfalconx86/recipes-kernel/linux/files/0004-yocto-amd-temperature-monitoring-support-for-F15h-M60h-processor.patch
new file mode 100644
index 00000000..4036d5b5
--- /dev/null
+++ b/meta-amdfalconx86/recipes-kernel/linux/files/0004-yocto-amd-temperature-monitoring-support-for-F15h-M60h-processor.patch
@@ -0,0 +1,94 @@
+This patch adds temperature monitoring support for F15h M60h processor.
+ - Add new pci device id for the relevant processor
+ - The functionality of REG_REPORTED_TEMPERATURE is moved to
+ D0F0xBC_xD820_0CA4 [Reported Temperature Control]
+ - So, use this to get CUR_TEMP value
+ - Since we need an indirect register access, protect this with
+ a mutex lock
+ - Add Kconfig, Doc entries to indicate support for this processor.
+
+Signed-off-by: Aravind Gopalakrishnan <aravind.gopalakrishnan@amd.com>
+Signed-off-by: Sanjay Mehta <sanju.mehta@amd.com>
+diff -Naur a/Documentation/hwmon/k10temp b/Documentation/hwmon/k10temp
+--- a/Documentation/hwmon/k10temp 2014-11-20 06:57:23.314425285 +0530
++++ b/Documentation/hwmon/k10temp 2014-11-20 06:59:21.794427609 +0530
+@@ -11,7 +11,7 @@
+ Socket S1G2: Athlon (X2), Sempron (X2), Turion X2 (Ultra)
+ * AMD Family 12h processors: "Llano" (E2/A4/A6/A8-Series)
+ * AMD Family 14h processors: "Brazos" (C/E/G/Z-Series)
+-* AMD Family 15h processors: "Bulldozer" (FX-Series), "Trinity"
++* AMD Family 15h processors: "Bulldozer" (FX-Series), "Trinity", "Carrizo"
+ * AMD Family 16h processors: "Kabini"
+
+ Prefix: 'k10temp'
+diff -Naur a/drivers/hwmon/k10temp.c b/drivers/hwmon/k10temp.c
+--- a/drivers/hwmon/k10temp.c 2014-11-20 06:57:25.386425326 +0530
++++ b/drivers/hwmon/k10temp.c 2014-11-20 07:10:20.450440524 +0530
+@@ -33,6 +33,9 @@
+ module_param(force, bool, 0444);
+ MODULE_PARM_DESC(force, "force loading on processors with erratum 319");
+
++/* Provide lock for writing to NB_SMU_IND_ADDR */
++DEFINE_MUTEX(nb_smu_ind_mutex);
++
+ /* CPUID function 0x80000001, ebx */
+ #define CPUID_PKGTYPE_MASK 0xf0000000
+ #define CPUID_PKGTYPE_F 0x00000000
+@@ -51,13 +54,41 @@
+ #define REG_NORTHBRIDGE_CAPABILITIES 0xe8
+ #define NB_CAP_HTC 0x00000400
+
++/*
++* For F15h M60h, functionality of REG_REPORTED_TEMPERATURE
++* has been moved to D0F0xBC_xD820_0CA4 [Reported Temperature
++* Control]
++*/
++#define F15H_M60H_REPORTED_TEMP_CTRL_OFFSET 0xd8200ca4
++#define PCI_DEVICE_ID_AMD_15H_M60H_NB_F3 0x1573
++
++void amd_nb_smu_index_read(struct pci_dev *pdev, unsigned int devfn,
++ int offset, u32 *val)
++{
++ mutex_lock(&nb_smu_ind_mutex);
++ pci_bus_write_config_dword(pdev->bus, devfn,
++ 0xb8, offset);
++ pci_bus_read_config_dword(pdev->bus, devfn,
++ 0xbc, val);
++ mutex_unlock(&nb_smu_ind_mutex);
++}
++
++
++
+ static ssize_t show_temp(struct device *dev,
+ struct device_attribute *attr, char *buf)
+ {
+ u32 regval;
+
+- pci_read_config_dword(to_pci_dev(dev),
+- REG_REPORTED_TEMPERATURE, &regval);
++ struct pci_dev *pdev = to_pci_dev(dev);
++
++ if (boot_cpu_data.x86 == 0x15 && boot_cpu_data.x86_model == 0x60) {
++ amd_nb_smu_index_read(pdev, PCI_DEVFN(0, 0),
++ F15H_M60H_REPORTED_TEMP_CTRL_OFFSET,
++ &regval);
++ } else {
++ pci_read_config_dword(pdev, REG_REPORTED_TEMPERATURE, &regval);
++ }
+ return sprintf(buf, "%u\n", (regval >> 21) * 125);
+ }
+
+diff -Naur a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig
+--- a/drivers/hwmon/Kconfig 2014-11-20 06:57:25.382425326 +0530
++++ b/drivers/hwmon/Kconfig 2014-11-20 07:01:10.974429749 +0530
+@@ -296,8 +296,8 @@
+ If you say yes here you get support for the temperature
+ sensor(s) inside your CPU. Supported are later revisions of
+ the AMD Family 10h and all revisions of the AMD Family 11h,
+- 12h (Llano), 14h (Brazos), 15h (Bulldozer/Trinity) and
+- 16h (Kabini) microarchitectures.
++ 12h (Llano), 14h (Brazos), 15h (Bulldozer/Trinity/Carrizo)
++ and 16h (Kabini) microarchitectures.
+
+ This driver can also be built as a module. If so, the module
+ will be called k10temp.