Re: [PATCH 7/7] thermal: qoriq: Add thermal management support

2016-06-12 Thread Hongtao Jia
Hi all,

I received this auto build error notice. I have something to clarify and ask:
- [cannot apply to robh/for-next soc-thermal/next]
   It could apply to robh/for-next.
   It could not apply to soc-thermal/next because this branch is not updated to 
the latest kernel.

- [auto build test ERROR on v4.7-rc1] [also build test ERROR on next-20160603]
   It passed all build test under ARCH=arm/powerpc/x86.
   The error log under ARCH=um "implicit declaration of function 'iounmap'" 
looks odd for me because
   I believe it's included in . Any suggestions for me to fix this 
issue?

Thanks.
- Hongtao


> -邮件原件-
> 发件人: kbuild test robot [mailto:l...@intel.com]
> 发送时间: Monday, June 06, 2016 1:52 AM
> 收件人: Hongtao Jia <hongtao@nxp.com>
> 抄送: kbuild-...@01.org; edubez...@gmail.com; rui.zh...@intel.com;
> robh...@kernel.org; ga...@codeaurora.org; Scott Wood
> <scott.w...@nxp.com>; shawn...@kernel.org; linux...@vger.kernel.org;
> devicet...@vger.kernel.org; linux-ker...@vger.kernel.org; linuxppc-
> d...@lists.ozlabs.org; linux-arm-ker...@lists.infradead.org; Hongtao Jia
> <hongtao....@nxp.com>
> 主题: Re: [PATCH 7/7] thermal: qoriq: Add thermal management support
> 
> Hi,
> 
> [auto build test ERROR on v4.7-rc1]
> [also build test ERROR on next-20160603]
> [cannot apply to robh/for-next soc-thermal/next]
> [if your patch is applied to the wrong git tree, please drop us a note to help
> improve the system]
> 
> url:https://github.com/0day-ci/linux/commits/Jia-Hongtao/dt-bindings-
> Update-QorIQ-TMU-thermal-bindings/20160603-154428
> config: um-allmodconfig (attached as .config)
> compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
> reproduce:
> # save the attached .config to linux build tree
> make ARCH=um
> 
> All errors (new ones prefixed by >>):
> 
>drivers/thermal/qoriq_thermal.c: In function 'qoriq_tmu_probe':
> >> drivers/thermal/qoriq_thermal.c:255:2: error: implicit declaration of
> function 'iounmap' [-Werror=implicit-function-declaration]
>  iounmap(data->regs);
>  ^~~
>cc1: some warnings being treated as errors
> 
> vim +/iounmap +255 drivers/thermal/qoriq_thermal.c
> 
>249site |= 0x1 << (15 - data->sensor_id);
>250tmu_write(data, site | TMR_ME | TMR_ALPF, >regs-
> >tmr);
>251
>252return 0;
>253
>254err_tmu:
>  > 255iounmap(data->regs);
>256
>257err_iomap:
>258platform_set_drvdata(pdev, NULL);
> 
> ---
> 0-DAY kernel test infrastructureOpen Source Technology Center
> https://lists.01.org/pipermail/kbuild-all   Intel Corporation
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

Re: [PATCH 7/7] thermal: qoriq: Add thermal management support

2016-06-05 Thread kbuild test robot
Hi,

[auto build test ERROR on v4.7-rc1]
[also build test ERROR on next-20160603]
[cannot apply to robh/for-next soc-thermal/next]
[if your patch is applied to the wrong git tree, please drop us a note to help 
improve the system]

url:
https://github.com/0day-ci/linux/commits/Jia-Hongtao/dt-bindings-Update-QorIQ-TMU-thermal-bindings/20160603-154428
config: um-allmodconfig (attached as .config)
compiler: gcc-6 (Debian 6.1.1-1) 6.1.1 20160430
reproduce:
# save the attached .config to linux build tree
make ARCH=um 

All errors (new ones prefixed by >>):

   drivers/thermal/qoriq_thermal.c: In function 'qoriq_tmu_probe':
>> drivers/thermal/qoriq_thermal.c:255:2: error: implicit declaration of 
>> function 'iounmap' [-Werror=implicit-function-declaration]
 iounmap(data->regs);
 ^~~
   cc1: some warnings being treated as errors

vim +/iounmap +255 drivers/thermal/qoriq_thermal.c

   249  site |= 0x1 << (15 - data->sensor_id);
   250  tmu_write(data, site | TMR_ME | TMR_ALPF, >regs->tmr);
   251  
   252  return 0;
   253  
   254  err_tmu:
 > 255  iounmap(data->regs);
   256  
   257  err_iomap:
   258  platform_set_drvdata(pdev, NULL);

---
0-DAY kernel test infrastructureOpen Source Technology Center
https://lists.01.org/pipermail/kbuild-all   Intel Corporation


.config.gz
Description: Binary data
___
Linuxppc-dev mailing list
Linuxppc-dev@lists.ozlabs.org
https://lists.ozlabs.org/listinfo/linuxppc-dev

[PATCH 7/7] thermal: qoriq: Add thermal management support

