power: Add AVS class 0 support for AM6
Subsystems (3)
cover power: Add AVS class 0 support for AM6
Adaptive Voltage Scaling is a technology used in TI SoCs to optimize the operating voltage based on characterization data written to efuse during production.
Add support for Adaptive Voltage scaling class 0 support for AM6 family of devices. Adaptive voltage scaling class 0 implies that optimized voltage values for a particular OPP of a particular voltage domain are read from Efuse and programmed on the pmic/regulator.
Tested on AM654-EVM for MPU @800 MHz.
Keerthy (2):
arm: mach-k3: am6_init: Initialize AVS class 0
clk: clk-ti-sci: Notify AVS driver upon setting clock rate
Tero Kristo (8):
power: add driver for K3 Adaptive Voltage Scaling Class 0
power: regulator: tps6236x: add support for tps6236x regulators
arm: dts: k3-am65: Add VTM node
arm: dts: k3-am654-r5-base-board: enable wkup_i2c0 driver for spl
arm: dts: k3-am654-r5-base-board: add supply rail for MPU
arm: dts: k3-am654-r5-base-board: enable wkup_vtm0 node and link in
supplies
configs: am65x_evm_r5_defconfig: Enable TPS62363 regulator support
configs: am65x_evm_r5_defconfig: Enable AVS class 0 support
arch/arm/dts/k3-am65-wakeup.dtsi | 7 + arch/arm/dts/k3-am654-r5-base-board.dts | 20 + arch/arm/mach-k3/am6_init.c | 6 + configs/am65x_evm_r5_defconfig | 2 + drivers/Makefile | 2 +- drivers/clk/clk-ti-sci.c | 5 + drivers/power/Kconfig | 9 + drivers/power/mfd/Makefile | 1 + drivers/power/mfd/k3_avs.c | 371 +++++++++++++++++++ drivers/power/regulator/Kconfig | 10 + drivers/power/regulator/Makefile | 1 + drivers/power/regulator/tps62360_regulator.c | 124 +++++++ include/dm/uclass-id.h | 1 + include/k3-avs.h | 28 ++ 14 files changed, 586 insertions(+), 1 deletion(-) create mode 100644 drivers/power/mfd/k3_avs.c create mode 100644 drivers/power/regulator/tps62360_regulator.c create mode 100644 include/k3-avs.h
Signature · 1 line
2.17.1
PATCH 1/10 power: add driver for K3 Adaptive Voltage Scaling Class 0
From: Tero Kristo <[email protected]>
Adaptive Voltage Scaling is a technology used in TI SoCs to optimize the operating voltage based on characterization data written to efuse during production. Add a driver to support this feature for K3 line of SoCs, initially for AM65x.
--- drivers/Makefile | 2 +- drivers/power/Kconfig | 9 + drivers/power/mfd/Makefile | 1 + drivers/power/mfd/k3_avs.c | 371 +++++++++++++++++++++++++++++++++++++ include/dm/uclass-id.h | 1 + include/k3-avs.h | 28 +++ 6 files changed, 411 insertions(+), 1 deletion(-) create mode 100644 drivers/power/mfd/k3_avs.c create mode 100644 include/k3-avs.h
drivers/Makefile +1 -1
@@ -38,7 +38,7 @@ obj-$(CONFIG_ARMADA_38X) += ddr/marvell/a38x/ obj-$(CONFIG_ARMADA_XP) += ddr/marvell/axp/ obj-$(CONFIG_$(SPL_)ALTERA_SDRAM) += ddr/altera/ obj-$(CONFIG_ARCH_IMX8M) += ddr/imx/imx8m/ -obj-$(CONFIG_SPL_POWER_SUPPORT) += power/ power/pmic/ +obj-$(CONFIG_SPL_POWER_SUPPORT) += power/ power/pmic/ power/mfd/ obj-$(CONFIG_SPL_POWER_SUPPORT) += power/regulator/ obj-$(CONFIG_SPL_POWER_DOMAIN) += power/domain/ obj-$(CONFIG_SPL_DM_RESET) += reset/
drivers/power/Kconfig +9 -0
@@ -364,4 +364,13 @@ config TWL4030_POWER The TWL4030 in a combination audio CODEC/power management with GPIO and it is commonly used with the OMAP3 family of processors +config K3_AVS0 + depends on ARCH_K3 && SPL_DM_REGULATOR + bool "AVS class 0 support for K3 devices" + help + K3 devices have the optimized voltage values for the main voltage + domains stored in efuse within the VTM IP. This driver reads the + optimized voltage from the efuse, so that it can be programmed + to the PMIC on board. + endmenu
drivers/power/mfd/Makefile +1 -0
@@ -6,3 +6,4 @@ obj-$(CONFIG_POWER_PMIC_MAX77693) += pmic_max77693.o obj-$(CONFIG_POWER_MUIC_MAX77693) += muic_max77693.o obj-$(CONFIG_POWER_FG_MAX77693) += fg_max77693.o +obj-$(CONFIG_K3_AVS0) += k3_avs.o
drivers/power/mfd/k3_avs.c new file +371 -0
371 lines not on this page · raw message
include/dm/uclass-id.h +1 -0
@@ -31,6 +31,7 @@ enum uclass_id {UCLASS_ADC ,/* Analog-to-digital converter */ UCLASS_AHCI ,/* SATA disk controller */ UCLASS_AUDIO_CODEC ,/* Audio codec with control and data path */ +UCLASS_AVS ,/* Adaptive voltage scaling */ UCLASS_AXI ,/* AXI bus */ UCLASS_BLK ,/* Block device */ UCLASS_BOARD, /* Device information from hardware */
include/k3-avs.h new file +28 -0
@@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Texas Instruments' K3 Adaptive Voltage Scaling driver +* +* Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ +* Tero Kristo <[email protected]> +* +*/ + +#ifndef _K3_AVS0_ +#define _K3_AVS0_ + +#define AM6_VDD_WKUP 0 +#define AM6_VDD_MCU 1 +#define AM6_VDD_CORE 2 +#define AM6_VDD_MPU0 3 +#define AM6_VDD_MPU1 4 + +#define NUM_OPPS 4 + +#define AM6_OPP_NOM 1 +#define AM6_OPP_OD 2 +#define AM6_OPP_TURBO 3 + +int k3_avs_set_opp (struct udevice *dev,int vdd_id,int opp_id); +int k3_avs_notify_freq (int dev_id,int clk_id,u32 freq); + +#endif
Signature · 1 line
2.17.1
PATCH 1/10 power: add driver for K3 Adaptive Voltage Scaling Class 0
[..snip..]
include/dm/uclass-id.h enum uclass_id { · line 34
Quoted 10 lines
(quoted diff) +1
-0+};include/dm/uclass-id.h +1
-0@@ -31,6 +31,7 @@ enum uclass_id {UCLASS_ADC ,/* Analog-to-digital converter */ UCLASS_AHCI ,/* SATA disk controller */ UCLASS_AUDIO_CODEC ,/* Audio codec with control and data path */ + UCLASS_AVS, /* Adaptive voltage scaling */
In general there should be sandbox tests written for adding any such new UCLASS.
Thanks and regards,
Lokesh
Quoted 38 lines
include/dm/uclass-id.h +0
-0UCLASS_AXI ,/* AXI bus */ UCLASS_BLK ,/* Block device */ UCLASS_BOARD, /* Device information from hardware */include/k3-avs.h new file +28
-0@@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Texas Instruments' K3 Adaptive Voltage Scaling driver +* +* Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ +* Tero Kristo <[email protected]> +* +*/ + +#ifndef _K3_AVS0_ +#define _K3_AVS0_ + +#define AM6_VDD_WKUP 0 +#define AM6_VDD_MCU 1 +#define AM6_VDD_CORE 2 +#define AM6_VDD_MPU0 3 +#define AM6_VDD_MPU1 4 + +#define NUM_OPPS 4 + +#define AM6_OPP_NOM 1 +#define AM6_OPP_OD 2 +#define AM6_OPP_TURBO 3 + +int k3_avs_set_opp (struct udevice *dev,int vdd_id,int opp_id); +int k3_avs_notify_freq (int dev_id,int clk_id,u32 freq); + +#endif
PATCH 1/10 power: add driver for K3 Adaptive Voltage Scaling Class 0
Quoted 15 lines · Lokesh Vutla
[..snip..]
include/dm/uclass-id.h enum uclass_id { · line 34
Quoted 10 lines
(quoted diff) +1
-0+};include/dm/uclass-id.h +1
-0@@ -31,6 +31,7 @@ enum uclass_id {UCLASS_ADC ,/* Analog-to-digital converter */ UCLASS_AHCI ,/* SATA disk controller */ UCLASS_AUDIO_CODEC ,/* Audio codec with control and data path */ + UCLASS_AVS, /* Adaptive voltage scaling */In general there should be sandbox tests written for adding any such new UCLASS.
Tero,
This is not a generic UCLASS driver. This is a K3 specific driver. So should this be really introducing a new UCLASS?
- Keerthy
Quoted 42 lines
Thanks and regards,
LokeshQuoted 38 lines
include/dm/uclass-id.h +0
-0UCLASS_AXI ,/* AXI bus */ UCLASS_BLK ,/* Block device */ UCLASS_BOARD, /* Device information from hardware */include/k3-avs.h new file +28
-0@@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Texas Instruments' K3 Adaptive Voltage Scaling driver +* +* Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/ +* Tero Kristo <[email protected]> +* +*/ + +#ifndef _K3_AVS0_ +#define _K3_AVS0_ + +#define AM6_VDD_WKUP 0 +#define AM6_VDD_MCU 1 +#define AM6_VDD_CORE 2 +#define AM6_VDD_MPU0 3 +#define AM6_VDD_MPU1 4 + +#define NUM_OPPS 4 + +#define AM6_OPP_NOM 1 +#define AM6_OPP_OD 2 +#define AM6_OPP_TURBO 3 + +int k3_avs_set_opp (struct udevice *dev,int vdd_id,int opp_id); +int k3_avs_notify_freq (int dev_id,int clk_id,u32 freq); + +#endif
PATCH 1/10 power: add driver for K3 Adaptive Voltage Scaling Class 0
Quoted 21 lines · Keerthy
Quoted 17 lines · Lokesh Vutla
[..snip..]
Quoted 11 lines
(quoted diff) +1
-0+};include/dm/uclass-id.h +0
-0@@ -31,6 +31,7 @@ enum uclass_id {UCLASS_ADC, /* Analog-to-digital converter */ UCLASS_AHCI, /* SATA disk controller */ UCLASS_AUDIO_CODEC, /* Audio codec with control and data path */
+ UCLASS_AVS, /* Adaptive voltage scaling */In general there should be sandbox tests written for adding any such new UCLASS.
Quoted 4 lines
Tero,
This is not a generic UCLASS driver. This is a K3 specific driver. So should this be really introducing a new UCLASS?
Well, AVS is kind of generic across TI SoCs. However, I am fine just using UCLASS_MISC if we don't want to introduce a new uclass.... assuming we don't get sequencing issues with remoteproc if we do that.
-Tero
Quoted 38 lines
- Keerthy
Quoted 35 lines
Thanks and regards,
LokeshQuoted 31 lines
UCLASS_AXI, /* AXI bus */
UCLASS_BLK, /* Block device */ UCLASS_BOARD, /* Device information from hardware */include/k3-avs.h new file +5
-0@@ -0,0 +1,28 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* +* Texas Instruments' K3 Adaptive Voltage Scaling driver +* +* Copyright (C) 2019 Texas Instruments Incorporated - http://www.ti.com/
+ * Tero Kristo <[email protected]>
+ *
+ */include/k3-avs.h new file +13
-0+ +#ifndef _K3_AVS0_ +#define _K3_AVS0_ + +#define AM6_VDD_WKUP 0 +#define AM6_VDD_MCU 1 +#define AM6_VDD_CORE 2 +#define AM6_VDD_MPU0 3 +#define AM6_VDD_MPU1 4 + +#define NUM_OPPS 4 + +#define AM6_OPP_NOM 1
Quoted 8 lines
Quoted 8 lines
include/k3-avs.h line 28
Quoted 8 lines
include/k3-avs.h new file +7
-0+#define AM6_OPP_OD 2 +#define AM6_OPP_TURBO 3 + +int k3_avs_set_opp (struct udevice *dev,int vdd_id,int opp_id); +int k3_avs_notify_freq (int dev_id,int clk_id,u32 freq); + +#endif
--
Texas Instruments Finland Oy, Porkkalankatu 22, 00180 Helsinki. Y-tunnus/Business ID: 0615521-4. Kotipaikka/Domicile: Helsinki
PATCH 2/10 arm: mach-k3: am6_init: Initialize AVS class 0
In reply to KeerthyInitialize AVS class 0 so that mpu voltage rail is programmed to the AVS class 0 compensated value.
--- arch/arm/mach-k3/am6_init.c | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/mach-k3/am6_init.c +6 -0
@@ -116,6 +116,12 @@ void board_init_f(ulong dummy)/* Perform EEPROM-based board detection */ do_board_detect (); +#if defined(CONFIG_CPU_V7R ) && defined(CONFIG_K3_AVS0 ) + ret =uclass_get_device (UCLASS_AVS ,0 , &dev); +if (ret) +printf ("AVS init failed: %d\n" , ret); +#endif +#ifdef CONFIG_K3_AM654_DDRSS ret =uclass_get_device (UCLASS_RAM ,0 , &dev);if (ret)
Signature · 1 line
2.17.1
PATCH 3/10 clk: clk-ti-sci: Notify AVS driver upon setting clock rate
In reply to KeerthyNotify AVS driver upon setting clock rate so that voltage is changed accordingly.
--- drivers/clk/clk-ti-sci.c | 5 +++++ 1 file changed, 5 insertions(+)
drivers/clk/clk-ti-sci.c +5 -0
@@ -13,6 +13,7 @@#include <errno.h> #include <clk-uclass.h> #include <linux/soc/ti/ti_sci_protocol.h> +#include <k3-avs.h> /** * struct ti_sci_clk_data - clock controller information structure
@@ -101,6 +102,10 @@ static ulong ti_sci_clk_set_rate(struct clk *clk, ulong rate)debug ("%s(clk=%p, rate=%lu)\n" , __func__, clk, rate); +#ifdef CONFIG_K3_AVS0 +k3_avs_notify_freq (clk->id, clk->data, rate); +#endif +/* Ask for exact frequency by using same value for min/target/max */ ret = cops->set_freq (sci, clk->id, clk->data, rate, rate, rate);if (ret)
Signature · 1 line
2.17.1
PATCH 4/10 power: regulator: tps6236x: add support for tps6236x regulators
In reply to KeerthyFrom: Tero Kristo <[email protected]>
TPS6236x is a family of step down DC-DC converters optimized for battery powered portable applications for a small solution size. Add a regulator driver for supporting these devices.
--- drivers/power/regulator/Kconfig | 10 ++ drivers/power/regulator/Makefile | 1 + drivers/power/regulator/tps62360_regulator.c | 123 +++++++++++++++++++ 3 files changed, 134 insertions(+) create mode 100644 drivers/power/regulator/tps62360_regulator.c
drivers/power/regulator/Kconfig +10 -0
@@ -273,6 +273,16 @@ config DM_REGULATOR_TPS65910 regulator types of the TPS65910 (BUCK, BOOST and LDO). It implements the get/set api for value and enable. +config DM_REGULATOR_TPS62360 + bool "Enable driver for TPS6236x Power Regulator" + depends on DM_REGULATOR + help + The TPS6236X DC/DC step down converter provides a single output + power line peaking at 3A current. This driver supports all four + variants of the chip (TPS62360, TPS62361, TPS62362, TPS62363). It + implements the get/set api for value only, as the power line is + always on. + config DM_REGULATOR_STPMIC1 bool "Enable driver for STPMIC1 regulators" depends on DM_REGULATOR && PMIC_STPMIC1
drivers/power/regulator/Makefile +1 -0
@@ -26,4 +26,5 @@ obj-$(CONFIG_$(SPL_)DM_REGULATOR_LP873X) += lp873x_regulator.o obj-$(CONFIG_$(SPL_)DM_REGULATOR_LP87565) += lp87565_regulator.o obj-$(CONFIG_$(SPL_)DM_REGULATOR_STM32_VREFBUF) += stm32-vrefbuf.o obj-$(CONFIG_DM_REGULATOR_TPS65910) += tps65910_regulator.o +obj-$(CONFIG_DM_REGULATOR_TPS62360) += tps62360_regulator.o obj-$(CONFIG_$(SPL_)DM_REGULATOR_STPMIC1) += stpmic1.o
drivers/power/regulator/tps62360_regulator.c new file +123 -0
123 lines not on this page · raw message
Signature · 1 line
2.17.1
PATCH 5/10 arm: dts: k3-am65: Add VTM node
In reply to KeerthyFrom: Tero Kristo <[email protected]>
Add VTM node for voltage and thermal management. For u-boot, this is needed for supporting AVS class 0, as the efuse values for the OPPs are stored under the VTM.
--- arch/arm/dts/k3-am65-wakeup.dtsi | 7 +++++++ 1 file changed, 7 insertions(+)
arch/arm/dts/k3-am65-wakeup.dtsi +7 -0
@@ -62,4 +62,11 @@ clocks = <&k3_clks 115 1>; power-domains = <&k3_pds 115 TI_SCI_PD_EXCLUSIVE>; }; + + wkup_vtm0: wkup_vtm at 42050000 { + compatible = "ti,am654-vtm", "ti,am654-avs"; + reg = <0x42050000 0x25c>; + power-domains = <&k3_pds 80>; + #thermal-sensor-cells = <1>; + }; };
Signature · 1 line
2.17.1
PATCH 6/10 arm: dts: k3-am654-r5-base-board: enable wkup_i2c0 driver for spl
In reply to KeerthyFrom: Tero Kristo <[email protected]>
Enable wkup_i2c0 as this is needed for voltage control.
--- arch/arm/dts/k3-am654-r5-base-board.dts | 1 + 1 file changed, 1 insertion(+)
arch/arm/dts/k3-am654-r5-base-board.dts +1 -0
@@ -211,4 +211,5 @@ pinctrl-names = "default"; pinctrl-0 = <&wkup_i2c0_pins_default>; clock-frequency = <400000>; + u-boot,dm-spl; };
Signature · 1 line
2.17.1
PATCH 7/10 arm: dts: k3-am654-r5-base-board: add supply rail for MPU
In reply to KeerthyFrom: Tero Kristo <[email protected]>
MPU voltage on AM65x-evm is controlled via the TPS62363 chip attached to i2c0 bus. Add device node for this so that it can be controlled via a regulator driver.
--- arch/arm/dts/k3-am654-r5-base-board.dts | 13 +++++++++++++ 1 file changed, 13 insertions(+)
arch/arm/dts/k3-am654-r5-base-board.dts +13 -0
@@ -212,4 +212,17 @@ pinctrl-0 = <&wkup_i2c0_pins_default>; clock-frequency = <400000>; u-boot,dm-spl; + + vdd_mpu: tps62363 at 60 { + compatible = "ti,tps62363"; + reg = <0x60>; + regulator-name = "VDD_MPU"; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1770000>; + regulator-always-on; + regulator-boot-on; + ti,vsel0-state-high; + ti,vsel1-state-high; + u-boot,dm-spl; + }; };
Signature · 1 line
2.17.1
PATCH 8/10 arm: dts: k3-am654-r5-base-board: enable wkup_vtm0 node and link in supplies
In reply to KeerthyFrom: Tero Kristo <[email protected]>
Link the vdd-supplies for the voltage domains under the VTM node. Also, enable the node under SPL. This will enable the AVS class 0 support on am65x-evm board.
--- arch/arm/dts/k3-am654-r5-base-board.dts | 6 ++++++ 1 file changed, 6 insertions(+)
arch/arm/dts/k3-am654-r5-base-board.dts +6 -0
@@ -131,6 +131,12 @@ power-domains = <&k3_pds 146 TI_SCI_PD_SHARED>; }; +&wkup_vtm0 { + vdd-supply-3 = <&vdd_mpu>; + vdd-supply-4 = <&vdd_mpu>; + u-boot,dm-spl; +}; + &wkup_pmx0 { u-boot,dm-spl; wkup_uart0_pins_default: wkup_uart0_pins_default {
Signature · 1 line
2.17.1
PATCH 9/10 configs: am65x_evm_r5_defconfig: Enable TPS62363 regulator support
In reply to KeerthyFrom: Tero Kristo <[email protected]>
TPS62363 is used to control the MPU_VDD voltage, so enable the driver for this.
--- configs/am65x_evm_r5_defconfig | 1 + 1 file changed, 1 insertion(+)
configs/am65x_evm_r5_defconfig +1 -0
@@ -84,6 +84,7 @@ CONFIG_DM_REGULATOR=y CONFIG_SPL_DM_REGULATOR=y CONFIG_DM_REGULATOR_GPIO=y CONFIG_SPL_DM_REGULATOR_GPIO=y +CONFIG_DM_REGULATOR_TPS62360=y CONFIG_RAM=y CONFIG_SPL_RAM=y CONFIG_K3_SYSTEM_CONTROLLER=y
Signature · 1 line
2.17.1
PATCH 10/10 configs: am65x_evm_r5_defconfig: Enable AVS class 0 support
In reply to KeerthyFrom: Tero Kristo <[email protected]>
Enable AVS class 0 support for the R5 SPL bootloader.
--- configs/am65x_evm_r5_defconfig | 1 + 1 file changed, 1 insertion(+)
configs/am65x_evm_r5_defconfig +1 -0
@@ -99,3 +99,4 @@ CONFIG_TIMER=y CONFIG_SPL_TIMER=y CONFIG_OMAP_TIMER=y CONFIG_FS_FAT_MAX_CLUSTSIZE=16384 +CONFIG_K3_AVS0=y
Signature · 1 line
2.17.1