[PATCH 00/10] Add AVS support for J721S2

This series does the DT sync with Linux 6.8-rc1 as that has the pmic nodes required for AVS support and then adds AVS Support for J721S2.
AVS Test for J721S2: https://gist.github.com/manorit2001/d7690ded6ef685aa8ffa5b16746cc529 Boot Test results: https://gist.github.com/manorit2001/6775d721b3df5a690497d94d012b93c4
Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com --- Manorit Chawdhry (10): arm: dts: k3-j721s2*: Sync with 6.8-rc1 arm: dts: k3-am68*: Sync with 6.8-rc1 drivers: misc: k3_avs: Use soc_match_device instead of compatible. drivers: misc: k3_avs: Check return code while programming AVS drivers: misc: k3_avs: Add AVS Support for J721S2. drivers: power: pmic: Fix compatible for J721S2 arm: mach-k3: j721s2_init: Initialize AVS Class 0 arm: dts: j721s2: Add VTM node in R5 DONOTMERGE: arm: dts: j721s2: Fix Power domain for VTM node. configs: j721s2_evm_r5_defconfig: Add AVS Configs
arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi | 18 +- arch/arm/dts/k3-am68-sk-base-board.dts | 1 + .../dts/k3-j721s2-common-proc-board-u-boot.dtsi | 18 +- arch/arm/dts/k3-j721s2-main.dtsi | 9 +- arch/arm/dts/k3-j721s2-mcu-wakeup.dtsi | 23 ++- arch/arm/dts/k3-j721s2-r5-common-proc-board.dts | 9 + arch/arm/dts/k3-j721s2-som-p0.dtsi | 193 ++++++++++++++++++ arch/arm/mach-k3/j721s2_init.c | 8 + configs/j721s2_evm_r5_defconfig | 6 + drivers/misc/k3_avs.c | 216 ++++++++++++--------- drivers/power/pmic/tps65941.c | 2 +- 11 files changed, 385 insertions(+), 118 deletions(-) --- base-commit: 6faba41927bdc8973b59678649ef83c564cc421e change-id: 20240130-b4-upstream-j721s2-avs-8c187d3fe26a
Best regards,

