On 8/28/2026 7:27 PM, Richard Genoud (TI) wrote:
> Add the capability to detect a resume on J7200, J784s4, J721e, j722s,
> j721s2 SoCs.
> 
> 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.
> 
> NB2: For j722s HS-* devices, we need an extra call to ctrl_mmr_unlock(),
> and we have to use I2C API instead of PMIC API for this to work.
> This is because bind is called before anything comes up, in between either
> bootrom or TIFS messing up, clearing pad config and pd config.

There is some work going on to avoid this dual call
see https://lore.kernel.org/all/[email protected]/

Please see, if above patch helps to avoid this unlock

> 
> Signed-off-by: Richard Genoud (TI) <[email protected]>
> ---
>  arch/arm/mach-k3/common.c                |  6 ++
>  arch/arm/mach-k3/include/mach/hardware.h |  1 +
>  arch/arm/mach-k3/r5/lpm-common.c         | 78 +++++++++++++++++++++++-
>  3 files changed, 83 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/arm/mach-k3/common.c b/arch/arm/mach-k3/common.c
> index 6e382efdb3be..d934f732b330 100644
> --- a/arch/arm/mach-k3/common.c
> +++ b/arch/arm/mach-k3/common.c
> @@ -713,3 +713,9 @@ int spl_start_uboot(void)
>       return 0;
>  }
>  #endif
> +
> +/* if r5/lpm-common.c is compiled, this will be overridden */
> +__weak bool j7xx_board_is_resuming(void)
> +{
> +     return false;
> +}
> diff --git a/arch/arm/mach-k3/include/mach/hardware.h 
> b/arch/arm/mach-k3/include/mach/hardware.h
> index 2c771a1195f5..c45bd3747163 100644
> --- a/arch/arm/mach-k3/include/mach/hardware.h
> +++ b/arch/arm/mach-k3/include/mach/hardware.h
> @@ -137,6 +137,7 @@ u32 get_boot_device(void);
>  const char *get_reset_reason(void);
> [..]+
> +     if (IS_ENABLED(CONFIG_SOC_K3_J722S)) {
> +             /*
> +              * On J722S devices, i2c access fails unless MMR
> +              * registers are unlocked.
> +              * Moreover, it fails also if we use PMIC API instead of I2C 
> API.
> +              */
> +             ctrl_mmr_unlock();
> +             ret = uclass_get_device_by_name(UCLASS_I2C,
> +                                             "i2c@2b200000", &i2c);
> +             if (ret) {
> +                     printf("Getting I2C failed: %d\n", ret);
> +                     goto end;
> +             }
> +             ret = dm_i2c_probe(i2c, 0x48, 0, &pmic);
> +             if (ret) {
> +                     printf("Getting PMIC failed: %d\n", ret);

Patch looks ok, but want to avoid special handling for J722S :)

> +                     goto end;
> +             }
> +     } else {
> +             ret = uclass_get_device_by_name(UCLASS_PMIC,
>[..]

Reply via email to