Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
63 changes: 38 additions & 25 deletions source/devices/AM62LX/linux/Release_Specific_Workarounds.rst
Original file line number Diff line number Diff line change
Expand Up @@ -7,37 +7,50 @@
ARM Trusted Firmware changes
****************************

This patch updates the system suspend mode for the AM62L platform. After making the following changes,
re-build the ARM Trusted Firmware and then re-package it in the :file:`tispl.bin` file to ensure
the changes take effect. To learn more about TF-A and how to rebuild it, see :ref:`foundational-components-atf`.
For rebuilding U-Boot and generating the new :file:`tispl.bin` follow :ref:`Build-U-Boot-label`.
The AM62L platform supports multiple low power modes. The TF-A firmware sets the

Check warning on line 10 in source/devices/AM62LX/linux/Release_Specific_Workarounds.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] reported by reviewdog 🐶 [RedHat.SimpleWords] Use simple language. Consider using 'many' rather than 'multiple'. Raw Output: {"message": "[RedHat.SimpleWords] Use simple language. Consider using 'many' rather than 'multiple'.", "location": {"path": "source/devices/AM62LX/linux/Release_Specific_Workarounds.rst", "range": {"start": {"line": 10, "column": 29}}}, "severity": "INFO"}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replace TF-A acronym then you can use it later in the docs

Suggested change
The AM62L platform supports multiple low power modes. The TF-A firmware sets the
The AM62L platform supports multiple low power modes. ARM Trusted Firmware (TF-A) sets the

active mode through the ``mode`` variable in the :func:`am62l_pwr_domain_suspend`
function. The following table lists all available modes:

+--------------+---------------------------+----------------------------------------------+
| Mode Value | Low Power Mode | Description |
+==============+===========================+==============================================+
| 0 | DeepSleep | Default mode. Low latency, higher power |
+--------------+---------------------------+----------------------------------------------+
| 6 | RTC + I/O + DDR | Lowest power with DDR retention |

Check warning on line 19 in source/devices/AM62LX/linux/Release_Specific_Workarounds.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] reported by reviewdog 🐶 [RedHat.Definitions] Define acronyms and abbreviations (such as 'DDR') on first occurrence if they're likely to be unfamiliar. Raw Output: {"message": "[RedHat.Definitions] Define acronyms and abbreviations (such as 'DDR') on first occurrence if they're likely to be unfamiliar.", "location": {"path": "source/devices/AM62LX/linux/Release_Specific_Workarounds.rst", "range": {"start": {"line": 19, "column": 64}}}, "severity": "INFO"}

Check warning on line 19 in source/devices/AM62LX/linux/Release_Specific_Workarounds.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] reported by reviewdog 🐶 [RedHat.Definitions] Define acronyms and abbreviations (such as 'DDR') on first occurrence if they're likely to be unfamiliar. Raw Output: {"message": "[RedHat.Definitions] Define acronyms and abbreviations (such as 'DDR') on first occurrence if they're likely to be unfamiliar.", "location": {"path": "source/devices/AM62LX/linux/Release_Specific_Workarounds.rst", "range": {"start": {"line": 19, "column": 30}}}, "severity": "INFO"}

Check warning on line 19 in source/devices/AM62LX/linux/Release_Specific_Workarounds.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] reported by reviewdog 🐶 [RedHat.Definitions] Define acronyms and abbreviations (such as 'RTC') on first occurrence if they're likely to be unfamiliar. Raw Output: {"message": "[RedHat.Definitions] Define acronyms and abbreviations (such as 'RTC') on first occurrence if they're likely to be unfamiliar.", "location": {"path": "source/devices/AM62LX/linux/Release_Specific_Workarounds.rst", "range": {"start": {"line": 19, "column": 18}}}, "severity": "INFO"}
+--------------+---------------------------+----------------------------------------------+
| 8 | DSS plus DeepSleep | DeepSleep with Display Subsystem powered |

Check warning on line 21 in source/devices/AM62LX/linux/Release_Specific_Workarounds.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] reported by reviewdog 🐶 [RedHat.Definitions] Define acronyms and abbreviations (such as 'DSS') on first occurrence if they're likely to be unfamiliar. Raw Output: {"message": "[RedHat.Definitions] Define acronyms and abbreviations (such as 'DSS') on first occurrence if they're likely to be unfamiliar.", "location": {"path": "source/devices/AM62LX/linux/Release_Specific_Workarounds.rst", "range": {"start": {"line": 21, "column": 18}}}, "severity": "INFO"}
+--------------+---------------------------+----------------------------------------------+

