* [U-Boot] [PATCH v2 1/4] mx6: add OTP bank1 registers
2015-05-14 5:11 [U-Boot] [PATCH v2 0/4]: imx: mx6: use OTP for temperature grade info Tim Harvey
@ 2015-05-14 5:11 ` Tim Harvey
2015-05-15 8:08 ` Christian Gmeiner
2015-05-17 22:32 ` Nikolay Dimitrov
2015-05-14 5:11 ` [U-Boot] [PATCH v2 2/4] imx: mx6: add get_cpu_temp_grade to obtain cpu temperature grade from OTP Tim Harvey
` (2 subsequent siblings)
3 siblings, 2 replies; 19+ messages in thread
From: Tim Harvey @ 2015-05-14 5:11 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] 19+ messages in thread
* [U-Boot] [PATCH v2 1/4] mx6: add OTP bank1 registers
2015-05-14 5:11 ` [U-Boot] [PATCH v2 1/4] mx6: add OTP bank1 registers Tim Harvey
@ 2015-05-15 8:08 ` Christian Gmeiner
2015-05-17 22:32 ` Nikolay Dimitrov
1 sibling, 0 replies; 19+ messages in thread
From: Christian Gmeiner @ 2015-05-15 8:08 UTC (permalink / raw)
To: u-boot
2015-05-14 7:11 GMT+02:00 Tim Harvey <tharvey@gateworks.com>:
> 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
>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
greets
--
Christian Gmeiner, MSc
https://soundcloud.com/christian-gmeiner
^ permalink raw reply [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH v2 1/4] mx6: add OTP bank1 registers
2015-05-14 5:11 ` [U-Boot] [PATCH v2 1/4] mx6: add OTP bank1 registers Tim Harvey
2015-05-15 8:08 ` Christian Gmeiner
@ 2015-05-17 22:32 ` Nikolay Dimitrov
1 sibling, 0 replies; 19+ messages in thread
From: Nikolay Dimitrov @ 2015-05-17 22:32 UTC (permalink / raw)
To: u-boot
Hi Tim,
On 05/14/2015 08:11 AM, Tim Harvey wrote:
> 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;
>
U-Boot 2015.07-rc1-21804-gaf1db4a-dirty (May 18 2015 - 01:26:05)
CPU: Freescale i.MX6SOLO rev1.1 996 MHz (running at 792 MHz)
CPU: Commercial temperature grade (0C to 95C) at 59C
Reset cause: POR
Board: RIoTboard
Tested-by: Nikolay Dimitrov <picmaster@mail.bg>
Regards,
Nikolay
^ permalink raw reply [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH v2 2/4] imx: mx6: add get_cpu_temp_grade to obtain cpu temperature grade from OTP
2015-05-14 5:11 [U-Boot] [PATCH v2 0/4]: imx: mx6: use OTP for temperature grade info Tim Harvey
2015-05-14 5:11 ` [U-Boot] [PATCH v2 1/4] mx6: add OTP bank1 registers Tim Harvey
@ 2015-05-14 5:11 ` Tim Harvey
2015-05-15 8:17 ` Christian Gmeiner
2015-05-17 22:33 ` Nikolay Dimitrov
2015-05-14 5:11 ` [U-Boot] [PATCH v2 3/4] imx: mx6: add display of CPU temperature grade in print_cpuinfo() Tim Harvey
2015-05-14 5:11 ` [U-Boot] [PATCH v2 4/4] thermal: imx_thermal: use CPU temperature grade for trip points Tim Harvey
3 siblings, 2 replies; 19+ messages in thread
From: Tim Harvey @ 2015-05-14 5:11 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] 19+ messages in thread
* [U-Boot] [PATCH v2 2/4] imx: mx6: add get_cpu_temp_grade to obtain cpu temperature grade from OTP
2015-05-14 5:11 ` [U-Boot] [PATCH v2 2/4] imx: mx6: add get_cpu_temp_grade to obtain cpu temperature grade from OTP Tim Harvey
@ 2015-05-15 8:17 ` Christian Gmeiner
2015-05-17 22:33 ` Nikolay Dimitrov
1 sibling, 0 replies; 19+ messages in thread
From: Christian Gmeiner @ 2015-05-15 8:17 UTC (permalink / raw)
To: u-boot
2015-05-14 7:11 GMT+02:00 Tim Harvey <tharvey@gateworks.com>:
> 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
>
Reviewed-by: Christian Gmeiner <christian.gmeiner@gmail.com>
greets
--
Christian Gmeiner, MSc
https://soundcloud.com/christian-gmeiner
^ permalink raw reply [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH v2 2/4] imx: mx6: add get_cpu_temp_grade to obtain cpu temperature grade from OTP
2015-05-14 5:11 ` [U-Boot] [PATCH v2 2/4] imx: mx6: add get_cpu_temp_grade to obtain cpu temperature grade from OTP Tim Harvey
2015-05-15 8:17 ` Christian Gmeiner
@ 2015-05-17 22:33 ` Nikolay Dimitrov
1 sibling, 0 replies; 19+ messages in thread
From: Nikolay Dimitrov @ 2015-05-17 22:33 UTC (permalink / raw)
To: u-boot
On 05/14/2015 08:11 AM, Tim Harvey wrote:
> 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;
>
Tested-by: Nikolay Dimitrov <picmaster@mail.bg>
Regards,
Nikolay
^ permalink raw reply [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH v2 3/4] imx: mx6: add display of CPU temperature grade in print_cpuinfo()
2015-05-14 5:11 [U-Boot] [PATCH v2 0/4]: imx: mx6: use OTP for temperature grade info Tim Harvey
2015-05-14 5:11 ` [U-Boot] [PATCH v2 1/4] mx6: add OTP bank1 registers Tim Harvey
2015-05-14 5:11 ` [U-Boot] [PATCH v2 2/4] imx: mx6: add get_cpu_temp_grade to obtain cpu temperature grade from OTP Tim Harvey
@ 2015-05-14 5:11 ` Tim Harvey
2015-05-15 8:14 ` Christian Gmeiner
2015-05-17 22:33 ` Nikolay Dimitrov
2015-05-14 5:11 ` [U-Boot] [PATCH v2 4/4] thermal: imx_thermal: use CPU temperature grade for trip points Tim Harvey
3 siblings, 2 replies; 19+ messages in thread
From: Tim Harvey @ 2015-05-14 5:11 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: Industiral temperature grade (-40C to 105C) at 42C
CPU: Extended Commercial temperature grade (-20C to 105C) at 42C
Signed-off-by: Tim Harvey <tharvey@gateworks.com>
---
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 | 27 +++++++++++++++++++++++----
1 file changed, 23 insertions(+), 4 deletions(-)
diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c
index 6b20482..f1b49bb 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,34 @@ int print_cpuinfo(void)
#endif
#if defined(CONFIG_MX6) && defined(CONFIG_IMX6_THERMAL)
+ puts("CPU: ");
+ if (!is_cpu_type(MXC_CPU_MX6SX)) {
+ 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] 19+ messages in thread
* [U-Boot] [PATCH v2 3/4] imx: mx6: add display of CPU temperature grade in print_cpuinfo()
2015-05-14 5:11 ` [U-Boot] [PATCH v2 3/4] imx: mx6: add display of CPU temperature grade in print_cpuinfo() Tim Harvey
@ 2015-05-15 8:14 ` Christian Gmeiner
2015-05-15 13:16 ` Tim Harvey
2015-05-17 22:33 ` Nikolay Dimitrov
1 sibling, 1 reply; 19+ messages in thread
From: Christian Gmeiner @ 2015-05-15 8:14 UTC (permalink / raw)
To: u-boot
2015-05-14 7:11 GMT+02:00 Tim Harvey <tharvey@gateworks.com>:
> 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: Industiral temperature grade (-40C to 105C) at 42C
> CPU: Extended Commercial temperature grade (-20C to 105C) at 42C
>
> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> ---
> 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 | 27 +++++++++++++++++++++++----
> 1 file changed, 23 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c
> index 6b20482..f1b49bb 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,34 @@ int print_cpuinfo(void)
> #endif
>
> #if defined(CONFIG_MX6) && defined(CONFIG_IMX6_THERMAL)
> + puts("CPU: ");
> + if (!is_cpu_type(MXC_CPU_MX6SX)) {
> + 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);
> + }
For the additions above we do not need CONFIG_IMX6_THERMAL.
> 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
>
greets
--
Christian Gmeiner, MSc
https://soundcloud.com/christian-gmeiner
^ permalink raw reply [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH v2 3/4] imx: mx6: add display of CPU temperature grade in print_cpuinfo()
2015-05-15 8:14 ` Christian Gmeiner
@ 2015-05-15 13:16 ` Tim Harvey
2015-05-15 13:24 ` Stefano Babic
0 siblings, 1 reply; 19+ messages in thread
From: Tim Harvey @ 2015-05-15 13:16 UTC (permalink / raw)
To: u-boot
On Fri, May 15, 2015 at 1:14 AM, Christian Gmeiner
<christian.gmeiner@gmail.com> wrote:
> 2015-05-14 7:11 GMT+02:00 Tim Harvey <tharvey@gateworks.com>:
>> 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: Industiral temperature grade (-40C to 105C) at 42C
>> CPU: Extended Commercial temperature grade (-20C to 105C) at 42C
>>
>> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
>> ---
>> 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 | 27 +++++++++++++++++++++++----
>> 1 file changed, 23 insertions(+), 4 deletions(-)
>>
>> diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c
>> index 6b20482..f1b49bb 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,34 @@ int print_cpuinfo(void)
>> #endif
>>
>> #if defined(CONFIG_MX6) && defined(CONFIG_IMX6_THERMAL)
>> + puts("CPU: ");
>> + if (!is_cpu_type(MXC_CPU_MX6SX)) {
>> + 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);
>> + }
>
> For the additions above we do not need CONFIG_IMX6_THERMAL.
Hi Christian,
Thanks for the review.
Its true that CONFIG_IMX6_THERMAL is not needed for cpu temperature
grade but I felt that there would be resistance in general to adding
additional lines in print_cpuinfo without allowing them to be easily
disabled. I felt that temperature grade and current temperature made
sense to go together in this fasion.
Looking over this though did remind me that now that Freescale has
told me that the IMX6SX has the same OTP registers/definitions for
temperature grade programmed I can remove the skip for MX6SX. I would
however sure like to have someone with an actual MX6SX enable that
code and give us some testing feedback.
Regards,
Tim
^ permalink raw reply [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH v2 3/4] imx: mx6: add display of CPU temperature grade in print_cpuinfo()
2015-05-15 13:16 ` Tim Harvey
@ 2015-05-15 13:24 ` Stefano Babic
2015-05-15 13:31 ` Tim Harvey
0 siblings, 1 reply; 19+ messages in thread
From: Stefano Babic @ 2015-05-15 13:24 UTC (permalink / raw)
To: u-boot
Hi Tim,
On 15/05/2015 15:16, Tim Harvey wrote:
> On Fri, May 15, 2015 at 1:14 AM, Christian Gmeiner
> <christian.gmeiner@gmail.com> wrote:
>> 2015-05-14 7:11 GMT+02:00 Tim Harvey <tharvey@gateworks.com>:
>>> 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: Industiral temperature grade (-40C to 105C) at 42C
>>> CPU: Extended Commercial temperature grade (-20C to 105C) at 42C
>>>
>>> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
>>> ---
>>> 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 | 27 +++++++++++++++++++++++----
>>> 1 file changed, 23 insertions(+), 4 deletions(-)
>>>
>>> diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c
>>> index 6b20482..f1b49bb 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,34 @@ int print_cpuinfo(void)
>>> #endif
>>>
>>> #if defined(CONFIG_MX6) && defined(CONFIG_IMX6_THERMAL)
>>> + puts("CPU: ");
>>> + if (!is_cpu_type(MXC_CPU_MX6SX)) {
>>> + 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);
>>> + }
>>
>> For the additions above we do not need CONFIG_IMX6_THERMAL.
>
> Hi Christian,
>
> Thanks for the review.
>
> Its true that CONFIG_IMX6_THERMAL is not needed for cpu temperature
> grade but I felt that there would be resistance in general to adding
> additional lines in print_cpuinfo without allowing them to be easily
> disabled.
Agree on this point.
> I felt that temperature grade and current temperature made
> sense to go together in this fasion.
>
> Looking over this though did remind me that now that Freescale has
> told me that the IMX6SX has the same OTP registers/definitions for
> temperature grade programmed I can remove the skip for MX6SX. I would
> however sure like to have someone with an actual MX6SX enable that
> code and give us some testing feedback.
>
Right. My proposal is to merge the currrent patchset, enabling for
IMX6SX again when someone will test it.
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] 19+ messages in thread
* [U-Boot] [PATCH v2 3/4] imx: mx6: add display of CPU temperature grade in print_cpuinfo()
2015-05-15 13:24 ` Stefano Babic
@ 2015-05-15 13:31 ` Tim Harvey
2015-05-15 13:36 ` Fabio Estevam
2015-05-15 13:44 ` Stefano Babic
0 siblings, 2 replies; 19+ messages in thread
From: Tim Harvey @ 2015-05-15 13:31 UTC (permalink / raw)
To: u-boot
On Fri, May 15, 2015 at 6:24 AM, Stefano Babic <sbabic@denx.de> wrote:
> Hi Tim,
>
> On 15/05/2015 15:16, Tim Harvey wrote:
>> On Fri, May 15, 2015 at 1:14 AM, Christian Gmeiner
>> <christian.gmeiner@gmail.com> wrote:
>>> 2015-05-14 7:11 GMT+02:00 Tim Harvey <tharvey@gateworks.com>:
>>>> 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: Industiral temperature grade (-40C to 105C) at 42C
>>>> CPU: Extended Commercial temperature grade (-20C to 105C) at 42C
>>>>
>>>> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
>>>> ---
>>>> 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 | 27 +++++++++++++++++++++++----
>>>> 1 file changed, 23 insertions(+), 4 deletions(-)
>>>>
>>>> diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c
>>>> index 6b20482..f1b49bb 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,34 @@ int print_cpuinfo(void)
>>>> #endif
>>>>
>>>> #if defined(CONFIG_MX6) && defined(CONFIG_IMX6_THERMAL)
>>>> + puts("CPU: ");
>>>> + if (!is_cpu_type(MXC_CPU_MX6SX)) {
>>>> + 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);
>>>> + }
>>>
>>> For the additions above we do not need CONFIG_IMX6_THERMAL.
>>
>> Hi Christian,
>>
>> Thanks for the review.
>>
>> Its true that CONFIG_IMX6_THERMAL is not needed for cpu temperature
>> grade but I felt that there would be resistance in general to adding
>> additional lines in print_cpuinfo without allowing them to be easily
>> disabled.
>
> Agree on this point.
>
>> I felt that temperature grade and current temperature made
>> sense to go together in this fasion.
>>
>> Looking over this though did remind me that now that Freescale has
>> told me that the IMX6SX has the same OTP registers/definitions for
>> temperature grade programmed I can remove the skip for MX6SX. I would
>> however sure like to have someone with an actual MX6SX enable that
>> code and give us some testing feedback.
>>
>
> Right. My proposal is to merge the currrent patchset, enabling for
> IMX6SX again when someone will test it.
>
> Best regards,
> Stefano Babic
>
Stefano,
Yes, that sounds like the best approach. What were your thoughts on
enabling the second CPU: line just to display the temperature grade if
CONFIG_IMX6_THERMAL was not enabled?
I'm surprised someone on this list hasn't already tested this on IMX6SX.
Fabio - certainly you must have a reference board with an IMX6SX and
could enable/test that the CPU markings agree with what is
detected/displayed via OTP?
Tim
^ permalink raw reply [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH v2 3/4] imx: mx6: add display of CPU temperature grade in print_cpuinfo()
2015-05-15 13:31 ` Tim Harvey
@ 2015-05-15 13:36 ` Fabio Estevam
2015-05-18 0:11 ` Peng Fan
2015-05-15 13:44 ` Stefano Babic
1 sibling, 1 reply; 19+ messages in thread
From: Fabio Estevam @ 2015-05-15 13:36 UTC (permalink / raw)
To: u-boot
Hi Tim,
On Fri, May 15, 2015 at 10:31 AM, Tim Harvey <tharvey@gateworks.com> wrote:
> Yes, that sounds like the best approach. What were your thoughts on
> enabling the second CPU: line just to display the temperature grade if
> CONFIG_IMX6_THERMAL was not enabled?
>
> I'm surprised someone on this list hasn't already tested this on IMX6SX.
>
> Fabio - certainly you must have a reference board with an IMX6SX and
> could enable/test that the CPU markings agree with what is
> detected/displayed via OTP?
Yes, I do have a mx6sx sdb board, but the one I have is from the old
silicon and I had issues event with the temperature reading, so I
prefer not to rely on my testing.
Ye Li / Peng / Nitin,
Could some of you please test Tim's series on a mx6sx sdb and let us
know what it displays on the CPU lines?
Thanks,
Fabio Estevam
^ permalink raw reply [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH v2 3/4] imx: mx6: add display of CPU temperature grade in print_cpuinfo()
2015-05-15 13:36 ` Fabio Estevam
@ 2015-05-18 0:11 ` Peng Fan
2015-05-18 13:30 ` Tim Harvey
0 siblings, 1 reply; 19+ messages in thread
From: Peng Fan @ 2015-05-18 0:11 UTC (permalink / raw)
To: u-boot
Hi Fabio,
On Fri, May 15, 2015 at 10:36:09AM -0300, Fabio Estevam wrote:
>Hi Tim,
>
>On Fri, May 15, 2015 at 10:31 AM, Tim Harvey <tharvey@gateworks.com> wrote:
>
>> Yes, that sounds like the best approach. What were your thoughts on
>> enabling the second CPU: line just to display the temperature grade if
>> CONFIG_IMX6_THERMAL was not enabled?
>>
>> I'm surprised someone on this list hasn't already tested this on IMX6SX.
>>
>> Fabio - certainly you must have a reference board with an IMX6SX and
>> could enable/test that the CPU markings agree with what is
>> detected/displayed via OTP?
>
>Yes, I do have a mx6sx sdb board, but the one I have is from the old
>silicon and I had issues event with the temperature reading, so I
>prefer not to rely on my testing.
>
>Ye Li / Peng / Nitin,
>
>Could some of you please test Tim's series on a mx6sx sdb and let us
>know what it displays on the CPU lines?
>
Tested on mx6sx sdb Revb board. I applied the following patches for this test:
mx6: add OTP bank1 registers
thermal: imx_thermal: use CPU temperature grade for trip points
imx: mx6: add display of CPU temperature grade in print_cpuinfo()
imx: mx6: add get_cpu_temp_grade to obtain cpu temperature grade from OTP
mx: mx6: display max cpu frequency in print_cpuinfo()
imx: mx6: add get_cpu_speed_grade_hz func to return MHz speed grade from OTP
The log info: "
U-Boot 2015.07-rc1-00256-gec154cc (May 18 2015 - 09:00:57)
CPU: Freescale i.MX6SX rev1.2 996 MHz (running at 792 MHz)
CPU: at 39C
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
"
>Thanks,
>
>Fabio Estevam
Regards,
Peng.
--
^ permalink raw reply [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH v2 3/4] imx: mx6: add display of CPU temperature grade in print_cpuinfo()
2015-05-18 0:11 ` Peng Fan
@ 2015-05-18 13:30 ` Tim Harvey
0 siblings, 0 replies; 19+ messages in thread
From: Tim Harvey @ 2015-05-18 13:30 UTC (permalink / raw)
To: u-boot
On Sun, May 17, 2015 at 5:11 PM, Peng Fan <b51431@freescale.com> wrote:
> Hi Fabio,
>
> On Fri, May 15, 2015 at 10:36:09AM -0300, Fabio Estevam wrote:
>>Hi Tim,
>>
>>On Fri, May 15, 2015 at 10:31 AM, Tim Harvey <tharvey@gateworks.com> wrote:
>>
>>> Yes, that sounds like the best approach. What were your thoughts on
>>> enabling the second CPU: line just to display the temperature grade if
>>> CONFIG_IMX6_THERMAL was not enabled?
>>>
>>> I'm surprised someone on this list hasn't already tested this on IMX6SX.
>>>
>>> Fabio - certainly you must have a reference board with an IMX6SX and
>>> could enable/test that the CPU markings agree with what is
>>> detected/displayed via OTP?
>>
>>Yes, I do have a mx6sx sdb board, but the one I have is from the old
>>silicon and I had issues event with the temperature reading, so I
>>prefer not to rely on my testing.
>>
>>Ye Li / Peng / Nitin,
>>
>>Could some of you please test Tim's series on a mx6sx sdb and let us
>>know what it displays on the CPU lines?
>>
> Tested on mx6sx sdb Revb board. I applied the following patches for this test:
>
> mx6: add OTP bank1 registers
> thermal: imx_thermal: use CPU temperature grade for trip points
> imx: mx6: add display of CPU temperature grade in print_cpuinfo()
> imx: mx6: add get_cpu_temp_grade to obtain cpu temperature grade from OTP
> mx: mx6: display max cpu frequency in print_cpuinfo()
> imx: mx6: add get_cpu_speed_grade_hz func to return MHz speed grade from OTP
>
> The log info: "
> U-Boot 2015.07-rc1-00256-gec154cc (May 18 2015 - 09:00:57)
>
> CPU: Freescale i.MX6SX rev1.2 996 MHz (running at 792 MHz)
> CPU: at 39C
> 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
> "
>>Thanks,
>>
>>Fabio Estevam
>
> Regards,
> Peng.
>
> --
Peng,
I'll send a v3 of the patch that removes disabling of showing the
temperature grade info for imx6sx and please test again with this
version as well as let us know the part markings for your chip so I
can verify the fuses are set properly.
Thanks!
Tim
^ permalink raw reply [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH v2 3/4] imx: mx6: add display of CPU temperature grade in print_cpuinfo()
2015-05-15 13:31 ` Tim Harvey
2015-05-15 13:36 ` Fabio Estevam
@ 2015-05-15 13:44 ` Stefano Babic
1 sibling, 0 replies; 19+ messages in thread
From: Stefano Babic @ 2015-05-15 13:44 UTC (permalink / raw)
To: u-boot
Hi Tim,
On 15/05/2015 15:31, Tim Harvey wrote:
>> Right. My proposal is to merge the currrent patchset, enabling for
>> IMX6SX again when someone will test it.
>>
>> Best regards,
>> Stefano Babic
>>
>
> Stefano,
>
> Yes, that sounds like the best approach. What were your thoughts on
> enabling the second CPU: line just to display the temperature grade if
> CONFIG_IMX6_THERMAL was not enabled?
As you said, printing a lot can be disturbing for someone, and letting
the possibility to turn out prints is not bad. I will let the board
maintainer to decide it.
>
> I'm surprised someone on this list hasn't already tested this on IMX6SX.
>
I am quite convinced that patches are tested by a few until they are
merged. If there is a ready-to-use tree, people are more motivated to
test it.
> Fabio - certainly you must have a reference board with an IMX6SX and
> could enable/test that the CPU markings agree with what is
> detected/displayed via OTP?
>
Of course, I could delay for applying this patchset if Fabio / someone
has the possibility to test it with 6X. Anyway, running on 6X is
protected by the check on the cpu, and I do not see problems to merge it.
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] 19+ messages in thread
* [U-Boot] [PATCH v2 3/4] imx: mx6: add display of CPU temperature grade in print_cpuinfo()
2015-05-14 5:11 ` [U-Boot] [PATCH v2 3/4] imx: mx6: add display of CPU temperature grade in print_cpuinfo() Tim Harvey
2015-05-15 8:14 ` Christian Gmeiner
@ 2015-05-17 22:33 ` Nikolay Dimitrov
1 sibling, 0 replies; 19+ messages in thread
From: Nikolay Dimitrov @ 2015-05-17 22:33 UTC (permalink / raw)
To: u-boot
On 05/14/2015 08:11 AM, Tim Harvey wrote:
> 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: Industiral temperature grade (-40C to 105C) at 42C
> CPU: Extended Commercial temperature grade (-20C to 105C) at 42C
>
> Signed-off-by: Tim Harvey <tharvey@gateworks.com>
> ---
> 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 | 27 +++++++++++++++++++++++----
> 1 file changed, 23 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm/imx-common/cpu.c b/arch/arm/imx-common/cpu.c
> index 6b20482..f1b49bb 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,34 @@ int print_cpuinfo(void)
> #endif
>
> #if defined(CONFIG_MX6) && defined(CONFIG_IMX6_THERMAL)
> + puts("CPU: ");
> + if (!is_cpu_type(MXC_CPU_MX6SX)) {
> + 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
>
>
Tested-by: Nikolay Dimitrov <picmaster@mail.bg>
Regards,
Nikolay
^ permalink raw reply [flat|nested] 19+ messages in thread
* [U-Boot] [PATCH v2 4/4] thermal: imx_thermal: use CPU temperature grade for trip points
2015-05-14 5:11 [U-Boot] [PATCH v2 0/4]: imx: mx6: use OTP for temperature grade info Tim Harvey
` (2 preceding siblings ...)
2015-05-14 5:11 ` [U-Boot] [PATCH v2 3/4] imx: mx6: add display of CPU temperature grade in print_cpuinfo() Tim Harvey
@ 2015-05-14 5:11 ` Tim Harvey
2015-05-17 22:34 ` Nikolay Dimitrov
3 siblings, 1 reply; 19+ messages in thread
From: Tim Harvey @ 2015-05-14 5:11 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] 19+ messages in thread
* [U-Boot] [PATCH v2 4/4] thermal: imx_thermal: use CPU temperature grade for trip points
2015-05-14 5:11 ` [U-Boot] [PATCH v2 4/4] thermal: imx_thermal: use CPU temperature grade for trip points Tim Harvey
@ 2015-05-17 22:34 ` Nikolay Dimitrov
0 siblings, 0 replies; 19+ messages in thread
From: Nikolay Dimitrov @ 2015-05-17 22:34 UTC (permalink / raw)
To: u-boot
On 05/14/2015 08:11 AM, Tim Harvey 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
> 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,
> };
>
Tested-by: Nikolay Dimitrov <picmaster@mail.bg>
Regards,
Nikolay
^ permalink raw reply [flat|nested] 19+ messages in thread