[PATCH RFC/RFT 0/3] k3-j784s4-r5-evm: Enable ESMs and related PMIC

This enables the ESMs and the associated PMIC. Programming these bits is a requirement to make the watchdog actually reset the board.
Note, this relies on the linked devicetree changes to land in Linux first and get synced here, otherwise the board will fail to boot!
I've tested this series (with the linked change) on the k3-j784s4-evm, but not its sibling the k3-am69-sk. I'd appreciate at a minimum someone to test on that platform to ensure this doesn't break boot.
Link: https://lore.kernel.org/all/20240906-j784s4-tps6594-bootph-v1-0-c5b58d43bf04... Signed-off-by: Andrew Halaney ahalaney@redhat.com --- Andrew Halaney (1): configs: j784s4_evm_r5: Enable ESM related configs
Keerthy (1): board: ti: j784s4: Initialize the ESM & PMIC ESM
Neha Malcom Francis (1): arm: dts: k3-j784s4-r5-evm: Add the PMIC ESM node
arch/arm/dts/k3-j784s4-r5-evm.dts | 7 +++++++ board/ti/j784s4/evm.c | 28 ++++++++++++++++++++++++++++ configs/j784s4_evm_r5_defconfig | 7 +++++++ 3 files changed, 42 insertions(+) --- base-commit: 1630ff26cc960439b5949b80cfc604a2c8aa47dd change-id: 20240906-j784s4-esm-enable-4c4f698fe7c4
Best regards,

From: Neha Malcom Francis n-francis@ti.com
Add the PMIC ESM node which is responsible for triggering the PMIC reset.
Signed-off-by: Neha Malcom Francis n-francis@ti.com Link: https://git.ti.com/cgit/ti-u-boot/ti-u-boot/commit/?h=ea82cf77031e Signed-off-by: Andrew Halaney ahalaney@redhat.com --- arch/arm/dts/k3-j784s4-r5-evm.dts | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/arch/arm/dts/k3-j784s4-r5-evm.dts b/arch/arm/dts/k3-j784s4-r5-evm.dts index bef4573d3d2..7714ef87388 100644 --- a/arch/arm/dts/k3-j784s4-r5-evm.dts +++ b/arch/arm/dts/k3-j784s4-r5-evm.dts @@ -104,3 +104,10 @@ &mcu_udmap { ti,sci = <&dm_tifs>; }; + +&tps659413 { + esm: esm { + compatible = "ti,tps659413-esm"; + bootph-pre-ram; + }; +};

From: Keerthy j-keerthy@ti.com
Initialize the ESM & PMIC ESM. This allows things like the watchdog to reset the board when tripped.
Signed-off-by: Keerthy j-keerthy@ti.com Signed-off-by: Neha Malcom Francis n-francis@ti.com Link: https://git.ti.com/cgit/ti-u-boot/ti-u-boot/commit/board/ti/j784s4/evm.c?h=t... [halaney: add a line to the commit message, include header] Signed-off-by: Andrew Halaney ahalaney@redhat.com --- board/ti/j784s4/evm.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
diff --git a/board/ti/j784s4/evm.c b/board/ti/j784s4/evm.c index 548dbd5925d..a0ef3a44536 100644 --- a/board/ti/j784s4/evm.c +++ b/board/ti/j784s4/evm.c @@ -7,6 +7,7 @@ * */
+#include <dm.h> #include <efi_loader.h> #include <init.h> #include <spl.h> @@ -72,4 +73,31 @@ int board_late_init(void)
void spl_board_init(void) { + struct udevice *dev; + int ret; + + if (IS_ENABLED(CONFIG_ESM_K3)) { + ret = uclass_get_device_by_name(UCLASS_MISC, "esm@700000", + &dev); + if (ret) + printf("MISC init for esm@700000 failed: %d\n", ret); + + ret = uclass_get_device_by_name(UCLASS_MISC, "esm@40800000", + &dev); + if (ret) + printf("MISC init for esm@40800000 failed: %d\n", ret); + + ret = uclass_get_device_by_name(UCLASS_MISC, "esm@42080000", + &dev); + if (ret) + printf("MISC init for esm@42080000 failed: %d\n", ret); + } + + if (IS_ENABLED(CONFIG_ESM_PMIC)) { + ret = uclass_get_device_by_driver(UCLASS_MISC, + DM_DRIVER_GET(pmic_esm), + &dev); + if (ret) + printf("ESM PMIC init failed: %d\n", ret); + } }