Syncs the DT from Linux v6.8-rc1.
Remove udmap overrides and handle location change of chipid node.
Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com --- arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi | 18 +- .../dts/k3-j721s2-common-proc-board-u-boot.dtsi | 18 +- arch/arm/dts/k3-j721s2-main.dtsi | 9 +- arch/arm/dts/k3-j721s2-mcu-wakeup.dtsi | 21 ++- arch/arm/dts/k3-j721s2-som-p0.dtsi | 193 +++++++++++++++++++++ 5 files changed, 230 insertions(+), 29 deletions(-)
diff --git a/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi b/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi index 4f34347586e0..43055b5c161e 100644 --- a/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi +++ b/arch/arm/dts/k3-am68-sk-base-board-u-boot.dtsi @@ -19,10 +19,14 @@
&cbass_mcu_wakeup { bootph-all; +};
- chipid@43000014 { - bootph-all; - }; +&wkup_conf { + bootph-all; +}; + +&chipid { + bootph-all; };
&mcu_navss { @@ -34,14 +38,6 @@ };
&mcu_udmap { - reg = <0x0 0x285c0000 0x0 0x100>, - <0x0 0x284c0000 0x0 0x4000>, - <0x0 0x2a800000 0x0 0x40000>, - <0x0 0x284a0000 0x0 0x4000>, - <0x0 0x2aa00000 0x0 0x40000>, - <0x0 0x28400000 0x0 0x2000>; - reg-names = "gcfg", "rchan", "rchanrt", "tchan", - "tchanrt", "rflow"; bootph-all; };
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 a3ebf5996eac..df5a2f3b7d5b 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 @@ -19,10 +19,14 @@
&cbass_mcu_wakeup { bootph-all; +};
- chipid@43000014 { - bootph-all; - }; +&wkup_conf { + bootph-all; +}; + +&chipid { + bootph-all; };
&mcu_navss { @@ -34,14 +38,6 @@ };
&mcu_udmap { - reg = <0x0 0x285c0000 0x0 0x100>, - <0x0 0x284c0000 0x0 0x4000>, - <0x0 0x2a800000 0x0 0x40000>, - <0x0 0x284a0000 0x0 0x4000>, - <0x0 0x2aa00000 0x0 0x40000>, - <0x0 0x28400000 0x0 0x2000>; - reg-names = "gcfg", "rchan", "rchanrt", "tchan", - "tchanrt", "rflow"; bootph-all; };
diff --git a/arch/arm/dts/k3-j721s2-main.dtsi b/arch/arm/dts/k3-j721s2-main.dtsi index b03731b53a26..ea7f2b2ab165 100644 --- a/arch/arm/dts/k3-j721s2-main.dtsi +++ b/arch/arm/dts/k3-j721s2-main.dtsi @@ -766,6 +766,7 @@ ti,itap-del-sel-sd-hs = <0x0>; ti,itap-del-sel-sdr12 = <0x0>; ti,itap-del-sel-sdr25 = <0x0>; + ti,itap-del-sel-ddr50 = <0x2>; ti,clkbuf-sel = <0x7>; ti,trm-icp = <0x8>; dma-coherent; @@ -1086,8 +1087,12 @@ compatible = "ti,j721e-navss-main-udmap"; reg = <0x0 0x31150000 0x0 0x100>, <0x0 0x34000000 0x0 0x80000>, - <0x0 0x35000000 0x0 0x200000>; - reg-names = "gcfg", "rchanrt", "tchanrt"; + <0x0 0x35000000 0x0 0x200000>, + <0x0 0x30b00000 0x0 0x20000>, + <0x0 0x30c00000 0x0 0x8000>, + <0x0 0x30d00000 0x0 0x4000>; + reg-names = "gcfg", "rchanrt", "tchanrt", + "tchan", "rchan", "rflow"; msi-parent = <&main_udmass_inta>; #dma-cells = <1>;
diff --git a/arch/arm/dts/k3-j721s2-mcu-wakeup.dtsi b/arch/arm/dts/k3-j721s2-mcu-wakeup.dtsi index 7254f3bd3634..80aa33c58a45 100644 --- a/arch/arm/dts/k3-j721s2-mcu-wakeup.dtsi +++ b/arch/arm/dts/k3-j721s2-mcu-wakeup.dtsi @@ -34,9 +34,16 @@ }; };
- chipid@43000014 { - compatible = "ti,am654-chipid"; - reg = <0x00 0x43000014 0x00 0x4>; + wkup_conf: bus@43000000 { + compatible = "simple-bus"; + #address-cells = <1>; + #size-cells = <1>; + ranges = <0x0 0x00 0x43000000 0x20000>; + + chipid: chipid@14 { + compatible = "ti,am654-chipid"; + reg = <0x14 0x4>; + }; };
secure_proxy_sa3: mailbox@43600000 { @@ -471,8 +478,12 @@ compatible = "ti,j721e-navss-mcu-udmap"; reg = <0x0 0x285c0000 0x0 0x100>, <0x0 0x2a800000 0x0 0x40000>, - <0x0 0x2aa00000 0x0 0x40000>; - reg-names = "gcfg", "rchanrt", "tchanrt"; + <0x0 0x2aa00000 0x0 0x40000>, + <0x0 0x284a0000 0x0 0x4000>, + <0x0 0x284c0000 0x0 0x4000>, + <0x0 0x28400000 0x0 0x2000>; + reg-names = "gcfg", "rchanrt", "tchanrt", + "tchan", "rchan", "rflow"; msi-parent = <&main_udmass_inta>; #dma-cells = <1>;
diff --git a/arch/arm/dts/k3-j721s2-som-p0.dtsi b/arch/arm/dts/k3-j721s2-som-p0.dtsi index dcad372620b1..da3237b23b63 100644 --- a/arch/arm/dts/k3-j721s2-som-p0.dtsi +++ b/arch/arm/dts/k3-j721s2-som-p0.dtsi @@ -172,6 +172,15 @@ }; };
+&wkup_pmx1 { + pmic_irq_pins_default: pmic-irq-default-pins { + pinctrl-single,pins = < + /* (C21) MCU_OSPI1_CSn1.WKUP_GPIO0_39 */ + J721S2_WKUP_IOPAD(0x028, PIN_INPUT, 7) + >; + }; +}; + &wkup_pmx2 { wkup_i2c0_pins_default: wkup-i2c0-default-pins { pinctrl-single,pins = < @@ -208,6 +217,190 @@ compatible = "atmel,24c256"; reg = <0x50>; }; + + tps659411: pmic@48 { + compatible = "ti,tps6594-q1"; + reg = <0x48>; + system-power-controller; + pinctrl-names = "default"; + pinctrl-0 = <&pmic_irq_pins_default>; + interrupt-parent = <&wkup_gpio0>; + interrupts = <39 IRQ_TYPE_EDGE_FALLING>; + gpio-controller; + #gpio-cells = <2>; + ti,primary-pmic; + buck1234-supply = <&vsys_3v3>; + buck5-supply = <&vsys_3v3>; + ldo1-supply = <&vsys_3v3>; + ldo2-supply = <&vsys_3v3>; + ldo3-supply = <&vsys_3v3>; + ldo4-supply = <&vsys_3v3>; + + regulators { + bucka1234: buck1234 { + regulator-name = "vdd_cpu_avs"; + regulator-min-microvolt = <600000>; + regulator-max-microvolt = <900000>; + regulator-boot-on; + regulator-always-on; + bootph-pre-ram; + }; + + bucka5: buck5 { + regulator-name = "vdd_mcu_0v85"; + regulator-min-microvolt = <850000>; + regulator-max-microvolt = <850000>; + regulator-boot-on; + regulator-always-on; + }; + + ldoa1: ldo1 { + regulator-name = "vdd_mcuwk_0v8"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <800000>; + regulator-boot-on; + regulator-always-on; + }; + + ldoa2: ldo2 { + regulator-name = "vdd_mcu_gpioret_3v3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + regulator-always-on; + }; + + ldoa3: ldo3 { + regulator-name = "vdd_mcuio_1v8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-boot-on; + regulator-always-on; + }; + + ldoa4: ldo4 { + regulator-name = "vda_mcu_1v8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-boot-on; + regulator-always-on; + }; + }; + }; + + tps659414: pmic@4c { + compatible = "ti,tps6594-q1"; + reg = <0x4c>; + system-power-controller; + interrupt-parent = <&wkup_gpio0>; + interrupts = <39 IRQ_TYPE_EDGE_FALLING>; + gpio-controller; + #gpio-cells = <2>; + buck1-supply = <&vsys_3v3>; + buck2-supply = <&vsys_3v3>; + buck3-supply = <&vsys_3v3>; + buck4-supply = <&vsys_3v3>; + buck5-supply = <&vsys_3v3>; + ldo1-supply = <&vsys_3v3>; + ldo2-supply = <&vsys_3v3>; + ldo3-supply = <&vsys_3v3>; + ldo4-supply = <&vsys_3v3>; + + regulators { + buckb1: buck1 { + regulator-name = "vdd_io_1v8_reg"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + regulator-boot-on; + }; + + buckb2: buck2 { + regulator-name = "vdd_fpd_1v1"; + regulator-min-microvolt = <1100000>; + regulator-max-microvolt = <1100000>; + regulator-boot-on; + regulator-always-on; + }; + + buckb3: buck3 { + regulator-name = "vdd_phy_1v8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-boot-on; + regulator-always-on; + }; + + buckb4: buck4 { + regulator-name = "vdd_ddr_1v1"; + regulator-min-microvolt = <1100000>; + regulator-max-microvolt = <1100000>; + regulator-boot-on; + regulator-always-on; + }; + + buckb5: buck5 { + regulator-name = "vdd_ram_0v85"; + regulator-min-microvolt = <850000>; + regulator-max-microvolt = <850000>; + regulator-boot-on; + regulator-always-on; + }; + + ldob1: ldo1 { + regulator-name = "vdd_wk_0v8"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <800000>; + regulator-boot-on; + regulator-always-on; + }; + + ldob2: ldo2 { + regulator-name = "vdd_gpioret_3v3"; + regulator-min-microvolt = <3300000>; + regulator-max-microvolt = <3300000>; + regulator-boot-on; + regulator-always-on; + }; + + ldob3: ldo3 { + regulator-name = "vda_dll_0v8"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <800000>; + regulator-boot-on; + regulator-always-on; + }; + + ldob4: ldo4 { + regulator-name = "vda_pll_1v8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-boot-on; + regulator-always-on; + }; + }; + }; + + lp876411: pmic@58 { + compatible = "ti,lp8764-q1"; + reg = <0x58>; + system-power-controller; + interrupt-parent = <&wkup_gpio0>; + interrupts = <39 IRQ_TYPE_EDGE_FALLING>; + gpio-controller; + #gpio-cells = <2>; + buck1234-supply = <&vsys_3v3>; + + regulators { + buckc1234: buck1234 { + regulator-name = "vdd_core_0v8"; + regulator-min-microvolt = <800000>; + regulator-max-microvolt = <800000>; + regulator-boot-on; + regulator-always-on; + }; + }; + }; };
&main_i2c0 {

Syncs the DT from Linux v6.8-rc1.
Remove udmap overrides and handle location change of chipid node.
Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com --- arch/arm/dts/k3-am68-sk-base-board.dts | 1 + 1 file changed, 1 insertion(+)
diff --git a/arch/arm/dts/k3-am68-sk-base-board.dts b/arch/arm/dts/k3-am68-sk-base-board.dts index 1e1a82f9d2b8..d0cfdeac21fb 100644 --- a/arch/arm/dts/k3-am68-sk-base-board.dts +++ b/arch/arm/dts/k3-am68-sk-base-board.dts @@ -31,6 +31,7 @@ can1 = &mcu_mcan1; can2 = &main_mcan6; can3 = &main_mcan7; + ethernet0 = &cpsw_port1; };
vusb_main: regulator-vusb-main5v0 {

On 2/6/24 6:21 AM, Manorit Chawdhry wrote:
Syncs the DT from Linux v6.8-rc1.
Remove udmap overrides and handle location change of chipid node.
Message doesn't match the patch. This patch should just be squashed into the previous one anyway.
Andrew
Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com
arch/arm/dts/k3-am68-sk-base-board.dts | 1 + 1 file changed, 1 insertion(+)
diff --git a/arch/arm/dts/k3-am68-sk-base-board.dts b/arch/arm/dts/k3-am68-sk-base-board.dts index 1e1a82f9d2b8..d0cfdeac21fb 100644 --- a/arch/arm/dts/k3-am68-sk-base-board.dts +++ b/arch/arm/dts/k3-am68-sk-base-board.dts @@ -31,6 +31,7 @@ can1 = &mcu_mcan1; can2 = &main_mcan6; can3 = &main_mcan7;
ethernet0 = &cpsw_port1;
};
vusb_main: regulator-vusb-main5v0 {

Hi Andrew,
On 11:38-20240206, Andrew Davis wrote:
On 2/6/24 6:21 AM, Manorit Chawdhry wrote:
Syncs the DT from Linux v6.8-rc1.
Remove udmap overrides and handle location change of chipid node.
Message doesn't match the patch. This patch should just be squashed into the previous one anyway.
Ah yeah, oversight. Would see what should be done about it after Tom's reply for OF_UPSTREAM, would change accordingly.
Regards, Manorit
Andrew
Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com
arch/arm/dts/k3-am68-sk-base-board.dts | 1 + 1 file changed, 1 insertion(+)
diff --git a/arch/arm/dts/k3-am68-sk-base-board.dts b/arch/arm/dts/k3-am68-sk-base-board.dts index 1e1a82f9d2b8..d0cfdeac21fb 100644 --- a/arch/arm/dts/k3-am68-sk-base-board.dts +++ b/arch/arm/dts/k3-am68-sk-base-board.dts @@ -31,6 +31,7 @@ can1 = &mcu_mcan1; can2 = &main_mcan6; can3 = &main_mcan7;
}; vusb_main: regulator-vusb-main5v0 {ethernet0 = &cpsw_port1;

vd_data remains the same for most of the SoCs but there are some differences in power domains and clocks that don't need a change to compatible and can be handled at SoC level.
Change the data population logic from compatible to soc_match_device to add support for newer devices.
Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com --- drivers/misc/k3_avs.c | 189 +++++++++++++++++++++++++++----------------------- 1 file changed, 103 insertions(+), 86 deletions(-)
diff --git a/drivers/misc/k3_avs.c b/drivers/misc/k3_avs.c index 0d29eff1ac08..02cd90f9d12c 100644 --- a/drivers/misc/k3_avs.c +++ b/drivers/misc/k3_avs.c @@ -13,6 +13,7 @@ #include <asm/io.h> #include <i2c.h> #include <k3-avs.h> +#include <soc.h> #include <dm/device_compat.h> #include <linux/bitops.h> #include <linux/delay.h> @@ -112,6 +113,95 @@ static u32 am6_efuse_xlate(struct k3_avs_privdata *priv, int idx, int opp) return 300000 + 20000 * val; }
+static struct vd_data am654_vd_data[] = { + { + .id = AM6_VDD_CORE, + .dev_id = 82, /* AM6_DEV_CBASS0 */ + .clk_id = 0, /* main sysclk0 */ + .opp = AM6_OPP_NOM, + .opps = { + [AM6_OPP_NOM] = { + .volt = 1000000, + .freq = 250000000, /* CBASS0 */ + }, + }, + }, + { + .id = AM6_VDD_MPU0, + .dev_id = 202, /* AM6_DEV_COMPUTE_CLUSTER_A53_0 */ + .clk_id = 0, /* ARM clock */ + .opp = AM6_OPP_NOM, + .opps = { + [AM6_OPP_NOM] = { + .volt = 1100000, + .freq = 800000000, + }, + [AM6_OPP_OD] = { + .volt = 1200000, + .freq = 1000000000, + }, + [AM6_OPP_TURBO] = { + .volt = 1240000, + .freq = 1100000000, + }, + }, + }, + { + .id = AM6_VDD_MPU1, + .opp = AM6_OPP_NOM, + .dev_id = 204, /* AM6_DEV_COMPUTE_CLUSTER_A53_2 */ + .clk_id = 0, /* ARM clock */ + .opps = { + [AM6_OPP_NOM] = { + .volt = 1100000, + .freq = 800000000, + }, + [AM6_OPP_OD] = { + .volt = 1200000, + .freq = 1000000000, + }, + [AM6_OPP_TURBO] = { + .volt = 1240000, + .freq = 1100000000, + }, + }, + }, + { .id = -1 }, +}; + +static struct vd_data j721e_vd_data[] = { + { + .id = J721E_VDD_MPU, + .opp = AM6_OPP_NOM, + .dev_id = 202, /* J721E_DEV_A72SS0_CORE0 */ + .clk_id = 2, /* ARM clock */ + .opps = { + [AM6_OPP_NOM] = { + .volt = 880000, /* TBD in DM */ + .freq = 2000000000, + }, + }, + }, + { .id = -1 }, +}; + +static struct vd_config j721e_vd_config = { + .efuse_xlate = am6_efuse_xlate, + .vds = j721e_vd_data, +}; + +static struct vd_config am654_vd_config = { + .efuse_xlate = am6_efuse_xlate, + .vds = am654_vd_data, +}; + +const struct soc_attr vtm_soc_list[] = { + { .family = "AM65X", .data = (void *)&am654_vd_config }, + { .family = "J721E", .data = (void *)&j721e_vd_config }, + { .family = "J7200", .data = (void *)&j721e_vd_config }, + {} +}; + static int k3_avs_program_voltage(struct k3_avs_privdata *priv, struct vd_data *vd, int opp_id) @@ -235,8 +325,16 @@ static int k3_avs_configure(struct udevice *dev, struct k3_avs_privdata *priv) int ret; char pname[20]; struct vd_data *vd; + const struct soc_attr *soc; + + soc = soc_device_match(vtm_soc_list); + if (soc && soc->data) + conf = (void *)soc->data;
- conf = (void *)dev_get_driver_data(dev); + if (!conf) { + printf("No SoC support for AVS\n"); + return -ENOSYS; + }
priv->vd_config = conf;
@@ -401,93 +499,12 @@ static int k3_avs_probe(struct udevice *dev) return 0; }
-static struct vd_data am654_vd_data[] = { - { - .id = AM6_VDD_CORE, - .dev_id = 82, /* AM6_DEV_CBASS0 */ - .clk_id = 0, /* main sysclk0 */ - .opp = AM6_OPP_NOM, - .opps = { - [AM6_OPP_NOM] = { - .volt = 1000000, - .freq = 250000000, /* CBASS0 */ - }, - }, - }, - { - .id = AM6_VDD_MPU0, - .dev_id = 202, /* AM6_DEV_COMPUTE_CLUSTER_A53_0 */ - .clk_id = 0, /* ARM clock */ - .opp = AM6_OPP_NOM, - .opps = { - [AM6_OPP_NOM] = { - .volt = 1100000, - .freq = 800000000, - }, - [AM6_OPP_OD] = { - .volt = 1200000, - .freq = 1000000000, - }, - [AM6_OPP_TURBO] = { - .volt = 1240000, - .freq = 1100000000, - }, - }, - }, - { - .id = AM6_VDD_MPU1, - .opp = AM6_OPP_NOM, - .dev_id = 204, /* AM6_DEV_COMPUTE_CLUSTER_A53_2 */ - .clk_id = 0, /* ARM clock */ - .opps = { - [AM6_OPP_NOM] = { - .volt = 1100000, - .freq = 800000000, - }, - [AM6_OPP_OD] = { - .volt = 1200000, - .freq = 1000000000, - }, - [AM6_OPP_TURBO] = { - .volt = 1240000, - .freq = 1100000000, - }, - }, - }, - { .id = -1 }, -}; - -static struct vd_data j721e_vd_data[] = { - { - .id = J721E_VDD_MPU, - .opp = AM6_OPP_NOM, - .dev_id = 202, /* J721E_DEV_A72SS0_CORE0 */ - .clk_id = 2, /* ARM clock */ - .opps = { - [AM6_OPP_NOM] = { - .volt = 880000, /* TBD in DM */ - .freq = 2000000000, - }, - }, - }, - { .id = -1 }, -}; - -static struct vd_config j721e_vd_config = { - .efuse_xlate = am6_efuse_xlate, - .vds = j721e_vd_data, -}; - -static struct vd_config am654_vd_config = { - .efuse_xlate = am6_efuse_xlate, - .vds = am654_vd_data, -};
static const struct udevice_id k3_avs_ids[] = { - { .compatible = "ti,am654-avs", .data = (ulong)&am654_vd_config }, - { .compatible = "ti,j721e-avs", .data = (ulong)&j721e_vd_config }, - { .compatible = "ti,j721e-vtm", .data = (ulong)&j721e_vd_config }, - { .compatible = "ti,j7200-vtm", .data = (ulong)&j721e_vd_config }, + { .compatible = "ti,am654-avs" }, + { .compatible = "ti,j721e-avs" }, + { .compatible = "ti,j721e-vtm" }, + { .compatible = "ti,j7200-vtm" }, {} };

Check if AVS could not be programmed and print a warning.
Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com --- drivers/misc/k3_avs.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/drivers/misc/k3_avs.c b/drivers/misc/k3_avs.c index 02cd90f9d12c..e20dc6755c29 100644 --- a/drivers/misc/k3_avs.c +++ b/drivers/misc/k3_avs.c @@ -490,7 +490,10 @@ static int k3_avs_probe(struct udevice *dev) if (vd->flags & VD_FLAG_INIT_DONE) continue;
- k3_avs_program_voltage(priv, vd, vd->opp); + ret = k3_avs_program_voltage(priv, vd, vd->opp); + if (ret) + dev_warn(dev, "Could not program AVS voltage for VD%d\n", + vd->id); }
if (!device_is_compatible(priv->dev, "ti,am654-avs"))

Add AVS Support for J721S2.
Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com --- drivers/misc/k3_avs.c | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+)
diff --git a/drivers/misc/k3_avs.c b/drivers/misc/k3_avs.c index e20dc6755c29..28e59fcf41d4 100644 --- a/drivers/misc/k3_avs.c +++ b/drivers/misc/k3_avs.c @@ -185,6 +185,22 @@ static struct vd_data j721e_vd_data[] = { { .id = -1 }, };
+static struct vd_data j721s2_vd_data[] = { + { + .id = J721E_VDD_MPU, + .opp = AM6_OPP_NOM, + .dev_id = 202, /* J721S2_DEV_A72SS0_CORE0 */ + .clk_id = 0, /* ARM clock */ + .opps = { + [AM6_OPP_NOM] = { + .volt = 880000, /* TBD in DM */ + .freq = 2000000000, + }, + }, + }, + { .id = -1 }, +}; + static struct vd_config j721e_vd_config = { .efuse_xlate = am6_efuse_xlate, .vds = j721e_vd_data, @@ -195,10 +211,16 @@ static struct vd_config am654_vd_config = { .vds = am654_vd_data, };
+static struct vd_config j721s2_vd_config = { + .efuse_xlate = am6_efuse_xlate, + .vds = j721s2_vd_data, +}; + const struct soc_attr vtm_soc_list[] = { { .family = "AM65X", .data = (void *)&am654_vd_config }, { .family = "J721E", .data = (void *)&j721e_vd_config }, { .family = "J7200", .data = (void *)&j721e_vd_config }, + { .family = "J721S2", .data = (void *)&j721s2_vd_config }, {} };

The other compatible is not in use by any other DT node.
Sync the compatible with the compatible present in Linux DT to help with DT Sync from Linux as well.
Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com --- drivers/power/pmic/tps65941.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/power/pmic/tps65941.c b/drivers/power/pmic/tps65941.c index 727b42747ab6..53db91fce69f 100644 --- a/drivers/power/pmic/tps65941.c +++ b/drivers/power/pmic/tps65941.c @@ -71,7 +71,7 @@ static struct dm_pmic_ops tps65941_ops = { };
static const struct udevice_id tps65941_ids[] = { - { .compatible = "ti,tps659411", .data = TPS659411 }, + { .compatible = "ti,tps6594-q1", .data = TPS659411 }, { .compatible = "ti,tps659412", .data = TPS659411 }, { .compatible = "ti,tps659413", .data = TPS659413 }, { .compatible = "ti,lp876441", .data = LP876441 },

Initialize AVS Class 0.
Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com --- arch/arm/mach-k3/j721s2_init.c | 8 ++++++++ 1 file changed, 8 insertions(+)
diff --git a/arch/arm/mach-k3/j721s2_init.c b/arch/arm/mach-k3/j721s2_init.c index fb0708bae162..7080c519cf4c 100644 --- a/arch/arm/mach-k3/j721s2_init.c +++ b/arch/arm/mach-k3/j721s2_init.c @@ -206,6 +206,14 @@ void k3_spl_init(void)
/* Output System Firmware version info */ k3_sysfw_print_ver(); + + if (IS_ENABLED(CONFIG_CPU_V7R) && IS_ENABLED(CONFIG_K3_AVS0)) { + ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(k3_avs), + &dev); + if (ret) + printf("AVS init failed: %d\n", ret); + } + }
bool check_rom_loaded_sysfw(void)

Add bootph-pre-ram property to VTM node and the pmic node.
Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com --- arch/arm/dts/k3-j721s2-r5-common-proc-board.dts | 9 +++++++++ 1 file changed, 9 insertions(+)
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 03bd680f4421..391baff2b608 100644 --- a/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts +++ b/arch/arm/dts/k3-j721s2-r5-common-proc-board.dts @@ -86,3 +86,12 @@ &mcu_udmap { ti,sci = <&dm_tifs>; }; + +&tps659411 { + bootph-pre-ram; +}; + +&wkup_vtm0 { + vdd-supply-2 = <&bucka1234>; + bootph-pre-ram; +};

Patch is sent to upstream linux [0].
[0]: https://lore.kernel.org/all/20240201-b4-upstream-j721s2-fix-vtm-devid-v2-0-8...
Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com --- arch/arm/dts/k3-j721s2-mcu-wakeup.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/dts/k3-j721s2-mcu-wakeup.dtsi b/arch/arm/dts/k3-j721s2-mcu-wakeup.dtsi index 80aa33c58a45..a47cb557dd95 100644 --- a/arch/arm/dts/k3-j721s2-mcu-wakeup.dtsi +++ b/arch/arm/dts/k3-j721s2-mcu-wakeup.dtsi @@ -663,7 +663,7 @@ compatible = "ti,j7200-vtm"; reg = <0x00 0x42040000 0x0 0x350>, <0x00 0x42050000 0x0 0x350>; - power-domains = <&k3_pds 154 TI_SCI_PD_SHARED>; + power-domains = <&k3_pds 180 TI_SCI_PD_SHARED>; #thermal-sensor-cells = <1>; };

On 2/6/2024 5:51 PM, Manorit Chawdhry wrote:
Patch is sent to upstream linux [0].
Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com
arch/arm/dts/k3-j721s2-mcu-wakeup.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/dts/k3-j721s2-mcu-wakeup.dtsi b/arch/arm/dts/k3-j721s2-mcu-wakeup.dtsi index 80aa33c58a45..a47cb557dd95 100644 --- a/arch/arm/dts/k3-j721s2-mcu-wakeup.dtsi +++ b/arch/arm/dts/k3-j721s2-mcu-wakeup.dtsi @@ -663,7 +663,7 @@ compatible = "ti,j7200-vtm"; reg = <0x00 0x42040000 0x0 0x350>, <0x00 0x42050000 0x0 0x350>;
power-domains = <&k3_pds 154 TI_SCI_PD_SHARED>;
power-domains = <&k3_pds 180 TI_SCI_PD_SHARED>;
I kind of disagree with this patch as Do not Merge, I understand you want to do this change as part of next sync.
But we got already node in u-boot for VTM with incorrect power-domain.
I am not sure, with incorrect power-domain, how AVS will be behave.
Here are my 2 cents
Either mark this patch part of series or Hold AVS till next sync
#thermal-sensor-cells = <1>;
};