2016-06-03 Thread Jia Hongtao
This driver add thermal management support by enabling TMU (Thermal
Monitoring Unit) on QorIQ platform.

It's based on thermal of framework:
- Trip points defined in device tree.
- Cpufreq as cooling device registered in qoriq cpufreq driver.

Signed-off-by: Jia Hongtao 
---
 drivers/thermal/Kconfig |   9 ++
 drivers/thermal/Makefile|   1 +
 drivers/thermal/qoriq_thermal.c | 328 
 3 files changed, 338 insertions(+)
 create mode 100644 drivers/thermal/qoriq_thermal.c

diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index 2d702ca..bef26cd 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -195,6 +195,15 @@ config IMX_THERMAL
  cpufreq is used as the cooling device to throttle CPUs when the
  passive trip is crossed.
 
+config QORIQ_THERMAL
+   tristate "QorIQ Thermal Monitoring Unit"
+   depends on THERMAL_OF
+   help
+ Support for Thermal Monitoring Unit (TMU) found on QorIQ platforms.
+ It supports one critical trip point and one passive trip point. The
+ cpufreq is used as the cooling device to throttle CPUs when the
+ passive trip is crossed.
+
 config SPEAR_THERMAL
tristate "SPEAr thermal sensor driver"
depends on PLAT_SPEAR || COMPILE_TEST
diff --git a/drivers/thermal/Makefile b/drivers/thermal/Makefile
index 10b07c1..6662232 100644
--- a/drivers/thermal/Makefile
+++ b/drivers/thermal/Makefile
@@ -37,6 +37,7 @@ obj-$(CONFIG_DB8500_THERMAL)  += db8500_thermal.o
 obj-$(CONFIG_ARMADA_THERMAL)   += armada_thermal.o
 obj-$(CONFIG_TANGO_THERMAL)+= tango_thermal.o
 obj-$(CONFIG_IMX_THERMAL)  += imx_thermal.o
+obj-$(CONFIG_QORIQ_THERMAL)+= qoriq_thermal.o
 obj-$(CONFIG_DB8500_CPUFREQ_COOLING)   += db8500_cpufreq_cooling.o
 obj-$(CONFIG_INTEL_POWERCLAMP) += intel_powerclamp.o
 obj-$(CONFIG_X86_PKG_TEMP_THERMAL) += x86_pkg_temp_thermal.o
diff --git a/drivers/thermal/qoriq_thermal.c b/drivers/thermal/qoriq_thermal.c
new file mode 100644
index 000..644ba52
--- /dev/null
+++ b/drivers/thermal/qoriq_thermal.c
@@ -0,0 +1,328 @@
+/*
+ * Copyright 2016 Freescale Semiconductor, Inc.
+ *
+ * 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.
+ *
+ */
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include "thermal_core.h"
+
+#define SITES_MAX  16
+
+/*
+ * QorIQ TMU Registers
+ */
+struct qoriq_tmu_site_regs {
+   u32 tritsr; /* Immediate Temperature Site Register */
+   u32 tratsr; /* Average Temperature Site Register */
+   u8 res0[0x8];
+};
+
+struct qoriq_tmu_regs {
+   u32 tmr;/* Mode Register */
+#define TMR_DISABLE0x0
+#define TMR_ME 0x8000
+#define TMR_ALPF   0x0c00
+   u32 tsr;/* Status Register */
+   u32 tmtmir; /* Temperature measurement interval Register */
+#define TMTMIR_DEFAULT 0x000f
+   u8 res0[0x14];
+   u32 tier;   /* Interrupt Enable Register */
+#define TIER_DISABLE   0x0
+   u32 tidr;   /* Interrupt Detect Register */
+   u32 tiscr;  /* Interrupt Site Capture Register */
+   u32 ticscr; /* Interrupt Critical Site Capture Register */
+   u8 res1[0x10];
+   u32 tmhtcrh;/* High Temperature Capture Register */
+   u32 tmhtcrl;/* Low Temperature Capture Register */
+   u8 res2[0x8];
+   u32 tmhtitr;/* High Temperature Immediate Threshold */
+   u32 tmhtatr;/* High Temperature Average Threshold */
+   u32 tmhtactr;   /* High Temperature Average Crit Threshold */
+   u8 res3[0x24];
+   u32 ttcfgr; /* Temperature Configuration Register */
+   u32 tscfgr; /* Sensor Configuration Register */
+   u8 res4[0x78];
+   struct qoriq_tmu_site_regs site[SITES_MAX];
+   u8 res5[0x9f8];
+   u32 ipbrr0; /* IP Block Revision Register 0 */
+   u32 ipbrr1; /* IP Block Revision Register 1 */
+   u8 res6[0x310];
+   u32 ttr0cr; /* Temperature Range 0 Control Register */
+   u32 ttr1cr; /* Temperature Range 1 Control Register */
+   u32 ttr2cr; /* Temperature Range 2 Control Register */
+   u32 ttr3cr; /* Temperature Range 3 Control Register */
+};
+
+/*
+ * Thermal zone data
+ */
+struct qoriq_tmu_data {
+   struct thermal_zone_device *tz;
+   struct qoriq_tmu_regs __iomem