Hi Andrew,
On 9/7/2024 2:54 AM, Andrew Halaney wrote:
From: Keerthy j-keerthy@ti.com
Initialize the ESM & PMIC ESM. This allows things like the watchdog to reset the board when tripped.
Signed-off-by: Keerthy j-keerthy@ti.com Signed-off-by: Neha Malcom Francis n-francis@ti.com Link: https://git.ti.com/cgit/ti-u-boot/ti-u-boot/commit/board/ti/j784s4/evm.c?h=t... [halaney: add a line to the commit message, include header] Signed-off-by: Andrew Halaney ahalaney@redhat.com
board/ti/j784s4/evm.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
diff --git a/board/ti/j784s4/evm.c b/board/ti/j784s4/evm.c index 548dbd5925d..a0ef3a44536 100644 --- a/board/ti/j784s4/evm.c +++ b/board/ti/j784s4/evm.c @@ -7,6 +7,7 @@
*/
+#include <dm.h> #include <efi_loader.h> #include <init.h> #include <spl.h> @@ -72,4 +73,31 @@ int board_late_init(void)
void spl_board_init(void) {
- struct udevice *dev;
- int ret;
- if (IS_ENABLED(CONFIG_ESM_K3)) {
ret = uclass_get_device_by_name(UCLASS_MISC, "esm@700000",
&dev);
if (ret)
printf("MISC init for esm@700000 failed: %d\n", ret);
ret = uclass_get_device_by_name(UCLASS_MISC, "esm@40800000",
&dev);
if (ret)
printf("MISC init for esm@40800000 failed: %d\n", ret);
ret = uclass_get_device_by_name(UCLASS_MISC, "esm@42080000",
&dev);
if (ret)
printf("MISC init for esm@42080000 failed: %d\n", ret);
- }
Thanks for patch ,
IMO, if one of esm is failing then we can skip other esm probe,
- if (IS_ENABLED(CONFIG_ESM_PMIC)) {
ret = uclass_get_device_by_driver(UCLASS_MISC,
DM_DRIVER_GET(pmic_esm),
&dev);
Same here if esm probe is successful then only we should probe pmic_esm.
Reason is , if any of probe is failing functionality will not work and
there is no point to probe devices, if function is not working.
if (ret)
printf("ESM PMIC init failed: %d\n", ret);
- } }

On Sat, Sep 07, 2024 at 11:12:05AM GMT, Kumar, Udit wrote:
Hi Andrew,
On 9/7/2024 2:54 AM, Andrew Halaney wrote:
From: Keerthy j-keerthy@ti.com
Initialize the ESM & PMIC ESM. This allows things like the watchdog to reset the board when tripped.
Signed-off-by: Keerthy j-keerthy@ti.com Signed-off-by: Neha Malcom Francis n-francis@ti.com Link: https://git.ti.com/cgit/ti-u-boot/ti-u-boot/commit/board/ti/j784s4/evm.c?h=t... [halaney: add a line to the commit message, include header] Signed-off-by: Andrew Halaney ahalaney@redhat.com
board/ti/j784s4/evm.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
diff --git a/board/ti/j784s4/evm.c b/board/ti/j784s4/evm.c index 548dbd5925d..a0ef3a44536 100644 --- a/board/ti/j784s4/evm.c +++ b/board/ti/j784s4/evm.c @@ -7,6 +7,7 @@
*/ +#include <dm.h> #include <efi_loader.h> #include <init.h> #include <spl.h> @@ -72,4 +73,31 @@ int board_late_init(void) void spl_board_init(void) {
- struct udevice *dev;
- int ret;
- if (IS_ENABLED(CONFIG_ESM_K3)) {
ret = uclass_get_device_by_name(UCLASS_MISC, "esm@700000",
&dev);
if (ret)
printf("MISC init for esm@700000 failed: %d\n", ret);
ret = uclass_get_device_by_name(UCLASS_MISC, "esm@40800000",
&dev);
if (ret)
printf("MISC init for esm@40800000 failed: %d\n", ret);
ret = uclass_get_device_by_name(UCLASS_MISC, "esm@42080000",
&dev);
if (ret)
printf("MISC init for esm@42080000 failed: %d\n", ret);
- }
Thanks for patch ,
IMO, if one of esm is failing then we can skip other esm probe,
- if (IS_ENABLED(CONFIG_ESM_PMIC)) {
ret = uclass_get_device_by_driver(UCLASS_MISC,
DM_DRIVER_GET(pmic_esm),
&dev);
Same here if esm probe is successful then only we should probe pmic_esm.
Reason is , if any of probe is failing functionality will not work and
there is no point to probe devices, if function is not working.
Any preference on how this is handled? I was going to do something like:
if (IS_ENABLED(CONFIG_ESM_K3)) { ret = uclass_get_device_by_name(UCLASS_MISC, "esm@700000", &dev); if (ret) { printf("MISC init for esm@700000 failed: %d\n", ret); return; }
ret = uclass_get_device_by_name(UCLASS_MISC, "esm@40800000", &dev); ... if (IS_ENABLED(CONFIG_ESM_PMIC)) { ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(pmic_esm), &dev); if (ret) { printf("ESM PMIC init failed: %d\n", ret); return; } } }
but wasn't sure if a err_esm label and goto would be more in line with what you imagined? Let me know otherwise I'll just submit this version tomorrow or so.
Thanks, Andrew

