diff mbox

[U-Boot,v2,3/4] imx: mx6: add display of CPU temperature grade in print_cpuinfo()

Message ID 1431580312-24880-4-git-send-email-tharvey@gateworks.com
State Changes Requested
Delegated to: Stefano Babic
Headers show

Commit Message

Tim Harvey May 14, 2015, 5:11 a.m. UTC
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(-)

Comments

Christian Gmeiner May 15, 2015, 8:14 a.m. UTC | #1
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
Tim Harvey May 15, 2015, 1:16 p.m. UTC | #2
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
Stefano Babic May 15, 2015, 1:24 p.m. UTC | #3
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
Tim Harvey May 15, 2015, 1:31 p.m. UTC | #4
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
Fabio Estevam May 15, 2015, 1:36 p.m. UTC | #5
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
Stefano Babic May 15, 2015, 1:44 p.m. UTC | #6
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
Nikolay Dimitrov May 17, 2015, 10:33 p.m. UTC | #7
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
Peng Fan May 18, 2015, 12:11 a.m. UTC | #8
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.
Tim Harvey May 18, 2015, 1:30 p.m. UTC | #9
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
diff mbox

Patch

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