[PATCH v2 00/13] TI TPS6594 PMIC support for multiple TI EVMs

TPS6594 is a Power Management IC which provides regulators and others features like GPIOs, RTC, watchdog, ESMs (Error Signal Monitor), and PFSM (Pre-configurable Finite State Machine). The SoC and the PMIC can communicate through the I2C or SPI interfaces. TPS6594 is the super-set device while TPS6593 and LP8764X are derivatives.
This series fixes LDO voltage conversion for TPS6594 PMIC, it adds support for its derivatives.
The features implemented are: - Regulators - WD disable
WD disable is not a watchdog driver implementation. Watchdog is active by default causing a reboot even if not used. This implementation allow to disable the watchdog at boot time.
Due to current situation with upstream u-boot dts, this patch suite can be applied only after u-boot dts upstream is resynched on latest Linux dts. Link: https://gist.github.com/nmenon/030b11b085473fa008145429b39fcc75
This should be applied on top of Linux patch series (for dts inheritence) Link: https://lore.kernel.org/all/20230406075622.8990-1-jpanis@baylibre.com/ Link: https://lore.kernel.org/all/20230328091448.648452-1-eblanc@baylibre.com/
Tested on boards listed below (resynched manually on Linux 6.3 dts)
Supported boards: - j721eXSOMXEVM: Link: https://www.ti.com/tool/J721EXSOMXEVM - j721s2: Link: https://www.ti.com/tool/J721S2XSOMXEVM - j7200XSOMXEVM: Link: https://www.ti.com/tool/J7200XSOMXEVM - AM62A-SKEVM: Link: https://www.ti.com/tool/SK-AM62A-LP
basic tests: => pmic list => regulator list => regulator dev reg_name_to_be_tested => regulator info => regulator value => regulator value my_test_val => regulator value Check WD reset is not happening when dip switch SW2 on GPIO8 is High.
History: v1 gated by moderator, no link available
Changes: - added support for 2 additional boards: j721s2 and j7200 - Convert driver model tags to use new schema: 8c103c33f
Esteban Blanc (2): configs: j7200_evm: Enable TP6594 family PMICs configs: j721s2_evm: Enable TP6594 PMIC and AVS0
Jerome Neanne (10): drivers: pmic: TPS65941 add support for WD disable drivers: regulator: Fixes for TPS65941 LDO voltage conversion configs: j721e_evm: Add support for TPS65941 PMICs on j721e TI EVM board board: ti: k3-j721e: Force TPS65941 PMIC WD disable on j721e TI EVM board DONOTMERGE: arm: dts: k3-j721e: u-boot overlay for TI tps6594 PMIC DONOTMERGE: arm: dts: k3-j721e: refactor r5 board file to use Linux dts tps6594 description DONOTMERGE: arm: dts: k3-j721e: realign node name on linux dts name DONOTMERGE: arm: dts: k3-am62a7-sk: Add TI TPS6593 PMIC support DONOTMERGE: arm: dts: k3-j7200: Add TP6594 family PMICs DONOTMERGE: arch: arm: dts: k3-j721s2: Add TPS6594 familly PMICs
Julien Panis (1): configs: am62ax_evm_a53: Enable support for TI TPS6593 PMIC
arch/arm/dts/k3-am62a7-sk-u-boot.dtsi | 22 ++++++ .../k3-j7200-common-proc-board-u-boot.dtsi | 17 +++++ .../arm/dts/k3-j7200-r5-common-proc-board.dts | 56 ++++++--------- .../k3-j721e-common-proc-board-u-boot.dtsi | 21 ++++++ .../k3-j721e-r5-common-proc-board-u-boot.dtsi | 2 +- .../arm/dts/k3-j721e-r5-common-proc-board.dts | 48 ++++++------- .../k3-j721s2-common-proc-board-u-boot.dtsi | 29 +++++++- .../dts/k3-j721s2-r5-common-proc-board.dts | 44 ++++++++++++ board/ti/j721e/evm.c | 8 +++ configs/am62ax_evm_a53_defconfig | 9 ++- configs/j7200_evm_a72_defconfig | 8 +++ configs/j721e_evm_a72_defconfig | 9 +++ configs/j721s2_evm_a72_defconfig | 8 +++ configs/j721s2_evm_r5_defconfig | 7 ++ drivers/power/pmic/tps65941.c | 36 ++++++++++ drivers/power/regulator/tps65941_regulator.c | 71 ++++++++++++++++--- include/power/tps65941.h | 25 ++++++- 17 files changed, 346 insertions(+), 74 deletions(-)

