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

2016-09-08 Thread Troy Jia


> -Original Message-
> From: Zhang Rui [mailto:rui.zh...@intel.com]
> Sent: Friday, August 19, 2016 8:40 PM
> To: Hongtao Jia <hongtao@nxp.com>; edubez...@gmail.com;
> robh...@kernel.org; ga...@codeaurora.org; Scott Wood
> <scott.w...@nxp.com>; shawn...@kernel.org
> Cc: linux...@vger.kernel.org; devicet...@vger.kernel.org; linux-
> ker...@vger.kernel.org; linuxppc-...@lists.ozlabs.org; linux-arm-
> ker...@lists.infradead.org
> Subject: Re: [PATCH V2 7/7] thermal: qoriq: Add thermal management support
> 
> On 四, 2016-06-30 at 11:08 +0800, Jia Hongtao wrote:
> > 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 <hongtao@nxp.com>
> 
> The patch looks good to me.
> I only need to take this patch, right?
> 
> thanks,
> rui

Yes. You just need to take this patch.
Sorry for the late response. I was on my long vacation back then.

Thanks,
Hongtao.

> > ---
> > Changes of V2:
> > * Add HAS_IOMEM dependency to fix build error on UM
> >
> >  drivers/thermal/Kconfig |  10 ++
> >  drivers/thermal/Makefile|   1 +
> >  drivers/thermal/qoriq_thermal.c | 328
> > 
> >  3 files changed, 339 insertions(+)
> >  create mode 100644 drivers/thermal/qoriq_thermal.c
> >
> > diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
> > index 2d702ca..56ef30d 100644
> > --- a/drivers/thermal/Kconfig
> > +++ b/drivers/thermal/Kconfig
> > @@ -195,6 +195,16 @@ 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
> > +   depends on HAS_IOMEM
> > +   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 Temperatur

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

2016-09-08 Thread Troy Jia


> -Original Message-
> From: Zhang Rui [mailto:rui.zh...@intel.com]
> Sent: Friday, August 19, 2016 8:40 PM
> To: Hongtao Jia ; edubez...@gmail.com;
> robh...@kernel.org; ga...@codeaurora.org; Scott Wood
> ; shawn...@kernel.org
> Cc: linux...@vger.kernel.org; devicet...@vger.kernel.org; linux-
> ker...@vger.kernel.org; linuxppc-...@lists.ozlabs.org; linux-arm-
> ker...@lists.infradead.org
> Subject: Re: [PATCH V2 7/7] thermal: qoriq: Add thermal management support
> 
> On 四, 2016-06-30 at 11:08 +0800, Jia Hongtao wrote:
> > 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 
> 
> The patch looks good to me.
> I only need to take this patch, right?
> 
> thanks,
> rui

Yes. You just need to take this patch.
Sorry for the late response. I was on my long vacation back then.

Thanks,
Hongtao.

> > ---
> > Changes of V2:
> > * Add HAS_IOMEM dependency to fix build error on UM
> >
> >  drivers/thermal/Kconfig |  10 ++
> >  drivers/thermal/Makefile|   1 +
> >  drivers/thermal/qoriq_thermal.c | 328
> > 
> >  3 files changed, 339 insertions(+)
> >  create mode 100644 drivers/thermal/qoriq_thermal.c
> >
> > diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
> > index 2d702ca..56ef30d 100644
> > --- a/drivers/thermal/Kconfig
> > +++ b/drivers/thermal/Kconfig
> > @@ -195,6 +195,16 @@ 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
> > +   depends on HAS_IOMEM
> > +   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 qo

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

2016-08-19 Thread Zhang Rui
On 四, 2016-06-30 at 11:08 +0800, Jia Hongtao wrote:
> 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 

The patch looks good to me.
I only need to take this patch, right?