To change the low power mode, modify the ``mode`` value in the TF-A source code as shown below.

Check warning on line 24 in source/devices/AM62LX/linux/Release_Specific_Workarounds.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] reported by reviewdog 🐶 [RedHat.TermsSuggestions] Depending on the context, consider using 'after', 'later', or 'following' rather than 'below'. Raw Output: {"message": "[RedHat.TermsSuggestions] Depending on the context, consider using 'after', 'later', or 'following' rather than 'below'.", "location": {"path": "source/devices/AM62LX/linux/Release_Specific_Workarounds.rst", "range": {"start": {"line": 24, "column": 90}}}, "severity": "INFO"}

Check warning on line 24 in source/devices/AM62LX/linux/Release_Specific_Workarounds.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] reported by reviewdog 🐶 [RedHat.SimpleWords] Use simple language. Consider using 'change' rather than 'modify'. Raw Output: {"message": "[RedHat.SimpleWords] Use simple language. Consider using 'change' rather than 'modify'.", "location": {"path": "source/devices/AM62LX/linux/Release_Specific_Workarounds.rst", "range": {"start": {"line": 24, "column": 31}}}, "severity": "INFO"}
After making the changes, re-build the ARM Trusted Firmware and then re-package it in the

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
After making the changes, re-build the ARM Trusted Firmware and then re-package it in the
After making the changes, re-build TF-A and then re-package it in the

:file:`tispl.bin` file to ensure the changes take effect. To learn more about TF-A and how to
rebuild it, see :ref:`foundational-components-atf`. For rebuilding U-Boot and generating the new
:file:`tispl.bin` follow :ref:`Build-U-Boot-label`.

.. code-block:: diff

diff --git a/plat/ti/k3/common/am62l_psci.c b/plat/ti/k3/common/am62l_psci.c
index 3df4986e5..945da5908 100644
--- a/plat/ti/k3/common/am62l_psci.c
+++ b/plat/ti/k3/common/am62l_psci.c
@@ -317,6 +317,7 @@ static void am62l_pwr_domain_suspend(const psci_power_state_t *target_state)
* mode=6 for RTC only + DDR and mode=0 for deepsleep
*/
uint32_t mode = am62l_lpm_state;
+ mode = 6;

diff --git a/plat/ti/k3low/common/am62l_psci.c b/plat/ti/k3low/common/am62l_psci.c
index 6bb9a4298..d8da7e6a9 100644
--- a/plat/ti/k3low/common/am62l_psci.c
+++ b/plat/ti/k3low/common/am62l_psci.c
@@ -233,7 +233,7 @@ static int am62l_validate_power_state(unsigned int power_state,
static void am62l_pwr_domain_suspend(const psci_power_state_t *target_state)
{
uint32_t core, proc_id;
- uint32_t mode = 0;
+ uint32_t mode = 6;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure that this modification is sufficient to hardcode mode value to 6?
For my understanding, we assign mode = am62l_lpm_state but this instruction is executed only for S2idle, right?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, the mode = am62l_lpm_state is only executed for the s2idle path. For the deep, we only need to make the above change

core = plat_my_core_pos();
proc_id = PLAT_PROC_START_ID + core;
uint64_t context_save_addr = TIFS_LPM_SAVE_CTX;

This modifies :file:`plat/ti/k3/common/am62l_psci.c`, which is the new Power
State Coordination Interface (PSCI) driver for AM62L in Arm Trusted Firmware.
The :func:`am62l_pwr_domain_suspend` function will change the default system
suspend mode from Deep Sleep to RTC Only + DDR.
This modifies :file:`plat/ti/k3/common/am62l_psci.c`, the PSCI driver for AM62L in

Check warning on line 45 in source/devices/AM62LX/linux/Release_Specific_Workarounds.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] reported by reviewdog 🐶 [RedHat.Definitions] Define acronyms and abbreviations (such as 'PSCI') on first occurrence if they're likely to be unfamiliar. Raw Output: {"message": "[RedHat.Definitions] Define acronyms and abbreviations (such as 'PSCI') on first occurrence if they're likely to be unfamiliar.", "location": {"path": "source/devices/AM62LX/linux/Release_Specific_Workarounds.rst", "range": {"start": {"line": 45, "column": 59}}}, "severity": "INFO"}

Check warning on line 45 in source/devices/AM62LX/linux/Release_Specific_Workarounds.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] reported by reviewdog 🐶 [RedHat.Slash] Use either 'or' or 'and' in 'plat/ti' Raw Output: {"message": "[RedHat.Slash] Use either 'or' or 'and' in 'plat/ti'", "location": {"path": "source/devices/AM62LX/linux/Release_Specific_Workarounds.rst", "range": {"start": {"line": 45, "column": 22}}}, "severity": "WARNING"}
Arm Trusted Firmware. The example above changes the default suspend mode from DeepSleep