Hi Udit,
On 19:37-20240206, Kumar, Udit wrote:
On 2/6/2024 5:51 PM, Manorit Chawdhry wrote:
Patch is sent to upstream linux [0].
Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com
arch/arm/dts/k3-j721s2-mcu-wakeup.dtsi | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/arch/arm/dts/k3-j721s2-mcu-wakeup.dtsi b/arch/arm/dts/k3-j721s2-mcu-wakeup.dtsi index 80aa33c58a45..a47cb557dd95 100644 --- a/arch/arm/dts/k3-j721s2-mcu-wakeup.dtsi +++ b/arch/arm/dts/k3-j721s2-mcu-wakeup.dtsi @@ -663,7 +663,7 @@ compatible = "ti,j7200-vtm"; reg = <0x00 0x42040000 0x0 0x350>, <0x00 0x42050000 0x0 0x350>;
power-domains = <&k3_pds 154 TI_SCI_PD_SHARED>;
power-domains = <&k3_pds 180 TI_SCI_PD_SHARED>;
I kind of disagree with this patch as Do not Merge, I understand you want to do this change as part of next sync.
But we got already node in u-boot for VTM with incorrect power-domain.
I am not sure, with incorrect power-domain, how AVS will be behave.
Here are my 2 cents
Either mark this patch part of series or Hold AVS till next sync
Can mark the series for AVS as RFC till then ig, will see what to be done for DT Sync.
Regards, Manorit
#thermal-sensor-cells = <1>;
};

