public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [U-Boot] [Patch v3 0/4] imx: mx6: use OTP for teperature grade info
@ 2015-05-18 13:56 Tim Harvey
  2015-05-18 13:56 ` [U-Boot] [Patch v3 1/4] mx6: add OTP bank1 registers Tim Harvey
                   ` (5 more replies)
  0 siblings, 6 replies; 11+ messages in thread
From: Tim Harvey @ 2015-05-18 13:56 UTC (permalink / raw)
  To: u-boot

Use Temperature grade info in OTP/eFUSE for thermal management and display of
thermal data.

Cc: Stefan Roese <sr@denx.de>
Cc: Eric Nelson <eric.nelson@boundarydevices.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: Nikita Kiryanov <nikita@compulab.co.il>
Cc: Jon Nettleton <jon.nettleton@gmail.com>
Cc: Jason Liu <r64343@freescale.com>
Cc: Ye Li <b37916@freescale.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: Markus Niebel <Markus.Niebel@tq-group.com>
Cc: Peng Fan <b51431@freescale.com>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
v3:
 - include display of temperature grade for IMX6SX
v2:
 - split into two series: 1 for CPU frequency, other for Temperature grade

Tim Harvey (4):
  mx6: add OTP bank1 registers
  imx: mx6: add get_cpu_temp_grade to obtain cpu temperature grade from
    OTP
  imx: mx6: add display of CPU temperature grade in print_cpuinfo()
  thermal: imx_thermal: use CPU temperature grade for trip points

 arch/arm/cpu/armv7/mx6/soc.c              | 38 +++++++++++++++++++++++++++++++
 arch/arm/imx-common/cpu.c                 | 25 ++++++++++++++++----
 arch/arm/include/asm/arch-mx6/imx-regs.h  | 19 ++++++++++++++++
 arch/arm/include/asm/arch-mx6/sys_proto.h |  1 +
 drivers/thermal/imx_thermal.c             | 29 +++++++++++++++--------
 include/imx_thermal.h                     |  6 +++++
 6 files changed, 104 insertions(+), 14 deletions(-)

-- 
1.9.1

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot]  [Patch v3 1/4] mx6: add OTP bank1 registers
  2015-05-18 13:56 [U-Boot] [Patch v3 0/4] imx: mx6: use OTP for teperature grade info Tim Harvey
@ 2015-05-18 13:56 ` Tim Harvey
  2015-05-18 13:56 ` [U-Boot] [Patch v3 2/4] imx: mx6: add get_cpu_temp_grade to obtain cpu temperature grade from OTP Tim Harvey
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Tim Harvey @ 2015-05-18 13:56 UTC (permalink / raw)
  To: u-boot

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
 arch/arm/include/asm/arch-mx6/imx-regs.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/arch/arm/include/asm/arch-mx6/imx-regs.h b/arch/arm/include/asm/arch-mx6/imx-regs.h
index 9a4ad8b..35bb005 100644
--- a/arch/arm/include/asm/arch-mx6/imx-regs.h
+++ b/arch/arm/include/asm/arch-mx6/imx-regs.h
@@ -640,6 +640,25 @@ struct fuse_bank0_regs {
 	u32	rsvd7[3];
 };
 
