On 8/28/2026 7:27 PM, Richard Genoud (TI) wrote:
> For J7200, J784s4, J721e, j722s, j721s2 SoCs, the everything is shutdown
> at suspend but the PMIC and the DDR.
> In order for U-Boot SPL to know that it is resuming from suspend and not
> booting, a flag is set in a PMIC register.
> So, at startup, U-Boot will read the PMIC register and deduce if the
> board is resuming from suspend or not.
>
> This state (resuming or not) is consulted at several places (in
> board_init_f() and in k3_ddrss_probe().
> As it takes some time to read a i2c register, it's best to cache the
> information.
> But, as stated by the README, in board_init_f(), the BSS is not
> available, so we cannot use global/static variables, only stack
> variables and global_data.
>
> Thus, we use gd to store the resume state of the board.
>
> Reviewed-by: Simon Glass <[email protected]>
> Signed-off-by: Richard Genoud (TI) <[email protected]>
> ---
> arch/arm/include/asm/global_data.h | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)
>
> diff --git a/arch/arm/include/asm/global_data.h
> b/arch/arm/include/asm/global_data.h
> index b2ec450f9002..a146206fdff9 100644
> --- a/arch/arm/include/asm/global_data.h
> +++ b/arch/arm/include/asm/global_data.h
> @@ -14,6 +14,14 @@
> #include <linux/types.h>
> #include <asm/u-boot.h>
>
> +#if IS_ENABLED(CONFIG_ARCH_K3)
> +enum k3_resume_state {
> + K3_RESUME_STATE_UNKNOWN = 0,
> + K3_RESUME_STATE_BOOTING,
> + K3_RESUME_STATE_RESUMING
> +};
> +#endif
> +
> /* Architecture-specific global data */
> struct arch_global_data {
> #if defined(CONFIG_FSL_ESDHC) || defined(CONFIG_FSL_ESDHC_IMX)
> @@ -108,8 +116,19 @@ struct arch_global_data {
> #ifdef CONFIG_SMBIOS
> ulong smbios_start; /* Start address of SMBIOS table */
> #endif
> +#if (IS_ENABLED(CONFIG_SPL_BUILD) && IS_ENABLED(CONFIG_ARCH_K3))
> + enum k3_resume_state k3_resuming;
> +#endif
> };
>
> +#if (IS_ENABLED(CONFIG_SPL_BUILD) && IS_ENABLED(CONFIG_ARCH_K3))
> +#define gd_k3_resuming() gd->arch.k3_resuming
> +#define gd_set_k3_resuming(state) gd->arch.k3_resuming = (state)
> +#else
> +#define gd_k3_resuming() 0
> +#define gd_set_k3_resuming(state)
> +#endif
> +
> #include <asm-generic/global_data.h>
Acked-by: Udit Kumar <[email protected]>
>
> #if defined(__clang__) || defined(LTO_ENABLE)