Add AVS and PMIC regulator configs
Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com --- configs/j721s2_evm_r5_defconfig | 6 ++++++ 1 file changed, 6 insertions(+)
diff --git a/configs/j721s2_evm_r5_defconfig b/configs/j721s2_evm_r5_defconfig index b180f6c48c0e..847758bb5334 100644 --- a/configs/j721s2_evm_r5_defconfig +++ b/configs/j721s2_evm_r5_defconfig @@ -112,6 +112,7 @@ CONFIG_DM_MAILBOX=y CONFIG_K3_SEC_PROXY=y CONFIG_FS_LOADER=y CONFIG_SPL_FS_LOADER=y +CONFIG_K3_AVS0=y CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_SPL_MMC_HS400_SUPPORT=y CONFIG_MMC_SDHCI=y @@ -141,6 +142,11 @@ CONFIG_SPL_PINCTRL=y CONFIG_PINCTRL_SINGLE=y CONFIG_POWER_DOMAIN=y CONFIG_TI_POWER_DOMAIN=y +CONFIG_DM_PMIC=y +CONFIG_PMIC_TPS65941=y +CONFIG_DM_REGULATOR=y +CONFIG_SPL_DM_REGULATOR=y +CONFIG_DM_REGULATOR_TPS65941=y CONFIG_K3_SYSTEM_CONTROLLER=y CONFIG_REMOTEPROC_TI_K3_ARM64=y CONFIG_RESET_TI_SCI=y