+struct fuse_bank1_regs {
+	u32	mem0;
+	u32	rsvd0[3];
+	u32	mem1;
+	u32	rsvd1[3];
+	u32	mem2;
+	u32	rsvd2[3];
+	u32	mem3;
+	u32	rsvd3[3];
+	u32	mem4;
+	u32	rsvd4[3];
+	u32	ana0;
+	u32	rsvd5[3];
+	u32	ana1;
+	u32	rsvd6[3];
+	u32	ana2;
+	u32	rsvd7[3];
+};
+
 #ifdef CONFIG_MX6SX
 struct fuse_bank4_regs {
 	u32 sjc_resp_low;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [Patch v3 2/4] imx: mx6: add get_cpu_temp_grade to obtain cpu temperature grade from OTP
  2015-05-18 13:56 [U-Boot] [Patch v3 0/4] imx: mx6: use OTP for teperature grade info Tim Harvey
  2015-05-18 13:56 ` [U-Boot] [Patch v3 1/4] mx6: add OTP bank1 registers Tim Harvey
@ 2015-05-18 13:56 ` Tim Harvey
  2015-05-18 13:56 ` [U-Boot] [Patch v3 3/4] imx: mx6: add display of CPU temperature grade in print_cpuinfo() Tim Harvey
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Tim Harvey @ 2015-05-18 13:56 UTC (permalink / raw)
  To: u-boot

The MX6 has a temperature grade defined by OCOTP_MEM0[7:6] which is at 0x480
in the Fusemap Description Table in the reference manual. Return this value
as well as min/max temperature based on the value.

Note that the IMX6SDLRM and the IMX6SXRM do not indicate this in the
their Fusemap Description Table however Freescale has confirmed that these
eFUSE bits match the description within the IMX6DQRM and that they will
be added to the next revision of the respective reference manuals.

This has been tested with IMX6 Automative and Industrial parts.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
v2:
 - split out adding get_cpu_temp_grade to its own patch
 - added note about support of MX6SDL and MX6SX

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
 arch/arm/cpu/armv7/mx6/soc.c              | 38 +++++++++++++++++++++++++++++++
 arch/arm/include/asm/arch-mx6/sys_proto.h |  1 +
 include/imx_thermal.h                     |  6 +++++
 3 files changed, 45 insertions(+)

diff --git a/arch/arm/cpu/armv7/mx6/soc.c b/arch/arm/cpu/armv7/mx6/soc.c
index 71fa1fb..6f501ac 100644
--- a/arch/arm/cpu/armv7/mx6/soc.c
+++ b/arch/arm/cpu/armv7/mx6/soc.c
@@ -124,6 +124,44 @@ u32 get_cpu_speed_grade_hz(void)
 	return 0;
 }
 
+/*
+ * OCOTP_MEM0[7:6] (see Fusemap Description Table offset 0x480)
+ * defines a 2-bit Temperature Grade
+ *
+ * return temperature grade and min/max temperature in celcius
+ */
+#define OCOTP_MEM0_TEMP_SHIFT          6
+
+u32 get_cpu_temp_grade(int *minc, int *maxc)
+{
+	struct ocotp_regs *ocotp = (struct ocotp_regs *)OCOTP_BASE_ADDR;
+	struct fuse_bank *bank = &ocotp->bank[1];
+	struct fuse_bank1_regs *fuse =
+		(struct fuse_bank1_regs *)bank->fuse_regs;
+	uint32_t val;
+
+	val = readl(&fuse->mem0);
+	val >>= OCOTP_MEM0_TEMP_SHIFT;
+	val &= 0x3;
+
+	if (minc && maxc) {
+		if (val == TEMP_AUTOMOTIVE) {
+			*minc = -40;
+			*maxc = 125;
+		} else if (val == TEMP_INDUSTRIAL) {
+			*minc = -40;
+			*maxc = 105;
+		} else if (val == TEMP_EXTCOMMERCIAL) {
+			*minc = -20;
+			*maxc = 105;
+		} else {
+			*minc = 0;
+			*maxc = 95;
+		}
+	}
+	return val;
+}
+
 #ifdef CONFIG_REVISION_TAG
 u32 __weak get_board_rev(void)
 {
diff --git a/arch/arm/include/asm/arch-mx6/sys_proto.h b/arch/arm/include/asm/arch-mx6/sys_proto.h
index a2cd0a9..c583291 100644
--- a/arch/arm/include/asm/arch-mx6/sys_proto.h
+++ b/arch/arm/include/asm/arch-mx6/sys_proto.h
@@ -17,6 +17,7 @@
 u32 get_nr_cpus(void);
 u32 get_cpu_rev(void);
 u32 get_cpu_speed_grade_hz(void);
+u32 get_cpu_temp_grade(int *minc, int *maxc);
 
 /* returns MXC_CPU_ value */
 #define cpu_type(rev) (((rev) >> 12)&0xff)
diff --git a/include/imx_thermal.h b/include/imx_thermal.h
index be13652..8ce333c 100644
--- a/include/imx_thermal.h
+++ b/include/imx_thermal.h
@@ -8,6 +8,12 @@
 #ifndef _IMX_THERMAL_H_
 #define _IMX_THERMAL_H_
 
+/* CPU Temperature Grades */
+#define TEMP_COMMERCIAL         0
+#define TEMP_EXTCOMMERCIAL      1
+#define TEMP_INDUSTRIAL         2
+#define TEMP_AUTOMOTIVE         3
+
 struct imx_thermal_plat {
 	void *regs;
 	int fuse_bank;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [Patch v3 3/4] imx: mx6: add display of CPU temperature grade in print_cpuinfo()
  2015-05-18 13:56 [U-Boot] [Patch v3 0/4] imx: mx6: use OTP for teperature grade info Tim Harvey
  2015-05-18 13:56 ` [U-Boot] [Patch v3 1/4] mx6: add OTP bank1 registers Tim Harvey
  2015-05-18 13:56 ` [U-Boot] [Patch v3 2/4] imx: mx6: add get_cpu_temp_grade to obtain cpu temperature grade from OTP Tim Harvey
@ 2015-05-18 13:56 ` Tim Harvey
  2015-05-18 13:56 ` [U-Boot] [Patch v3 4/4] thermal: imx_thermal: use CPU temperature grade for trip points Tim Harvey
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 11+ messages in thread
From: Tim Harvey @ 2015-05-18 13:56 UTC (permalink / raw)
  To: u-boot

When CONFIG_IMX6_THERMAL is defined print the CPU temperature grade info
along with the current temperature.

Before:
 CPU:   Temperature 42 C

After:
 CPU:   Automotive temperature grade (-40C to 125C) at 42C
 CPU:   Industrial temperature grade (-40C to 105C) at 42C
 CPU:   Extended Commercial temperature grade (-20C to 105C) at 42C

Cc: Stefan Roese <sr@denx.de>
Cc: Eric Nelson <eric.nelson@boundarydevices.com>
Cc: Heiko Schocher <hs@denx.de>
Cc: Nikita Kiryanov <nikita@compulab.co.il>
Cc: Jon Nettleton <jon.nettleton@gmail.com>
Cc: Jason Liu <r64343@freescale.com>
Cc: Ye Li <b37916@freescale.com>
Cc: Fabio Estevam <fabio.estevam@freescale.com>
Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
Cc: Markus Niebel <Markus.Niebel@tq-group.com>
Cc: Peng Fan <b51431@freescale.com>
Tested-by: Nikolay Dimitrov <picmaster@mail.bg>
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
v3:
 - remove check for IMX6SX - it supports the same OTP regs/definitions for this
 - fixed typo in commit message
 - added Nokolay's tested by
v2:
 - moved display of CPU temperature grade to own patch and combined with the
   current temperature from the thermal sensor driver
 - add example output to description

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
 arch/arm/imx-common/cpu.c | 25 +++++++++++++++++++++----
 1 file changed, 21 insertions(+), 4 deletions(-)

diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c
index 6b20482..5be07a2 100644
--- a/arch/arm/imx-common/cpu.c
+++ b/arch/arm/imx-common/cpu.c
@@ -16,6 +16,7 @@
 #include <asm/arch/clock.h>
 #include <asm/arch/sys_proto.h>
 #include <asm/arch/crm_regs.h>
+#include <imx_thermal.h>
 #include <ipu_pixfmt.h>
 #include <thermal.h>
 #include <sata.h>
@@ -146,7 +147,7 @@ int print_cpuinfo(void)
 
 #if defined(CONFIG_MX6) && defined(CONFIG_IMX6_THERMAL)
 	struct udevice *thermal_dev;
-	int cpu_tmp, ret;
+	int cpu_tmp, minc, maxc, ret;
 #endif
 
 	cpurev = get_cpu_rev();
@@ -172,16 +173,32 @@ int print_cpuinfo(void)
 #endif
 
 #if defined(CONFIG_MX6) && defined(CONFIG_IMX6_THERMAL)
+	puts("CPU:   ");
+	switch (get_cpu_temp_grade(&minc, &maxc)) {
+	case TEMP_AUTOMOTIVE:
+		puts("Automotive temperature grade ");
+		break;
+	case TEMP_INDUSTRIAL:
+		puts("Industrial temperature grade ");
+		break;
+	case TEMP_EXTCOMMERCIAL:
+		puts("Extended Commercial temperature grade ");
+		break;
+	default:
+		puts("Commercial temperature grade ");
+		break;
+	}
+	printf("(%dC to %dC)", minc, maxc);
 	ret = uclass_get_device(UCLASS_THERMAL, 0, &thermal_dev);
 	if (!ret) {
 		ret = thermal_get_temp(thermal_dev, &cpu_tmp);
 
 		if (!ret)
-			printf("CPU:   Temperature %d C\n", cpu_tmp);
+			printf(" at %dC\n", cpu_tmp);
 		else
-			printf("CPU:   Temperature: invalid sensor data\n");
+			puts(" - invalid sensor data\n");
 	} else {
-		printf("CPU:   Temperature: Can't find sensor device\n");
+		puts(" - invalid sensor device\n");
 	}
 #endif
 
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [Patch v3 4/4] thermal: imx_thermal: use CPU temperature grade for trip points
  2015-05-18 13:56 [U-Boot] [Patch v3 0/4] imx: mx6: use OTP for teperature grade info Tim Harvey
                   ` (2 preceding siblings ...)
  2015-05-18 13:56 ` [U-Boot] [Patch v3 3/4] imx: mx6: add display of CPU temperature grade in print_cpuinfo() Tim Harvey
@ 2015-05-18 13:56 ` Tim Harvey
  2015-05-20 14:09   ` Tim Harvey
  2015-05-19  0:21 ` [U-Boot] [Patch v3 0/4] imx: mx6: use OTP for teperature grade info Peng Fan
  2015-05-20 14:43 ` Markus Niebel
  5 siblings, 1 reply; 11+ messages in thread
From: Tim Harvey @ 2015-05-18 13:56 UTC (permalink / raw)
  To: u-boot

Replace the hard-coded values for min/max/passive with values derived from
the CPU temperature grade.

Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
 drivers/thermal/imx_thermal.c | 29 +++++++++++++++++++----------
 1 file changed, 19 insertions(+), 10 deletions(-)

diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
index 0bd9cfd..b5dab63 100644
--- a/drivers/thermal/imx_thermal.c
+++ b/drivers/thermal/imx_thermal.c
@@ -12,15 +12,13 @@
 #include <fuse.h>
 #include <asm/io.h>
 #include <asm/arch/clock.h>
+#include <asm/arch/sys_proto.h>
 #include <dm.h>
 #include <errno.h>
 #include <malloc.h>
 #include <thermal.h>
 #include <imx_thermal.h>
 
-#define TEMPERATURE_MIN		-40
-#define TEMPERATURE_HOT		80
-#define TEMPERATURE_MAX		125
 #define FACTOR0			10000000
 #define FACTOR1			15976
 #define FACTOR2			4297157
@@ -34,14 +32,21 @@
 #define MISC0_REFTOP_SELBIASOFF		(1 << 3)
 #define TEMPSENSE1_MEASURE_FREQ		0xffff
 
+struct thermal_data {
+	unsigned int fuse;
+	int passive;
+	int minc;
+	int maxc;
+};
+
 static int read_cpu_temperature(struct udevice *dev)
 {
 	int temperature;
 	unsigned int reg, n_meas;
 	const struct imx_thermal_plat *pdata = dev_get_platdata(dev);
 	struct anatop_regs *anatop = (struct anatop_regs *)pdata->regs;
-	unsigned int *priv = dev_get_priv(dev);
-	u32 fuse = *priv;
+	struct thermal_data *priv = dev_get_priv(dev);
+	u32 fuse = priv->fuse;
 	int t1, n1;
 	u32 c1, c2;
 	u64 temp64;
@@ -119,11 +124,12 @@ static int read_cpu_temperature(struct udevice *dev)
 
 int imx_thermal_get_temp(struct udevice *dev, int *temp)
 {
+	struct thermal_data *priv = dev_get_priv(dev);
 	int cpu_tmp = 0;
 
 	cpu_tmp = read_cpu_temperature(dev);
-	while (cpu_tmp > TEMPERATURE_MIN && cpu_tmp < TEMPERATURE_MAX) {
-		if (cpu_tmp >= TEMPERATURE_HOT) {
+	while (cpu_tmp > priv->minc && cpu_tmp < priv->maxc) {
+		if (cpu_tmp >= priv->passive) {
 			printf("CPU Temperature is %d C, too hot to boot, waiting...\n",
 			       cpu_tmp);
 			udelay(5000000);
@@ -147,7 +153,7 @@ static int imx_thermal_probe(struct udevice *dev)
 	unsigned int fuse = ~0;
 
 	const struct imx_thermal_plat *pdata = dev_get_platdata(dev);
-	unsigned int *priv = dev_get_priv(dev);
+	struct thermal_data *priv = dev_get_priv(dev);
 
 	/* Read Temperature calibration data fuse */
 	fuse_read(pdata->fuse_bank, pdata->fuse_word, &fuse);
@@ -158,7 +164,10 @@ static int imx_thermal_probe(struct udevice *dev)
 		return -EPERM;
 	}
 
-	*priv = fuse;
+	/* set passive cooling temp to max - 20C */
+	get_cpu_temp_grade(&priv->minc, &priv->maxc);
+	priv->passive = priv->maxc - 20;
+	priv->fuse = fuse;
 
 	enable_thermal_clk();
 
@@ -170,6 +179,6 @@ U_BOOT_DRIVER(imx_thermal) = {
 	.id	= UCLASS_THERMAL,
 	.ops	= &imx_thermal_ops,
 	.probe	= imx_thermal_probe,
-	.priv_auto_alloc_size = sizeof(unsigned int),
+	.priv_auto_alloc_size = sizeof(struct thermal_data),
 	.flags  = DM_FLAG_PRE_RELOC,
 };
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 11+ messages in thread

* [U-Boot] [Patch v3 0/4] imx: mx6: use OTP for teperature grade info
  2015-05-18 13:56 [U-Boot] [Patch v3 0/4] imx: mx6: use OTP for teperature grade info Tim Harvey
                   ` (3 preceding siblings ...)
  2015-05-18 13:56 ` [U-Boot] [Patch v3 4/4] thermal: imx_thermal: use CPU temperature grade for trip points Tim Harvey
@ 2015-05-19  0:21 ` Peng Fan
  2015-05-19  8:24   ` Stefano Babic
  2015-05-20 14:43 ` Markus Niebel
  5 siblings, 1 reply; 11+ messages in thread
From: Peng Fan @ 2015-05-19  0:21 UTC (permalink / raw)
  To: u-boot

Hi Tim,

On Mon, May 18, 2015 at 06:56:43AM -0700, Tim Harvey wrote:
>Use Temperature grade info in OTP/eFUSE for thermal management and display of
>thermal data.
>
>Cc: Stefan Roese <sr@denx.de>
>Cc: Eric Nelson <eric.nelson@boundarydevices.com>
>Cc: Heiko Schocher <hs@denx.de>
>Cc: Nikita Kiryanov <nikita@compulab.co.il>
>Cc: Jon Nettleton <jon.nettleton@gmail.com>
>Cc: Jason Liu <r64343@freescale.com>
>Cc: Ye Li <b37916@freescale.com>
>Cc: Fabio Estevam <fabio.estevam@freescale.com>
>Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
>Cc: Markus Niebel <Markus.Niebel@tq-group.com>
>Cc: Peng Fan <b51431@freescale.com>
>Signed-off-by: Tim Harvey <tharvey@gateworks.com>
>---
>v3:
> - include display of temperature grade for IMX6SX
>v2:
> - split into two series: 1 for CPU frequency, other for Temperature grade
>
>Tim Harvey (4):
>  mx6: add OTP bank1 registers
>  imx: mx6: add get_cpu_temp_grade to obtain cpu temperature grade from
>    OTP
>  imx: mx6: add display of CPU temperature grade in print_cpuinfo()
>  thermal: imx_thermal: use CPU temperature grade for trip points
>
> arch/arm/cpu/armv7/mx6/soc.c              | 38 +++++++++++++++++++++++++++++++
> arch/arm/imx-common/cpu.c                 | 25 ++++++++++++++++----
> arch/arm/include/asm/arch-mx6/imx-regs.h  | 19 ++++++++++++++++
> arch/arm/include/asm/arch-mx6/sys_proto.h |  1 +
> drivers/thermal/imx_thermal.c             | 29 +++++++++++++++--------
> include/imx_thermal.h                     |  6 +++++
> 6 files changed, 104 insertions(+), 14 deletions(-)

Tested on mx6sxsabresd RevB TO1.2 board.

I also applied this two patch for this test:
https://patchwork.ozlabs.org/patch/473405/
https://patchwork.ozlabs.org/patch/473406/

U-Boot 2015.07-rc1-00260-g44bf513 (May 19 2015 - 09:14:52)

CPU:   Freescale i.MX6SX rev1.2 996 MHz (running at 792 MHz)
CPU:   Extended Commercial temperature grade (-20C to 105C) at 33C
Reset cause: POR
Board: MX6SX SABRE SDB
I2C:   ready
DRAM:  1 GiB
PMIC:  PFUZE100 ID=0x11
MMC:   FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2
In:    serial
Out:   serial
Err:   serial
Net:   FEC [PRIME]
Hit any key to stop autoboot:  0
=>

Tested-by: Peng Fan <Peng.Fan@freescale.com>

>
>-- 
>1.9.1
>

-- 

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [Patch v3 0/4] imx: mx6: use OTP for teperature grade info
  2015-05-19  0:21 ` [U-Boot] [Patch v3 0/4] imx: mx6: use OTP for teperature grade info Peng Fan
@ 2015-05-19  8:24   ` Stefano Babic
  0 siblings, 0 replies; 11+ messages in thread
From: Stefano Babic @ 2015-05-19  8:24 UTC (permalink / raw)
  To: u-boot

Hi Peng, Tim,

On 19/05/2015 02:21, Peng Fan wrote:

> 
> U-Boot 2015.07-rc1-00260-g44bf513 (May 19 2015 - 09:14:52)
> 
> CPU:   Freescale i.MX6SX rev1.2 996 MHz (running at 792 MHz)
> CPU:   Extended Commercial temperature grade (-20C to 105C) at 33C
> Reset cause: POR
> Board: MX6SX SABRE SDB
> I2C:   ready
> DRAM:  1 GiB
> PMIC:  PFUZE100 ID=0x11
> MMC:   FSL_SDHC: 0, FSL_SDHC: 1, FSL_SDHC: 2
> In:    serial
> Out:   serial
> Err:   serial
> Net:   FEC [PRIME]
> Hit any key to stop autoboot:  0
> =>
> 
> Tested-by: Peng Fan <Peng.Fan@freescale.com>
> 

Thanks.

It looks like the last issue was solved - if nobody else complains,
these patches are ready for merging.

Best regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [Patch v3 4/4] thermal: imx_thermal: use CPU temperature grade for trip points
  2015-05-18 13:56 ` [U-Boot] [Patch v3 4/4] thermal: imx_thermal: use CPU temperature grade for trip points Tim Harvey
@ 2015-05-20 14:09   ` Tim Harvey
  0 siblings, 0 replies; 11+ messages in thread
From: Tim Harvey @ 2015-05-20 14:09 UTC (permalink / raw)
  To: u-boot

On Mon, May 18, 2015 at 6:56 AM, Tim Harvey <tharvey@gateworks.com> wrote:
> Replace the hard-coded values for min/max/passive with values derived from
> the CPU temperature grade.
>
> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> ---
>  drivers/thermal/imx_thermal.c | 29 +++++++++++++++++++----------
>  1 file changed, 19 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/thermal/imx_thermal.c b/drivers/thermal/imx_thermal.c
<snip>
> -#define TEMPERATURE_MIN                -40
> -#define TEMPERATURE_HOT                80
> -#define TEMPERATURE_MAX                125
<snip>
> @@ -119,11 +124,12 @@ static int read_cpu_temperature(struct udevice *dev)
>
>  int imx_thermal_get_temp(struct udevice *dev, int *temp)
>  {
> +       struct thermal_data *priv = dev_get_priv(dev);
>         int cpu_tmp = 0;
>
>         cpu_tmp = read_cpu_temperature(dev);
> -       while (cpu_tmp > TEMPERATURE_MIN && cpu_tmp < TEMPERATURE_MAX) {
> -               if (cpu_tmp >= TEMPERATURE_HOT) {
> +       while (cpu_tmp > priv->minc && cpu_tmp < priv->maxc) {
> +               if (cpu_tmp >= priv->passive) {
>                         printf("CPU Temperature is %d C, too hot to boot, waiting...\n",
>                                cpu_tmp);
>                         udelay(5000000);

Ye,

I'm curious where you got your previous hard-coded values of -40/80/125 from?

The range of -40 to 125 makes me think it was assumed that the IMX6
was Automotive grade (probably a bad assumption) but I'm more curious
about the value of 80C that kicks in this busywait loop above.

<snip>
> +       /* set passive cooling temp to max - 20C */
> +       get_cpu_temp_grade(&priv->minc, &priv->maxc);
> +       priv->passive = priv->maxc - 20;
> +       priv->fuse = fuse;
>

In my patch here I am calling your TEMPERATURE_HOT the 'passive' temp
and setting it to maxc-20 which for an industrial grade CPU with a max
of 105C is 85C.

Do we really want to sit in a busywait loop if the board is too hot
and if so isn't maxc-20 way too aggressive? I think that I should
re-work this patch and set 'passive' to 'maxc' or maybe just a few C
under it instead of 20C. Until then I'll need to disable
CONFIG_IMX6_THERMAL for our board because it doesn't allow us to even
run at an ambient temperature of 80C with an intdustrial processor
(80C is the point at which the CPU hits 85C at 800Mhz in U-Boot on our
board).

Tim

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [Patch v3 0/4] imx: mx6: use OTP for teperature grade info
  2015-05-18 13:56 [U-Boot] [Patch v3 0/4] imx: mx6: use OTP for teperature grade info Tim Harvey
                   ` (4 preceding siblings ...)
  2015-05-19  0:21 ` [U-Boot] [Patch v3 0/4] imx: mx6: use OTP for teperature grade info Peng Fan
@ 2015-05-20 14:43 ` Markus Niebel
  2015-05-20 14:45   ` Otavio Salvador
  5 siblings, 1 reply; 11+ messages in thread
From: Markus Niebel @ 2015-05-20 14:43 UTC (permalink / raw)
  To: u-boot

Am 18.05.2015 um 15:56 schrieb Tim Harvey:
> Use Temperature grade info in OTP/eFUSE for thermal management and display of
> thermal data.
> 
> Cc: Stefan Roese <sr@denx.de>
> Cc: Eric Nelson <eric.nelson@boundarydevices.com>
> Cc: Heiko Schocher <hs@denx.de>
> Cc: Nikita Kiryanov <nikita@compulab.co.il>
> Cc: Jon Nettleton <jon.nettleton@gmail.com>
> Cc: Jason Liu <r64343@freescale.com>
> Cc: Ye Li <b37916@freescale.com>
> Cc: Fabio Estevam <fabio.estevam@freescale.com>
> Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
> Cc: Markus Niebel <Markus.Niebel@tq-group.com>
> Cc: Peng Fan <b51431@freescale.com>
> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> ---
> v3:
>  - include display of temperature grade for IMX6SX
> v2:
>  - split into two series: 1 for CPU frequency, other for Temperature grade
> 
> Tim Harvey (4):
>   mx6: add OTP bank1 registers
>   imx: mx6: add get_cpu_temp_grade to obtain cpu temperature grade from
>     OTP
>   imx: mx6: add display of CPU temperature grade in print_cpuinfo()
>   thermal: imx_thermal: use CPU temperature grade for trip points
> 
>  arch/arm/cpu/armv7/mx6/soc.c              | 38 +++++++++++++++++++++++++++++++
>  arch/arm/imx-common/cpu.c                 | 25 ++++++++++++++++----
>  arch/arm/include/asm/arch-mx6/imx-regs.h  | 19 ++++++++++++++++
>  arch/arm/include/asm/arch-mx6/sys_proto.h |  1 +
>  drivers/thermal/imx_thermal.c             | 29 +++++++++++++++--------
>  include/imx_thermal.h                     |  6 +++++
>  6 files changed, 104 insertions(+), 14 deletions(-)
> 

Tested on TQMa6Q and TQMa6D

following patches were also applied:
https://patchwork.ozlabs.org/patch/473405/
https://patchwork.ozlabs.org/patch/473406/

Tested-by: Markus Niebel <Markus.Niebel@tq-group.com>

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [Patch v3 0/4] imx: mx6: use OTP for teperature grade info
  2015-05-20 14:43 ` Markus Niebel
@ 2015-05-20 14:45   ` Otavio Salvador
  2015-05-20 15:09     ` Stefano Babic
  0 siblings, 1 reply; 11+ messages in thread
From: Otavio Salvador @ 2015-05-20 14:45 UTC (permalink / raw)
  To: u-boot

On Wed, May 20, 2015 at 11:43 AM, Markus Niebel <list-09_u-boot@tqsc.de> wrote:
> Am 18.05.2015 um 15:56 schrieb Tim Harvey:
>> Use Temperature grade info in OTP/eFUSE for thermal management and display of
>> thermal data.
>>
>> Cc: Stefan Roese <sr@denx.de>
>> Cc: Eric Nelson <eric.nelson@boundarydevices.com>
>> Cc: Heiko Schocher <hs@denx.de>
>> Cc: Nikita Kiryanov <nikita@compulab.co.il>
>> Cc: Jon Nettleton <jon.nettleton@gmail.com>
>> Cc: Jason Liu <r64343@freescale.com>
>> Cc: Ye Li <b37916@freescale.com>
>> Cc: Fabio Estevam <fabio.estevam@freescale.com>
>> Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
>> Cc: Markus Niebel <Markus.Niebel@tq-group.com>
>> Cc: Peng Fan <b51431@freescale.com>
>> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
>> ---
>> v3:
>>  - include display of temperature grade for IMX6SX
>> v2:
>>  - split into two series: 1 for CPU frequency, other for Temperature grade
>>
>> Tim Harvey (4):
>>   mx6: add OTP bank1 registers
>>   imx: mx6: add get_cpu_temp_grade to obtain cpu temperature grade from
>>     OTP
>>   imx: mx6: add display of CPU temperature grade in print_cpuinfo()
>>   thermal: imx_thermal: use CPU temperature grade for trip points
>>
>>  arch/arm/cpu/armv7/mx6/soc.c              | 38 +++++++++++++++++++++++++++++++
>>  arch/arm/imx-common/cpu.c                 | 25 ++++++++++++++++----
>>  arch/arm/include/asm/arch-mx6/imx-regs.h  | 19 ++++++++++++++++
>>  arch/arm/include/asm/arch-mx6/sys_proto.h |  1 +
>>  drivers/thermal/imx_thermal.c             | 29 +++++++++++++++--------
>>  include/imx_thermal.h                     |  6 +++++
>>  6 files changed, 104 insertions(+), 14 deletions(-)
>>
>
> Tested on TQMa6Q and TQMa6D
>
> following patches were also applied:
> https://patchwork.ozlabs.org/patch/473405/
> https://patchwork.ozlabs.org/patch/473406/
>
> Tested-by: Markus Niebel <Markus.Niebel@tq-group.com>

I think those are applied in Stephano's tree today.

-- 
Otavio Salvador                             O.S. Systems
http://www.ossystems.com.br        http://code.ossystems.com.br
Mobile: +55 (53) 9981-7854            Mobile: +1 (347) 903-9750

^ permalink raw reply	[flat|nested] 11+ messages in thread

* [U-Boot] [Patch v3 0/4] imx: mx6: use OTP for teperature grade info
  2015-05-20 14:45   ` Otavio Salvador
@ 2015-05-20 15:09     ` Stefano Babic
  0 siblings, 0 replies; 11+ messages in thread
From: Stefano Babic @ 2015-05-20 15:09 UTC (permalink / raw)
  To: u-boot

On 20/05/2015 16:45, Otavio Salvador wrote:
> On Wed, May 20, 2015 at 11:43 AM, Markus Niebel <list-09_u-boot@tqsc.de> wrote:
>> Am 18.05.2015 um 15:56 schrieb Tim Harvey:
>>> Use Temperature grade info in OTP/eFUSE for thermal management and display of
>>> thermal data.
>>>
>>> Cc: Stefan Roese <sr@denx.de>
>>> Cc: Eric Nelson <eric.nelson@boundarydevices.com>
>>> Cc: Heiko Schocher <hs@denx.de>
>>> Cc: Nikita Kiryanov <nikita@compulab.co.il>
>>> Cc: Jon Nettleton <jon.nettleton@gmail.com>
>>> Cc: Jason Liu <r64343@freescale.com>
>>> Cc: Ye Li <b37916@freescale.com>
>>> Cc: Fabio Estevam <fabio.estevam@freescale.com>
>>> Cc: Christian Gmeiner <christian.gmeiner@gmail.com>
>>> Cc: Markus Niebel <Markus.Niebel@tq-group.com>
>>> Cc: Peng Fan <b51431@freescale.com>
>>> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
>>> ---
>>> v3:
>>>  - include display of temperature grade for IMX6SX
>>> v2:
>>>  - split into two series: 1 for CPU frequency, other for Temperature grade
>>>
>>> Tim Harvey (4):
>>>   mx6: add OTP bank1 registers
>>>   imx: mx6: add get_cpu_temp_grade to obtain cpu temperature grade from
>>>     OTP
>>>   imx: mx6: add display of CPU temperature grade in print_cpuinfo()
>>>   thermal: imx_thermal: use CPU temperature grade for trip points
>>>
>>>  arch/arm/cpu/armv7/mx6/soc.c              | 38 +++++++++++++++++++++++++++++++
>>>  arch/arm/imx-common/cpu.c                 | 25 ++++++++++++++++----
>>>  arch/arm/include/asm/arch-mx6/imx-regs.h  | 19 ++++++++++++++++
>>>  arch/arm/include/asm/arch-mx6/sys_proto.h |  1 +
>>>  drivers/thermal/imx_thermal.c             | 29 +++++++++++++++--------
>>>  include/imx_thermal.h                     |  6 +++++
>>>  6 files changed, 104 insertions(+), 14 deletions(-)
>>>
>>
>> Tested on TQMa6Q and TQMa6D
>>
>> following patches were also applied:
>> https://patchwork.ozlabs.org/patch/473405/
>> https://patchwork.ozlabs.org/patch/473406/
>>
>> Tested-by: Markus Niebel <Markus.Niebel@tq-group.com>
> 
> I think those are applied in Stephano's tree today.

Yes, Markus - patches are already merged into imx.

Regards,
Stefano Babic

-- 
=====================================================================
DENX Software Engineering GmbH,      Managing Director: Wolfgang Denk
HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany
Phone: +49-8142-66989-53 Fax: +49-8142-66989-80 Email: sbabic at denx.de
=====================================================================

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2015-05-20 15:09 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-18 13:56 [U-Boot] [Patch v3 0/4] imx: mx6: use OTP for teperature grade info Tim Harvey
2015-05-18 13:56 ` [U-Boot] [Patch v3 1/4] mx6: add OTP bank1 registers Tim Harvey
2015-05-18 13:56 ` [U-Boot] [Patch v3 2/4] imx: mx6: add get_cpu_temp_grade to obtain cpu temperature grade from OTP Tim Harvey
2015-05-18 13:56 ` [U-Boot] [Patch v3 3/4] imx: mx6: add display of CPU temperature grade in print_cpuinfo() Tim Harvey
2015-05-18 13:56 ` [U-Boot] [Patch v3 4/4] thermal: imx_thermal: use CPU temperature grade for trip points Tim Harvey
2015-05-20 14:09   ` Tim Harvey
2015-05-19  0:21 ` [U-Boot] [Patch v3 0/4] imx: mx6: use OTP for teperature grade info Peng Fan
2015-05-19  8:24   ` Stefano Babic
2015-05-20 14:43 ` Markus Niebel
2015-05-20 14:45   ` Otavio Salvador
2015-05-20 15:09     ` Stefano Babic

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox