From 7551a7fce2709c1ac80ab74b17cc40f2f98f23c2 Mon Sep 17 00:00:00 2001 From: Keerthy Date: Fri, 4 Jun 2021 16:51:53 -0500 Subject: [PATCH] HACK: arm: mach-k3: j721e: Fix AVS Class 0 for PM1 SoM The J721E PM1 SoM uses TPS65917 PMIC, and uses a different regulator (SMPS12) as the supply for A72 AVS Class 0. Add support for this by fixing up the DT supply dynamically based on the board version to get the right phandle for avs supply regulator. The same k3-j721e-r5-common-proc-board.dts file is used to avoid dynamic detection for R5 SPL DTB, with the TPS65917 PMIC nodes added. Both PMIC nodes are present (not at all ideal), but their sole usage is to provide for AVS Class 0 functionality. There is no plan to upstream this support, and hence the simpler HACK approach is taken. Signed-off-by: Keerthy [s-anna@ti.com: port to 2021 LTS and split up the R5 portion] Signed-off-by: Suman Anna --- .../arm/dts/k3-j721e-r5-common-proc-board.dts | 109 ++++++++++++++++++ arch/arm/mach-k3/j721e_init.c | 15 +++ configs/j721e_evm_r5_defconfig | 4 + 3 files changed, 128 insertions(+) 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 2250d16e78..3a9167fa3c 100644 --- a/arch/arm/dts/k3-j721e-r5-common-proc-board.dts +++ b/arch/arm/dts/k3-j721e-r5-common-proc-board.dts @@ -268,10 +268,119 @@ }; }; }; + + /* PMIC for PM1 SoM, unused on PM2 */ + tps65917: tps65917@58 { + reg = <0x58>; + compatible = "ti,tps65917"; + interrupt-controller; + #interrupt-cells = <2>; + u-boot,dm-spl; + + ti,system-power-controller; + + tps65917_pmic { + compatible = "ti,tps65917-pmic"; + u-boot,dm-spl; + + tps65917_regulators: regulators { + u-boot,dm-spl; + smps12_reg: smps12 { + /* VDD_CPU_AVS_REG */ + regulator-name = "smps1"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <1250000>; + regulator-always-on; + regulator-boot-on; + u-boot,dm-spl; + }; + + smps3_reg: smps3 { + /* V917_SMPS3_1V1 */ + regulator-name = "smps3"; + regulator-min-microvolt = <1100000>; + regulator-max-microvolt = <1100000>; + regulator-boot-on; + regulator-always-on; + u-boot,dm-spl; + }; + + smps4_reg: smps4 { + /* VDD_CORE_RAM_0V85_REG */ + regulator-name = "smps4"; + regulator-min-microvolt = <850000>; + regulator-max-microvolt = <850000>; + regulator-always-on; + regulator-boot-on; + u-boot,dm-spl; + }; + + smps5_reg: smps5 { + /* VDD_CPU_RAM_0V85_REG */ + regulator-name = "smps5"; + regulator-min-microvolt = <850000>; + regulator-max-microvolt = <850000>; + regulator-boot-on; + regulator-always-on; + u-boot,dm-spl; + }; + + ldo1_reg: ldo1 { + /* LDO1_OUT --> VDD_SD_DV_REG */ + regulator-name = "ldo1"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <3300000>; + regulator-always-on; + regulator-boot-on; + regulator-allow-bypass; + u-boot,dm-spl; + }; + + ldo2_reg: ldo2 { + /* VDA_USB_3V3_REG */ + regulator-name = "ldo2"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-allow-bypass; + u-boot,dm-spl; + }; + + ldo3_reg: ldo3 { + /* VDA_PLL_1V8_REG */ + regulator-name = "ldo3"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-boot-on; + regulator-always-on; + u-boot,dm-spl; + }; + + ldo4_reg: ldo4 { + /* V917_LDO4_1V8 */ + regulator-name = "ldo4"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-boot-on; + u-boot,dm-spl; + }; + + ldo5_reg: ldo5 { + /* VPP_EFUSE_1V8 */ + regulator-name = "ldo5"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + regulator-boot-on; + u-boot,dm-spl; + }; + }; + }; + }; }; &wkup_vtm0 { vdd-supply-2 = <&buck12_reg>; + som1-supply-2 = <&smps12_reg>; u-boot,dm-spl; }; diff --git a/arch/arm/mach-k3/j721e_init.c b/arch/arm/mach-k3/j721e_init.c index 0645d97cc3..9c572a091d 100644 --- a/arch/arm/mach-k3/j721e_init.c +++ b/arch/arm/mach-k3/j721e_init.c @@ -19,8 +19,10 @@ #include #include #include +#include #include #include +#include "../../../board/ti/common/board_detect.h" #ifdef CONFIG_SPL_BUILD #ifdef CONFIG_K3_LOAD_SYSFW @@ -137,6 +139,10 @@ static void store_boot_info_from_rom(void) void board_init_f(ulong dummy) { +#if defined(CONFIG_CPU_V7R) && defined(CONFIG_K3_AVS0) + int offset; + u32 val, dflt = 0; +#endif #if defined(CONFIG_K3_J721E_DDRSS) || defined(CONFIG_K3_LOAD_SYSFW) struct udevice *dev; int ret; @@ -218,6 +224,15 @@ void board_init_f(ulong dummy) do_board_detect(); #if defined(CONFIG_CPU_V7R) && defined(CONFIG_K3_AVS0) + if (board_ti_k3_is("J721EX-PM1-SOM")) { + offset = fdt_node_offset_by_compatible(gd->fdt_blob, -1, + "ti,am654-vtm"); + val = fdt_getprop_u32_default_node(gd->fdt_blob, offset, 0, + "som1-supply-2", dflt); + do_fixup_by_compat_u32((void *)gd->fdt_blob, "ti,am654-vtm", + "vdd-supply-2", val, 0); + } + ret = uclass_get_device_by_driver(UCLASS_MISC, DM_GET_DRIVER(k3_avs), &dev); if (ret) diff --git a/configs/j721e_evm_r5_defconfig b/configs/j721e_evm_r5_defconfig index 0881d56035..3558f954d1 100644 --- a/configs/j721e_evm_r5_defconfig +++ b/configs/j721e_evm_r5_defconfig @@ -115,9 +115,13 @@ CONFIG_PINCTRL_SINGLE=y CONFIG_POWER_DOMAIN=y CONFIG_TI_POWER_DOMAIN=y CONFIG_DM_PMIC=y +CONFIG_PMIC_PALMAS=y +CONFIG_SPL_PMIC_PALMAS=y CONFIG_PMIC_TPS65941=y CONFIG_DM_REGULATOR=y CONFIG_SPL_DM_REGULATOR=y +CONFIG_DM_REGULATOR_PALMAS=y +CONFIG_SPL_DM_REGULATOR_PALMAS=y CONFIG_DM_REGULATOR_TPS65941=y CONFIG_K3_SYSTEM_CONTROLLER=y CONFIG_REMOTEPROC_TI_K3_ARM64=y