This is not a proper WD driver because it's not planned to support WD driver for PMIC in u-boot at any time. The purpose is just WD disable.
Signed-off-by: Jerome Neanne jneanne@baylibre.com --- drivers/power/pmic/tps65941.c | 36 +++++++++++++++++++++++++++++++++++ include/power/tps65941.h | 25 ++++++++++++++++++++++-- 2 files changed, 59 insertions(+), 2 deletions(-)
diff --git a/drivers/power/pmic/tps65941.c b/drivers/power/pmic/tps65941.c index 83d0f83c64..643ea6179c 100644 --- a/drivers/power/pmic/tps65941.c +++ b/drivers/power/pmic/tps65941.c @@ -47,6 +47,9 @@ static int tps65941_bind(struct udevice *dev) ofnode regulators_node; int children;
+ if (dev->driver_data == TPS65941_WD) + return 0; + regulators_node = dev_read_subnode(dev, "regulators"); if (!ofnode_valid(regulators_node)) { debug("%s: %s regulators subnode not found!\n", __func__, @@ -64,6 +67,36 @@ static int tps65941_bind(struct udevice *dev) return dm_scan_fdt_dev(dev); }
+static int stop_watchdog(struct udevice *wd_i2c_dev) +{ + int ret; + + ret = dm_i2c_reg_read(wd_i2c_dev, TPS65941_WD_MODE_REG); + if (ret < 0) { + debug("failed to write i2c reg (%d)\n", ret); + return 0; + } + + ret &= ~TPS65941_WD_PWRHOLD_MASK; + ret |= TPS65941_WD_PWRHOLD_MASK; + ret = dm_i2c_reg_write(wd_i2c_dev, TPS65941_WD_MODE_REG, ret); + if (ret) + debug("%s: %s write WD disable fail!\n", __func__, wd_i2c_dev->name); + ret = dm_i2c_reg_read(wd_i2c_dev, TPS65941_WD_MODE_REG); + if (ret < 0) { + debug("failed to read back i2c reg (%d)\n", ret); + return 0; + } + return 0; +} + +static int tps65941_probe(struct udevice *dev) +{ + if (dev->driver_data == TPS65941_WD) + return stop_watchdog(dev); + return 0; +} + static struct dm_pmic_ops tps65941_ops = { .read = tps65941_read, .write = tps65941_write, @@ -73,7 +106,9 @@ static const struct udevice_id tps65941_ids[] = { { .compatible = "ti,tps659411", .data = TPS659411 }, { .compatible = "ti,tps659412", .data = TPS659411 }, { .compatible = "ti,tps659413", .data = TPS659413 }, + { .compatible = "ti,tps659312", .data = TPS659312 }, { .compatible = "ti,lp876441", .data = LP876441 }, + { .compatible = "ti,tps65941_watchdog", .data = TPS65941_WD }, { } };
@@ -82,5 +117,6 @@ U_BOOT_DRIVER(pmic_tps65941) = { .id = UCLASS_PMIC, .of_match = tps65941_ids, .bind = tps65941_bind, + .probe = tps65941_probe, .ops = &tps65941_ops, }; diff --git a/include/power/tps65941.h b/include/power/tps65941.h index a2bc6814ba..70c7274355 100644 --- a/include/power/tps65941.h +++ b/include/power/tps65941.h @@ -2,7 +2,9 @@ #define TPS659412 0x1 #define TPS659413 0x2 #define TPS659414 0x3 -#define LP876441 0x4 +#define TPS659312 0x4 +#define LP876441 0x5 +#define TPS65941_WD 0x20
/* I2C device address for pmic tps65941 */ #define TPS65941_I2C_ADDR (0x12 >> 1) @@ -18,10 +20,29 @@ #define TPS65941_BUCK_VOLT_MAX 3340000 #define TPS65941_BUCK_MODE_MASK 0x1
-#define TPS65941_LDO_VOLT_MASK 0x3E +#define TPS65941_LDO_VOLT_MASK 0x7F #define TPS65941_LDO_VOLT_MAX_HEX 0x3A #define TPS65941_LDO_VOLT_MIN_HEX 0x4 #define TPS65941_LDO_VOLT_MAX 3300000 #define TPS65941_LDO_MODE_MASK 0x1 #define TPS65941_LDO_BYPASS_EN 0x80 #define TP65941_BUCK_CONF_SLEW_MASK 0x7 + +/* BYPASS is bit7 of VOUT TPS65941_LDO_BYP_MASK */ +#define TPS65941_LDO123_BYP_CONFIG 7 + +#define TPS65941_LDO123_VOLT_BYP_MIN 1700000 +#define TPS65941_LDO123_VOLT_BYP_MAX 3600000 +#define TPS65941_LDO123_VOLT_MIN 600000 +#define TPS65941_LDO4_VOLT_MIN 1200000 +#define TPS65941_LDO4_VOLT_MIN 1200000 +#define TPS65941_LDO123_VSET_MIN 0x04 +#define TPS65941_LDO4_VSET_MIN 0x20 +#define TPS65941_LDO123_VSET_MAX 0x3A +#define TPS65941_LDO4_VSET_MAX 0x74 +#define TPS65941_LDO123_STEP 50000 +#define TPS65941_LDO4_STEP 25000 + +#define TPS65941_WD_MODE_REG 0x406 +#define TPS65941_WD_PWRHOLD_MASK BIT(2) +

Fixes: 065a452ae6a power: regulator: tps65941: add regulator support
LDO voltage conversion was incorrect. This was checked by writing and reading back value.
Signed-off-by: Jerome Neanne jneanne@baylibre.com --- drivers/power/regulator/tps65941_regulator.c | 71 +++++++++++++++++--- 1 file changed, 63 insertions(+), 8 deletions(-)
diff --git a/drivers/power/regulator/tps65941_regulator.c b/drivers/power/regulator/tps65941_regulator.c index b041126775..7afd68c5c4 100644 --- a/drivers/power/regulator/tps65941_regulator.c +++ b/drivers/power/regulator/tps65941_regulator.c @@ -212,12 +212,55 @@ static int tps65941_ldo_enable(struct udevice *dev, int op, bool *enable) return 0; }
-static int tps65941_ldo_val2volt(int val) +static int tps65941_ldo_volt2val(int idx, int uV) { - if (val > TPS65941_LDO_VOLT_MAX_HEX || val < TPS65941_LDO_VOLT_MIN_HEX) + int base = TPS65941_LDO123_VOLT_MIN; + int max = TPS65941_LDO_VOLT_MAX; + int offset = TPS65941_LDO123_VSET_MIN; + int step = TPS65941_LDO123_STEP; + + if (idx > 2) { + base = TPS65941_LDO4_VOLT_MIN; + offset = TPS65941_LDO4_VSET_MIN; + step = TPS65941_LDO4_STEP; + } + + if (uV > max) return -EINVAL; - else if (val >= TPS65941_LDO_VOLT_MIN_HEX) - return 600000 + (val - TPS65941_LDO_VOLT_MIN_HEX) * 50000; + else if (uV >= base) + return (uV - base) / step + offset; + else + return -EINVAL; +} + +static int tps65941_ldo_val2volt(int idx, int val) +{ + int reg_base = TPS65941_LDO123_VSET_MIN; + int reg_max = TPS65941_LDO123_VSET_MAX; + int base = TPS65941_LDO123_VOLT_MIN; + int max = TPS65941_LDO_VOLT_MAX; + int step = TPS65941_LDO123_STEP; + int mask = TPS65941_LDO_VOLT_MASK >> 1; + + if (idx > 2) { + base = TPS65941_LDO4_VOLT_MIN; + max = TPS65941_LDO_VOLT_MAX; + reg_base = TPS65941_LDO4_VSET_MIN; + reg_max = TPS65941_LDO4_VSET_MAX; + step = TPS65941_LDO4_STEP; + mask = TPS65941_LDO_VOLT_MASK; + } else { + val = val >> 1; + } + + if (val > mask || val < 0) + return -EINVAL; + else if (val >= reg_max) + return max; + else if (val <= reg_base) + return base; + else if (val >= 0) + return base + (step * (val - reg_base)); else return -EINVAL; } @@ -227,7 +270,9 @@ static int tps65941_ldo_val(struct udevice *dev, int op, int *uV) unsigned int hex, adr; int ret; struct dm_regulator_uclass_plat *uc_pdata; + int idx;
+ idx = dev->driver_data - 1; uc_pdata = dev_get_uclass_plat(dev);
if (op == PMIC_OP_GET) @@ -240,7 +285,8 @@ static int tps65941_ldo_val(struct udevice *dev, int op, int *uV) return ret;
ret &= TPS65941_LDO_VOLT_MASK; - ret = tps65941_ldo_val2volt(ret); + ret = tps65941_ldo_val2volt(idx, ret); + if (ret < 0) return ret;
@@ -249,12 +295,21 @@ static int tps65941_ldo_val(struct udevice *dev, int op, int *uV) return 0; }
- hex = tps65941_buck_volt2val(*uV); + /* LDO1, LDO2 & LDO3 in BYPASS mode only supports 1.7V min to 3.6V max */ + if (idx < 2 && + (ret & BIT(TPS65941_LDO123_BYP_CONFIG)) && + *uV < TPS65941_LDO123_VOLT_BYP_MIN) + return -EINVAL; + + hex = tps65941_ldo_volt2val(idx, *uV); if (hex < 0) return hex;
- ret &= 0x0; - ret = hex; + if (idx < 2) + hex = hex << 1; + + ret &= ~TPS65941_LDO_VOLT_MASK; + ret |= hex;
ret = pmic_reg_write(dev->parent, adr, ret);

