Skip to content

Introduce resume for J7xx SoCs

Richard Genoud (TI) u-boot 7 versions – In review

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v7 Latest20 patches 1 replyIn review
  2. v622 patches 3 repliesSuperseded
  3. v521 patches 24 repliesSuperseded
Earlier versions · 4
VersionPostedPatchesRepliesStatus
v419 patches1 replySuperseded
v319 patches2 repliesSuperseded
v216 patches1 replySuperseded
v120 patches25 repliesSuperseded

Changes in v7 from the cover letter

- rebase on u-boot/next:

Patches in v7 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/20firmware: ti_sci: add low power mode operationsarch/arm/mach-k3/include/mach/security.h arch/arm/mach-k3/security.c drivers/firmware/ti_sci.c +2 more+344 -00 replies
2/20arm: mach-k3: security: introduce ti_secure_skip_cert()arch/arm/mach-k3/include/mach/security.h arch/arm/mach-k3/security.c+27 -200 replies
3/20mach-k3: r5: common: add helper functions needed in LPM resume sequencearch/arm/mach-k3/common.h arch/arm/mach-k3/lpm-common.h arch/arm/mach-k3/r5/Kconfig +3 more+359 -130 replies
4/20mach-k3: r5: common: introduce j7xx_board_is_resuming()arch/arm/mach-k3/common.c arch/arm/mach-k3/include/mach/hardware.h arch/arm/mach-k3/r5/lpm-common.c+58 -20 replies
5/20mach-k3: r5: common: introduce k3_deassert_ddr_ret()arch/arm/mach-k3/lpm-common.h arch/arm/mach-k3/r5/lpm-common.c+29 -00 replies
6/20board: mach-k3: r5: common: enable GTC after core_resumearch/arm/mach-k3/r5/lpm-common.c drivers/remoteproc/ti_k3_arm64_rproc.c+19 -20 replies
7/20board: evm: Enable de-isolation of IOs at resume for j7200 and j784s4arch/arm/mach-k3/include/mach/j721e_hardware.h arch/arm/mach-k3/include/mach/j784s4_hardware.h arch/arm/mach-k3/r5/lpm-common.c +2 more+86 -00 replies
8/20board: mach-k3: r5: common: Store wakeup reason on scratchpad memoryarch/arm/mach-k3/Kconfig arch/arm/mach-k3/r5/lpm-common.c+35 -00 replies
9/20board: mach-k3: r5: common: Set PMIC NSLEEP triggers bits at resumearch/arm/mach-k3/r5/lpm-common.c+23 -10 replies
10/20ram: k3-ddrss: Add exit retention supportarch/arm/mach-k3/include/mach/k3-ddr.h drivers/ram/k3-ddrss/k3-ddrss.c drivers/ram/k3-ddrss/lpddr4_k3_reg.h+363 -00 replies
11/20ram: k3-ddrss: Add j722s DDR resume sequencearch/arm/dts/k3-j722s-r5-evm.dts drivers/ram/k3-ddrss/k3-ddrss-lpm.c drivers/ram/k3-ddrss/k3-ddrss.c+14 -10 replies
12/20ram: k3-ddrss: support j784s4/j721s2 DDR resumedrivers/ram/k3-ddrss/k3-ddrss.c+8 -00 replies
13/20arm: mach-k3: j721e: Enable LPM resume flow for J7200 SOCarch/arm/mach-k3/j721e/j721e_init.c+32 -00 replies
14/20arm: mach-k3: j784s4: Enable LPM resume flow for J784s4/J742s2 SOCsarch/arm/mach-k3/j784s4/j784s4_init.c board/ti/j784s4/evm.c+52 -30 replies
15/20arm: mach-k3: j722s: Enable LPM resume flowarch/arm/mach-k3/j722s/j722s_init.c+8 -00 replies
16/20arm: mach-k3: j721s2: Enable LPM resume flowarch/arm/mach-k3/j721s2/j721s2_init.c+53 -40 replies
17/20arm: mach-k3: Update pm-boardcfg for all k3 platformsarch/arm/mach-k3/schema.yaml board/beagle/beagleboneai64/pm-cfg.yaml board/beagle/beagleplay/pm-cfg.yaml +19 more+649 -660 replies
18/20arm: dts: k3-j7200: Remove background firewall on DDRarch/arm/dts/k3-j7200-binman.dtsi+4 -00 replies
19/20arm: dts: k3-j7200: Extend firewall for ATF region to TIFSarch/arm/dts/k3-binman.dtsi arch/arm/dts/k3-security.h+7 -10 replies
20/20doc: board: ti: Add Jacinto resume flowdoc/board/ti/img/boot_diagram_k3_current.svg doc/board/ti/img/resume_diagram_k3.svg doc/board/ti/j7200_evm.rst +3 more+2048 -900 replies

