[PATCH 04/20] board: ti: j784s4: Add resume detection

Kumar, Udit u-kumar1 at ti.com
Mon May 11 12:47:06 CEST 2026



On 4/30/2026 2:13 PM, Richard Genoud (TI) wrote:
> Add the capability to detect a resume. This overrides the weak
> function j7xx_board_is_resuming().
> To detect the resume, SPL searches a magic value (0xBA) in a register
> of PMIC.
> This value is set by DM-Firmware during the suspend sequence.
> 
> NB: As this is called in board_init_f(), there's no BSS, so we can't
> use global/static variables.
> 
> Signed-off-by: Richard Genoud (TI) <richard.genoud at bootlin.com>
> ---
>  board/ti/j784s4/evm.c | 38 ++++++++++++++++++++++++++++++++++++++
>  1 file changed, 38 insertions(+)
> 
> diff --git a/board/ti/j784s4/evm.c b/board/ti/j784s4/evm.c
> index cabb3017ee14..4a74024fe4fe 100644
> --- a/board/ti/j784s4/evm.c
> +++ b/board/ti/j784s4/evm.c
> @@ -12,7 +12,9 @@
>  #include <init.h>
>  #include <spl.h>
>  #include <asm/arch/k3-ddr.h>
> +#include <power/pmic.h>
>  #include "../common/fdt_ops.h"
> +#include "../common/k3-lpm.h"
>  
>  DECLARE_GLOBAL_DATA_PTR;
>  
> @@ -61,6 +63,42 @@ int board_late_init(void)
>  }
>  #endif
>  
> +#if (IS_ENABLED(CONFIG_SPL_BUILD) && IS_ENABLED(CONFIG_TARGET_J784S4_R5_EVM))
> +
> +/* in board_init_f(), there's no BSS, so we can't use global/static variables */
> +bool j7xx_board_is_resuming(void)
> +{
> +	struct udevice *pmic;
> +	int err;
> +
> +	if (gd_k3_resuming() != K3_RESUME_STATE_UNKNOWN)
> +		goto end;
> +
> +	err = uclass_get_device_by_name(UCLASS_PMIC,
> +					"pmic at 48", &pmic);
> +	if (err) {
> +		printf("Getting PMIC init failed: %d\n", err);
> +		goto end;
> +	}
> +	debug("%s: PMIC is detected (%s)\n", __func__, pmic->name);
> +
> +	if (pmic_reg_read(pmic, K3_LPM_SCRATCH_PAD_REG) == K3_LPM_MAGIC_SUSPEND) {
> +		debug("%s: board is resuming\n", __func__);
> +		gd_set_k3_resuming(K3_RESUME_STATE_RESUMING);
> +

Same comment  as patch 3/20

> +		/* clean magic suspend */
> +		if (pmic_reg_write(pmic, K3_LPM_SCRATCH_PAD_REG, 0))
> +			printf("Failed to clean magic value for suspend detection in PMIC\n");
> +	} else {
> +		debug("%s: board is booting (no resume detected)\n", __func__);
> +		gd_set_k3_resuming(K3_RESUME_STATE_BOOTING);
> +	}
> +end:
> +	return gd_k3_resuming() == K3_RESUME_STATE_RESUMING;
> +}
> +
> +#endif /* CONFIG_SPL_BUILD && CONFIG_TARGET_J784s4_R5_EVM */
> +
>  void spl_board_init(void)
>  {
>  	struct udevice *dev;



More information about the U-Boot mailing list