On 9/10/2024 10:52 PM, Andrew Halaney wrote:
On Sat, Sep 07, 2024 at 11:12:05AM GMT, Kumar, Udit wrote:
Hi Andrew,
On 9/7/2024 2:54 AM, Andrew Halaney wrote:
From: Keerthy j-keerthy@ti.com
Initialize the ESM & PMIC ESM. This allows things like the watchdog to reset the board when tripped.
Signed-off-by: Keerthy j-keerthy@ti.com Signed-off-by: Neha Malcom Francis n-francis@ti.com Link: https://git.ti.com/cgit/ti-u-boot/ti-u-boot/commit/board/ti/j784s4/evm.c?h=t... [halaney: add a line to the commit message, include header] Signed-off-by: Andrew Halaney ahalaney@redhat.com
board/ti/j784s4/evm.c | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+)
diff --git a/board/ti/j784s4/evm.c b/board/ti/j784s4/evm.c index 548dbd5925d..a0ef3a44536 100644 --- a/board/ti/j784s4/evm.c +++ b/board/ti/j784s4/evm.c @@ -7,6 +7,7 @@ * */ +#include <dm.h> #include <efi_loader.h> #include <init.h> #include <spl.h> @@ -72,4 +73,31 @@ int board_late_init(void) void spl_board_init(void) {
- struct udevice *dev;
- int ret;
- if (IS_ENABLED(CONFIG_ESM_K3)) {
ret = uclass_get_device_by_name(UCLASS_MISC, "esm@700000",
&dev);
if (ret)
printf("MISC init for esm@700000 failed: %d\n", ret);
ret = uclass_get_device_by_name(UCLASS_MISC, "esm@40800000",
&dev);
if (ret)
printf("MISC init for esm@40800000 failed: %d\n", ret);
ret = uclass_get_device_by_name(UCLASS_MISC, "esm@42080000",
&dev);
if (ret)
printf("MISC init for esm@42080000 failed: %d\n", ret);
- }
Thanks for patch ,
IMO, if one of esm is failing then we can skip other esm probe,
- if (IS_ENABLED(CONFIG_ESM_PMIC)) {
ret = uclass_get_device_by_driver(UCLASS_MISC,
DM_DRIVER_GET(pmic_esm),
&dev);
Same here if esm probe is successful then only we should probe pmic_esm.
Reason is , if any of probe is failing functionality will not work and
there is no point to probe devices, if function is not working.
Any preference on how this is handled? I was going to do something like:
if (IS_ENABLED(CONFIG_ESM_K3)) { ret = uclass_get_device_by_name(UCLASS_MISC, "esm@700000", &dev); if (ret) { printf("MISC init for esm@700000 failed: %d\n", ret); return; }
What I have in mind kind of having string array with name , as esm@700000, esm@40800000 and esm@42080000
if (IS_ENABLED(CONFIG_ESM_K3)) {
for(i = 0 ; i< 2; i++) { ret = uclass_get_device_by_name(UCLASS_MISC, STRING[i], &dev); if(ret) { printf("MISC init for %s failed: %d\n", ret, STRING[i]); break; } }
}
if (IS_ENABLED(CONFIG_ESM_PMIC) && ret == 0) { ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(pmic_esm), &dev); .... } ... ....
ret = uclass_get_device_by_name(UCLASS_MISC, "esm@40800000", &dev); ... if (IS_ENABLED(CONFIG_ESM_PMIC)) { ret = uclass_get_device_by_driver(UCLASS_MISC, DM_DRIVER_GET(pmic_esm), &dev); if (ret) { printf("ESM PMIC init failed: %d\n", ret); return; } }
}
but wasn't sure if a err_esm label and goto would be more in line with what you imagined? Let me know otherwise I'll just submit this version tomorrow or so.
Thanks, Andrew