Reviews trailers per patch

5 of 20 patches have a Reviewed-by or Acked-by.

PatchUdit Kumar
1/20
2/20
3/20
4/20
5/20R-b
6/20R-b
7/20
8/20
9/20
10/20R-b
11/20A-b
12/20
13/20
14/20
15/20
16/20
17/20A-b
18/20
19/20
20/20

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v7 thread

Cover letter [PATCH v7 00/20] Introduce resume for J7xx SoCs

This series allows J7200/J721s2/J784s4/J722s to resume from suspend.

On those SoCs, a magic value is set in a PMIC register by the DM firmware just before suspend, then everything but the PMIC and DDR is powered off.
At resume/boot time, the magic value has to be read back by U-Boot SPL in order to know if we are indeed in a resume situation.
That's the purpose of j7xx_board_is_resuming() introduced here.

Then, if the SoC is resuming, the DDR has to be brought out of retention, at full speed and get out of low power mode. Between those steps, the DDR_RET pin has to be de-asserted. But the DDR_RET pins of all DDR chips are tied together on a single GPIO, so it's impossible to resume one DDR chip after the other, they must be all resumed at once.
That's why it's orchestrated from board_init_f() and not in the k3ddrss driver.

Once the DDR is fully functional, the next steps are:
- retrieve the LPM memory region from DTS
- authenticate certificates from LPM memory region and apply firewalls
- ask TIFS to restore TFA and its own minimal context
- start TFA on remote proc
- load and jump to DM

Disclaimer:
---------
There's a potential attack vector in this sequence, because OPTEE could be modified before being reloaded.
Also, if the certificate replay is skipped, then TFA can be read from MSMC.

Patches 1-3 add LPM helpers for all SoCs
Patch 4 adds the resume detection for all SoCs
Patch 5 adds common code for DDR retention pin
Patch 6 enables GTC at resume
Patch 7 detects IO+DDR resume state for j7200/j784s4
Patch 8 stores the wakeup reason in MCU_PSRAM0_RAM for j7200/j784s4 Patch 9 sets the PMIC NSLEEP triggers
Patches 10-12 add the DDR resume sequence for all SoCs Patches 13-16 add the resume flow for all SoCs
Patch 17 updates the pm-cfg and schema to a new version
Patch 18 removes now unneeded background firewall on DDR for j7200/j784s4 Patch 19 extends the firewall for ATF region to TIFS
Patch 20 add the resume flow documentation

Tested on J722s HS-FS, J7200 GP, J784s4 GP, J721s2 GP

https://software-dl.ti.com/tisci/esd/latest/2_tisci_msgs/pm/lpm.html#tisci-msg-min-context-restore

It needs lpm_memory_regions described in DTS [updated to v6]:
https://lore.kernel.org/lkml/[email protected]/

Changes from v6:
- rebase on u-boot/next:

    commit 6201222134cd ("lzma: Update LZMA SDK code from 25.01 to 26.05")

- drop patches from am62 LPM series (merged in u-boot/next)
- apply errata i2487 as am62 does (indeed, the memory was seen as corrupted when the first suspend was longer than 40 seconds) in patch 11 ("ram: k3-ddrss: Add j722s DDR resume sequence")

