[RFC PATCH 06/19] board: ti: j721e: Add resume detection for J7200
Prasanth Babu Mantena
p-mantena at ti.com
Fri Mar 13 14:58:47 CET 2026
From: Thomas Richard <thomas.richard at bootlin.com>
Add the capability to detect a resume. This overrides the weak
function board_is_resuming(void).
To detect the resume, SPL searches a magic value (0xBA) in a register
of PMICA.
This value is set by DM-Firmware during the suspend sequence.
Based on the work of Gregory CLEMENT <gregory.clement at bootlin.com>
Signed-off-by: Richard Genoud <richard.genoud at bootlin.com>
Signed-off-by: Thomas Richard <thomas.richard at bootlin.com>
Signed-off-by: Prasanth Babu Mantena <p-mantena at ti.com>
---
arch/arm/mach-k3/j721e/j721e_init.c | 4 +++
board/ti/j721e/evm.c | 49 +++++++++++++++++++++++++++++
2 files changed, 53 insertions(+)
diff --git a/arch/arm/mach-k3/j721e/j721e_init.c b/arch/arm/mach-k3/j721e/j721e_init.c
index f9af0288cf6..f325597a70b 100644
--- a/arch/arm/mach-k3/j721e/j721e_init.c
+++ b/arch/arm/mach-k3/j721e/j721e_init.c
@@ -300,6 +300,10 @@ void board_init_f(ulong dummy)
#if defined(CONFIG_K3_J721E_DDRSS) || defined(CONFIG_K3_LOAD_SYSFW)
struct udevice *dev;
#endif
+
+ /* init resume flag */
+ gd_set_k3_resuming(-1);
+
/*
* Cannot delay this further as there is a chance that
* K3_BOOT_PARAM_TABLE_INDEX can be over written by SPL MALLOC section.
diff --git a/board/ti/j721e/evm.c b/board/ti/j721e/evm.c
index 881392bd963..20c77ff804f 100644
--- a/board/ti/j721e/evm.c
+++ b/board/ti/j721e/evm.c
@@ -17,6 +17,7 @@
#include <spl.h>
#include <dm.h>
#include <asm/arch/k3-ddr.h>
+#include <power/pmic.h>
#include "../common/board_detect.h"
#include "../common/fdt_ops.h"
@@ -469,6 +470,54 @@ err_free_gpio:
}
}
+#if (IS_ENABLED(CONFIG_SPL_BUILD) && IS_ENABLED(CONFIG_TARGET_J7200_R5_EVM))
+
+#define SCRATCH_PAD_REG_3 0xCB
+
+#define MAGIC_SUSPEND 0xBA
+
+int board_is_resuming(void)
+{
+ struct udevice *pmica;
+ struct udevice *pmicb;
+ int ret;
+
+ if (gd_k3_resuming() >= 0)
+ goto end;
+
+ ret = uclass_get_device_by_name(UCLASS_PMIC,
+ "pmic at 48", &pmica);
+ if (ret) {
+ printf("Getting PMICA init failed: %d\n", ret);
+ goto end;
+ }
+ debug("%s: PMICA is detected (%s)\n", __func__, pmica->name);
+
+ ret = uclass_get_device_by_name(UCLASS_PMIC,
+ "pmic at 4c", &pmicb);
+ if (ret) {
+ printf("Getting PMICB init failed: %d\n", ret);
+ goto end;
+ }
+ debug("%s: PMICB is detected (%s)\n", __func__, pmicb->name);
+
+ if (pmic_reg_read(pmica, SCRATCH_PAD_REG_3) == MAGIC_SUSPEND) {
+ debug("%s: board is resuming\n", __func__);
+ gd_set_k3_resuming(1);
+
+ /* clean magic suspend */
+ if (pmic_reg_write(pmica, SCRATCH_PAD_REG_3, 0))
+ printf("Failed to clean magic value for suspend detection in PMICA\n");
+ } else {
+ debug("%s: board is booting (no resume detected)\n", __func__);
+ gd_set_k3_resuming(0);
+ }
+end:
+ return gd_k3_resuming();
+}
+
+#endif /* CONFIG_SPL_BUILD && CONFIG_TARGET_J7200_R5_EVM */
+
void spl_board_init(void)
{
struct udevice *dev;
--
2.34.1
More information about the U-Boot
mailing list