All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Kumar, Udit" <u-kumar1@ti.com>
To: "Richard Genoud (TI)" <richard.genoud@bootlin.com>,
	Tom Rini <trini@konsulko.com>,
	Manorit Chawdhry <m-chawdhry@ti.com>,
	Apurva Nandan <a-nandan@ti.com>, "Andrew F . Davis" <afd@ti.com>,
	Vignesh Raghavendra <vigneshr@ti.com>, Bryan Brattlof <bb@ti.com>,
	Vaishnav Achath <vaishnav.a@ti.com>,
	Jayesh Choudhary <j-choudhary@ti.com>,
	Simon Glass <sjg@chromium.org>,
	Alper Nebi Yasak <alpernebiyasak@gmail.com>
Cc: Markus Schneider-Pargmann <msp@baylibre.com>,
	Abhash Kumar <a-kumar2@ti.com>,
	Thomas Richard <thomas.richard@bootlin.com>,
	"Gregory CLEMENT" <gregory.clement@bootlin.com>,
	Thomas Petazzoni <thomas.petazzoni@bootlin.com>,
	<u-boot@lists.denx.de>
Subject: Re: [PATCH 04/20] board: ti: j784s4: Add resume detection
Date: Mon, 11 May 2026 16:17:06 +0530	[thread overview]
Message-ID: <9f8659f1-73c8-400a-9729-cf19afd0a2af@ti.com> (raw)
In-Reply-To: <20260430084414.1354490-5-richard.genoud@bootlin.com>



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@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@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;


  reply	other threads:[~2026-05-11 10:47 UTC|newest]

Thread overview: 32+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-30  8:43 [PATCH 00/20] Introduce resume for J7xx SoCs Richard Genoud (TI)
2026-04-30  8:43 ` [PATCH 01/20] configs: j784s4_evm_r5: enable TI_SCI_POWER_DOMAIN Richard Genoud (TI)
2026-05-11  9:49   ` Kumar, Udit
2026-04-30  8:43 ` [PATCH 02/20] global: k3: use gd to store the resume state Richard Genoud (TI)
2026-04-30  8:43 ` [PATCH 03/20] board: ti: j721e: Add resume detection for J721e/J7200 Richard Genoud (TI)
2026-05-11  9:53   ` Kumar, Udit
2026-04-30  8:43 ` [PATCH 04/20] board: ti: j784s4: Add resume detection Richard Genoud (TI)
2026-05-11 10:47   ` Kumar, Udit [this message]
2026-04-30  8:43 ` [PATCH 05/20] board: ti: j722s: " Richard Genoud (TI)
2026-04-30  8:43 ` [PATCH 06/20] board: ti: j721s2: " Richard Genoud (TI)
2026-05-11 10:48   ` Kumar, Udit
2026-04-30  8:44 ` [PATCH 07/20] ram: k3-ddrss: Add exit retention support Richard Genoud (TI)
2026-04-30  8:44 ` [PATCH 08/20] ram: k3-ddrss: Add j722s DDR resume sequence Richard Genoud (TI)
2026-04-30  8:44 ` [PATCH 09/20] ram: k3-ddrss: support j784s4/j721e/j721s2 DDR resume Richard Genoud (TI)
2026-04-30  8:44 ` [PATCH 10/20] firmware: ti_sci: add low power mode operations Richard Genoud (TI)
2026-05-11 10:50   ` Kumar, Udit
2026-04-30  8:44 ` [PATCH 11/20] mach-k3: r5: common: add helper functions needed in LPM resume sequence Richard Genoud (TI)
2026-05-11 10:52   ` Kumar, Udit
2026-04-30  8:44 ` [PATCH 12/20] arm: mach-k3: j721e: Enable LPM resume flow for J7200/J721e SOC Richard Genoud (TI)
2026-04-30  8:44 ` [PATCH 13/20] arm: mach-k3: j784s4: Enable LPM resume flow for J784s4/J742s2 SOCs Richard Genoud (TI)
2026-04-30  8:44 ` [PATCH 14/20] arm: mach-k3: j722s: Enable LPM resume flow Richard Genoud (TI)
2026-04-30  8:44 ` [PATCH 15/20] arm: mach-k3: j721s2: " Richard Genoud (TI)
2026-04-30  8:44 ` [PATCH 16/20] arm: mach-k3: Update pm-boardcfg for all k3 platforms Richard Genoud (TI)
2026-05-11 10:54   ` Kumar, Udit
2026-04-30  8:44 ` [PATCH 17/20] board: evm: Enable de-isolation of IOs at resume for j7200 and j784s4 Richard Genoud (TI)
2026-04-30  8:44 ` [PATCH 18/20] board: ti: evm: Store wakeup reason on scratchpad memory Richard Genoud (TI)
2026-04-30 17:32   ` Andrew Davis
2026-04-30  8:44 ` [PATCH 19/20] arm: dts: k3-j7200: Remove background firewall on DDR Richard Genoud (TI)
2026-04-30 17:30   ` Andrew Davis
2026-05-11 10:56     ` Kumar, Udit
2026-04-30  8:44 ` [PATCH 20/20] arm: dts: k3-j7200: Extend firewall for ATF region to TIFS Richard Genoud (TI)
2026-04-30 17:28   ` Andrew Davis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=9f8659f1-73c8-400a-9729-cf19afd0a2af@ti.com \
    --to=u-kumar1@ti.com \
    --cc=a-kumar2@ti.com \
    --cc=a-nandan@ti.com \
    --cc=afd@ti.com \
    --cc=alpernebiyasak@gmail.com \
    --cc=bb@ti.com \
    --cc=gregory.clement@bootlin.com \
    --cc=j-choudhary@ti.com \
    --cc=m-chawdhry@ti.com \
    --cc=msp@baylibre.com \
    --cc=richard.genoud@bootlin.com \
    --cc=sjg@chromium.org \
    --cc=thomas.petazzoni@bootlin.com \
    --cc=thomas.richard@bootlin.com \
    --cc=trini@konsulko.com \
    --cc=u-boot@lists.denx.de \
    --cc=vaishnav.a@ti.com \
    --cc=vigneshr@ti.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.