Check warning on line 46 in source/devices/AM62LX/linux/Release_Specific_Workarounds.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] reported by reviewdog 🐶 [RedHat.TermsSuggestions] Depending on the context, consider using 'earlier', 'previous', 'preceding', or 'before' rather than 'above'. Raw Output: {"message": "[RedHat.TermsSuggestions] Depending on the context, consider using 'earlier', 'previous', 'preceding', or 'before' rather than 'above'.", "location": {"path": "source/devices/AM62LX/linux/Release_Specific_Workarounds.rst", "range": {"start": {"line": 46, "column": 35}}}, "severity": "INFO"}
(mode 0) to RTC + I/O + DDR (mode 6). Replace the ``mode`` value with any value from the
table above to select a different low power mode.

The default mode of 0 is the Deep Sleep state. Deep Sleep provides the lowest
latency wake-up but also uses more power. The updated default mode of 6 is
the RTC only + DDR state. In contrast, RTC only + DDR offers a lower power
consumption profile, but at the cost of higher wake-up latency.
.. note::

This change is a temporary solution. A more robust solution is under development to pass a suspend parameter from the kernel
by leveraging the s2idle mechanism.
This is a workaround required for selecting the low power mode when using [deep] in the /sys/power/suspend interface.
A more robust solution to select the suspend mode at runtime from the kernel is via the s2idle mechanism, without requiring
a firmware rebuild. See :ref:`pm_s2idle_psci` for details.

Once :file:`tispl.bin` is rebuilt and packaged, continue with entering LPM as described in :ref:`lpm_modes`.
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,28 @@
#. RTC Only Plus DDR
#. Deep Sleep

These modes fall into two distinct categories based on whether DDR context is retained:

- **Power Off**: The system enters a complete poweroff state. DDR context is lost and a
full hardware restart is required on wakeup.
Comment on lines +24 to +25

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sort of makes it sound like the user will have to do a full hardware restart upon wakeup. Maybe reword to be something along the lines of "DDR context is lost and upon wakeup, the system executes a full hardware restart"


- **Suspend to RAM**: The system suspends with DDR RAM context retained. State is
restored on resume without a full hardware restart, resulting in significantly lower wakeup

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO leave out "without a full hardware restart"

latency.

| **Power Off Mode**
| - RTC Only

| **Suspend to RAM Mode**
| - RTC + I/O + DDR
| - Deep Sleep

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you add DSS + DeepSleep also

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes

| - DSS plus DeepSleep

Power Off Mode
**************

RTC Only
********
========

RTC Only mode is the deepest low power mode that allows the system to enter a complete poweroff state
with ultra-low power consumption while maintaining system time and wakeup capability.
Expand Down Expand Up @@ -80,17 +100,41 @@
detects that the RTC is already programmed and skips the full initialization, performing only minimal
cleanup to preserve the system time.

RTC Only Plus DDR
*****************
Suspend to RAM Mode
*******************

Selecting the Suspend to RAM Entry Mechanism
============================================

When entering Suspend to RAM via ``echo mem > /sys/power/state``, the kernel selects the

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
When entering Suspend to RAM via ``echo mem > /sys/power/state``, the kernel selects the
When entering suspend to RAM via ``echo mem > /sys/power/state``, the kernel selects the

low power mode to enter based on the value of ``/sys/power/mem_sleep``:

- ``deep`` — uses the System Suspend path, and is the default mode.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- ``deep`` — uses the System Suspend path, and is the default mode.
- ``deep`` — uses the system suspend path; selected by default.

Always enters the hardcoded mode selected in the firmware during build time,

Check failure on line 113 in source/linux/Foundational_Components/Power_Management/pm_am62lx_low_power_modes.rst

View workflow job for this annotation

GitHub Actions / vale