thanks,
rui
> ---
> Changes of V2:
> * Add HAS_IOMEM dependency to fix build error on UM
> 
>  drivers/thermal/Kconfig |  10 ++
>  drivers/thermal/Makefile|   1 +
>  drivers/thermal/qoriq_thermal.c | 328
> 
>  3 files changed, 339 insertions(+)
>  create mode 100644 drivers/thermal/qoriq_thermal.c
> 
> diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
> index 2d702ca..56ef30d 100644
> --- a/drivers/thermal/Kconfig
> +++ b/drivers/thermal/Kconfig
> @@ -195,6 +195,16 @@ 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
> + depends on HAS_IOMEM
> + 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_MAX16
> +
> +/*
> + * 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_DISABLE  0x0
> +#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 

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

2016-08-19 Thread Zhang Rui
On 四, 2016-06-30 at 11:08 +0800, Jia Hongtao wrote:
> 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 

The patch looks good to me.
I only need to take this patch, right?

thanks,
rui
> ---
> Changes of V2:
> * Add HAS_IOMEM dependency to fix build error on UM
> 
>  drivers/thermal/Kconfig |  10 ++
>  drivers/thermal/Makefile|   1 +
>  drivers/thermal/qoriq_thermal.c | 328
> 
>  3 files changed, 339 insertions(+)
>  create mode 100644 drivers/thermal/qoriq_thermal.c
> 
> diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
> index 2d702ca..56ef30d 100644
> --- a/drivers/thermal/Kconfig
> +++ b/drivers/thermal/Kconfig
> @@ -195,6 +195,16 @@ 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
> + depends on HAS_IOMEM
> + 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_MAX16
> +
> +/*
> + * 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_DISABLE  0x0
> +#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 

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

2016-08-05 Thread Hongtao Jia
Hi Eduardo,

If you have any comments please let me know.

Thanks.
-Hongtao. 


> -Original Message-
> From: Linuxppc-dev [mailto:linuxppc-dev-
> bounces+b38951=freescale@lists.ozlabs.org] On Behalf Of Hongtao Jia
> Sent: Tuesday, July 19, 2016 2:54 PM
> To: edubez...@gmail.com; rui.zh...@intel.com; Scott Wood
> <scott.w...@nxp.com>
> Cc: devicet...@vger.kernel.org; linuxppc-...@lists.ozlabs.org; linux-
> ker...@vger.kernel.org; linux-arm-ker...@lists.infradead.org; linux-
> p...@vger.kernel.org
> Subject: RE: [PATCH V2 7/7] thermal: qoriq: Add thermal management support
> 
> Hi Eduardo,
> 
> Any comments on this patch?
> 
> Thanks.
> -Hongtao.
> 
> > -Original Message-
> > From: Jia Hongtao [mailto:hongtao@nxp.com]
> > Sent: Thursday, June 30, 2016 11:09 AM
> > To: edubez...@gmail.com; rui.zh...@intel.com; robh...@kernel.org;
> > ga...@codeaurora.org; Scott Wood <scott.w...@nxp.com>;
> > shawn...@kernel.org
> > Cc: linux...@vger.kernel.org; devicet...@vger.kernel.org; linux-
> > ker...@vger.kernel.org; linuxppc-...@lists.ozlabs.org; linux-arm-
> > ker...@lists.infradead.org; Hongtao Jia <hongtao@nxp.com>
> > Subject: [PATCH V2 7/7] thermal: qoriq: Add thermal management support
> >
> > 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 <hongtao@nxp.com>
> > ---
> > Changes of V2:
> > * Add HAS_IOMEM dependency to fix build error on UM
> >
> >  drivers/thermal/Kconfig |  10 ++
> >  drivers/thermal/Makefile|   1 +
> >  drivers/thermal/qoriq_thermal.c | 328
> > 
> >  3 files changed, 339 insertions(+)
> >  create mode 100644 drivers/thermal/qoriq_thermal.c
> >
> > diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index
> > 2d702ca..56ef30d 100644
> > --- a/drivers/thermal/Kconfig
> > +++ b/drivers/thermal/Kconfig
> > @@ -195,6 +195,16 @@ 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
> > +   depends on HAS_IOMEM
> > +   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 
&g

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

2016-08-05 Thread Hongtao Jia
Hi Eduardo,

If you have any comments please let me know.

Thanks.
-Hongtao. 


> -Original Message-
> From: Linuxppc-dev [mailto:linuxppc-dev-
> bounces+b38951=freescale@lists.ozlabs.org] On Behalf Of Hongtao Jia
> Sent: Tuesday, July 19, 2016 2:54 PM
> To: edubez...@gmail.com; rui.zh...@intel.com; Scott Wood
> 
> Cc: devicet...@vger.kernel.org; linuxppc-...@lists.ozlabs.org; linux-
> ker...@vger.kernel.org; linux-arm-ker...@lists.infradead.org; linux-
> p...@vger.kernel.org
> Subject: RE: [PATCH V2 7/7] thermal: qoriq: Add thermal management support
> 
> Hi Eduardo,
> 
> Any comments on this patch?
> 
> Thanks.
> -Hongtao.
> 
> > -Original Message-
> > From: Jia Hongtao [mailto:hongtao@nxp.com]
> > Sent: Thursday, June 30, 2016 11:09 AM
> > To: edubez...@gmail.com; rui.zh...@intel.com; robh...@kernel.org;
> > ga...@codeaurora.org; Scott Wood ;
> > shawn...@kernel.org
> > Cc: linux...@vger.kernel.org; devicet...@vger.kernel.org; linux-
> > ker...@vger.kernel.org; linuxppc-...@lists.ozlabs.org; linux-arm-
> > ker...@lists.infradead.org; Hongtao Jia 
> > Subject: [PATCH V2 7/7] thermal: qoriq: Add thermal management support
> >
> > 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 
> > ---
> > Changes of V2:
> > * Add HAS_IOMEM dependency to fix build error on UM
> >
> >  drivers/thermal/Kconfig |  10 ++
> >  drivers/thermal/Makefile|   1 +
> >  drivers/thermal/qoriq_thermal.c | 328
> > 
> >  3 files changed, 339 insertions(+)
> >  create mode 100644 drivers/thermal/qoriq_thermal.c
> >
> > diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index
> > 2d702ca..56ef30d 100644
> > --- a/drivers/thermal/Kconfig
> > +++ b/drivers/thermal/Kconfig
> > @@ -195,6 +195,16 @@ 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
> > +   depends on HAS_IOMEM
> > +   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

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

2016-07-19 Thread Hongtao Jia
Hi Eduardo,

Any comments on this patch?

Thanks.
-Hongtao.

> -Original Message-
> From: Jia Hongtao [mailto:hongtao@nxp.com]
> Sent: Thursday, June 30, 2016 11:09 AM
> To: edubez...@gmail.com; rui.zh...@intel.com; robh...@kernel.org;
> ga...@codeaurora.org; Scott Wood ;
> shawn...@kernel.org
> Cc: linux...@vger.kernel.org; devicet...@vger.kernel.org; linux-
> ker...@vger.kernel.org; linuxppc-...@lists.ozlabs.org; linux-arm-
> ker...@lists.infradead.org; Hongtao Jia 
> Subject: [PATCH V2 7/7] thermal: qoriq: Add thermal management support
> 
> 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 
> ---
> Changes of V2:
> * Add HAS_IOMEM dependency to fix build error on UM
> 
>  drivers/thermal/Kconfig |  10 ++
>  drivers/thermal/Makefile|   1 +
>  drivers/thermal/qoriq_thermal.c | 328
> 
>  3 files changed, 339 insertions(+)
>  create mode 100644 drivers/thermal/qoriq_thermal.c
> 
> diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index
> 2d702ca..56ef30d 100644
> --- a/drivers/thermal/Kconfig
> +++ b/drivers/thermal/Kconfig
> @@ -195,6 +195,16 @@ 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
> + depends on HAS_IOMEM
> + 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_MAX16
> +
> +/*
> + * 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_DISABLE  0x0
> +#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 

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

2016-07-19 Thread Hongtao Jia
Hi Eduardo,

Any comments on this patch?

Thanks.
-Hongtao.

> -Original Message-
> From: Jia Hongtao [mailto:hongtao@nxp.com]
> Sent: Thursday, June 30, 2016 11:09 AM
> To: edubez...@gmail.com; rui.zh...@intel.com; robh...@kernel.org;
> ga...@codeaurora.org; Scott Wood ;
> shawn...@kernel.org
> Cc: linux...@vger.kernel.org; devicet...@vger.kernel.org; linux-
> ker...@vger.kernel.org; linuxppc-...@lists.ozlabs.org; linux-arm-
> ker...@lists.infradead.org; Hongtao Jia 
> Subject: [PATCH V2 7/7] thermal: qoriq: Add thermal management support
> 
> 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 
> ---
> Changes of V2:
> * Add HAS_IOMEM dependency to fix build error on UM
> 
>  drivers/thermal/Kconfig |  10 ++
>  drivers/thermal/Makefile|   1 +
>  drivers/thermal/qoriq_thermal.c | 328
> 
>  3 files changed, 339 insertions(+)
>  create mode 100644 drivers/thermal/qoriq_thermal.c
> 
> diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig index
> 2d702ca..56ef30d 100644
> --- a/drivers/thermal/Kconfig
> +++ b/drivers/thermal/Kconfig
> @@ -195,6 +195,16 @@ 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
> + depends on HAS_IOMEM
> + 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_MAX16
> +
> +/*
> + * 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_DISABLE  0x0
> +#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;