Thermal management support on SAMA7G5

Introduction

SAMA7G5 support thermal management. The in SoC temperature sensor is connected to channel 31 of ADC. Starting with linux4microchip-22.04 ADC driver has been updated to support temperature measurements. The computed temperature is based on the values read from channel 31 of ADC and calibration data from OTP memory.

OTP memory content for thermal management

In order to have the thermal management support available on a SAMA7G5 based system OTP memory need to contain thermal management calibration packet. Thermal management calibration packet will always be the 2nd packet in OTP memory. The 1st OTP packet should be the boot configuration packet. For OTP to be able to read the 2nd packet (thermal management calibration packet) the 1st packet need to be also available.

To be able to read the content of OTP memory the following Linux command could be used:

$ hexdump -C /sys/bus/nvmem/devices/mchp-otpc0/nvmem
00000000  83 10 00 00 00 00 00 00  00 00 00 00 11 00 00 00  |................|
00000010  10 03 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000040  00 00 00 00 00 00 00 00  89 11 a5 a5 54 53 43 41  |............TSCA|
00000050  1b 00 00 00 1b 00 00 00  69 00 00 00 63 8c 09 00  |........i...c...|
00000060  e9 08 12 00 10 f1 11 00  00 00 00 00 00 00 00 00  |................|
00000070  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000080  00 00 00 00 00 00 00 00  00 00 00 00              |............|
0000008c

The above OTP memory contains a boot configuration packet:

00000000  83 10 00 00 00 00 00 00  00 00 00 00 11 00 00 00  |................|
00000010  10 03 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
00000020  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|
*
00000040  00 00 00 00 00 00 00 00
and a thermal management calibration packet starting from offset 0x49:
00000040  00 00 00 00 00 00 00 00  89 11 a5 a5 54 53 43 41  |............TSCA|
00000050  1b 00 00 00 1b 00 00 00  69 00 00 00 63 8c 09 00  |........i...c...|
00000060  e9 08 12 00 10 f1 11 00  00 00 00 00 00 00 00 00  |................|
00000070  00 00 00 00 00 00 00 00  00 00 00 00 00 00 00 00  |................|

The thermal management calibration packet contains TSCA tag in it.

Why do I see ADC and thermal management errors during boot?

There are 3 scenarios where errors messages like:

at91-sama5d2_adc e1000000.adc: Failed to read calibration data!
at91-sama5d2_adc e1000000.adc: version: a03
ERROR: could not get IIO channel /thermal-sensor:sensor-channel(0)
generic-adc-thermal thermal-sensor: IIO channel not found: -19

could be displayed on Linux console. These are:

1/ Thermal management calibration packet is available in OTP memory but boot configuration is not'
2/ There is no thermal management calibration packet available in OTP memory
3/ There are no packets in OTP memory
WebFaqBaseForm
Boards Sama7g5-ek
Components Kernel, linux-5.15-mchp, linux-6.1-mchp
Summary Thermal management support on SAMA7G5
r5 - 16 May 2023 - 15:36:33 - VarshiniRajendran
 
Linux & Open Source for AT91 Microchip Microprocessors

Copyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.

Linux® is the registered trademark of Linus Torvalds in the U.S. and other countries.

Microchip® and others, are registered trademarks or trademarks of Microchip Technology Inc. and its subsidiaries. This site is powered by the TWiki collaboration platform

Arm® and others are registered trademarks or trademarks of Arm Limited (or its affiliates). Other terms and product names may be trademarks of others.

Ideas, requests, contributions ? Connect to LinksToCommunities page.

Syndicate this siteRSS ATOM