devicetree.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2 0/5] firmware: ti_sci: Introduce system suspend support
@ 2022-11-08 22:45 Georgi Vlaev
  2022-11-08 22:45 ` [PATCH v2 1/5] dt-bindings: ti, sci: Add lpm region and firmware-name Georgi Vlaev
                   ` (5 more replies)
  0 siblings, 6 replies; 8+ messages in thread
From: Georgi Vlaev @ 2022-11-08 22:45 UTC (permalink / raw)
  To: Nishanth Menon, Tero Kristo, Santosh Shilimkar, Rob Herring,
	Krzysztof Kozlowski
  Cc: linux-arm-kernel, linux-kernel, devicetree, Vibhore Vardhan,
	Vignesh Raghavendra

This series introduces necessary ti_sci driver functionality in
preparation of supporting DeepSleep mode for suspend to mem on TI
K3 AM62x. This version is a fixup and rebase of the patch series by
Dave Gerlach [1]. It applies on top of v6.1-rc4.

Deep Sleep mode is described in section "5.2.4.4 DeepSleep" of the
AM62x Technical Reference Manual [2].

The kernel triggers entry to Deep Sleep mode through the mem suspend
transition with the following:

* Use a TF-A binary that supports PSCI_SYSTEM_SUSPEND call. This causes
  system to use PSCI system suspend as last step of mem sleep.

* The firmware requires that the OS sends a TISCI_MSG_PREPARE_SLEEP
  message in order to provide details about suspend, so we must add the
  ability to send this message. We also add TISCI_MSG_LPM_WAKE_REASON
  and TISCI_MSG_SET_IO_ISOLATION messages as part of a new PM ops. These
  messages are part of the TISCI PM Low Power Mode API [3]. (Patch 2)

* A memory address must be provided to the firmware using the above
  message, which is allocated and managed by dma_alloc_coherent()
  and friends. (Patch 3)

* System must load firmware to a specific location before Deep Sleep is
  entered, and this is accomplished using a memory region in device
  tree to indicate where this firmware should be loaded, and also a
  "firmware-name" property to indicate the name of the firmware
  to load. The ti_sci driver checks in its pm handler to see if
  the firmware has been loaded and if not, loads it. (Patch 4)

* Finally, the ti_sci driver must actually send TISCI_MSG_PREPARE_SLEEP
  message to firmware with the above information included, which it
  does during the driver suspend handler when PM_MEM_SUSPEND is the
  determined state being entered. (Patch 5)

This is tested on am625-sk using a limited dts with all devices disabled
apart from cpu0, main_uart0, i2c, rtc, mmc/sd, dmsc, and secure_proxy_main.

Testing this sequence requires K3 sdhci suspend/resume support [4],
enable the wkup_rtc in the am625-sk.dts, disable devices that don't
support system suspend/resume like OSPI and CPSW3G.

In can be tested on the following branch:
https://github.com/gvlaev/linux/tree/upstream-v6.2/lpm-ti-sci-v1

Changelog:
v2:
- Addressed comments received for v1 series [1].
- Updated v1 patch 5 to use pm notifier to avoid firmware loading
  issues.
- Dropped the reserved region requirement and allocate DMA memory
  instead. The reserved region binding patch is also removed.
- Introduce two more TISCI LPM messages that are supported in SysFW.
- Fixes in error handling.

[1] https://lore.kernel.org/lkml/20220421203659.27853-1-d-gerlach@ti.com
[2] https://www.ti.com/lit/pdf/spruiv7
[3] https://software-dl.ti.com/tisci/esd/latest/2_tisci_msgs/pm/lpm.html
[4] https://lore.kernel.org/lkml/20220408124338.27090-1-a-govindraju@ti.com

Dave Gerlach (5):
  dt-bindings: ti, sci: Add lpm region and firmware-name
  firmware: ti_sci: Introduce Power Management Ops
  firmware: ti_sci: Allocate memory for the LPM modes
  firmware: ti_sci: Use dt provided fw name and address to load at
    suspend time
  firmware: ti_sci: Introduce prepare system suspend call

 .../bindings/arm/keystone/ti,sci.yaml         |  21 +-
 drivers/firmware/ti_sci.c                     | 356 ++++++++++++++++++
 drivers/firmware/ti_sci.h                     |  64 +++-
 include/linux/soc/ti/ti_sci_protocol.h        |  44 +++
 4 files changed, 480 insertions(+), 5 deletions(-)


base-commit: f0c4d9fc9cc9462659728d168387191387e903cc
-- 
2.30.2


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2022-11-11 13:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-11-08 22:45 [PATCH v2 0/5] firmware: ti_sci: Introduce system suspend support Georgi Vlaev
2022-11-08 22:45 ` [PATCH v2 1/5] dt-bindings: ti, sci: Add lpm region and firmware-name Georgi Vlaev
2022-11-08 22:45 ` [PATCH v2 2/5] firmware: ti_sci: Introduce Power Management Ops Georgi Vlaev
2022-11-08 22:45 ` [PATCH v2 3/5] firmware: ti_sci: Allocate memory for the LPM modes Georgi Vlaev
2022-11-11 13:00   ` kernel test robot
2022-11-08 22:45 ` [PATCH v2 4/5] firmware: ti_sci: Use dt provided fw name and address to load at suspend time Georgi Vlaev
2022-11-08 22:45 ` [PATCH v2 5/5] firmware: ti_sci: Introduce prepare system suspend call Georgi Vlaev
2022-11-09 13:55 ` [PATCH v2 0/5] firmware: ti_sci: Introduce system suspend support Roger Quadros

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).