Like other TI platforms, let's enable the ESM. This allows the ESM to be programmed during boot, and the PMIC associated with the ESM output, enabling blocks like the RTI watchdogs to actually cause the system to reset.
Signed-off-by: Andrew Halaney ahalaney@redhat.com --- configs/j784s4_evm_r5_defconfig | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/configs/j784s4_evm_r5_defconfig b/configs/j784s4_evm_r5_defconfig index 543b0a50d7a..4d3bc68528c 100644 --- a/configs/j784s4_evm_r5_defconfig +++ b/configs/j784s4_evm_r5_defconfig @@ -97,6 +97,8 @@ CONFIG_DM_MAILBOX=y CONFIG_K3_SEC_PROXY=y CONFIG_FS_LOADER=y CONFIG_SPL_FS_LOADER=y +CONFIG_ESM_K3=y +CONFIG_ESM_PMIC=y CONFIG_SUPPORT_EMMC_BOOT=y CONFIG_SPL_MMC_HS400_SUPPORT=y CONFIG_MMC_SDHCI=y @@ -123,6 +125,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

Hi Andrew
On 9/7/2024 2:54 AM, Andrew Halaney wrote:
This enables the ESMs and the associated PMIC. Programming these bits is a requirement to make the watchdog actually reset the board.
Note, this relies on the linked devicetree changes to land in Linux first and get synced here, otherwise the board will fail to boot!
I've tested this series (with the linked change) on the k3-j784s4-evm, but not its sibling the k3-am69-sk. I'd appreciate at a minimum someone to test on that platform to ensure this doesn't break boot.
For am69-sk, I need to add esm node on top of your patches
Also, as commented in Linux patch series, boothph is enough in one child node
with these two changes , tested on AM69 for watchdog reset.
https://gist.github.com/uditkumarti/e5666b5623c3a78e23548fbfcbe813c8
upto line https://gist.github.com/uditkumarti/e5666b5623c3a78e23548fbfcbe813c8#file-gi..., Patch added for test
Line https://gist.github.com/uditkumarti/e5666b5623c3a78e23548fbfcbe813c8#file-gi... to see watchdog reset action
Link: https://lore.kernel.org/all/20240906-j784s4-tps6594-bootph-v1-0-c5b58d43bf04... Signed-off-by: Andrew Halaney ahalaney@redhat.com
Andrew Halaney (1): configs: j784s4_evm_r5: Enable ESM related configs
Keerthy (1): board: ti: j784s4: Initialize the ESM & PMIC ESM
Neha Malcom Francis (1): arm: dts: k3-j784s4-r5-evm: Add the PMIC ESM node
arch/arm/dts/k3-j784s4-r5-evm.dts | 7 +++++++ board/ti/j784s4/evm.c | 28 ++++++++++++++++++++++++++++ configs/j784s4_evm_r5_defconfig | 7 +++++++ 3 files changed, 42 insertions(+)
base-commit: 1630ff26cc960439b5949b80cfc604a2c8aa47dd change-id: 20240906-j784s4-esm-enable-4c4f698fe7c4
Best regards,

On Tue, Sep 10, 2024 at 04:21:32PM GMT, Kumar, Udit wrote:
Hi Andrew
On 9/7/2024 2:54 AM, Andrew Halaney wrote:
This enables the ESMs and the associated PMIC. Programming these bits is a requirement to make the watchdog actually reset the board.
Note, this relies on the linked devicetree changes to land in Linux first and get synced here, otherwise the board will fail to boot!
I've tested this series (with the linked change) on the k3-j784s4-evm, but not its sibling the k3-am69-sk. I'd appreciate at a minimum someone to test on that platform to ensure this doesn't break boot.
For am69-sk, I need to add esm node on top of your patches
Also, as commented in Linux patch series, boothph is enough in one child node
with these two changes , tested on AM69 for watchdog reset.
https://gist.github.com/uditkumarti/e5666b5623c3a78e23548fbfcbe813c8
upto line https://gist.github.com/uditkumarti/e5666b5623c3a78e23548fbfcbe813c8#file-gi..., Patch added for test
Line https://gist.github.com/uditkumarti/e5666b5623c3a78e23548fbfcbe813c8#file-gi... to see watchdog reset action
Thanks for much for testing, somehow I mentally foobared the existence of the am69 specific dts in u-boot :)
Let me incorporate all your changes and requests for v2 of this and the kernel side of things too!
Thanks, Andrew
participants (2)
-
Andrew Halaney
-
Kumar, Udit