On Tue, Feb 06, 2024 at 05:51:07PM +0530, Manorit Chawdhry wrote:
This series does the DT sync with Linux 6.8-rc1 as that has the pmic nodes required for AVS support and then adds AVS Support for J721S2.
AVS Test for J721S2: https://gist.github.com/manorit2001/d7690ded6ef685aa8ffa5b16746cc529 Boot Test results: https://gist.github.com/manorit2001/6775d721b3df5a690497d94d012b93c4
Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com
Manorit Chawdhry (10): arm: dts: k3-j721s2*: Sync with 6.8-rc1 arm: dts: k3-am68*: Sync with 6.8-rc1
The starting point for this series should be to build on top of Sumit's OF_UPSTREAM series.
DONOTMERGE: arm: dts: j721s2: Fix Power domain for VTM node.
And please make sure to mark the series as RFC if there's DONOTMERGE parts in it, thanks.

Hi Tom,
On 08:45-20240206, Tom Rini wrote:
On Tue, Feb 06, 2024 at 05:51:07PM +0530, Manorit Chawdhry wrote:
This series does the DT sync with Linux 6.8-rc1 as that has the pmic nodes required for AVS support and then adds AVS Support for J721S2.
AVS Test for J721S2: https://gist.github.com/manorit2001/d7690ded6ef685aa8ffa5b16746cc529 Boot Test results: https://gist.github.com/manorit2001/6775d721b3df5a690497d94d012b93c4
Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com
Manorit Chawdhry (10): arm: dts: k3-j721s2*: Sync with 6.8-rc1 arm: dts: k3-am68*: Sync with 6.8-rc1
The starting point for this series should be to build on top of Sumit's OF_UPSTREAM series.
I see that series is still under discussion and not yet merged ( hoping am on the correct thread [0]). Do I have to rebase my commits on top of that and try or do you think that series is gonna take time?
[0]: https://lore.kernel.org/u-boot/20240206130040.GO1152441@bill-the-cat/
DONOTMERGE: arm: dts: j721s2: Fix Power domain for VTM node.
And please make sure to mark the series as RFC if there's DONOTMERGE parts in it, thanks.
Sure, would convert it to an RFC series.
Regards, Manorit
-- Tom