Changes from v5:
- gather {Acked,Reviewed}-bys
- remove j721e support
- Check lpm image size retrieved from DTS
- Fix size when loading optee+certificate
- Update U-Boot documentation TODO
- drop resume state from global data since EARLY_BSS is set, using static variable is ok
- make CONFIG_K3_LPM default n to prevent from breaking configs with older TIFS
- check lpm_reg_size in extract_lpm_region
- replay DM certificate with ti_secure_image_auth_apply_fwls()
- drop special hanling for j722s in j7xx_board_is_resuming by adding another call to ctrl_mmr_unlock()
- add missing calls to k3_set_lpm_core_* for each soc
- panic if clearing isolation fails
- add resume boot flow and disclaimer in uboot docs

Changes from v4:
- rebase onto v2026.10-rc2
- add disclaimer in do_resume() for 2 potential attack vectors
- include needed patches from AM62 LPM series
- fix minor checkpatch warning (!xxx instead of == NULL)

Changes from v3:
- rebase on:
commit 8d5f30b52f7c ("Merge patch series "env: migrate static flags list to Kconfig"")
+ AM62 LPM series

Changes from v2:
- enable GTC counter at resume
- factorise __weak j7xx_board_is_resuming()
- reset PMIC NSLEEP triggers register in one place
- gather Reviewed-by
- fix comment style in k3-ddrss.c
- clean and Factorize k3_deassert_ddr_ret()
- change printf in dev_err in ti_sci_cmd_proc_auth_apply_fwls()

Changes from v1:
- drop unneeded patch: configs: j784s4_evm_r5: enable TI_SCI_POWER_DOMAIN
- factorize j7xx_board_is_resuming (that lead to patch renumbering)
- drop From: field duplication from patch 1
- use SYS_K3_SCRATCH_LPM_ADDR config option instead of hardcoded value
- add missing board/ti/j722s/pm-cfg.yaml
- migrate missing K3 platforms to new pm-boardcfg
- remove struct lpm_addr_info mem_addr_lpm; (globals are forbidden at this stage)
- rework ti_secure_image_auth_apply_fwls()
- Fix pointer arithmetic: mem_addr_lpm->context_save_addr + FW_IMAGE_SIZE
- Fix K3_LPM_WAKE_SOURCE_PMIC_GPIO value
- Fix spellings/comments

Abhash Kumar Jha (4):
board: mach-k3: r5: common: enable GTC after core_resume
board: evm: Enable de-isolation of IOs at resume for j7200 and j784s4
board: mach-k3: r5: common: Store wakeup reason on scratchpad memory
arm: mach-k3: Update pm-boardcfg for all k3 platforms

Prasanth Babu Mantena (4):
firmware: ti_sci: add low power mode operations
mach-k3: r5: common: add helper functions needed in LPM resume
sequence
arm: dts: k3-j7200: Remove background firewall on DDR
arm: dts: k3-j7200: Extend firewall for ATF region to TIFS

Richard Genoud (TI) (9):
arm: mach-k3: security: introduce ti_secure_skip_cert()
mach-k3: r5: common: introduce j7xx_board_is_resuming()
mach-k3: r5: common: introduce k3_deassert_ddr_ret()
board: mach-k3: r5: common: Set PMIC NSLEEP triggers bits at resume
ram: k3-ddrss: Add j722s DDR resume sequence
ram: k3-ddrss: support j784s4/j721s2 DDR resume
arm: mach-k3: j784s4: Enable LPM resume flow for J784s4/J742s2 SOCs
arm: mach-k3: j722s: Enable LPM resume flow
doc: board: ti: Add Jacinto resume flow