Add PMIC and regulators feature support for j721e. PMIC is controlled by SoC through I2C interface.
Signed-off-by: Jerome Neanne jneanne@baylibre.com --- configs/j721e_evm_a72_defconfig | 9 +++++++++ 1 file changed, 9 insertions(+)
diff --git a/configs/j721e_evm_a72_defconfig b/configs/j721e_evm_a72_defconfig index 452e4b9695..7774330b60 100644 --- a/configs/j721e_evm_a72_defconfig +++ b/configs/j721e_evm_a72_defconfig @@ -77,6 +77,8 @@ CONFIG_CMD_USB=y CONFIG_CMD_USB_MASS_STORAGE=y # CONFIG_CMD_SETEXPR is not set CONFIG_CMD_TIME=y +CONFIG_CMD_PMIC=y +CONFIG_CMD_REGULATOR=y CONFIG_CMD_EXT4_WRITE=y CONFIG_MTDIDS_DEFAULT="nor0=47040000.spi.0,nor0=47034000.hyperbus" CONFIG_MTDPARTS_DEFAULT="mtdparts=47040000.spi.0:512k(ospi.tiboot3),2m(ospi.tispl),4m(ospi.u-boot),256k(ospi.env),1m(ospi.sysfw),256k(ospi.env.backup),57344k@8m(ospi.rootfs),256k(ospi.phypattern);47034000.hyperbus:512k(hbmc.tiboot3),2m(hbmc.tispl),4m(hbmc.u-boot),256k(hbmc.env),1m(hbmc.sysfw),-@8m(hbmc.rootfs)" @@ -205,3 +207,10 @@ CONFIG_UFS=y CONFIG_CADENCE_UFS=y CONFIG_TI_J721E_UFS=y CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_PMIC=y +CONFIG_PMIC_TPS65941=y +CONFIG_DM_REGULATOR=y +CONFIG_DM_REGULATOR_TPS65941=y +CONFIG_CMD_DM=y +CONFIG_OF_PLATDATA=y +