On Wed, Feb 07, 2024 at 03:35:51PM +0530, Manorit Chawdhry wrote:
Hi Tom,
On 08:45-20240206, Tom Rini wrote:
On Tue, Feb 06, 2024 at 05:51:07PM +0530, Manorit Chawdhry wrote:
This series does the DT sync with Linux 6.8-rc1 as that has the pmic nodes required for AVS support and then adds AVS Support for J721S2.
AVS Test for J721S2: https://gist.github.com/manorit2001/d7690ded6ef685aa8ffa5b16746cc529 Boot Test results: https://gist.github.com/manorit2001/6775d721b3df5a690497d94d012b93c4
Signed-off-by: Manorit Chawdhry m-chawdhry@ti.com
Manorit Chawdhry (10): arm: dts: k3-j721s2*: Sync with 6.8-rc1 arm: dts: k3-am68*: Sync with 6.8-rc1
The starting point for this series should be to build on top of Sumit's OF_UPSTREAM series.
I see that series is still under discussion and not yet merged ( hoping am on the correct thread [0]). Do I have to rebase my commits on top of that and try or do you think that series is gonna take time?
Yes, you need to rebase on top of that series, just like how the am62p support was posted. Thanks.
participants (4)
-
Andrew Davis
-
Kumar, Udit
-
Manorit Chawdhry
-
Tom Rini