Thomas Richard (TI) (3):
ram: k3-ddrss: Add exit retention support
arm: mach-k3: j721e: Enable LPM resume flow for J7200 SOC
arm: mach-k3: j721s2: Enable LPM resume flow

 arch/arm/dts/k3-binman.dtsi                   |    7 +-
 arch/arm/dts/k3-j7200-binman.dtsi             |    4 +
 arch/arm/dts/k3-j722s-r5-evm.dts              |    4 +
 arch/arm/dts/k3-security.h                    |    1 +
 arch/arm/mach-k3/Kconfig                      |   10 +
 arch/arm/mach-k3/common.c                     |    6 +
 arch/arm/mach-k3/common.h                     |   17 +
 arch/arm/mach-k3/include/mach/hardware.h      |    1 +
 .../arm/mach-k3/include/mach/j721e_hardware.h |   11 +
 .../mach-k3/include/mach/j784s4_hardware.h    |   10 +
 arch/arm/mach-k3/include/mach/k3-ddr.h        |   16 +
 arch/arm/mach-k3/include/mach/security.h      |    2 +
 arch/arm/mach-k3/j721e/j721e_init.c           |   32 +
 arch/arm/mach-k3/j721s2/j721s2_init.c         |   57 +-
 arch/arm/mach-k3/j722s/j722s_init.c           |    8 +
 arch/arm/mach-k3/j784s4/j784s4_init.c         |   52 +-
 arch/arm/mach-k3/lpm-common.h                 |   33 +
 arch/arm/mach-k3/r5/Kconfig                   |    8 +
 arch/arm/mach-k3/r5/Makefile                  |    1 +
 arch/arm/mach-k3/r5/common.c                  |   21 +-
 arch/arm/mach-k3/r5/lpm-common.c              |  444 +++++
 arch/arm/mach-k3/schema.yaml                  |  146 +-
 arch/arm/mach-k3/security.c                   |  108 +-
 board/beagle/beagleboneai64/pm-cfg.yaml       |    5 +-
 board/beagle/beagleplay/pm-cfg.yaml           |    7 +-
 board/beagle/beagley-ai/pm-cfg.yaml           |    7 +-
 board/phytec/phycore_am62ax/pm-cfg.yaml       |    7 +-
 board/phytec/phycore_am62x/pm-cfg.yaml        |    7 +-
 board/phytec/phycore_am64x/pm-cfg.yaml        |    5 +-
 board/phytec/phycore_am68x/pm-cfg.yaml        |    7 +-
 board/ti/am62ax/pm-cfg.yaml                   |    7 +-
 board/ti/am62px/pm-cfg.yaml                   |    7 +-
 board/ti/am62x/pm-cfg.yaml                    |    7 +-
 board/ti/am64x/pm-cfg.yaml                    |    5 +-
 board/ti/am65x/pm-cfg.yaml                    |    7 +-
 board/ti/j7200/pm-cfg.yaml                    |   92 +-
 board/ti/j721e/evm.c                          |   25 +
 board/ti/j721e/pm-cfg.yaml                    |   92 +-
 board/ti/j721s2/pm-cfg.yaml                   |   94 +-
 board/ti/j722s/pm-cfg.yaml                    |   94 +-
 board/ti/j784s4/evm.c                         |   25 +
 board/ti/j784s4/pm-cfg.yaml                   |   94 +-
 board/toradex/aquila-am69/pm-cfg.yaml         |    7 +-
 board/toradex/verdin-am62/pm-cfg.yaml         |    7 +-
 board/toradex/verdin-am62p/pm-cfg.yaml        |    7 +-
 doc/board/ti/img/boot_diagram_k3_current.svg  |  444 ++++-
 doc/board/ti/img/resume_diagram_k3.svg        | 1638 +++++++++++++++++
 doc/board/ti/j7200_evm.rst                    |   14 +
 doc/board/ti/j721s2_evm.rst                   |   14 +
 doc/board/ti/j722s_evm.rst                    |   14 +
 doc/board/ti/j784s4_evm.rst                   |   14 +
 drivers/firmware/ti_sci.c                     |  181 ++
 drivers/firmware/ti_sci.h                     |   92 +
 drivers/ram/k3-ddrss/k3-ddrss-lpm.c           |    2 +-
 drivers/ram/k3-ddrss/k3-ddrss.c               |  270 +++
 drivers/ram/k3-ddrss/lpddr4_k3_reg.h          |   94 +
 drivers/remoteproc/ti_k3_arm64_rproc.c        |   10 +-
 include/linux/soc/ti/ti_sci_protocol.h        |    8 +
 tools/binman/etype/ti_board_config.py         |    4 +-
 59 files changed, 4214 insertions(+), 199 deletions(-)
 create mode 100644 arch/arm/mach-k3/lpm-common.h
 create mode 100644 arch/arm/mach-k3/r5/lpm-common.c
 create mode 100644 doc/board/ti/img/resume_diagram_k3.svg
 create mode 100644 drivers/ram/k3-ddrss/lpddr4_k3_reg.h

base-commit: 6201222134cd704b5717211fc917e2ca6263577a