[vale] reported by reviewdog 🐶 [RedHat.TermsErrors] Use 'hard-coded' rather than 'hardcoded'. Raw Output: {"message": "[RedHat.TermsErrors] Use 'hard-coded' rather than 'hardcoded'.", "location": {"path": "source/linux/Foundational_Components/Power_Management/pm_am62lx_low_power_modes.rst", "range": {"start": {"line": 113, "column": 22}}}, "severity": "ERROR"}
which is **DeepSleep** mode by default.
- ``s2idle`` — uses the Suspend-to-Idle path via PSCI, which allows the platform firmware(TF-A) to select the deepest available mode.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- ``s2idle`` — uses the Suspend-to-Idle path via PSCI, which allows the platform firmware(TF-A) to select the deepest available mode.
- ``s2idle`` — uses the Suspend-to-Idle path via PSCI, which allows the platform firmware (TF-A) to select the deepest available mode.

Allows mode selection in runtime. Mode selected is determined by latency and system configuration.

To check or change the current default at runtime:

.. code-block:: console

root@am62lxx-evm:~# cat /sys/power/mem_sleep
s2idle [deep]

root@am62lxx-evm:~# echo s2idle > /sys/power/mem_sleep


For full details on the s2idle path, PSCI integration, and mode selection at runtime, refer to :ref:`pm_s2idle_psci`.

.. note::

Please go through the s2idle docs to understand how to select between multiple low power modes.
The steps and overall architecture/ sequence diagrams are documented in :ref:`pm_s2idle_psci`.
The default mode via s2idle is RTC Only Plus DDR, since it's the deepest.
If the [deep] path is selected in `/sys/power/mem_sleep`, the low power mode
selection requires special steps to enter. The steps are documented in :ref:`am62l_suspend_workarounds`.
The default mode entered would be **DeepSleep** mode.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
The default mode entered would be **DeepSleep** mode.
The default mode is **DeepSleep** mode.


If regular [mem] interface is selected in `/sys/power/mem_sleep`, the RTC Only + DDR low power mode
requires special steps to enter. The steps are documented in :ref:`am62l_suspend_workarounds`.
RTC + I/O + DDR
=================

RTC Only + DDR mode is the deepest low power mode that allows the system to enter a state of lowest power consumption
while still retaining the DDR RAM context.
Expand All @@ -108,6 +152,14 @@
root@am62lxx-evm:~# echo disabled > /sys/devices/platform/bus@f0000/f900000.dwc3-usb/power/wakeup
root@am62lxx-evm:~# echo disabled > /sys/devices/platform/bus@f0000/f910000.dwc3-usb/power/wakeup

.. note::

Without the disabling USB as a wakeup source, the system will not resume cleanly and result in a usb driver crash on resume,

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Without the disabling USB as a wakeup source, the system will not resume cleanly and result in a usb driver crash on resume,
Without the disabling USB as a wakeup source, upon resume the USB driver will crash and the system will not resume

while using the [deep] path.

For the [s2idle] path, the system will not enter RTC + I/O + DDR mode if USB0 or USB1 is enabled as a wakeup source, and enter
Deepsleep mode instead.
Comment on lines +160 to +161

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
For the [s2idle] path, the system will not enter RTC + I/O + DDR mode if USB0 or USB1 is enabled as a wakeup source, and enter
Deepsleep mode instead.
For the [s2idle] path, if USB0 or USB1 is enabled as a wakeup source the system will enter DeepSleep instead of RTC + I/O + DDR.


Now the SoC can be suspended using the following command.

.. code-block:: console
Expand All @@ -132,7 +184,7 @@
[ 222.445468] PM: suspend exit

DeepSleep
*********
=========

DeepSleep AKA Suspend-to-RAM is a low-power mode that allows the SoC
to retain its state in RAM while the processor is turned off.
Expand All @@ -144,7 +196,14 @@
power to key modules such as GPIO and others is maintained to allow wakeup events
to exit out of this mode.

In order to enter DeepSleep,
DeepSleep is the default mode entered using the [deep] path in `/sys/power/mem_sleep`.

| To enter DeepSleep mode using the [s2idle] path, set the cpu latency constraint between that of DeepSleep(350ms) and RTC + I/O + DDR(900ms) mode.
| Use the following command to set the constraint to 500ms, which will allow the system to enter DeepSleep mode.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Add a sentence that says to refer to the standby documentation on how setting the constraint works to choose modes.


.. code-block:: bash

exec 4<>/dev/cpu_wakeup_latency; echo 0x7a120 >&4

.. code-block:: console

Expand Down Expand Up @@ -172,6 +231,8 @@
[ 88.649913] PM: suspend exit
root@am62lxx-evm:~#

Execute the above commands in a subshell to avoid accidentally keeping the file descriptor open indefinitely.

Memory Usage
************

Expand Down
Loading