Using uclass_probe_all forces probe on all devices: Only probe for WD stop is really needed here. Probing other devices has no impact.
Signed-off-by: Jerome Neanne jneanne@baylibre.com --- board/ti/j721e/evm.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c index d4e672a7ac..a3304468d4 100644 --- a/board/ti/j721e/evm.c +++ b/board/ti/j721e/evm.c @@ -27,6 +27,8 @@
#include "../common/board_detect.h"
+#include <power/tps65941.h> + #define board_is_j721e_som() (board_ti_k3_is("J721EX-PM1-SOM") || \ board_ti_k3_is("J721EX-PM2-SOM"))
@@ -43,6 +45,12 @@ DECLARE_GLOBAL_DATA_PTR;
int board_init(void) { + int ret; + + /* WD stop is applied unconditionally on all platforms*/ + ret = uclass_probe_all(UCLASS_PMIC); + if (ret) + printf("Failed to probe! stop tps65941 wd\n"); return 0; }

j721e board includes 2 instances of TPS6594: - Primary PMIC - Secondary PMIC
Add AVS class0 in u-boot SPL. AVS is supported only on CPU rail: vdd_cpu_avs. This rail is supplied by the primary PMIC: tps659413 This rail is supplied by a dual-phased buck: buck12.
Other PMICs rails are not AVS capable.
Each PMIC includes a Watchdog that is active by default at boot. This would issue a platform reset unless pmic GPIO8 is driven or this is handled by SW. Watchdog driver is not required for identified use of this product. This software disable inside u-boot avoids parasitic wd reset. GPIO8 can then be used for other purpose.
Board documentation: Link: https://www.ti.com/tool/J721EXSOMXEVM
Signed-off-by: Jerome Neanne jneanne@baylibre.com --- .../k3-j721e-common-proc-board-u-boot.dtsi | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+)
diff --git a/arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi b/arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi index 867ec2bb1a..a57d491689 100644 --- a/arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi +++ b/arch/arm/dts/k3-j721e-common-proc-board-u-boot.dtsi @@ -79,6 +79,14 @@ chipid@43000014 { bootph-pre-ram; }; + + mcu_i2c0: i2c@40b00000 { + status = "okay"; + tps65941_wd: tps65941-wd@12 { + compatible = "ti,tps65941_watchdog"; + reg = <0x12>; + }; + }; };
&secure_proxy_main { @@ -170,6 +178,19 @@
&wkup_i2c0 { bootph-pre-ram; + tps659413: tps659413@48 { + bootph-pre-ram; + compatible = "ti,tps659413"; + + regulators { + bootph-pre-ram; + bucka12_reg: buck12 { + }; + }; + }; + tps659411: tps659411@4c { + compatible = "ti,tps659411"; + }; };
&main_i2c0 {

Use a copy of Linux dts for TPS6594 PMIC description instead of custom u-boot
Signed-off-by: Jerome Neanne jneanne@baylibre.com --- .../arm/dts/k3-j721e-r5-common-proc-board.dts | 48 +++++++++---------- 1 file changed, 22 insertions(+), 26 deletions(-)
diff --git a/arch/arm/dts/k3-j721e-r5-common-proc-board.dts b/arch/arm/dts/k3-j721e-r5-common-proc-board.dts index e9e50538cb..f31d1c4649 100644 --- a/arch/arm/dts/k3-j721e-r5-common-proc-board.dts +++ b/arch/arm/dts/k3-j721e-r5-common-proc-board.dts @@ -21,6 +21,27 @@ tick-timer = &timer1; };
+ evm_12v0: fixedregulator-evm12v0 { + /* main supply */ + compatible = "regulator-fixed"; + regulator-name = "evm_12v0"; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + regulator-always-on; + regulator-boot-on; + }; + + vsys_3v3: fixedregulator-vsys3v3 { + /* Output of LM5140 */ + compatible = "regulator-fixed"; + regulator-name = "vsys_3v3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&evm_12v0>; + regulator-always-on; + regulator-boot-on; + }; + a72_0: a72@0 { compatible = "ti,am654-rproc"; reg = <0x0 0x00a90000 0x0 0x10>; @@ -276,33 +297,8 @@ ti,driver-strength-ohm = <50>; };
-&wkup_i2c0 { - bootph-pre-ram; - tps659413a: tps659413a@48 { - reg = <0x48>; - compatible = "ti,tps659413"; - bootph-pre-ram; - pinctrl-names = "default"; - pinctrl-0 = <&wkup_i2c0_pins_default>; - clock-frequency = <400000>; - - regulators: regulators { - bootph-pre-ram; - buck12_reg: buck12 { - /*VDD_CPU*/ - regulator-name = "buck12"; - regulator-min-microvolt = <600000>; - regulator-max-microvolt = <900000>; - regulator-always-on; - regulator-boot-on; - bootph-pre-ram; - }; - }; - }; -}; - &wkup_vtm0 { - vdd-supply-2 = <&buck12_reg>; + vdd-supply-2 = <&bucka12_reg>; bootph-pre-ram; };

Change node name to reuse Linux common dts naming style.
Signed-off-by: Jerome Neanne jneanne@baylibre.com --- arch/arm/dts/k3-j721e-r5-common-proc-board-u-boot.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/dts/k3-j721e-r5-common-proc-board-u-boot.dtsi b/arch/arm/dts/k3-j721e-r5-common-proc-board-u-boot.dtsi index f9746d33ec..332f3f4672 100644 --- a/arch/arm/dts/k3-j721e-r5-common-proc-board-u-boot.dtsi +++ b/arch/arm/dts/k3-j721e-r5-common-proc-board-u-boot.dtsi @@ -21,7 +21,7 @@ }; };
-&tps659413a { +&tps659413 { esm: esm { compatible = "ti,tps659413-esm"; bootph-pre-ram;

From: Julien Panis jpanis@baylibre.com
Add support for TPS6593 regulators and watchdog. PMIC is controlled by SoC through I2C interface.
Signed-off-by: Julien Panis jpanis@baylibre.com Signed-off-by: Jerome Neanne jneanne@baylibre.com --- configs/am62ax_evm_a53_defconfig | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/configs/am62ax_evm_a53_defconfig b/configs/am62ax_evm_a53_defconfig index 46a95a692e..c3c886fed3 100644 --- a/configs/am62ax_evm_a53_defconfig +++ b/configs/am62ax_evm_a53_defconfig @@ -51,7 +51,6 @@ CONFIG_SPL_CLK=y CONFIG_CLK_TI_SCI=y CONFIG_TI_SCI_PROTOCOL=y # CONFIG_GPIO is not set -# CONFIG_I2C is not set CONFIG_DM_MAILBOX=y CONFIG_K3_SEC_PROXY=y CONFIG_MMC_SDHCI=y @@ -75,3 +74,11 @@ CONFIG_SPL_SYSRESET=y CONFIG_SYSRESET_TI_SCI=y CONFIG_FS_FAT_MAX_CLUSTSIZE=16384 CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_PMIC=y +CONFIG_PMIC_TPS65941=y +CONFIG_DM_REGULATOR=y +CONFIG_DM_REGULATOR_TPS65941=y +CONFIG_DM_I2C=y +CONFIG_I2C=y +CONFIG_SPL_I2C=y +CONFIG_SYS_I2C_OMAP24XX=y

Add support for TPS6593 PMIC devices: - regulators (bucks and LDOs) on main I2C0 bus, - watchdog on MCU I2C0 bus.
Signed-off-by: Julien Panis jpanis@baylibre.com Signed-off-by: Jerome Neanne jneanne@baylibre.com --- arch/arm/dts/k3-am62a7-sk-u-boot.dtsi | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
diff --git a/arch/arm/dts/k3-am62a7-sk-u-boot.dtsi b/arch/arm/dts/k3-am62a7-sk-u-boot.dtsi index cf938c43b8..e8e35f6cde 100644 --- a/arch/arm/dts/k3-am62a7-sk-u-boot.dtsi +++ b/arch/arm/dts/k3-am62a7-sk-u-boot.dtsi @@ -85,6 +85,14 @@
&mcu_pmx0 { bootph-pre-ram; + status = "okay"; + + mcu_i2c0_pins_default: mcu_i2c0_pins_default { + pinctrl-single,pins = < + AM62X_MCU_IOPAD(0x044, PIN_INPUT_PULLUP, 0) /* (E12) MCU_I2C0_SCL */ + AM62X_MCU_IOPAD(0x048, PIN_INPUT_PULLUP, 0) /* (D9) MCU_I2C0_SDA */ + >; + }; };
&wkup_uart0 { @@ -97,6 +105,20 @@
&main_i2c0 { bootph-pre-ram; + tps659312: tps659312@48 { + compatible = "ti,tps659312"; + }; +}; + +&mcu_i2c0 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&mcu_i2c0_pins_default>; + + tps65931_wd: tps65931_wd@12 { + compatible = "ti,tps65941_watchdog"; + reg = <0x12>; + }; };
&main_i2c0_pins_default {

From: Esteban Blanc eblanc@baylibre.com
Add support for TPS6594 family regulators and watchdog. PMIC is controlled by SoC through I2C interface.
Add dm, pmic and regulators commands to allow testing
Signed-off-by: Esteban Blanc eblanc@baylibre.com Signed-off-by: Jerome Neanne jneanne@baylibre.com --- configs/j7200_evm_a72_defconfig | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/configs/j7200_evm_a72_defconfig b/configs/j7200_evm_a72_defconfig index 9b6512bacb..b43eb2fcbf 100644 --- a/configs/j7200_evm_a72_defconfig +++ b/configs/j7200_evm_a72_defconfig @@ -201,3 +201,11 @@ CONFIG_UFS=y CONFIG_CADENCE_UFS=y CONFIG_TI_J721E_UFS=y CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_PMIC=y +CONFIG_PMIC_TPS65941=y +CONFIG_DM_REGULATOR_TPS65941=y +CONFIG_DM_REGULATOR=y +CONFIG_CMD_PMIC=y +CONFIG_CMD_REGULATOR=y +CONFIG_CMD_DM=y +CONFIG_OF_PLATDATA=y

Add support for TPS6594 PMIC family devices: - regulators (bucks and LDOs) on WKUP_I2C0 bus, - watchdog on MCU_I2C0 bus.
Signed-off-by: Esteban Blanc eblanc@baylibre.com Signed-off-by: Jerome Neanne jneanne@baylibre.com --- .../k3-j7200-common-proc-board-u-boot.dtsi | 17 ++++++ .../arm/dts/k3-j7200-r5-common-proc-board.dts | 56 ++++++++----------- 2 files changed, 39 insertions(+), 34 deletions(-)
diff --git a/arch/arm/dts/k3-j7200-common-proc-board-u-boot.dtsi b/arch/arm/dts/k3-j7200-common-proc-board-u-boot.dtsi index f57c2306ba..a633f045a5 100644 --- a/arch/arm/dts/k3-j7200-common-proc-board-u-boot.dtsi +++ b/arch/arm/dts/k3-j7200-common-proc-board-u-boot.dtsi @@ -120,6 +120,15 @@
&wkup_i2c0 { bootph-pre-ram; + status = "okay"; +}; + +&mcu_i2c0 { + status="okay"; + tps65941_wd: tps65941_wd@12 { + compatible = "ti,tps65941_watchdog"; + reg = <0x12>; + }; };
&main_i2c0 { @@ -196,3 +205,11 @@ &main_r5fss0 { ti,cluster-mode = <0>; }; + +&tps659414 { + compatible = "ti,tps659411"; +}; + +&lp876441 { + compatible = "ti,lp876441"; +}; diff --git a/arch/arm/dts/k3-j7200-r5-common-proc-board.dts b/arch/arm/dts/k3-j7200-r5-common-proc-board.dts index 55ad6153dd..aac776ee33 100644 --- a/arch/arm/dts/k3-j7200-r5-common-proc-board.dts +++ b/arch/arm/dts/k3-j7200-r5-common-proc-board.dts @@ -21,6 +21,27 @@ firmware-loader = &fs_loader0; };
+ evm_12v0: fixedregulator-evm12v0 { + /* main supply */ + compatible = "regulator-fixed"; + regulator-name = "evm_12v0"; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + regulator-always-on; + regulator-boot-on; + }; + + vsys_3v3: fixedregulator-vsys3v3 { + /* Output of LM5140 */ + compatible = "regulator-fixed"; + regulator-name = "vsys_3v3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&evm_12v0>; + regulator-always-on; + regulator-boot-on; + }; + fs_loader0: fs_loader@0 { bootph-all; compatible = "u-boot,fs-loader"; @@ -125,13 +146,6 @@ >; };
- wkup_i2c0_pins_default: wkup-i2c0-pins-default { - pinctrl-single,pins = < - J721E_WKUP_IOPAD(0x100, PIN_INPUT_PULLUP, 0) /* (F20) WKUP_I2C0_SCL */ - J721E_WKUP_IOPAD(0x104, PIN_INPUT_PULLUP, 0) /* (H21) WKUP_I2C0_SDA */ - >; - }; - mcu_fss0_hpb0_pins_default: mcu-fss0-hpb0-pins-default { pinctrl-single,pins = < J721E_WKUP_IOPAD(0x0, PIN_OUTPUT, 1) /* (E20) MCU_OSPI0_CLK.MCU_HYPERBUS0_CK */ @@ -246,34 +260,8 @@ ti,driver-strength-ohm = <50>; };
-&wkup_i2c0 { - bootph-pre-ram; - lp876441: lp876441@4c { - compatible = "ti,lp876441"; - reg = <0x4c>; - bootph-pre-ram; - pinctrl-names = "default"; - pinctrl-0 = <&wkup_i2c0_pins_default>; - clock-frequency = <400000>; - - regulators: regulators { - bootph-pre-ram; - buck1_reg: buck1 { - /*VDD_CPU_AVS_REG*/ - regulator-name = "buck1"; - regulator-min-microvolt = <800000>; - regulator-max-microvolt = <1250000>; - regulator-always-on; - regulator-boot-on; - bootph-pre-ram; - }; - }; - }; - -}; - &wkup_vtm0 { - vdd-supply-2 = <&buck1_reg>; + vdd-supply-2 = <&buckb1_reg>; bootph-pre-ram; };

Add support for TPS6594 PMIC family devices: - regulators (bucks and LDOs) on main WKUP_I2C0 bus, - watchdog on MCU_I2C0 bus.
Signed-off-by: Esteban Blanc eblanc@baylibre.com Signed-off-by: Jerome Neanne jneanne@baylibre.com --- .../k3-j721s2-common-proc-board-u-boot.dtsi | 29 +++++++++++- .../dts/k3-j721s2-r5-common-proc-board.dts | 44 +++++++++++++++++++ 2 files changed, 71 insertions(+), 2 deletions(-)
diff --git a/arch/arm/dts/k3-j721s2-common-proc-board-u-boot.dtsi b/arch/arm/dts/k3-j721s2-common-proc-board-u-boot.dtsi index 4fd6d36417..e249edeff4 100644 --- a/arch/arm/dts/k3-j721s2-common-proc-board-u-boot.dtsi +++ b/arch/arm/dts/k3-j721s2-common-proc-board-u-boot.dtsi @@ -21,8 +21,16 @@ }; };
-&wkup_i2c0 { - bootph-pre-ram; +&tps659411 { + compatible = "ti,tps659411"; +}; + +&tps659414 { + compatible = "ti,tps659411"; +}; + +&lp876411 { + compatible = "ti,lp876441"; };
&cbass_main { @@ -47,6 +55,17 @@ chipid@43000014 { bootph-pre-ram; }; + + mcu_i2c0: i2c@40b00000 { + status = "okay"; + pinctrl-names = "default"; + pinctrl-0 = <&mcu_i2c0_pins_default>; + + tps65941_wd: tps65941-wd@12 { + compatible = "ti,tps65941_watchdog"; + reg = <0x12>; + }; + }; };
&mcu_navss { @@ -101,6 +120,12 @@
&wkup_pmx0 { bootph-pre-ram; + mcu_i2c0_pins_default: mcu_i2c0_pins_default { + pinctrl-single,pins = < + J721S2_WKUP_IOPAD(0x108, PIN_INPUT, 0) /* (G24) MCU_I2C0_SCL */ + J721S2_WKUP_IOPAD(0x10c, PIN_INPUT, 0) /* (J25) MCU_I2C0_SDA */ + >; + }; };
&k3_pds { diff --git a/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts b/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts index bc617022c1..a379b169d0 100644 --- a/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts +++ b/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts @@ -21,6 +21,38 @@ remoteproc1 = &a72_0; };
+ evm_12v0: fixedregulator-evm12v0 { + /* main supply */ + compatible = "regulator-fixed"; + regulator-name = "evm_12v0"; + regulator-min-microvolt = <12000000>; + regulator-max-microvolt = <12000000>; + regulator-always-on; + regulator-boot-on; + }; + + vsys_3v3: fixedregulator-vsys3v3 { + /* Output of LM5140 */ + compatible = "regulator-fixed"; + regulator-name = "vsys_3v3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + vin-supply = <&evm_12v0>; + regulator-always-on; + regulator-boot-on; + }; + + vsys_5v0: fixedregulator-vsys5v0 { + /* Output of LM5140 */ + compatible = "regulator-fixed"; + regulator-name = "vsys_5v0"; + regulator-min-microvolt = <5000000>; + regulator-max-microvolt = <5000000>; + vin-supply = <&evm_12v0>; + regulator-always-on; + regulator-boot-on; + }; + fs_loader0: fs_loader@0 { compatible = "u-boot,fs-loader"; bootph-all; @@ -94,6 +126,13 @@ <&mcu_secproxy 23>; bootph-pre-ram; }; + + wkup_vtm0: vtm@42040000 { + compatible = "ti,am654-vtm", "ti,j721e-avs"; + reg = <0x0 0x42040000 0x0 0x330>; + power-domains = <&k3_pds 180 TI_SCI_PD_EXCLUSIVE>; + #thermal-sensor-cells = <1>; + }; };
&main_pmx0 { @@ -195,4 +234,9 @@ ti,sci = <&dm_tifs>; };
+&wkup_vtm0 { + vdd-supply-2 = <&bucka1234_reg>; + bootph-pre-ram; +}; + #include "k3-j721s2-common-proc-board-u-boot.dtsi"

From: Esteban Blanc eblanc@baylibre.com
Add support for TPS6594 family regulators and watchdog. Add support for AVS0. PMIC is controlled by SoC through I2C interface.
Add dm, pmic and regulators commands to allow testing.
Signed-off-by: Esteban Blanc eblanc@baylibre.com Signed-off-by: Jerome Neanne jneanne@baylibre.com --- configs/j721s2_evm_a72_defconfig | 8 ++++++++ configs/j721s2_evm_r5_defconfig | 7 +++++++ 2 files changed, 15 insertions(+)
diff --git a/configs/j721s2_evm_a72_defconfig b/configs/j721s2_evm_a72_defconfig index 3a91df71d3..f37b4a596d 100644 --- a/configs/j721s2_evm_a72_defconfig +++ b/configs/j721s2_evm_a72_defconfig @@ -210,3 +210,11 @@ CONFIG_UFS=y CONFIG_CADENCE_UFS=y CONFIG_TI_J721E_UFS=y CONFIG_OF_LIBFDT_OVERLAY=y +CONFIG_DM_PMIC=y +CONFIG_PMIC_TPS65941=y +CONFIG_DM_REGULATOR=y +CONFIG_DM_REGULATOR_TPS65941=y +CONFIG_CMD_PMIC=y +CONFIG_CMD_REGULATOR=y +CONFIG_CMD_DM=y +CONFIG_OF_PLATDATA=y diff --git a/configs/j721s2_evm_r5_defconfig b/configs/j721s2_evm_r5_defconfig index 343e3c1630..b4c67a0bcb 100644 --- a/configs/j721s2_evm_r5_defconfig +++ b/configs/j721s2_evm_r5_defconfig @@ -178,3 +178,10 @@ CONFIG_FS_FAT_MAX_CLUSTSIZE=16384 CONFIG_PANIC_HANG=y CONFIG_LIB_RATIONAL=y CONFIG_SPL_LIB_RATIONAL=y +CONFIG_K3_AVS0=y +CONFIG_CPU_V7R=y +CONFIG_DM_PMIC=y +CONFIG_PMIC_TPS65941=y +CONFIG_DM_REGULATOR=y +CONFIG_SPL_DM_REGULATOR=y +CONFIG_DM_REGULATOR_TPS65941=y \ No newline at end of file
participants (1)
-
Jerome Neanne