NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.
TI81XX PSP PM AVS Driver User Guide
This document applies only to TI816X.
TI816X refers to TI816X/AM389x devices unless specified.
Contents
Acronyms & definitions[edit]
Acronym | Definition |
AVS | Adaptive Voltage Scaling |
SR | SmartReflex |
HVT | High Voltage Threshold sensor |
SVT | Standard Voltage Threshold sensor |
GPIO | General Purpose Input Output |
PMIC | Power Management Integrated Circuit |
VR | Voltage regulator |
Introduction[edit]
Adaptive Voltage Scaling(AVS) is a technology which modifies the voltage of system/component by comparing the system performance against targeted performance.
On TI81XX devices, AVS makes use of the HW technology called "SmartReflex" for comparing the on chip performance against target performance.
The target performance is calculated during product engineering which is called "Characterization of the Silicon(chip)" and blown into the efuses on the chip.
The AVS driver then acts on the information provided by SmartReflex and modifies the voltage accordingly using a voltage controller(PMIC).
AVS solution comprises following three components:
- SmartReflex HW/IP
- AVS Driver (used interchangeably with SR driver)
- Software Controllable PMIC with working Software Driver(Regulator Driver)
For further details on the "SmartReflex" IP/HW refer to the TRM/DataSheet available for TI816X devices.
For PMICs that can be used with TI816X devices look for Power Management solutions on TI website
AVS/SR Framework Architecture[edit]
User Space[edit]
AVS/SR driver exports debug-fs entries which provide information related to current state/configuration of AVS Driver.
Kernel Space[edit]
This layer consists of the core SR driver, voltage regulator driver and gpio driver.
SR/AVS driver configures the SmartReflex module/HW.
SR driver uses Voltage regulator driver APIs for requesting the current operating voltage and for setting the new operating voltage.
Voltage regulator driver uses the GPIO driver API's for changing/requesting the gpio values which reflect the current voltage.
Files[edit]
SR driver core file: arch/arm/mach-omap2/smartreflex-ti816x.c SR Platform data addition: arch/arm/mach-omap2/devices.c VR driver core file: drivers/regulator/gpio-regulator.c VR Platform data addition: arch/arm/mach-omap2/board-ti8168evm.c
Hardware[edit]
The Hardware layer consists of HVT & SVT sensors, GPIO pins and PMIC. For voltage control TI816X uses GPIO Bank-0 pins[0-3]. Power Management IC outputs the required voltage to the device based on the GPIO output.
AVS Support[edit]
For a silicon/chip to support AVS/SR operation it needs to undergo "Characterization" and the target performance values(called as nTarget values) must be blown into the efuses, such silicon is called "Characterized silicon" in this document.
On the characterized silicon, the SR driver is initialized during system boot-up and starts the voltage scaling operation.
On silicon which is not characterized, then SR driver will print the following error messages during Kernel boot up
smartreflex: Driver is not initialized, nTarget values are not found
Note: If you see the message mentioned above during kernel boot, then the device is not characterized(does not have nTarget values). To confirm whether you have a characterized silicon or not, you may check the Memory mapped registers of the efuses at U-Boot prompt as shown below:
A non-zero value in following registers means the silicon is characterized. a. SmartReflex HVT nTarget value, address - 0x481406AC TI816X-EVM# md 0x481406AC b. SmartReflex SVT nTarget value, address - 0x481406A8 TI816X-EVM# md 0x481406A8
AVS Configuration[edit]
This section talks about configuration of AVS components.
Voltage Regulator Driver configuration[edit]
The default kernel configuration enables support for GPIO voltage regulator Driver (built into the kernel).
The GPIO VR driver support can be disabled through menuconfig during kernel build, as shown below:
$ make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm menuconfig
- Select Device Drivers from the main menu.
Power management options ---> [*] Networking support ---> '''Device Drivers --->''' File systems ---> ... ...
- Select Voltage and Current Regulator Support from the menu.
Sonics Silicon Backplane ---> -*- Multifunction device drivers ---> '''-*- Voltage and Current Regulator Support --->''' <*> Multimedia support ---> ... ...
- Uncheck the GPIO voltage regulator from the menu
< > National Semiconductors LP3972 PMIC regulator driver < > TI TPS65023 Power regulators '''< > GPIO voltage regulator''' < > TI TPS6507X Power regulators < > Intersil ISL6271A Power regulator ... ...
- After undoing driver de-selection, exit and save the kernel configuration when prompted.
AVS Driver configuration[edit]
The default kernel configuration enables support for AVS/SR Driver (built into the kernel).
The AVS/SR driver support can be disabled through menuconfig during kernel build, as shown below:
$ make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm menuconfig
- Select System Type from the main menu.
General setup ---> [*] Enable loadable module support ---> -*- Enable the block layer ---> ''' System Type --->''' Bus support ---> ... ...
- Select TI OMAP Common Features from the menu.
[*] MMU-based Paged Memory Management Support ARM system type (TI OMAP) ---> ''' TI OMAP Common Features --->''' TI OMAP2/3/4 Specific Features ---> ... ...
- Uncheck SmartReflex class2 support for ti816x from menu
OMAP System Type (TI OMAP2/3/4/81XX) ---> *** OMAP Feature Selections *** [ ] Reset unused clocks during boot '''[ ] SmartReflex class2 support for ti816x''' [*] OMAP multiplexing support ...
- After doing driver de-selection, exit and save the kernel configuration when prompted.
Debugfs configuration[edit]
The default kernel configuration enables support for debugfs (built into the kernel).
The Debugfs filesystem support can be disabled through menuconfig during kernel build, as shown below:
$ make CROSS_COMPILE=arm-none-linux-gnueabi- ARCH=arm menuconfig
- Select Device Drivers from the main menu.
Device Drivers ---> File systems ---> '''Kernel hacking --->''' Security options ---> ... ...
- Select Debug Filesystem Support from the menu.
[ ] Strip assembler-generated symbols during link [ ] Enable unused/obsolete exported symbols '''[*] Debug Filesystem''' [ ] Run 'make headers_check' when building vmlinux ... ...
- After doing filesystem de-selection, exit and save the kernel configuration when prompted.
Building the Kernel:
- Once the configuration done according to your requirement then build the kernel as described in Compiling Linux Kernel section of PSP User Guide
Debugging AVS driver[edit]
SmartReflex driver provides some debugfs entries to aid debugging. Prior to that mount the debug file system into a directory
$ mount -t debugfs debugfs /sys/kernel/debug/
To know the current nTarget values for HVT and SVT sensors use:
$ cat /sys/kernel/debug/smartreflex/sr_hvt/nvalue $ cat /sys/kernel/debug/smartreflex/sr_svt/nvalue
For enabling the SR driver from debugfs use:
$ echo 1 > /sys/kernel/debug/smartreflex/autocomp
For disabling the SR driver from debugfs use:
$ echo 0 > /sys/kernel/debug/smartreflex/autocomp
User can also configure the period for which SR interrupts are kept disabled. This is achieved by:
$ echo <delay in msec> > /sys/kernel/debug/smartreflex/interrupt_delay
By default delay is set to 2000 msec.
Note: Please be aware that writing too small value to this can cause high interrupt load on the system and writing higher value makes SmartReflex non-responsive for longer time.So use an optimal value based on system load and responsiveness required
This value tells us the initial voltage of the AVS voltage domain.
$ cat /sys/kernel/debug/smartreflex/initial_voltage
To know the current voltage feeding to AVS voltage domain, use:
$ cat /sys/kernel/debug/smartreflex/current_voltage
Error to voltage gain helps in converting the percentage error (between the blown nTarget value and the current nTarget value reading by the SR sensor) to voltage delta. Err2VoltGain value is specific to each sensor
$ cat /sys/kernel/debug/smartreflex/sr_hvt/err2voltgain $ cat /sys/kernel/debug/smartreflex/sr_svt/err2voltgain
Supporting AVS with a different PMIC[edit]
Note: This section is only meant for controlling the vdd_avs voltage from SmartReflex driver
1. Implement voltage regulator for chosen PMIC and provide the generic calls to the SmartReflex driver
Integrate with regulator core APIs such as, regulator_get(), regulator_get_voltage(), regulator_set_voltage().
If needed provide the enable and disable hook ups.
For reference go through GPIO based voltage regulator driver at "drivers/regulator/gpio-regulator.c", used by current implementation of SmartReflex driver.
2. Add Voltage Regulator platform specific data to the board file at "arch/arm/mach-omap2/board-ti8168evm.c". Regulator platform device need to be registered at board initialization, so that other modules can use this driver utilities.
supply name is used while SmartReflex driver is requesting the regulator
3. Add SR platform specific data based on the chosen PMIC to the devices file at "arch/arm/mach-omap2/devices.c", so that SR driver request the same regulator
These fields must change according to the PMIC
a. voltage domain name, which is registered as a supply name in voltage regulator driver .vd_name = "vdd_avs",
During SmartReflex driver initialization SR module gets a handle to the voltage regulator by passing the voltage domain name(should be same as supply_name member of regulator init data).
b. Step size of the PMIC, which is used to calculate the voltage delta .vstep_size_uv = 15000, Ex: 15mV, which is a default one for GPIO voltage regulator.
Based on voltage step size, modify err_minlimit & e2v_gain fields in sr_sensor_data structure. Below table lists the values of the parameters that change when a new voltage step_size is chosen
NOTE: Smaller voltage step size makes SmartReflex more sensitive to performance changes. On TI816X devices it is recommended to choose the step size such that the operating voltage window 800mV to 1050 mV is spanned in 8 to 32 steps.
So the recommended step size should lie between the min and max, wheremin = (1050-800)/32 = 7.8125 mV and max = (1050 - 800)/8 = 31.25 mV
Step Size (uV) | 7812 | 10000 | 12500 | 15000 | 16667 | 31250 |
---|---|---|---|---|---|---|
e2v_gain | 0x18 | 0x13 | 0xF | 0xD | 0xB | 0x6 |
err_minlimit | 0xFA | 0xF9 | 0xF7 | 0xF6 | 0xF4 | 0xEA |
Step Size (uV) | 7812 | 10000 | 12500 | 15000 | 16667 | 31250 |
---|---|---|---|---|---|---|
e2v_gain | 0x23 | 0x1B | 0x16 | 0x12 | 0x10 | 0x8 |
err_minlimit | 0xFC | 0xFA | 0xFA | 0xF8 | 0xF7 | 0xF0 |