public inbox for u-boot@lists.denx.de
 help / color / mirror / Atom feed
* [PATCH v8 00/13] am62: IO+DDR resume support
@ 2025-12-22 20:01 Markus Schneider-Pargmann (TI.com)
  2025-12-22 20:01 ` [PATCH v8 01/13] arm: mach-k3: Kconfig: Add symbol for IO+DDR Low Power Mode Markus Schneider-Pargmann (TI.com)
                   ` (13 more replies)
  0 siblings, 14 replies; 18+ messages in thread
From: Markus Schneider-Pargmann (TI.com) @ 2025-12-22 20:01 UTC (permalink / raw)
  To: Tom Rini, Sumit Garg, Nishanth Menon, Robert Nelson,
	Vignesh Raghavendra, Bryan Brattlof
  Cc: Vishal Mahaveer, Kevin Hilman, Dhruva Gole, Sebin Francis,
	Kendall Willis, Akashdeep Kaur, u-boot, Anshul Dalal, Moteen Shah,
	Santhosh Kumar K, Nathan Morrisson, Garrett Giordano,
	Judith Mendez, Aparna Patra, Jayesh Choudhary, Chintan Vankar,
	Ilias Apalodimas, Neha Malcom Francis, Prasanth Babu Mantena,
	Beleswar Padhi, Manorit Chawdhry, Andrew Davis, Wadim Egorov,
	Udit Kumar, Andrew Goodbody, E Shattow, Devarsh Thakkar, Peng Fan,
	Jerome Forissier, Sam Protsenko, Marek Vasut, Andre Przywara,
	Théo Lebrun, Markus Schneider-Pargmann (TI.com)

Hi,

this series introduces support to resume from IO+DDR. IO+DDR is a low
power mode of am62a and am62p in which nearly everything is powered off
except DDR which is in self-refresh and a few pins which detect
activity and can wakeup the system again.

On resume uboot SPL is loaded and checks if this is a IO+DDR resume. If
it is, the DDR initialization sequence in k3-ddrss differs slightly as
it has to get the DDR out of the self-refresh.

Afterward a specific address determined from DT is used to get the
metadata that stores relevant context addresses. The context is restored
using the tisci message TI_SCI_MSG_MIN_CONTEXT_RESTORE. At the end all
further initializations are skipped and uboot SPL directly jumps into
the DM resume address which takes care of the rest.

k3-ddrss is using absolute register accesses at the moment. I am trying
to submit syscon DT patches upstream to access these through syscon,
unfortunately there is ongoing discussion regarding syscon.

I tested this on am62a.

Best,
Markus

Signed-off-by: Markus Schneider-Pargmann (TI.com) <msp@baylibre.com>
---
Changes in v8:
- Create and use am62xx-lpm-common for am62xx lpm common functions
- Create platform dependent functions in k3-ddrss in k3_ddrss_data
- Align am62a and am62p initialization regarding caches and QoS
- Link to v7: https://lore.kernel.org/r/20251210-topic-am62-ioddr-v2025-04-rc1-v7-0-f113b156f83f@baylibre.com

Changes in v7:
- Removed parent nodes bootph-pre-ram properties as not necessary
  anymore.
- Added missing new line in
    arm: mach-k3: common: Helper for LPM meta data address from DT
- Split off LPM specific ddr code into its own file k3-ddrss-lpm
- Rename lpm_ops->restore_context to lpm_ops->min_context_restore
- Pulled patch to add wakeup check helpers before the IO isolation
  removal to remove later cleanup of
  wkup_ctrl_remove_can_io_isolation_if_set()
- Some reviewed-bys and tested-bys removed due to changes in the
  patches
- Link to v6: https://lore.kernel.org/r/20251120-topic-am62-ioddr-v2025-04-rc1-v6-0-6dd99a7271bb@baylibre.com

Changes in v6:
- Add comment for last part of removing can io isolation
- Only mention a single kconfig symbol in the commit message
- Add defines for timeouts in k3-ddrss
- Link to v5: https://lore.kernel.org/r/20251110-topic-am62-ioddr-v2025-04-rc1-v5-0-980ee0036c26@baylibre.com

Changes in v5:
- Fixed compile warnings
- Link to v4: https://lore.kernel.org/r/20251030-topic-am62-ioddr-v2025-04-rc1-v4-0-4cef18af0226@baylibre.com

Changes in v4:
- Copy lpm_meta_data into the stack to be able to debug unstable memory
  issues
- Add missing comments about ctx_lo and ctx_hi
- Use absolute addresses for k3-ddrss CANUART_WAKE_STAT1 and
  CANUART_WAKE_OFF_MODE_STAT to avoid using addresses outside of the
  range given in the devicetree
- Remove the cherry picked devicetree patches as they are already
  included now
- In lpm_resume_from_ddr() print upper and lower 32bit of the meta data
  values separately.
- Link to v3: https://lore.kernel.org/r/20250623-topic-am62-ioddr-v2025-04-rc1-v3-0-a4da322c16af@baylibre.com

Changes in v3:
- Use wait_for_bit helpers in k3-ddrss where possible and add panic
  messages for easier debugging
- Link to v2: https://lore.kernel.org/r/20250613-topic-am62-ioddr-v2025-04-rc1-v2-0-3d233aaea355@baylibre.com

Changes in v2:
- Remove 'default n' from K3_IODDR
- Pick devicetree patches from upstream instead of mailinglist
- Link to v1: https://lore.kernel.org/r/20250311-topic-am62-ioddr-v2025-04-rc1-v1-0-666de9c105cb@baylibre.com

---
Markus Schneider-Pargmann (TI.com) (13):
      arm: mach-k3: Kconfig: Add symbol for IO+DDR Low Power Mode
      arm: mach-k3: am62xx-lpm-common: Add CANUART wakeup check helpers
      arm: mach-k3: Remove CANUART IO isolation
      ram: k3-ddrss: Add support for DDR in self-refresh
      firmware: ti_sci: Add TI_SCI_MSG_MIN_CONTEXT_RESTORE
      arm: mach-k3: am62xx-lpm-common: Add lpm_resume_from_ddr
      arm: mach-k3: am62xx-lpm-common: Helper for LPM meta data address from DT
      arm: mach-k3: am62a7_init: Resume on LPM exit
      arm: mach-k3: am62p5_init: Resume on LPM exit
      arm: dts: k3-am62a: Add r5 device nodes
      arm: dts: k3-am62p: Add r5 device nodes
      configs: am62ax_evm_r5: Enable IODDR resume support
      configs: am62p_evm_r5_defconfig: Enable IODDR resume support

 arch/arm/dts/k3-am62a7-sk-u-boot.dtsi  |   8 ++
 arch/arm/dts/k3-am62p5-sk-u-boot.dtsi  |   8 ++
 arch/arm/mach-k3/Kconfig               |   8 ++
 arch/arm/mach-k3/Makefile              |   3 +
 arch/arm/mach-k3/am62ax/am62a7_init.c  |  14 +++
 arch/arm/mach-k3/am62px/am62p5_init.c  |  14 +++
 arch/arm/mach-k3/am62x/am625_init.c    |   5 +
 arch/arm/mach-k3/am62xx-lpm-common.c   | 220 +++++++++++++++++++++++++++++++++
 arch/arm/mach-k3/am62xx-lpm-common.h   |  19 +++
 configs/am62ax_evm_r5_defconfig        |   1 +
 configs/am62px_evm_r5_defconfig        |   1 +
 drivers/firmware/ti_sci.c              |  38 ++++++
 drivers/firmware/ti_sci.h              |  16 +++
 drivers/ram/k3-ddrss/Makefile          |   1 +
 drivers/ram/k3-ddrss/k3-ddrss-lpm.c    | 181 +++++++++++++++++++++++++++
 drivers/ram/k3-ddrss/k3-ddrss-lpm.h    |  20 +++
 drivers/ram/k3-ddrss/k3-ddrss.c        |  26 +++-
 include/linux/soc/ti/ti_sci_protocol.h |   9 ++
 18 files changed, 591 insertions(+), 1 deletion(-)
---
base-commit: 0e0a198a68be71148f5ec27ef86796174f91436f
change-id: 20250306-topic-am62-ioddr-v2025-04-rc1-0b3a0ffe92b1

Best regards,
-- 
Markus Schneider-Pargmann (TI.com) <msp@baylibre.com>


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

* [PATCH v8 01/13] arm: mach-k3: Kconfig: Add symbol for IO+DDR Low Power Mode
  2025-12-22 20:01 [PATCH v8 00/13] am62: IO+DDR resume support Markus Schneider-Pargmann (TI.com)
@ 2025-12-22 20:01 ` Markus Schneider-Pargmann (TI.com)
  2025-12-22 20:01 ` [PATCH v8 02/13] arm: mach-k3: am62xx-lpm-common: Add CANUART wakeup check helpers Markus Schneider-Pargmann (TI.com)
                   ` (12 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Markus Schneider-Pargmann (TI.com) @ 2025-12-22 20:01 UTC (permalink / raw)
  To: Tom Rini, Sumit Garg, Nishanth Menon, Robert Nelson,
	Vignesh Raghavendra, Bryan Brattlof
  Cc: Vishal Mahaveer, Kevin Hilman, Dhruva Gole, Sebin Francis,
	Kendall Willis, Akashdeep Kaur, u-boot, Anshul Dalal, Moteen Shah,
	Santhosh Kumar K, Nathan Morrisson, Garrett Giordano,
	Judith Mendez, Aparna Patra, Jayesh Choudhary, Chintan Vankar,
	Ilias Apalodimas, Neha Malcom Francis, Prasanth Babu Mantena,
	Beleswar Padhi, Manorit Chawdhry, Andrew Davis, Wadim Egorov,
	Udit Kumar, Andrew Goodbody, E Shattow, Devarsh Thakkar, Peng Fan,
	Jerome Forissier, Sam Protsenko, Marek Vasut, Andre Przywara,
	Théo Lebrun, Markus Schneider-Pargmann (TI.com)

Symbol to enable support to resume from IO+DDR where the SoC is turned
off and DDR is in self-refresh.

Signed-off-by: Markus Schneider-Pargmann (TI.com) <msp@baylibre.com>
---
 arch/arm/mach-k3/Kconfig | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/mach-k3/Kconfig b/arch/arm/mach-k3/Kconfig
index 1b8c0b1eb968f0414107c0bf3142f744ce8364c8..4b7cef64935c7b403051c080eba7bdb48f727bf1 100644
--- a/arch/arm/mach-k3/Kconfig
+++ b/arch/arm/mach-k3/Kconfig
@@ -148,6 +148,14 @@ config K3_DM_FW
 	  bootloader, it makes RM and PM services not being available
 	  during R5 SPL execution time.
 
+config K3_IODDR
+	bool "Enable IO+DDR Low Power Mode support"
+	depends on SPL && (SOC_K3_AM62A7 || SOC_K3_AM62P5)
+	help
+	  Enable support for IO+DDR Low Power Mode. If this is enabled and a
+	  resume from IO+DDR is detected, metadata in the DDR is used to
+	  restore TIFS and resume DM.
+
 config K3_X509_SWRV
 	int "SWRV for X509 certificate used for boot images"
 	default 1

-- 
2.51.0


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

* [PATCH v8 02/13] arm: mach-k3: am62xx-lpm-common: Add CANUART wakeup check helpers
  2025-12-22 20:01 [PATCH v8 00/13] am62: IO+DDR resume support Markus Schneider-Pargmann (TI.com)
  2025-12-22 20:01 ` [PATCH v8 01/13] arm: mach-k3: Kconfig: Add symbol for IO+DDR Low Power Mode Markus Schneider-Pargmann (TI.com)
@ 2025-12-22 20:01 ` Markus Schneider-Pargmann (TI.com)
  2025-12-22 20:01 ` [PATCH v8 03/13] arm: mach-k3: Remove CANUART IO isolation Markus Schneider-Pargmann (TI.com)
                   ` (11 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Markus Schneider-Pargmann (TI.com) @ 2025-12-22 20:01 UTC (permalink / raw)
  To: Tom Rini, Sumit Garg, Nishanth Menon, Robert Nelson,
	Vignesh Raghavendra, Bryan Brattlof
  Cc: Vishal Mahaveer, Kevin Hilman, Dhruva Gole, Sebin Francis,
	Kendall Willis, Akashdeep Kaur, u-boot, Anshul Dalal, Moteen Shah,
	Santhosh Kumar K, Nathan Morrisson, Garrett Giordano,
	Judith Mendez, Aparna Patra, Jayesh Choudhary, Chintan Vankar,
	Ilias Apalodimas, Neha Malcom Francis, Prasanth Babu Mantena,
	Beleswar Padhi, Manorit Chawdhry, Andrew Davis, Wadim Egorov,
	Udit Kumar, Andrew Goodbody, E Shattow, Devarsh Thakkar, Peng Fan,
	Jerome Forissier, Sam Protsenko, Marek Vasut, Andre Przywara,
	Théo Lebrun, Markus Schneider-Pargmann (TI.com)

Add dedicated helper functions to check CANUART wake registers and magic
word. This helps determining if we are in a wakeup or if CAN IO
isolation has to be removed.

Also add a helper to detect a low power mode exit/resume.

Signed-off-by: Markus Schneider-Pargmann (TI.com) <msp@baylibre.com>
---
 arch/arm/mach-k3/Makefile            |  3 +++
 arch/arm/mach-k3/am62xx-lpm-common.c | 38 ++++++++++++++++++++++++++++++++++++
 arch/arm/mach-k3/am62xx-lpm-common.h | 16 +++++++++++++++
 3 files changed, 57 insertions(+)

diff --git a/arch/arm/mach-k3/Makefile b/arch/arm/mach-k3/Makefile
index b2fd5810b67cd8c62af8e0cb4c60020bed2b5624..7a020a8318bae924e6d976fa625b817b37456d84 100644
--- a/arch/arm/mach-k3/Makefile
+++ b/arch/arm/mach-k3/Makefile
@@ -7,6 +7,9 @@ obj-$(CONFIG_ARM64) += arm64/
 obj-$(CONFIG_CPU_V7R) += r5/
 obj-$(CONFIG_OF_LIBFDT) += common_fdt.o
 obj-y += common.o security.o k3-ddr.o
+obj-$(CONFIG_SOC_K3_AM625) += am62xx-lpm-common.o
+obj-$(CONFIG_SOC_K3_AM62A7) += am62xx-lpm-common.o
+obj-$(CONFIG_SOC_K3_AM62P5) += am62xx-lpm-common.o
 obj-$(CONFIG_SOC_K3_AM62A7) += am62ax/
 obj-$(CONFIG_SOC_K3_AM62P5) += am62px/
 obj-$(CONFIG_SOC_K3_AM625) += am62x/
diff --git a/arch/arm/mach-k3/am62xx-lpm-common.c b/arch/arm/mach-k3/am62xx-lpm-common.c
new file mode 100644
index 0000000000000000000000000000000000000000..424d7457c596290ef48acd7f7aec3fd192dd3000
--- /dev/null
+++ b/arch/arm/mach-k3/am62xx-lpm-common.c
@@ -0,0 +1,38 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * am62xx common LPM functions
+ *
+ * Copyright (C) 2025 Texas Instruments Incorporated - https://www.ti.com/
+ * Copyright (C) 2025 BayLibre, SAS
+ */
+
+#include <config.h>
+#include <asm/arch/hardware.h>
+#include <asm/io.h>
+
+#include "am62xx-lpm-common.h"
+
+#define WKUP_CTRL_MMR_CANUART_WAKE_STAT1			0x1830c
+#define WKUP_CTRL_MMR_CANUART_WAKE_STAT1_CANUART_IO_MODE	BIT(0)
+
+#define WKUP_CTRL_MMR_CANUART_WAKE_OFF_MODE_STAT		0x18318
+#define WKUP_CTRL_MMR_CANUART_WAKE_OFF_MODE_STAT_MW		0x555555
+
+static bool wkup_ctrl_canuart_wakeup_active(void)
+{
+	return !!(readl(WKUP_CTRL_MMR0_BASE + WKUP_CTRL_MMR_CANUART_WAKE_STAT1) &
+		WKUP_CTRL_MMR_CANUART_WAKE_STAT1_CANUART_IO_MODE);
+}
+
+static bool wkup_ctrl_canuart_magic_word_set(void)
+{
+	return readl(WKUP_CTRL_MMR0_BASE + WKUP_CTRL_MMR_CANUART_WAKE_OFF_MODE_STAT) ==
+		WKUP_CTRL_MMR_CANUART_WAKE_OFF_MODE_STAT_MW;
+}
+
+bool wkup_ctrl_is_lpm_exit(void)
+{
+	return IS_ENABLED(CONFIG_K3_IODDR) &&
+		wkup_ctrl_canuart_wakeup_active() &&
+		wkup_ctrl_canuart_magic_word_set();
+}
diff --git a/arch/arm/mach-k3/am62xx-lpm-common.h b/arch/arm/mach-k3/am62xx-lpm-common.h
new file mode 100644
index 0000000000000000000000000000000000000000..36dcd20a9b802bb0eae8dfa56836e7da70107e62
--- /dev/null
+++ b/arch/arm/mach-k3/am62xx-lpm-common.h
@@ -0,0 +1,16 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * am62xx common LPM functions
+ *
+ * Copyright (C) 2025 Texas Instruments Incorporated - https://www.ti.com/
+ * Copyright (C) 2025 BayLibre, SAS
+ */
+
+#ifndef _AM62XX_LPM_COMMON_H_
+#define _AM62XX_LPM_COMMON_H_
+
+#include <asm/io.h>
+
+bool wkup_ctrl_is_lpm_exit(void);
+
+#endif  /* _AM62XX_LPM_COMMON_H_ */

-- 
2.51.0


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

* [PATCH v8 03/13] arm: mach-k3: Remove CANUART IO isolation
  2025-12-22 20:01 [PATCH v8 00/13] am62: IO+DDR resume support Markus Schneider-Pargmann (TI.com)
  2025-12-22 20:01 ` [PATCH v8 01/13] arm: mach-k3: Kconfig: Add symbol for IO+DDR Low Power Mode Markus Schneider-Pargmann (TI.com)
  2025-12-22 20:01 ` [PATCH v8 02/13] arm: mach-k3: am62xx-lpm-common: Add CANUART wakeup check helpers Markus Schneider-Pargmann (TI.com)
@ 2025-12-22 20:01 ` Markus Schneider-Pargmann (TI.com)
  2025-12-22 20:01 ` [PATCH v8 04/13] ram: k3-ddrss: Add support for DDR in self-refresh Markus Schneider-Pargmann (TI.com)
                   ` (10 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Markus Schneider-Pargmann (TI.com) @ 2025-12-22 20:01 UTC (permalink / raw)
  To: Tom Rini, Sumit Garg, Nishanth Menon, Robert Nelson,
	Vignesh Raghavendra, Bryan Brattlof
  Cc: Vishal Mahaveer, Kevin Hilman, Dhruva Gole, Sebin Francis,
	Kendall Willis, Akashdeep Kaur, u-boot, Anshul Dalal, Moteen Shah,
	Santhosh Kumar K, Nathan Morrisson, Garrett Giordano,
	Judith Mendez, Aparna Patra, Jayesh Choudhary, Chintan Vankar,
	Ilias Apalodimas, Neha Malcom Francis, Prasanth Babu Mantena,
	Beleswar Padhi, Manorit Chawdhry, Andrew Davis, Wadim Egorov,
	Udit Kumar, Andrew Goodbody, E Shattow, Devarsh Thakkar, Peng Fan,
	Jerome Forissier, Sam Protsenko, Marek Vasut, Andre Przywara,
	Théo Lebrun, Markus Schneider-Pargmann (TI.com)

After leaving the Partial-IO mode or other deep sleep states, the IO
isolation needs to be removed. This routine is shared by at least am62,
am62a and am62p.

The original function for testing was developed by
Akashdeep Kaur <a-kaur@ti.com>

Signed-off-by: Markus Schneider-Pargmann (TI.com) <msp@baylibre.com>
---
 arch/arm/mach-k3/am62ax/am62a7_init.c |  5 +++
 arch/arm/mach-k3/am62px/am62p5_init.c |  5 +++
 arch/arm/mach-k3/am62x/am625_init.c   |  5 +++
 arch/arm/mach-k3/am62xx-lpm-common.c  | 85 +++++++++++++++++++++++++++++++++++
 arch/arm/mach-k3/am62xx-lpm-common.h  |  1 +
 5 files changed, 101 insertions(+)

diff --git a/arch/arm/mach-k3/am62ax/am62a7_init.c b/arch/arm/mach-k3/am62ax/am62a7_init.c
index 7de234611639d119db5c7a718738a02cedf8028c..c1c7d669a45f53b7528c80d44bf9b914fed1cc10 100644
--- a/arch/arm/mach-k3/am62ax/am62a7_init.c
+++ b/arch/arm/mach-k3/am62ax/am62a7_init.c
@@ -14,6 +14,7 @@
 
 #include "../sysfw-loader.h"
 #include "../common.h"
+#include "../am62xx-lpm-common.h"
 
 #define CTRLMMR_MCU_RST_CTRL             0x04518170
 #define RST_CTRL_ESM_ERROR_RST_EN_Z_MASK 0xFFFDFFFF
@@ -101,6 +102,10 @@ void board_init_f(ulong dummy)
 	/* Init DM early */
 	spl_early_init();
 
+	ret = wkup_ctrl_remove_can_io_isolation_if_set();
+	if (ret)
+		panic("Failed to remove can IO isolation when set %d\n", ret);
+
 	/*
 	 * Process pinctrl for the serial0 and serial3, aka WKUP_UART0 and
 	 * MAIN_UART1 modules and continue regardless of the result of pinctrl.
diff --git a/arch/arm/mach-k3/am62px/am62p5_init.c b/arch/arm/mach-k3/am62px/am62p5_init.c
index 4c215d5cebed5930bce70bdc975fe31c437ce82b..a74fe3d23d7c4b66ac95aa5a01c2a32a586e9ced 100644
--- a/arch/arm/mach-k3/am62px/am62p5_init.c
+++ b/arch/arm/mach-k3/am62px/am62p5_init.c
@@ -15,6 +15,7 @@
 
 #include "../sysfw-loader.h"
 #include "../common.h"
+#include "../am62xx-lpm-common.h"
 
 /* TISCI DEV ID for A53 Clock */
 #define AM62PX_DEV_A53SS0_CORE_0_DEV_ID 135
@@ -160,6 +161,10 @@ void board_init_f(ulong dummy)
 	if (ret)
 		panic("spl_early_init() failed: %d\n", ret);
 
+	ret = wkup_ctrl_remove_can_io_isolation_if_set();
+	if (ret)
+		panic("Failed to remove can IO isolation when set %d\n", ret);
+
 	/*
 	 * Process pinctrl for the serial0 and serial3, aka WKUP_UART0 and
 	 * MAIN_UART1 modules and continue regardless of the result of pinctrl.
diff --git a/arch/arm/mach-k3/am62x/am625_init.c b/arch/arm/mach-k3/am62x/am625_init.c
index 02b7414e21cd56faab795fe7b39eefcc67cb044a..d2deecb16670739cee20e2e525688ba61a434872 100644
--- a/arch/arm/mach-k3/am62x/am625_init.c
+++ b/arch/arm/mach-k3/am62x/am625_init.c
@@ -16,6 +16,7 @@
 
 #include "../sysfw-loader.h"
 #include "../common.h"
+#include "../am62xx-lpm-common.h"
 
 #define RTC_BASE_ADDRESS		0x2b1f0000
 #define REG_K3RTC_S_CNT_LSW		(RTC_BASE_ADDRESS + 0x18)
@@ -201,6 +202,10 @@ void board_init_f(ulong dummy)
 	/* Init DM early */
 	spl_early_init();
 
+	ret = wkup_ctrl_remove_can_io_isolation_if_set();
+	if (ret)
+		panic("Failed to remove can IO isolation when set %d\n", ret);
+
 	/*
 	 * Process pinctrl for the serial0 and serial3, aka WKUP_UART0 and
 	 * MAIN_UART1 modules and continue regardless of the result of pinctrl.
diff --git a/arch/arm/mach-k3/am62xx-lpm-common.c b/arch/arm/mach-k3/am62xx-lpm-common.c
index 424d7457c596290ef48acd7f7aec3fd192dd3000..54d86b0474df691e8568a9c38530c56cc1eb3a0a 100644
--- a/arch/arm/mach-k3/am62xx-lpm-common.c
+++ b/arch/arm/mach-k3/am62xx-lpm-common.c
@@ -9,15 +9,93 @@
 #include <config.h>
 #include <asm/arch/hardware.h>
 #include <asm/io.h>
+#include <wait_bit.h>
 
 #include "am62xx-lpm-common.h"
 
+/*
+ * Shared WKUP_CTRL_MMR0 definitions used to remove IO isolation
+ */
+#define WKUP_CTRL_MMR_PMCTRL_IO_0				0x18084
+#define WKUP_CTRL_MMR_PMCTRL_IO_0_ISOCLK_OVRD_0			BIT(0)
+#define WKUP_CTRL_MMR_PMCTRL_IO_0_ISOOVR_EXTEND_0		BIT(4)
+#define WKUP_CTRL_MMR_PMCTRL_IO_0_ISO_BYPASS_OVR_0		BIT(6)
+#define WKUP_CTRL_MMR_PMCTRL_IO_0_WUCLK_CTRL_0			BIT(8)
+#define WKUP_CTRL_MMR_PMCTRL_IO_0_GLOBAL_WUEN_0			BIT(16)
+#define WKUP_CTRL_MMR_PMCTRL_IO_0_IO_ISO_CTRL_0			BIT(24)
+#define WKUP_CTRL_MMR_PMCTRL_IO_0_WRITE_MASK ( \
+		WKUP_CTRL_MMR_PMCTRL_IO_0_ISOCLK_OVRD_0 |	\
+		WKUP_CTRL_MMR_PMCTRL_IO_0_ISOOVR_EXTEND_0 |	\
+		WKUP_CTRL_MMR_PMCTRL_IO_0_ISO_BYPASS_OVR_0 |	\
+		WKUP_CTRL_MMR_PMCTRL_IO_0_WUCLK_CTRL_0 |	\
+		WKUP_CTRL_MMR_PMCTRL_IO_0_GLOBAL_WUEN_0 |	\
+		WKUP_CTRL_MMR_PMCTRL_IO_0_IO_ISO_CTRL_0)
+
+#define WKUP_CTRL_MMR_PMCTRL_IO_GLB				0x1809c
+#define WKUP_CTRL_MMR_DEEPSLEEP_CTRL				0x18160
+
+#define WKUP_CTRL_MMR_CANUART_WAKE_CTRL				0x18300
+#define WKUP_CTRL_MMR_CANUART_WAKE_CTRL_MW			0x2aaaaaaa
+#define WKUP_CTRL_MMR_CANUART_WAKE_CTRL_MW_SHIFT		1
+#define WKUP_CTRL_MMR_CANUART_WAKE_CTRL_MW_LOAD_EN		BIT(0)
+
 #define WKUP_CTRL_MMR_CANUART_WAKE_STAT1			0x1830c
 #define WKUP_CTRL_MMR_CANUART_WAKE_STAT1_CANUART_IO_MODE	BIT(0)
 
 #define WKUP_CTRL_MMR_CANUART_WAKE_OFF_MODE_STAT		0x18318
 #define WKUP_CTRL_MMR_CANUART_WAKE_OFF_MODE_STAT_MW		0x555555
 
+#define CLKSTOP_TRANSITION_TIMEOUT_MS	10
+
+static int wkup_ctrl_remove_can_io_isolation(void)
+{
+	const void *wait_reg = (const void *)(WKUP_CTRL_MMR0_BASE +
+					      WKUP_CTRL_MMR_CANUART_WAKE_STAT1);
+	int ret;
+	u32 reg = 0;
+
+	/* Program magic word */
+	reg = readl(WKUP_CTRL_MMR0_BASE + WKUP_CTRL_MMR_CANUART_WAKE_CTRL);
+	reg |= WKUP_CTRL_MMR_CANUART_WAKE_CTRL_MW << WKUP_CTRL_MMR_CANUART_WAKE_CTRL_MW_SHIFT;
+	writel(reg, WKUP_CTRL_MMR0_BASE + WKUP_CTRL_MMR_CANUART_WAKE_CTRL);
+
+	/* Set enable bit. */
+	reg |= WKUP_CTRL_MMR_CANUART_WAKE_CTRL_MW_LOAD_EN;
+	writel(reg, WKUP_CTRL_MMR0_BASE + WKUP_CTRL_MMR_CANUART_WAKE_CTRL);
+
+	/* Clear enable bit. */
+	reg &= ~WKUP_CTRL_MMR_CANUART_WAKE_CTRL_MW_LOAD_EN;
+	writel(reg, WKUP_CTRL_MMR0_BASE + WKUP_CTRL_MMR_CANUART_WAKE_CTRL);
+
+	/* wait for CAN_ONLY_IO signal to be 0 */
+	ret = wait_for_bit_32(wait_reg,
+			      WKUP_CTRL_MMR_CANUART_WAKE_STAT1_CANUART_IO_MODE,
+			      false,
+			      CLKSTOP_TRANSITION_TIMEOUT_MS,
+			      false);
+	if (ret < 0)
+		return ret;
+
+	/* Reset magic word */
+	writel(0, WKUP_CTRL_MMR0_BASE + WKUP_CTRL_MMR_CANUART_WAKE_CTRL);
+
+	/* Remove WKUP IO isolation */
+	reg = readl(WKUP_CTRL_MMR0_BASE + WKUP_CTRL_MMR_PMCTRL_IO_0);
+	reg = reg & WKUP_CTRL_MMR_PMCTRL_IO_0_WRITE_MASK & ~WKUP_CTRL_MMR_PMCTRL_IO_0_GLOBAL_WUEN_0;
+	writel(reg, WKUP_CTRL_MMR0_BASE + WKUP_CTRL_MMR_PMCTRL_IO_0);
+
+	/* clear global IO isolation */
+	reg = readl(WKUP_CTRL_MMR0_BASE + WKUP_CTRL_MMR_PMCTRL_IO_0);
+	reg = reg & WKUP_CTRL_MMR_PMCTRL_IO_0_WRITE_MASK & ~WKUP_CTRL_MMR_PMCTRL_IO_0_IO_ISO_CTRL_0;
+	writel(reg, WKUP_CTRL_MMR0_BASE + WKUP_CTRL_MMR_PMCTRL_IO_0);
+
+	/* Release all IOs from deepsleep mode and clear IO daisy chain control */
+	writel(0, WKUP_CTRL_MMR0_BASE + WKUP_CTRL_MMR_DEEPSLEEP_CTRL);
+	writel(0, WKUP_CTRL_MMR0_BASE + WKUP_CTRL_MMR_PMCTRL_IO_GLB);
+
+	return 0;
+}
+
 static bool wkup_ctrl_canuart_wakeup_active(void)
 {
 	return !!(readl(WKUP_CTRL_MMR0_BASE + WKUP_CTRL_MMR_CANUART_WAKE_STAT1) &
@@ -36,3 +114,10 @@ bool wkup_ctrl_is_lpm_exit(void)
 		wkup_ctrl_canuart_wakeup_active() &&
 		wkup_ctrl_canuart_magic_word_set();
 }
+
+int __maybe_unused wkup_ctrl_remove_can_io_isolation_if_set(void)
+{
+	if (wkup_ctrl_canuart_wakeup_active() && !wkup_ctrl_canuart_magic_word_set())
+		return wkup_ctrl_remove_can_io_isolation();
+	return 0;
+}
diff --git a/arch/arm/mach-k3/am62xx-lpm-common.h b/arch/arm/mach-k3/am62xx-lpm-common.h
index 36dcd20a9b802bb0eae8dfa56836e7da70107e62..2d110bcca0fc74ecd5424ae288d43519d0c05908 100644
--- a/arch/arm/mach-k3/am62xx-lpm-common.h
+++ b/arch/arm/mach-k3/am62xx-lpm-common.h
@@ -12,5 +12,6 @@
 #include <asm/io.h>
 
 bool wkup_ctrl_is_lpm_exit(void);
+int wkup_ctrl_remove_can_io_isolation_if_set(void);
 
 #endif  /* _AM62XX_LPM_COMMON_H_ */

-- 
2.51.0


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

* [PATCH v8 04/13] ram: k3-ddrss: Add support for DDR in self-refresh
  2025-12-22 20:01 [PATCH v8 00/13] am62: IO+DDR resume support Markus Schneider-Pargmann (TI.com)
                   ` (2 preceding siblings ...)
  2025-12-22 20:01 ` [PATCH v8 03/13] arm: mach-k3: Remove CANUART IO isolation Markus Schneider-Pargmann (TI.com)
@ 2025-12-22 20:01 ` Markus Schneider-Pargmann (TI.com)
  2025-12-22 20:01 ` [PATCH v8 05/13] firmware: ti_sci: Add TI_SCI_MSG_MIN_CONTEXT_RESTORE Markus Schneider-Pargmann (TI.com)
                   ` (9 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Markus Schneider-Pargmann (TI.com) @ 2025-12-22 20:01 UTC (permalink / raw)
  To: Tom Rini, Sumit Garg, Nishanth Menon, Robert Nelson,
	Vignesh Raghavendra, Bryan Brattlof
  Cc: Vishal Mahaveer, Kevin Hilman, Dhruva Gole, Sebin Francis,
	Kendall Willis, Akashdeep Kaur, u-boot, Anshul Dalal, Moteen Shah,
	Santhosh Kumar K, Nathan Morrisson, Garrett Giordano,
	Judith Mendez, Aparna Patra, Jayesh Choudhary, Chintan Vankar,
	Ilias Apalodimas, Neha Malcom Francis, Prasanth Babu Mantena,
	Beleswar Padhi, Manorit Chawdhry, Andrew Davis, Wadim Egorov,
	Udit Kumar, Andrew Goodbody, E Shattow, Devarsh Thakkar, Peng Fan,
	Jerome Forissier, Sam Protsenko, Marek Vasut, Andre Przywara,
	Théo Lebrun, Markus Schneider-Pargmann (TI.com)

In IO+DDR the DDR is kept in self-refresh while the SoC cores are
powered off completely. During boot the normal initialization routine of
DDR is slightly different to exit self-refresh and keep the DDR contents.

Signed-off-by: Markus Schneider-Pargmann (TI.com) <msp@baylibre.com>
---
 drivers/ram/k3-ddrss/Makefile       |   1 +
 drivers/ram/k3-ddrss/k3-ddrss-lpm.c | 181 ++++++++++++++++++++++++++++++++++++
 drivers/ram/k3-ddrss/k3-ddrss-lpm.h |  20 ++++
 drivers/ram/k3-ddrss/k3-ddrss.c     |  26 +++++-
 4 files changed, 227 insertions(+), 1 deletion(-)

diff --git a/drivers/ram/k3-ddrss/Makefile b/drivers/ram/k3-ddrss/Makefile
index 823d1887178174021778296e6626cadfd11170de..8a2ece1c27eeae51593467259337483a852f5f85 100644
--- a/drivers/ram/k3-ddrss/Makefile
+++ b/drivers/ram/k3-ddrss/Makefile
@@ -4,6 +4,7 @@
 #
 
 obj-$(CONFIG_K3_DDRSS) += k3-ddrss.o
+obj-$(CONFIG_K3_DDRSS) += k3-ddrss-lpm.o
 obj-$(CONFIG_K3_DDRSS) += lpddr4_obj_if.o
 obj-$(CONFIG_K3_DDRSS) += lpddr4.o
 ccflags-$(CONFIG_K3_DDRSS) += -Idrivers/ram/k3-ddrss/
diff --git a/drivers/ram/k3-ddrss/k3-ddrss-lpm.c b/drivers/ram/k3-ddrss/k3-ddrss-lpm.c
new file mode 100644
index 0000000000000000000000000000000000000000..20181d0a876dbb723920efb78ed980948eec117f
--- /dev/null
+++ b/drivers/ram/k3-ddrss/k3-ddrss-lpm.c
@@ -0,0 +1,181 @@
+// SPDX-License-Identifier: GPL-2.0+
+/*
+ * K3 DDRSS LPM specific functions
+ *
+ * Copyright (C) 2025 Texas Instruments Incorporated - https://www.ti.com/
+ * Copyright (C) 2025 BayLibre, SAS
+ */
+
+#include <asm/io.h>
+#include <linux/compiler_types.h>
+#include <linux/types.h>
+#include <time.h>
+#include <vsprintf.h>
+#include <wait_bit.h>
+
+#include "k3-ddrss-lpm.h"
+
+#define AM62XX_WKUP_CTRL_MMR0_DDR16SS_PMCTRL				0x430080d0
+#define AM62XX_WKUP_CTRL_MMR0_DDR16SS_PMCTRL_DATA_RET_LD		BIT(31)
+#define AM62XX_WKUP_CTRL_MMR0_DDR16SS_PMCTRL_DATA_RETENTION_MASK	GENMASK(3, 0)
+
+#define AM62XX_WKUP_CTRL_MMR_CANUART_WAKE_STAT1				0x4301830c
+#define AM62XX_WKUP_CTRL_MMR_CANUART_WAKE_STAT1_CANUART_IO_MODE		BIT(0)
+
+#define AM62XX_WKUP_CTRL_MMR_CANUART_WAKE_OFF_MODE_STAT			0x43018318
+#define AM62XX_WKUP_CTRL_MMR_CANUART_WAKE_OFF_MODE_STAT_MW		0x555555
+
+#define K3_DDRSS_CFG_DENALI_CTL_20				0x0050
+#define K3_DDRSS_CFG_DENALI_CTL_20_PHY_INDEP_TRAIN_MODE		BIT(24)
+#define K3_DDRSS_CFG_DENALI_CTL_21				0x0054
+#define K3_DDRSS_CFG_DENALI_CTL_21_PHY_INDEP_INIT_MODE		BIT(8)
+#define K3_DDRSS_CFG_DENALI_CTL_106				0x01a8
+#define K3_DDRSS_CFG_DENALI_CTL_106_PWRUP_SREFRESH_EXIT		BIT(16)
+#define K3_DDRSS_CFG_DENALI_CTL_160				0x0280
+#define K3_DDRSS_CFG_DENALI_CTL_160_LP_CMD_MASK			GENMASK(14, 8)
+#define K3_DDRSS_CFG_DENALI_CTL_160_LP_CMD_ENTRY		BIT(9)
+#define K3_DDRSS_CFG_DENALI_CTL_169				0x02a4
+#define K3_DDRSS_CFG_DENALI_CTL_169_LP_AUTO_EXIT_EN_MASK	GENMASK(27, 24)
+#define K3_DDRSS_CFG_DENALI_CTL_169_LP_AUTO_ENTRY_EN_MASK	GENMASK(19, 16)
+#define K3_DDRSS_CFG_DENALI_CTL_169_LP_STATE_MASK		GENMASK(14, 8)
+#define K3_DDRSS_CFG_DENALI_CTL_169_LP_STATE_SHIFT		8
+#define K3_DDRSS_CFG_DENALI_CTL_345				0x0564
+#define K3_DDRSS_CFG_DENALI_CTL_345_INT_STATUS_LOWPOWER_SHIFT	16
+#define K3_DDRSS_CFG_DENALI_CTL_353				0x0584
+#define K3_DDRSS_CFG_DENALI_CTL_353_INT_ACK_LOWPOWER_SHIFT	16
+#define K3_DDRSS_CFG_DENALI_PI_6				0x2018
+#define K3_DDRSS_CFG_DENALI_PI_6_PI_DFI_PHYMSTR_STATE_SEL_R	BIT(8)
+#define K3_DDRSS_CFG_DENALI_PI_146				0x2248
+#define K3_DDRSS_CFG_DENALI_PI_150				0x2258
+#define K3_DDRSS_CFG_DENALI_PI_150_PI_DRAM_INIT_EN		BIT(8)
+#define K3_DDRSS_CFG_DENALI_PHY_1820				0x5C70
+#define K3_DDRSS_CFG_DENALI_PHY_1820_SET_DFI_INPUT_2_SHIFT	16
+
+#define AM62XX_WKUP_CTRL_DDRSS_RETENTION_TIMEOUT_MS	5000
+#define K3_DDRSS_LPM_TIMEOUT_MS				5000
+
+static void k3_ddrss_reg_update_bits(void __iomem *addr, u32 offset, u32 mask, u32 set)
+{
+	u32 val = readl(addr + offset);
+
+	val &= ~mask;
+	val |= set;
+	writel(val, addr + offset);
+}
+
+void k3_ddrss_self_refresh_exit(void __iomem *ddrss_ctl_cfg)
+{
+	k3_ddrss_reg_update_bits(ddrss_ctl_cfg,
+				 K3_DDRSS_CFG_DENALI_CTL_169,
+				 K3_DDRSS_CFG_DENALI_CTL_169_LP_AUTO_EXIT_EN_MASK |
+				 K3_DDRSS_CFG_DENALI_CTL_169_LP_AUTO_ENTRY_EN_MASK,
+				 0x0);
+	k3_ddrss_reg_update_bits(ddrss_ctl_cfg,
+				 K3_DDRSS_CFG_DENALI_PHY_1820,
+				 0,
+				 BIT(2) << K3_DDRSS_CFG_DENALI_PHY_1820_SET_DFI_INPUT_2_SHIFT);
+	k3_ddrss_reg_update_bits(ddrss_ctl_cfg,
+				 K3_DDRSS_CFG_DENALI_CTL_106,
+				 0,
+				 K3_DDRSS_CFG_DENALI_CTL_106_PWRUP_SREFRESH_EXIT);
+	writel(0, ddrss_ctl_cfg + K3_DDRSS_CFG_DENALI_PI_146);
+	k3_ddrss_reg_update_bits(ddrss_ctl_cfg,
+				 K3_DDRSS_CFG_DENALI_PI_150,
+				 K3_DDRSS_CFG_DENALI_PI_150_PI_DRAM_INIT_EN,
+				 0x0);
+	k3_ddrss_reg_update_bits(ddrss_ctl_cfg,
+				 K3_DDRSS_CFG_DENALI_PI_6,
+				 0,
+				 K3_DDRSS_CFG_DENALI_PI_6_PI_DFI_PHYMSTR_STATE_SEL_R);
+	k3_ddrss_reg_update_bits(ddrss_ctl_cfg,
+				 K3_DDRSS_CFG_DENALI_CTL_21,
+				 K3_DDRSS_CFG_DENALI_CTL_21_PHY_INDEP_INIT_MODE,
+				 0);
+	k3_ddrss_reg_update_bits(ddrss_ctl_cfg,
+				 K3_DDRSS_CFG_DENALI_CTL_20,
+				 0,
+				 K3_DDRSS_CFG_DENALI_CTL_20_PHY_INDEP_TRAIN_MODE);
+}
+
+void k3_ddrss_lpm_resume(void __iomem *ddrss_ctl_cfg)
+{
+	int ret;
+	unsigned long timeout_start;
+
+	k3_ddrss_reg_update_bits(ddrss_ctl_cfg,
+				 K3_DDRSS_CFG_DENALI_CTL_160,
+				 K3_DDRSS_CFG_DENALI_CTL_160_LP_CMD_MASK,
+				 K3_DDRSS_CFG_DENALI_CTL_160_LP_CMD_ENTRY);
+	ret = wait_for_bit_32(ddrss_ctl_cfg + K3_DDRSS_CFG_DENALI_CTL_345,
+			      (1 << K3_DDRSS_CFG_DENALI_CTL_345_INT_STATUS_LOWPOWER_SHIFT),
+			      true, 5000, false);
+	if (ret)
+		panic("Failed waiting for low power command %d\n", ret);
+
+	k3_ddrss_reg_update_bits(ddrss_ctl_cfg,
+				 K3_DDRSS_CFG_DENALI_CTL_353,
+				 0,
+				 1 << K3_DDRSS_CFG_DENALI_CTL_353_INT_ACK_LOWPOWER_SHIFT);
+
+	timeout_start = get_timer(0);
+	while (1) {
+		if (get_timer(timeout_start) > K3_DDRSS_LPM_TIMEOUT_MS)
+			panic("Failed waiting for low power state\n");
+
+		if ((readl(ddrss_ctl_cfg + K3_DDRSS_CFG_DENALI_CTL_169) &
+		     K3_DDRSS_CFG_DENALI_CTL_169_LP_STATE_MASK) ==
+		    0x40 << K3_DDRSS_CFG_DENALI_CTL_169_LP_STATE_SHIFT)
+			break;
+	}
+}
+
+void am62xx_ddrss_deassert_retention(void)
+{
+	int ret;
+
+	k3_ddrss_reg_update_bits((void *)AM62XX_WKUP_CTRL_MMR0_DDR16SS_PMCTRL,
+				 0x0,
+				 AM62XX_WKUP_CTRL_MMR0_DDR16SS_PMCTRL_DATA_RET_LD |
+				 AM62XX_WKUP_CTRL_MMR0_DDR16SS_PMCTRL_DATA_RETENTION_MASK,
+				 0);
+	k3_ddrss_reg_update_bits((void *)AM62XX_WKUP_CTRL_MMR0_DDR16SS_PMCTRL,
+				 0x0,
+				 AM62XX_WKUP_CTRL_MMR0_DDR16SS_PMCTRL_DATA_RET_LD,
+				 AM62XX_WKUP_CTRL_MMR0_DDR16SS_PMCTRL_DATA_RET_LD);
+
+	ret = wait_for_bit_32((void *)AM62XX_WKUP_CTRL_MMR0_DDR16SS_PMCTRL,
+			      AM62XX_WKUP_CTRL_MMR0_DDR16SS_PMCTRL_DATA_RET_LD,
+			      true, AM62XX_WKUP_CTRL_DDRSS_RETENTION_TIMEOUT_MS, false);
+	if (ret)
+		panic("Failed waiting for latching of retention %d\n", ret);
+
+	k3_ddrss_reg_update_bits((void *)AM62XX_WKUP_CTRL_MMR0_DDR16SS_PMCTRL,
+				 0x0,
+				 AM62XX_WKUP_CTRL_MMR0_DDR16SS_PMCTRL_DATA_RET_LD,
+				 0);
+}
+
+static bool am62xx_wkup_conf_canuart_wakeup_active(void)
+{
+	u32 active;
+
+	active = readl((void *)AM62XX_WKUP_CTRL_MMR_CANUART_WAKE_STAT1);
+
+	return !!(active & AM62XX_WKUP_CTRL_MMR_CANUART_WAKE_STAT1_CANUART_IO_MODE);
+}
+
+static bool am62xx_wkup_conf_canuart_magic_word_set(void)
+{
+	u32 magic_word;
+
+	magic_word = readl((void *)AM62XX_WKUP_CTRL_MMR_CANUART_WAKE_OFF_MODE_STAT);
+
+	return magic_word == AM62XX_WKUP_CTRL_MMR_CANUART_WAKE_OFF_MODE_STAT_MW;
+}
+
+bool am62xx_wkup_conf_boot_is_resume(void)
+{
+	return IS_ENABLED(CONFIG_K3_IODDR) &&
+		am62xx_wkup_conf_canuart_wakeup_active() &&
+		am62xx_wkup_conf_canuart_magic_word_set();
+}
diff --git a/drivers/ram/k3-ddrss/k3-ddrss-lpm.h b/drivers/ram/k3-ddrss/k3-ddrss-lpm.h
new file mode 100644
index 0000000000000000000000000000000000000000..742d224327e45b926508cf6b1fb14f4f7323cd76
--- /dev/null
+++ b/drivers/ram/k3-ddrss/k3-ddrss-lpm.h
@@ -0,0 +1,20 @@
+/* SPDX-License-Identifier: GPL-2.0+ */
+/*
+ * K3 DDRSS LPM specific functions
+ *
+ * Copyright (C) 2025 Texas Instruments Incorporated - https://www.ti.com/
+ * Copyright (C) 2025 BayLibre, SAS
+ */
+
+#ifndef _K3_DDRSS_LPM_H_
+#define _K3_DDRSS_LPM_H_
+
+#include <linux/compiler_types.h>
+#include <linux/types.h>
+
+void k3_ddrss_self_refresh_exit(void __iomem *ddrss_ctl_cfg);
+void k3_ddrss_lpm_resume(void __iomem *ddrss_ctl_cfg);
+void am62xx_ddrss_deassert_retention(void);
+bool am62xx_wkup_conf_boot_is_resume(void);
+
+#endif  /* _K3_DDRSS_LPM_H_ */
diff --git a/drivers/ram/k3-ddrss/k3-ddrss.c b/drivers/ram/k3-ddrss/k3-ddrss.c
index 5144470b931384534e78fbfcea5e66b7083c9f07..27823e91d5efbd7e6629f60921aebc6c834f6989 100644
--- a/drivers/ram/k3-ddrss/k3-ddrss.c
+++ b/drivers/ram/k3-ddrss/k3-ddrss.c
@@ -20,6 +20,7 @@
 #include <wait_bit.h>
 #include <power/regulator.h>
 
+#include "k3-ddrss-lpm.h"
 #include "lpddr4_obj_if.h"
 #include "lpddr4_if.h"
 #include "lpddr4_structs_if.h"
@@ -119,6 +120,8 @@ enum intrlv_size {
 
 struct k3_ddrss_data {
 	u32 flags;
+	bool (*is_lpm_resume)(void);
+	void (*ddrss_deassert_retention)(void);
 };
 
 enum ecc_enable {
@@ -866,6 +869,7 @@ static void k3_ddrss_lpddr4_ecc_init(struct k3_ddrss_desc *ddrss)
 
 static int k3_ddrss_probe(struct udevice *dev)
 {
+	struct k3_ddrss_data *ddrss_data = (struct k3_ddrss_data *)dev_get_driver_data(dev);
 	u64 end, bank0, bank1, bank0_size;
 	int ret;
 	struct k3_ddrss_desc *ddrss = dev_get_priv(dev);
@@ -873,6 +877,7 @@ static int k3_ddrss_probe(struct udevice *dev)
 	__maybe_unused u32 inst;
 	__maybe_unused struct k3_ddrss_ecc_region *range = ddrss->ecc_ranges;
 	__maybe_unused struct k3_msmc *msmc_parent = NULL;
+	bool is_lpm_resume;
 
 	debug("%s(dev=%p)\n", __func__, dev);
 
@@ -880,6 +885,10 @@ static int k3_ddrss_probe(struct udevice *dev)
 	if (ret)
 		return ret;
 
+	is_lpm_resume = ddrss_data->is_lpm_resume && ddrss_data->is_lpm_resume();
+	if (is_lpm_resume)
+		dev_info(dev, "Detected IO+DDR resume\n");
+
 	ddrss->dev = dev;
 	ret = k3_ddrss_power_on(ddrss);
 	if (ret)
@@ -895,12 +904,21 @@ static int k3_ddrss_probe(struct udevice *dev)
 	k3_lpddr4_init(ddrss);
 	k3_lpddr4_hardware_reg_init(ddrss);
 
+	if (is_lpm_resume)
+		k3_ddrss_self_refresh_exit(ddrss->ddrss_ctl_cfg);
+
 	ret = k3_ddrss_init_freq(ddrss);
 	if (ret)
 		return ret;
 
+	if (is_lpm_resume && ddrss_data->ddrss_deassert_retention)
+		ddrss_data->ddrss_deassert_retention();
+
 	k3_lpddr4_start(ddrss);
 
+	if (is_lpm_resume)
+		k3_ddrss_lpm_resume(ddrss->ddrss_ctl_cfg);
+
 	if (IS_ENABLED(CONFIG_K3_INLINE_ECC)) {
 		if (!ddrss->ddrss_ss_cfg) {
 			printf("%s: ss_cfg is required if ecc is enabled but not provided.",
@@ -1020,12 +1038,18 @@ static const struct k3_ddrss_data k3_data = {
 	.flags = SINGLE_DDR_SUBSYSTEM,
 };
 
+static const struct k3_ddrss_data am62xx_data = {
+	.flags = SINGLE_DDR_SUBSYSTEM,
+	.is_lpm_resume = am62xx_wkup_conf_boot_is_resume,
+	.ddrss_deassert_retention = am62xx_ddrss_deassert_retention,
+};
+
 static const struct k3_ddrss_data j721s2_data = {
 	.flags = MULTI_DDR_SUBSYSTEM,
 };
 
 static const struct udevice_id k3_ddrss_ids[] = {
-	{.compatible = "ti,am62a-ddrss", .data = (ulong)&k3_data, },
+	{.compatible = "ti,am62a-ddrss", .data = (ulong)&am62xx_data, },
 	{.compatible = "ti,am64-ddrss", .data = (ulong)&k3_data, },
 	{.compatible = "ti,j721e-ddrss", .data = (ulong)&k3_data, },
 	{.compatible = "ti,j721s2-ddrss", .data = (ulong)&j721s2_data, },

-- 
2.51.0


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

* [PATCH v8 05/13] firmware: ti_sci: Add TI_SCI_MSG_MIN_CONTEXT_RESTORE
  2025-12-22 20:01 [PATCH v8 00/13] am62: IO+DDR resume support Markus Schneider-Pargmann (TI.com)
                   ` (3 preceding siblings ...)
  2025-12-22 20:01 ` [PATCH v8 04/13] ram: k3-ddrss: Add support for DDR in self-refresh Markus Schneider-Pargmann (TI.com)
@ 2025-12-22 20:01 ` Markus Schneider-Pargmann (TI.com)
  2025-12-22 20:01 ` [PATCH v8 06/13] arm: mach-k3: am62xx-lpm-common: Add lpm_resume_from_ddr Markus Schneider-Pargmann (TI.com)
                   ` (8 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Markus Schneider-Pargmann (TI.com) @ 2025-12-22 20:01 UTC (permalink / raw)
  To: Tom Rini, Sumit Garg, Nishanth Menon, Robert Nelson,
	Vignesh Raghavendra, Bryan Brattlof
  Cc: Vishal Mahaveer, Kevin Hilman, Dhruva Gole, Sebin Francis,
	Kendall Willis, Akashdeep Kaur, u-boot, Anshul Dalal, Moteen Shah,
	Santhosh Kumar K, Nathan Morrisson, Garrett Giordano,
	Judith Mendez, Aparna Patra, Jayesh Choudhary, Chintan Vankar,
	Ilias Apalodimas, Neha Malcom Francis, Prasanth Babu Mantena,
	Beleswar Padhi, Manorit Chawdhry, Andrew Davis, Wadim Egorov,
	Udit Kumar, Andrew Goodbody, E Shattow, Devarsh Thakkar, Peng Fan,
	Jerome Forissier, Sam Protsenko, Marek Vasut, Andre Przywara,
	Théo Lebrun, Markus Schneider-Pargmann (TI.com)

This patch adds code to be able to call TI_SCI_MSG_MIN_CONTEXT_RESTORE.
The context needs to be restored after booting SPL when resuming from
IO+DDR.

Signed-off-by: Markus Schneider-Pargmann (TI.com) <msp@baylibre.com>
---
 drivers/firmware/ti_sci.c              | 38 ++++++++++++++++++++++++++++++++++
 drivers/firmware/ti_sci.h              | 16 ++++++++++++++
 include/linux/soc/ti/ti_sci_protocol.h |  9 ++++++++
 3 files changed, 63 insertions(+)

diff --git a/drivers/firmware/ti_sci.c b/drivers/firmware/ti_sci.c
index 6f57dcfe8de8f874318cd53372c798d182faae73..74e4f162aaa2da8c3ecc1cf393ca11fa5108d83b 100644
--- a/drivers/firmware/ti_sci.c
+++ b/drivers/firmware/ti_sci.c
@@ -2710,6 +2710,41 @@ static int ti_sci_cmd_change_fwl_owner(const struct ti_sci_handle *handle,
 	return ret;
 }
 
+static int ti_sci_cmd_min_context_restore(const struct ti_sci_handle *handle, u64 ctx_addr)
+{
+	struct ti_sci_msg_min_restore_context_req req;
+	struct ti_sci_msg_hdr *resp;
+	struct ti_sci_info *info;
+	struct ti_sci_xfer *xfer;
+	int ret = 0;
+
+	if (IS_ERR(handle))
+		return PTR_ERR(handle);
+	if (!handle)
+		return -EINVAL;
+
+	info = handle_to_ti_sci_info(handle);
+
+	xfer = ti_sci_setup_one_xfer(info, TI_SCI_MSG_MIN_CONTEXT_RESTORE,
+				     TI_SCI_FLAG_REQ_ACK_ON_PROCESSED,
+				     (u32 *)&req, sizeof(req), sizeof(*resp));
+	if (IS_ERR(xfer)) {
+		ret = PTR_ERR(xfer);
+		return ret;
+	}
+
+	req.ctx_lo = (u32)(ctx_addr & 0xffffffff);
+	req.ctx_hi = (u32)(ctx_addr >> 32);
+
+	ret = ti_sci_do_xfer(info, xfer);
+	if (ret) {
+		dev_err(info->dev, "Failed restoring context %d\n", ret);
+		return ret;
+	}
+
+	return ret;
+}
+
 /*
  * ti_sci_setup_ops() - Setup the operations structures
  * @info:	pointer to TISCI pointer
@@ -2728,6 +2763,7 @@ static void ti_sci_setup_ops(struct ti_sci_info *info)
 	struct ti_sci_rm_psil_ops *psilops = &ops->rm_psil_ops;
 	struct ti_sci_rm_udmap_ops *udmap_ops = &ops->rm_udmap_ops;
 	struct ti_sci_fwl_ops *fwl_ops = &ops->fwl_ops;
+	struct ti_sci_lpm_ops *lpm_ops = &ops->lpm_ops;
 
 	bops->board_config = ti_sci_cmd_set_board_config;
 	bops->board_config_rm = ti_sci_cmd_set_board_config_rm;
@@ -2795,6 +2831,8 @@ static void ti_sci_setup_ops(struct ti_sci_info *info)
 
 	fw_ops->get_dm_version = ti_sci_cmd_get_dm_version;
 	fw_ops->query_dm_cap = ti_sci_cmd_query_dm_cap;
+
+	lpm_ops->min_context_restore = ti_sci_cmd_min_context_restore;
 }
 
 /**
diff --git a/drivers/firmware/ti_sci.h b/drivers/firmware/ti_sci.h
index ce50bf6800eb1fee70a872d8ae648b1a9582b681..68908c6c8c46ed2e3f0ed1ad4e764b14f0b5f465 100644
--- a/drivers/firmware/ti_sci.h
+++ b/drivers/firmware/ti_sci.h
@@ -45,6 +45,9 @@
 #define TI_SCI_MSG_QUERY_CLOCK_FREQ	0x010d
 #define TI_SCI_MSG_GET_CLOCK_FREQ	0x010e
 
+/* Low Power Mode Requests */
+#define TI_SCI_MSG_MIN_CONTEXT_RESTORE	0x0308
+
 /* Processor Control Messages */
 #define TISCI_MSG_PROC_REQUEST		0xc000
 #define TISCI_MSG_PROC_RELEASE		0xc001
@@ -1572,4 +1575,17 @@ struct ti_sci_msg_fwl_change_owner_info_resp {
 	u16			owner_permission_bits;
 } __packed;
 
+/**
+ * struct ti_sci_msg_min_restore_context_req - Request to restore context from DDR
+ *
+ * @hdr:		Generic Header
+ * @ctx_lo		Low 32-bits of physical pointer to address to use for context restore.
+ * @ctx_hi		High 32-bits of physical pointer to address to use for context restore.
+ */
+struct ti_sci_msg_min_restore_context_req {
+	struct ti_sci_msg_hdr	hdr;
+	u32			ctx_lo;
+	u32			ctx_hi;
+} __packed;
+
 #endif /* __TI_SCI_H */
diff --git a/include/linux/soc/ti/ti_sci_protocol.h b/include/linux/soc/ti/ti_sci_protocol.h
index 52696763ecf6bc2336e796978e1cc02896db13ab..6b1dd801f5f8ec5f6bce3490401a71b24954a2ff 100644
--- a/include/linux/soc/ti/ti_sci_protocol.h
+++ b/include/linux/soc/ti/ti_sci_protocol.h
@@ -632,6 +632,14 @@ struct ti_sci_fwl_ops {
 	int (*change_fwl_owner)(const struct ti_sci_handle *handle, struct ti_sci_msg_fwl_owner *owner);
 };
 
+/**
+ * struct ti_sci_lpm_ops - Low Power Mode operations
+ * @min_context_restore: Request restoring context from DDR.
+ */
+struct ti_sci_lpm_ops {
+	int (*min_context_restore)(const struct ti_sci_handle *handle, u64 ctx_addr);
+};
+
 /**
  * struct ti_sci_ops - Function support for TI SCI
  * @board_ops:	Miscellaneous operations
@@ -654,6 +662,7 @@ struct ti_sci_ops {
 	struct ti_sci_rm_psil_ops rm_psil_ops;
 	struct ti_sci_rm_udmap_ops rm_udmap_ops;
 	struct ti_sci_fwl_ops fwl_ops;
+	struct ti_sci_lpm_ops lpm_ops;
 };
 
 /**

-- 
2.51.0


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

* [PATCH v8 06/13] arm: mach-k3: am62xx-lpm-common: Add lpm_resume_from_ddr
  2025-12-22 20:01 [PATCH v8 00/13] am62: IO+DDR resume support Markus Schneider-Pargmann (TI.com)
                   ` (4 preceding siblings ...)
  2025-12-22 20:01 ` [PATCH v8 05/13] firmware: ti_sci: Add TI_SCI_MSG_MIN_CONTEXT_RESTORE Markus Schneider-Pargmann (TI.com)
@ 2025-12-22 20:01 ` Markus Schneider-Pargmann (TI.com)
  2025-12-22 20:01 ` [PATCH v8 07/13] arm: mach-k3: am62xx-lpm-common: Helper for LPM meta data address from DT Markus Schneider-Pargmann (TI.com)
                   ` (7 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Markus Schneider-Pargmann (TI.com) @ 2025-12-22 20:01 UTC (permalink / raw)
  To: Tom Rini, Sumit Garg, Nishanth Menon, Robert Nelson,
	Vignesh Raghavendra, Bryan Brattlof
  Cc: Vishal Mahaveer, Kevin Hilman, Dhruva Gole, Sebin Francis,
	Kendall Willis, Akashdeep Kaur, u-boot, Anshul Dalal, Moteen Shah,
	Santhosh Kumar K, Nathan Morrisson, Garrett Giordano,
	Judith Mendez, Aparna Patra, Jayesh Choudhary, Chintan Vankar,
	Ilias Apalodimas, Neha Malcom Francis, Prasanth Babu Mantena,
	Beleswar Padhi, Manorit Chawdhry, Andrew Davis, Wadim Egorov,
	Udit Kumar, Andrew Goodbody, E Shattow, Devarsh Thakkar, Peng Fan,
	Jerome Forissier, Sam Protsenko, Marek Vasut, Andre Przywara,
	Théo Lebrun, Markus Schneider-Pargmann (TI.com)

This is a common function that helps to resume from DDR. There are two
pointers which are fetched from DDR to resume, the TIFS context pointer
which points to the context in DDR. There is another pointer to the DM
loadaddr to jump back into DM.

Signed-off-by: Markus Schneider-Pargmann (TI.com) <msp@baylibre.com>
---
 arch/arm/mach-k3/am62xx-lpm-common.c | 52 ++++++++++++++++++++++++++++++++++++
 arch/arm/mach-k3/am62xx-lpm-common.h |  1 +
 2 files changed, 53 insertions(+)

diff --git a/arch/arm/mach-k3/am62xx-lpm-common.c b/arch/arm/mach-k3/am62xx-lpm-common.c
index 54d86b0474df691e8568a9c38530c56cc1eb3a0a..fa068c60ce9ccf9cec89aeae1d224b07091a3298 100644
--- a/arch/arm/mach-k3/am62xx-lpm-common.c
+++ b/arch/arm/mach-k3/am62xx-lpm-common.c
@@ -9,9 +9,12 @@
 #include <config.h>
 #include <asm/arch/hardware.h>
 #include <asm/io.h>
+#include <linux/soc/ti/ti_sci_protocol.h>
+#include <vsprintf.h>
 #include <wait_bit.h>
 
 #include "am62xx-lpm-common.h"
+#include "common.h"
 
 /*
  * Shared WKUP_CTRL_MMR0 definitions used to remove IO isolation
@@ -121,3 +124,52 @@ int __maybe_unused wkup_ctrl_remove_can_io_isolation_if_set(void)
 		return wkup_ctrl_remove_can_io_isolation();
 	return 0;
 }
+
+#if IS_ENABLED(CONFIG_K3_IODDR)
+static int lpm_restore_context(u64 ctx_addr)
+{
+	struct ti_sci_handle *ti_sci = get_ti_sci_handle();
+	int ret;
+
+	ret = ti_sci->ops.lpm_ops.min_context_restore(ti_sci, ctx_addr);
+	if (ret)
+		printf("Failed to restore context from DDR %d\n", ret);
+
+	return ret;
+}
+
+struct lpm_meta_data {
+	u64 dm_jump_address;
+	u64 tifs_context_save_address;
+	u64 reserved[30];
+} __packed;
+
+void __noreturn lpm_resume_from_ddr(u64 meta_data_addr)
+{
+	struct lpm_meta_data lpm_data = *(struct lpm_meta_data *)(uintptr_t)meta_data_addr;
+	typedef void __noreturn (*image_entry_noargs_t)(void);
+	image_entry_noargs_t image_entry;
+	int ret;
+
+	ret = lpm_restore_context(lpm_data.tifs_context_save_address);
+	if (ret)
+		panic("Failed to restore context from 0x%x%08x\n",
+		      (u32)(lpm_data.tifs_context_save_address >> 32),
+		      (u32)lpm_data.tifs_context_save_address);
+
+	image_entry = (image_entry_noargs_t)(uintptr_t)lpm_data.dm_jump_address;
+	printf("Resuming from DDR, jumping to stored DM loadaddr 0x%x%08x, TIFS context restored from 0x%x%08x\n",
+	       (u32)(lpm_data.dm_jump_address >> 32),
+	       (u32)lpm_data.dm_jump_address,
+	       (u32)(lpm_data.tifs_context_save_address >> 32),
+	       (u32)lpm_data.tifs_context_save_address);
+
+	image_entry();
+}
+#else
+
+void __noreturn lpm_resume_from_ddr(u64 meta_data_addr)
+{
+	panic("No IO+DDR support");
+}
+#endif
diff --git a/arch/arm/mach-k3/am62xx-lpm-common.h b/arch/arm/mach-k3/am62xx-lpm-common.h
index 2d110bcca0fc74ecd5424ae288d43519d0c05908..d5793759da4a05d355f5d88fbd8e103ebc46f9cc 100644
--- a/arch/arm/mach-k3/am62xx-lpm-common.h
+++ b/arch/arm/mach-k3/am62xx-lpm-common.h
@@ -13,5 +13,6 @@
 
 bool wkup_ctrl_is_lpm_exit(void);
 int wkup_ctrl_remove_can_io_isolation_if_set(void);
+void lpm_resume_from_ddr(u64 meta_data_addr);
 
 #endif  /* _AM62XX_LPM_COMMON_H_ */

-- 
2.51.0


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

* [PATCH v8 07/13] arm: mach-k3: am62xx-lpm-common: Helper for LPM meta data address from DT
  2025-12-22 20:01 [PATCH v8 00/13] am62: IO+DDR resume support Markus Schneider-Pargmann (TI.com)
                   ` (5 preceding siblings ...)
  2025-12-22 20:01 ` [PATCH v8 06/13] arm: mach-k3: am62xx-lpm-common: Add lpm_resume_from_ddr Markus Schneider-Pargmann (TI.com)
@ 2025-12-22 20:01 ` Markus Schneider-Pargmann (TI.com)
  2025-12-22 20:01 ` [PATCH v8 08/13] arm: mach-k3: am62a7_init: Resume on LPM exit Markus Schneider-Pargmann (TI.com)
                   ` (6 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Markus Schneider-Pargmann (TI.com) @ 2025-12-22 20:01 UTC (permalink / raw)
  To: Tom Rini, Sumit Garg, Nishanth Menon, Robert Nelson,
	Vignesh Raghavendra, Bryan Brattlof
  Cc: Vishal Mahaveer, Kevin Hilman, Dhruva Gole, Sebin Francis,
	Kendall Willis, Akashdeep Kaur, u-boot, Anshul Dalal, Moteen Shah,
	Santhosh Kumar K, Nathan Morrisson, Garrett Giordano,
	Judith Mendez, Aparna Patra, Jayesh Choudhary, Chintan Vankar,
	Ilias Apalodimas, Neha Malcom Francis, Prasanth Babu Mantena,
	Beleswar Padhi, Manorit Chawdhry, Andrew Davis, Wadim Egorov,
	Udit Kumar, Andrew Goodbody, E Shattow, Devarsh Thakkar, Peng Fan,
	Jerome Forissier, Sam Protsenko, Marek Vasut, Andre Przywara,
	Théo Lebrun, Markus Schneider-Pargmann (TI.com)

Add a small helper that uses memory regions referenced by the R5
devicetree node to calculate the LPM meta data address.

Signed-off-by: Markus Schneider-Pargmann (TI.com) <msp@baylibre.com>
---
 arch/arm/mach-k3/am62xx-lpm-common.c | 45 ++++++++++++++++++++++++++++++++++++
 arch/arm/mach-k3/am62xx-lpm-common.h |  1 +
 2 files changed, 46 insertions(+)

diff --git a/arch/arm/mach-k3/am62xx-lpm-common.c b/arch/arm/mach-k3/am62xx-lpm-common.c
index fa068c60ce9ccf9cec89aeae1d224b07091a3298..6870395aec838949b5c25a32262a6c30e6c88d2e 100644
--- a/arch/arm/mach-k3/am62xx-lpm-common.c
+++ b/arch/arm/mach-k3/am62xx-lpm-common.c
@@ -9,6 +9,8 @@
 #include <config.h>
 #include <asm/arch/hardware.h>
 #include <asm/io.h>
+#include <dm/of_access.h>
+#include <dm/ofnode.h>
 #include <linux/soc/ti/ti_sci_protocol.h>
 #include <vsprintf.h>
 #include <wait_bit.h>
@@ -48,6 +50,8 @@
 #define WKUP_CTRL_MMR_CANUART_WAKE_OFF_MODE_STAT		0x18318
 #define WKUP_CTRL_MMR_CANUART_WAKE_OFF_MODE_STAT_MW		0x555555
 
+#define K3_R5_MEMREGION_LPM_METADATA_OFFSET	0x108000
+
 #define CLKSTOP_TRANSITION_TIMEOUT_MS	10
 
 static int wkup_ctrl_remove_can_io_isolation(void)
@@ -126,6 +130,43 @@ int __maybe_unused wkup_ctrl_remove_can_io_isolation_if_set(void)
 }
 
 #if IS_ENABLED(CONFIG_K3_IODDR)
+int wkup_r5f_am62_lpm_meta_data_addr(u64 *meta_data_addr)
+{
+	struct ofnode_phandle_args memregion_phandle;
+	ofnode memregion;
+	ofnode wkup_bus;
+	int ret;
+
+	wkup_bus = ofnode_path("/bus@f0000/bus@b00000");
+	if (!ofnode_valid(wkup_bus)) {
+		printf("Failed to find wkup bus\n");
+		return -EINVAL;
+	}
+
+	memregion = ofnode_by_compatible(wkup_bus, "ti,am62-r5f");
+	if (!ofnode_valid(memregion)) {
+		printf("Failed to find r5f devicetree node ti,am62-r5f\n");
+		return -EINVAL;
+	}
+
+	ret = ofnode_parse_phandle_with_args(memregion, "memory-region", NULL,
+					     0, 1, &memregion_phandle);
+	if (ret) {
+		printf("Failed to parse phandle for second memory region\n");
+		return ret;
+	}
+
+	ret = ofnode_read_u64_index(memregion_phandle.node, "reg", 0, meta_data_addr);
+	if (ret) {
+		printf("Failed to read memory region offset\n");
+		return ret;
+	}
+
+	*meta_data_addr += K3_R5_MEMREGION_LPM_METADATA_OFFSET;
+
+	return 0;
+}
+
 static int lpm_restore_context(u64 ctx_addr)
 {
 	struct ti_sci_handle *ti_sci = get_ti_sci_handle();
@@ -167,6 +208,10 @@ void __noreturn lpm_resume_from_ddr(u64 meta_data_addr)
 	image_entry();
 }
 #else
+int wkup_r5f_am62_lpm_meta_data_addr(u64 *meta_data_addr)
+{
+	return -EINVAL;
+}
 
 void __noreturn lpm_resume_from_ddr(u64 meta_data_addr)
 {
diff --git a/arch/arm/mach-k3/am62xx-lpm-common.h b/arch/arm/mach-k3/am62xx-lpm-common.h
index d5793759da4a05d355f5d88fbd8e103ebc46f9cc..741e3ccbcbd082da9d11c61624df8a4f456fd724 100644
--- a/arch/arm/mach-k3/am62xx-lpm-common.h
+++ b/arch/arm/mach-k3/am62xx-lpm-common.h
@@ -13,6 +13,7 @@
 
 bool wkup_ctrl_is_lpm_exit(void);
 int wkup_ctrl_remove_can_io_isolation_if_set(void);
+int wkup_r5f_am62_lpm_meta_data_addr(u64 *meta_data_addr);
 void lpm_resume_from_ddr(u64 meta_data_addr);
 
 #endif  /* _AM62XX_LPM_COMMON_H_ */

-- 
2.51.0


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

* [PATCH v8 08/13] arm: mach-k3: am62a7_init: Resume on LPM exit
  2025-12-22 20:01 [PATCH v8 00/13] am62: IO+DDR resume support Markus Schneider-Pargmann (TI.com)
                   ` (6 preceding siblings ...)
  2025-12-22 20:01 ` [PATCH v8 07/13] arm: mach-k3: am62xx-lpm-common: Helper for LPM meta data address from DT Markus Schneider-Pargmann (TI.com)
@ 2025-12-22 20:01 ` Markus Schneider-Pargmann (TI.com)
  2025-12-23  8:10   ` Kumar, Udit
  2025-12-22 20:01 ` [PATCH v8 09/13] arm: mach-k3: am62p5_init: " Markus Schneider-Pargmann (TI.com)
                   ` (5 subsequent siblings)
  13 siblings, 1 reply; 18+ messages in thread
From: Markus Schneider-Pargmann (TI.com) @ 2025-12-22 20:01 UTC (permalink / raw)
  To: Tom Rini, Sumit Garg, Nishanth Menon, Robert Nelson,
	Vignesh Raghavendra, Bryan Brattlof
  Cc: Vishal Mahaveer, Kevin Hilman, Dhruva Gole, Sebin Francis,
	Kendall Willis, Akashdeep Kaur, u-boot, Anshul Dalal, Moteen Shah,
	Santhosh Kumar K, Nathan Morrisson, Garrett Giordano,
	Judith Mendez, Aparna Patra, Jayesh Choudhary, Chintan Vankar,
	Ilias Apalodimas, Neha Malcom Francis, Prasanth Babu Mantena,
	Beleswar Padhi, Manorit Chawdhry, Andrew Davis, Wadim Egorov,
	Udit Kumar, Andrew Goodbody, E Shattow, Devarsh Thakkar, Peng Fan,
	Jerome Forissier, Sam Protsenko, Marek Vasut, Andre Przywara,
	Théo Lebrun, Markus Schneider-Pargmann (TI.com)

When exiting a low power mode with DDR self-refresh, we can directly
resume after DDR setup is done. Call the common function to resume.

Signed-off-by: Markus Schneider-Pargmann (TI.com) <msp@baylibre.com>
---
 arch/arm/mach-k3/am62ax/am62a7_init.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/mach-k3/am62ax/am62a7_init.c b/arch/arm/mach-k3/am62ax/am62a7_init.c
index c1c7d669a45f53b7528c80d44bf9b914fed1cc10..51b0386853b065d62cd0ecac589e316de5ab4038 100644
--- a/arch/arm/mach-k3/am62ax/am62a7_init.c
+++ b/arch/arm/mach-k3/am62ax/am62a7_init.c
@@ -198,6 +198,15 @@ void board_init_f(ulong dummy)
 	ret = uclass_get_device(UCLASS_RAM, 0, &dev);
 	if (ret)
 		panic("DRAM init failed: %d\n", ret);
+
+	if (wkup_ctrl_is_lpm_exit()) {
+		u64 meta_data_addr;
+
+		ret = wkup_r5f_am62_lpm_meta_data_addr(&meta_data_addr);
+		if (ret)
+			panic("Failed to get LPM meta data address %d\n", ret);
+		lpm_resume_from_ddr(meta_data_addr);
+	}
 #endif
 	spl_enable_cache();
 

-- 
2.51.0


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

* [PATCH v8 09/13] arm: mach-k3: am62p5_init: Resume on LPM exit
  2025-12-22 20:01 [PATCH v8 00/13] am62: IO+DDR resume support Markus Schneider-Pargmann (TI.com)
                   ` (7 preceding siblings ...)
  2025-12-22 20:01 ` [PATCH v8 08/13] arm: mach-k3: am62a7_init: Resume on LPM exit Markus Schneider-Pargmann (TI.com)
@ 2025-12-22 20:01 ` Markus Schneider-Pargmann (TI.com)
  2025-12-23  8:13   ` Kumar, Udit
  2025-12-22 20:01 ` [PATCH v8 10/13] arm: dts: k3-am62a: Add r5 device nodes Markus Schneider-Pargmann (TI.com)
                   ` (4 subsequent siblings)
  13 siblings, 1 reply; 18+ messages in thread
From: Markus Schneider-Pargmann (TI.com) @ 2025-12-22 20:01 UTC (permalink / raw)
  To: Tom Rini, Sumit Garg, Nishanth Menon, Robert Nelson,
	Vignesh Raghavendra, Bryan Brattlof
  Cc: Vishal Mahaveer, Kevin Hilman, Dhruva Gole, Sebin Francis,
	Kendall Willis, Akashdeep Kaur, u-boot, Anshul Dalal, Moteen Shah,
	Santhosh Kumar K, Nathan Morrisson, Garrett Giordano,
	Judith Mendez, Aparna Patra, Jayesh Choudhary, Chintan Vankar,
	Ilias Apalodimas, Neha Malcom Francis, Prasanth Babu Mantena,
	Beleswar Padhi, Manorit Chawdhry, Andrew Davis, Wadim Egorov,
	Udit Kumar, Andrew Goodbody, E Shattow, Devarsh Thakkar, Peng Fan,
	Jerome Forissier, Sam Protsenko, Marek Vasut, Andre Przywara,
	Théo Lebrun, Markus Schneider-Pargmann (TI.com)

When exiting a low power mode with DDR self-refresh, we can directly
resume after DDR setup is done. Call the common function to resume.

Signed-off-by: Markus Schneider-Pargmann (TI.com) <msp@baylibre.com>
---
 arch/arm/mach-k3/am62px/am62p5_init.c | 9 +++++++++
 1 file changed, 9 insertions(+)

diff --git a/arch/arm/mach-k3/am62px/am62p5_init.c b/arch/arm/mach-k3/am62px/am62p5_init.c
index a74fe3d23d7c4b66ac95aa5a01c2a32a586e9ced..63cc9827b6a178d36f054400772417411cb508f5 100644
--- a/arch/arm/mach-k3/am62px/am62p5_init.c
+++ b/arch/arm/mach-k3/am62px/am62p5_init.c
@@ -253,6 +253,15 @@ void board_init_f(ulong dummy)
 		enable_mcu_esm_reset();
 	}
 
+	if (wkup_ctrl_is_lpm_exit()) {
+		u64 meta_data_addr;
+
+		ret = wkup_r5f_am62_lpm_meta_data_addr(&meta_data_addr);
+		if (ret)
+			panic("Failed to get LPM meta data address %d\n", ret);
+		lpm_resume_from_ddr(meta_data_addr);
+	}
+
 	spl_enable_cache();
 
 	setup_qos();

-- 
2.51.0


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

* [PATCH v8 10/13] arm: dts: k3-am62a: Add r5 device nodes
  2025-12-22 20:01 [PATCH v8 00/13] am62: IO+DDR resume support Markus Schneider-Pargmann (TI.com)
                   ` (8 preceding siblings ...)
  2025-12-22 20:01 ` [PATCH v8 09/13] arm: mach-k3: am62p5_init: " Markus Schneider-Pargmann (TI.com)
@ 2025-12-22 20:01 ` Markus Schneider-Pargmann (TI.com)
  2025-12-22 20:01 ` [PATCH v8 11/13] arm: dts: k3-am62p: " Markus Schneider-Pargmann (TI.com)
                   ` (3 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Markus Schneider-Pargmann (TI.com) @ 2025-12-22 20:01 UTC (permalink / raw)
  To: Tom Rini, Sumit Garg, Nishanth Menon, Robert Nelson,
	Vignesh Raghavendra, Bryan Brattlof
  Cc: Vishal Mahaveer, Kevin Hilman, Dhruva Gole, Sebin Francis,
	Kendall Willis, Akashdeep Kaur, u-boot, Anshul Dalal, Moteen Shah,
	Santhosh Kumar K, Nathan Morrisson, Garrett Giordano,
	Judith Mendez, Aparna Patra, Jayesh Choudhary, Chintan Vankar,
	Ilias Apalodimas, Neha Malcom Francis, Prasanth Babu Mantena,
	Beleswar Padhi, Manorit Chawdhry, Andrew Davis, Wadim Egorov,
	Udit Kumar, Andrew Goodbody, E Shattow, Devarsh Thakkar, Peng Fan,
	Jerome Forissier, Sam Protsenko, Marek Vasut, Andre Przywara,
	Théo Lebrun, Markus Schneider-Pargmann (TI.com)

These are needed in SPL to be able to resume from DDR immediately after
booting from IO+DDR.

Reviewed-by: Udit Kumar <u-kumar1@ti.com>
Signed-off-by: Markus Schneider-Pargmann (TI.com) <msp@baylibre.com>
---
 arch/arm/dts/k3-am62a7-sk-u-boot.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/dts/k3-am62a7-sk-u-boot.dtsi b/arch/arm/dts/k3-am62a7-sk-u-boot.dtsi
index a70fc88317e04de032e4da1428e25eb78ecc30cf..84f3a5c199b344d17300b9672cb9c77f607beb6c 100644
--- a/arch/arm/dts/k3-am62a7-sk-u-boot.dtsi
+++ b/arch/arm/dts/k3-am62a7-sk-u-boot.dtsi
@@ -16,6 +16,10 @@
 	};
 };
 
+&wkup_r5fss0_core0_memory_region {
+	bootph-pre-ram;
+};
+
 &cbass_main {
 	bootph-all;
 };
@@ -68,6 +72,10 @@
 	bootph-all;
 };
 
+&wkup_r5fss0_core0 {
+	bootph-pre-ram;
+};
+
 &cbass_wakeup {
 	bootph-all;
 };

-- 
2.51.0


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

* [PATCH v8 11/13] arm: dts: k3-am62p: Add r5 device nodes
  2025-12-22 20:01 [PATCH v8 00/13] am62: IO+DDR resume support Markus Schneider-Pargmann (TI.com)
                   ` (9 preceding siblings ...)
  2025-12-22 20:01 ` [PATCH v8 10/13] arm: dts: k3-am62a: Add r5 device nodes Markus Schneider-Pargmann (TI.com)
@ 2025-12-22 20:01 ` Markus Schneider-Pargmann (TI.com)
  2025-12-22 20:01 ` [PATCH v8 12/13] configs: am62ax_evm_r5: Enable IODDR resume support Markus Schneider-Pargmann (TI.com)
                   ` (2 subsequent siblings)
  13 siblings, 0 replies; 18+ messages in thread
From: Markus Schneider-Pargmann (TI.com) @ 2025-12-22 20:01 UTC (permalink / raw)
  To: Tom Rini, Sumit Garg, Nishanth Menon, Robert Nelson,
	Vignesh Raghavendra, Bryan Brattlof
  Cc: Vishal Mahaveer, Kevin Hilman, Dhruva Gole, Sebin Francis,
	Kendall Willis, Akashdeep Kaur, u-boot, Anshul Dalal, Moteen Shah,
	Santhosh Kumar K, Nathan Morrisson, Garrett Giordano,
	Judith Mendez, Aparna Patra, Jayesh Choudhary, Chintan Vankar,
	Ilias Apalodimas, Neha Malcom Francis, Prasanth Babu Mantena,
	Beleswar Padhi, Manorit Chawdhry, Andrew Davis, Wadim Egorov,
	Udit Kumar, Andrew Goodbody, E Shattow, Devarsh Thakkar, Peng Fan,
	Jerome Forissier, Sam Protsenko, Marek Vasut, Andre Przywara,
	Théo Lebrun, Markus Schneider-Pargmann (TI.com)

These are needed in SPL to be able to resume from DDR immediately after
booting from IO+DDR.

Reviewed-by: Udit Kumar <u-kumar1@ti.com>
Signed-off-by: Markus Schneider-Pargmann (TI.com) <msp@baylibre.com>
---
 arch/arm/dts/k3-am62p5-sk-u-boot.dtsi | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/arch/arm/dts/k3-am62p5-sk-u-boot.dtsi b/arch/arm/dts/k3-am62p5-sk-u-boot.dtsi
index cf087c6e343a8af6f4bb2093bb6c3f28395a2686..26133d818973214914f68838f678dda5aba63970 100644
--- a/arch/arm/dts/k3-am62p5-sk-u-boot.dtsi
+++ b/arch/arm/dts/k3-am62p5-sk-u-boot.dtsi
@@ -13,6 +13,14 @@
 	};
 };
 
+&wkup_r5fss0_core0_memory_region {
+	bootph-pre-ram;
+};
+
 &dmsc {
 	bootph-pre-ram;
 };
+
+&wkup_r5fss0_core0 {
+	bootph-pre-ram;
+};

-- 
2.51.0


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

* [PATCH v8 12/13] configs: am62ax_evm_r5: Enable IODDR resume support
  2025-12-22 20:01 [PATCH v8 00/13] am62: IO+DDR resume support Markus Schneider-Pargmann (TI.com)
                   ` (10 preceding siblings ...)
  2025-12-22 20:01 ` [PATCH v8 11/13] arm: dts: k3-am62p: " Markus Schneider-Pargmann (TI.com)
@ 2025-12-22 20:01 ` Markus Schneider-Pargmann (TI.com)
  2025-12-22 20:01 ` [PATCH v8 13/13] configs: am62p_evm_r5_defconfig: " Markus Schneider-Pargmann (TI.com)
  2025-12-23  8:17 ` [PATCH v8 00/13] am62: IO+DDR " Kumar, Udit
  13 siblings, 0 replies; 18+ messages in thread
From: Markus Schneider-Pargmann (TI.com) @ 2025-12-22 20:01 UTC (permalink / raw)
  To: Tom Rini, Sumit Garg, Nishanth Menon, Robert Nelson,
	Vignesh Raghavendra, Bryan Brattlof
  Cc: Vishal Mahaveer, Kevin Hilman, Dhruva Gole, Sebin Francis,
	Kendall Willis, Akashdeep Kaur, u-boot, Anshul Dalal, Moteen Shah,
	Santhosh Kumar K, Nathan Morrisson, Garrett Giordano,
	Judith Mendez, Aparna Patra, Jayesh Choudhary, Chintan Vankar,
	Ilias Apalodimas, Neha Malcom Francis, Prasanth Babu Mantena,
	Beleswar Padhi, Manorit Chawdhry, Andrew Davis, Wadim Egorov,
	Udit Kumar, Andrew Goodbody, E Shattow, Devarsh Thakkar, Peng Fan,
	Jerome Forissier, Sam Protsenko, Marek Vasut, Andre Przywara,
	Théo Lebrun, Markus Schneider-Pargmann (TI.com)

Enable K3_IODDR to enable support to resume from DDR after exiting
IO+DDR.

Reviewed-by: Kendall Willis <k-willis@ti.com>
Reviewed-by: Udit Kumar <u-kumar1@ti.com>
Signed-off-by: Markus Schneider-Pargmann (TI.com) <msp@baylibre.com>
---
 configs/am62ax_evm_r5_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/am62ax_evm_r5_defconfig b/configs/am62ax_evm_r5_defconfig
index 64886986c4264a5d9272228e468f7057c195593a..3a9f382193532dc3b712a1bd3fa16a9c0de3fedb 100644
--- a/configs/am62ax_evm_r5_defconfig
+++ b/configs/am62ax_evm_r5_defconfig
@@ -106,3 +106,4 @@ CONFIG_SPL_TIMER=y
 CONFIG_OMAP_TIMER=y
 CONFIG_LIB_RATIONAL=y
 CONFIG_SPL_LIB_RATIONAL=y
+CONFIG_K3_IODDR=y

-- 
2.51.0


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

* [PATCH v8 13/13] configs: am62p_evm_r5_defconfig: Enable IODDR resume support
  2025-12-22 20:01 [PATCH v8 00/13] am62: IO+DDR resume support Markus Schneider-Pargmann (TI.com)
                   ` (11 preceding siblings ...)
  2025-12-22 20:01 ` [PATCH v8 12/13] configs: am62ax_evm_r5: Enable IODDR resume support Markus Schneider-Pargmann (TI.com)
@ 2025-12-22 20:01 ` Markus Schneider-Pargmann (TI.com)
  2025-12-23  8:17 ` [PATCH v8 00/13] am62: IO+DDR " Kumar, Udit
  13 siblings, 0 replies; 18+ messages in thread
From: Markus Schneider-Pargmann (TI.com) @ 2025-12-22 20:01 UTC (permalink / raw)
  To: Tom Rini, Sumit Garg, Nishanth Menon, Robert Nelson,
	Vignesh Raghavendra, Bryan Brattlof
  Cc: Vishal Mahaveer, Kevin Hilman, Dhruva Gole, Sebin Francis,
	Kendall Willis, Akashdeep Kaur, u-boot, Anshul Dalal, Moteen Shah,
	Santhosh Kumar K, Nathan Morrisson, Garrett Giordano,
	Judith Mendez, Aparna Patra, Jayesh Choudhary, Chintan Vankar,
	Ilias Apalodimas, Neha Malcom Francis, Prasanth Babu Mantena,
	Beleswar Padhi, Manorit Chawdhry, Andrew Davis, Wadim Egorov,
	Udit Kumar, Andrew Goodbody, E Shattow, Devarsh Thakkar, Peng Fan,
	Jerome Forissier, Sam Protsenko, Marek Vasut, Andre Przywara,
	Théo Lebrun, Markus Schneider-Pargmann (TI.com)

Enable K3_IODDR to enable support to resume from DDR after exiting
IO+DDR.

Reviewed-by: Kendall Willis <k-willis@ti.com>
Reviewed-by: Udit Kumar <u-kumar1@ti.com>
Signed-off-by: Markus Schneider-Pargmann (TI.com) <msp@baylibre.com>
---
 configs/am62px_evm_r5_defconfig | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configs/am62px_evm_r5_defconfig b/configs/am62px_evm_r5_defconfig
index c9592d7b6c4cc037a886fe81385791269a825aa3..39e8093597352e6ed3fb67ac59e0494239a51352 100644
--- a/configs/am62px_evm_r5_defconfig
+++ b/configs/am62px_evm_r5_defconfig
@@ -123,3 +123,4 @@ CONFIG_SPL_TIMER=y
 CONFIG_OMAP_TIMER=y
 CONFIG_LIB_RATIONAL=y
 CONFIG_SPL_LIB_RATIONAL=y
+CONFIG_K3_IODDR=y

-- 
2.51.0


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

* Re: [PATCH v8 08/13] arm: mach-k3: am62a7_init: Resume on LPM exit
  2025-12-22 20:01 ` [PATCH v8 08/13] arm: mach-k3: am62a7_init: Resume on LPM exit Markus Schneider-Pargmann (TI.com)
@ 2025-12-23  8:10   ` Kumar, Udit
  2026-01-05 15:44     ` Markus Schneider-Pargmann
  0 siblings, 1 reply; 18+ messages in thread
From: Kumar, Udit @ 2025-12-23  8:10 UTC (permalink / raw)
  To: Markus Schneider-Pargmann (TI.com), Tom Rini, Sumit Garg,
	Nishanth Menon, Robert Nelson, Vignesh Raghavendra,
	Bryan Brattlof
  Cc: Vishal Mahaveer, Kevin Hilman, Dhruva Gole, Sebin Francis,
	Kendall Willis, Akashdeep Kaur, u-boot, Anshul Dalal, Moteen Shah,
	Santhosh Kumar K, Nathan Morrisson, Garrett Giordano,
	Judith Mendez, Aparna Patra, Jayesh Choudhary, Chintan Vankar,
	Ilias Apalodimas, Neha Malcom Francis, Prasanth Babu Mantena,
	Beleswar Padhi, Manorit Chawdhry, Andrew Davis, Wadim Egorov,
	Andrew Goodbody, E Shattow, Devarsh Thakkar, Peng Fan,
	Jerome Forissier, Sam Protsenko, Marek Vasut, Andre Przywara,
	Théo Lebrun

Hi Markus

On 12/23/2025 1:31 AM, Markus Schneider-Pargmann (TI.com) wrote:
> When exiting a low power mode with DDR self-refresh, we can directly
> resume after DDR setup is done. Call the common function to resume.
>
> Signed-off-by: Markus Schneider-Pargmann (TI.com) <msp@baylibre.com>
> ---
>   arch/arm/mach-k3/am62ax/am62a7_init.c | 9 +++++++++
>   1 file changed, 9 insertions(+)
>
> diff --git a/arch/arm/mach-k3/am62ax/am62a7_init.c b/arch/arm/mach-k3/am62ax/am62a7_init.c
> index c1c7d669a45f53b7528c80d44bf9b914fed1cc10..51b0386853b065d62cd0ecac589e316de5ab4038 100644
> --- a/arch/arm/mach-k3/am62ax/am62a7_init.c
> +++ b/arch/arm/mach-k3/am62ax/am62a7_init.c
> @@ -198,6 +198,15 @@ void board_init_f(ulong dummy)
>   	ret = uclass_get_device(UCLASS_RAM, 0, &dev);
>   	if (ret)
>   		panic("DRAM init failed: %d\n", ret);
> +
> +	if (wkup_ctrl_is_lpm_exit()) {
> +		u64 meta_data_addr;
> +
> +		ret = wkup_r5f_am62_lpm_meta_data_addr(&meta_data_addr);
> +		if (ret)
> +			panic("Failed to get LPM meta data address %d\n", ret);
> +		lpm_resume_from_ddr(meta_data_addr);
> +	}

Could you help, how qos will be set after s2r

see 
https://lore.kernel.org/all/5058275b-a198-43b1-a040-df330775f695@ti.com/ 
as well


>   #endif
>   	spl_enable_cache();
>   
>

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

* Re: [PATCH v8 09/13] arm: mach-k3: am62p5_init: Resume on LPM exit
  2025-12-22 20:01 ` [PATCH v8 09/13] arm: mach-k3: am62p5_init: " Markus Schneider-Pargmann (TI.com)
@ 2025-12-23  8:13   ` Kumar, Udit
  0 siblings, 0 replies; 18+ messages in thread
From: Kumar, Udit @ 2025-12-23  8:13 UTC (permalink / raw)
  To: Markus Schneider-Pargmann (TI.com), Tom Rini, Sumit Garg,
	Nishanth Menon, Robert Nelson, Vignesh Raghavendra,
	Bryan Brattlof
  Cc: Vishal Mahaveer, Kevin Hilman, Dhruva Gole, Sebin Francis,
	Kendall Willis, Akashdeep Kaur, u-boot, Anshul Dalal, Moteen Shah,
	Santhosh Kumar K, Nathan Morrisson, Garrett Giordano,
	Judith Mendez, Aparna Patra, Jayesh Choudhary, Chintan Vankar,
	Ilias Apalodimas, Neha Malcom Francis, Prasanth Babu Mantena,
	Beleswar Padhi, Manorit Chawdhry, Andrew Davis, Wadim Egorov,
	Andrew Goodbody, E Shattow, Devarsh Thakkar, Peng Fan,
	Jerome Forissier, Sam Protsenko, Marek Vasut, Andre Przywara,
	Théo Lebrun

Hi Markus,

On 12/23/2025 1:31 AM, Markus Schneider-Pargmann (TI.com) wrote:
> When exiting a low power mode with DDR self-refresh, we can directly
> resume after DDR setup is done. Call the common function to resume.
>
> Signed-off-by: Markus Schneider-Pargmann (TI.com) <msp@baylibre.com>
> ---
>   arch/arm/mach-k3/am62px/am62p5_init.c | 9 +++++++++
>   1 file changed, 9 insertions(+)
>
> diff --git a/arch/arm/mach-k3/am62px/am62p5_init.c b/arch/arm/mach-k3/am62px/am62p5_init.c
> index a74fe3d23d7c4b66ac95aa5a01c2a32a586e9ced..63cc9827b6a178d36f054400772417411cb508f5 100644
> --- a/arch/arm/mach-k3/am62px/am62p5_init.c
> +++ b/arch/arm/mach-k3/am62px/am62p5_init.c
> @@ -253,6 +253,15 @@ void board_init_f(ulong dummy)
>   		enable_mcu_esm_reset();
>   	}
>   
> +	if (wkup_ctrl_is_lpm_exit()) {
> +		u64 meta_data_addr;
> +
> +		ret = wkup_r5f_am62_lpm_meta_data_addr(&meta_data_addr);
> +		if (ret)
> +			panic("Failed to get LPM meta data address %d\n", ret);
> +		lpm_resume_from_ddr(meta_data_addr);
> +	}
> +


Thanks for moving enable cache after if

But advise how setup_qos will be done now.


>   	spl_enable_cache();
>   
>   	setup_qos();
>

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

* Re: [PATCH v8 00/13] am62: IO+DDR resume support
  2025-12-22 20:01 [PATCH v8 00/13] am62: IO+DDR resume support Markus Schneider-Pargmann (TI.com)
                   ` (12 preceding siblings ...)
  2025-12-22 20:01 ` [PATCH v8 13/13] configs: am62p_evm_r5_defconfig: " Markus Schneider-Pargmann (TI.com)
@ 2025-12-23  8:17 ` Kumar, Udit
  13 siblings, 0 replies; 18+ messages in thread
From: Kumar, Udit @ 2025-12-23  8:17 UTC (permalink / raw)
  To: Markus Schneider-Pargmann (TI.com), Tom Rini, Sumit Garg,
	Nishanth Menon, Robert Nelson, Vignesh Raghavendra,
	Bryan Brattlof
  Cc: Vishal Mahaveer, Kevin Hilman, Dhruva Gole, Sebin Francis,
	Kendall Willis, Akashdeep Kaur, u-boot, Anshul Dalal, Moteen Shah,
	Santhosh Kumar K, Nathan Morrisson, Garrett Giordano,
	Judith Mendez, Aparna Patra, Jayesh Choudhary, Chintan Vankar,
	Ilias Apalodimas, Neha Malcom Francis, Prasanth Babu Mantena,
	Beleswar Padhi, Manorit Chawdhry, Andrew Davis, Wadim Egorov,
	Andrew Goodbody, E Shattow, Devarsh Thakkar, Peng Fan,
	Jerome Forissier, Sam Protsenko, Marek Vasut, Andre Przywara,
	Théo Lebrun, u-kumar1

Hi Markus,

On 12/23/2025 1:31 AM, Markus Schneider-Pargmann (TI.com) wrote:
> Hi,
>
> this series introduces support to resume from IO+DDR. IO+DDR is a low
> power mode of am62a and am62p in which nearly everything is powered off
> except DDR which is in self-refresh and a few pins which detect
> activity and can wakeup the system again.
>
> On resume uboot SPL is loaded and checks if this is a IO+DDR resume. If
> it is, the DDR initialization sequence in k3-ddrss differs slightly as
> it has to get the DDR out of the self-refresh.
>
> Afterward a specific address determined from DT is used to get the
> metadata that stores relevant context addresses. The context is restored
> using the tisci message TI_SCI_MSG_MIN_CONTEXT_RESTORE. At the end all
> further initializations are skipped and uboot SPL directly jumps into
> the DM resume address which takes care of the rest.
>
> k3-ddrss is using absolute register accesses at the moment. I am trying
> to submit syscon DT patches upstream to access these through syscon,
> unfortunately there is ongoing discussion regarding syscon.
>
> I tested this on am62a.
>
> Best,
> Markus
>
> Signed-off-by: Markus Schneider-Pargmann (TI.com) <msp@baylibre.com>
> ---
> Changes in v8:
> - Create and use am62xx-lpm-common for am62xx lpm common functions
> - Create platform dependent functions in k3-ddrss in k3_ddrss_data
> - Align am62a and am62p initialization regarding caches and QoS
> - Link to v7: https://lore.kernel.org/r/20251210-topic-am62-ioddr-v2025-04-rc1-v7-0-f113b156f83f@baylibre.com


Thanks for clean up ,

Apart from qos comments on patch 8/13 and 9/13, overall series looks 
good to me.


>
> Changes in v7:
> - Removed parent nodes bootph-pre-ram properties as not necessary
>    anymore.
> - Added missing new line in
>      arm: mach-k3: common: Helper for LPM meta data address from DT
> - Split off LPM specific ddr code into its own file k3-ddrss-lpm
> - Rename lpm_ops->restore_context to lpm_ops->min_context_restore
> - Pulled patch to add wakeup check helpers before the IO isolation
>    removal to remove later cleanup of
>    wkup_ctrl_remove_can_io_isolation_if_set()
> - Some reviewed-bys and tested-bys removed due to changes in the
>    patches
> - Link to v6: https://lore.kernel.org/r/20251120-topic-am62-ioddr-v2025-04-rc1-v6-0-6dd99a7271bb@baylibre.com
> [..]

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

* Re: [PATCH v8 08/13] arm: mach-k3: am62a7_init: Resume on LPM exit
  2025-12-23  8:10   ` Kumar, Udit
@ 2026-01-05 15:44     ` Markus Schneider-Pargmann
  0 siblings, 0 replies; 18+ messages in thread
From: Markus Schneider-Pargmann @ 2026-01-05 15:44 UTC (permalink / raw)
  To: Kumar, Udit, Markus Schneider-Pargmann (TI.com), Tom Rini,
	Sumit Garg, Nishanth Menon, Robert Nelson, Vignesh Raghavendra,
	Bryan Brattlof
  Cc: Vishal Mahaveer, Kevin Hilman, Dhruva Gole, Sebin Francis,
	Kendall Willis, Akashdeep Kaur, u-boot, Anshul Dalal, Moteen Shah,
	Santhosh Kumar K, Nathan Morrisson, Garrett Giordano,
	Judith Mendez, Aparna Patra, Jayesh Choudhary, Chintan Vankar,
	Ilias Apalodimas, Neha Malcom Francis, Prasanth Babu Mantena,
	Beleswar Padhi, Manorit Chawdhry, Andrew Davis, Wadim Egorov,
	Andrew Goodbody, E Shattow, Devarsh Thakkar, Peng Fan,
	Jerome Forissier, Sam Protsenko, Marek Vasut, Andre Przywara,
	Théo Lebrun

[-- Attachment #1: Type: text/plain, Size: 1480 bytes --]

Hi Udit,

On Tue Dec 23, 2025 at 9:10 AM CET, Udit Kumar wrote:
> Hi Markus
>
> On 12/23/2025 1:31 AM, Markus Schneider-Pargmann (TI.com) wrote:
>> When exiting a low power mode with DDR self-refresh, we can directly
>> resume after DDR setup is done. Call the common function to resume.
>>
>> Signed-off-by: Markus Schneider-Pargmann (TI.com) <msp@baylibre.com>
>> ---
>>   arch/arm/mach-k3/am62ax/am62a7_init.c | 9 +++++++++
>>   1 file changed, 9 insertions(+)
>>
>> diff --git a/arch/arm/mach-k3/am62ax/am62a7_init.c b/arch/arm/mach-k3/am62ax/am62a7_init.c
>> index c1c7d669a45f53b7528c80d44bf9b914fed1cc10..51b0386853b065d62cd0ecac589e316de5ab4038 100644
>> --- a/arch/arm/mach-k3/am62ax/am62a7_init.c
>> +++ b/arch/arm/mach-k3/am62ax/am62a7_init.c
>> @@ -198,6 +198,15 @@ void board_init_f(ulong dummy)
>>   	ret = uclass_get_device(UCLASS_RAM, 0, &dev);
>>   	if (ret)
>>   		panic("DRAM init failed: %d\n", ret);
>> +
>> +	if (wkup_ctrl_is_lpm_exit()) {
>> +		u64 meta_data_addr;
>> +
>> +		ret = wkup_r5f_am62_lpm_meta_data_addr(&meta_data_addr);
>> +		if (ret)
>> +			panic("Failed to get LPM meta data address %d\n", ret);
>> +		lpm_resume_from_ddr(meta_data_addr);
>> +	}
>
> Could you help, how qos will be set after s2r

Yes, you are right, a misunderstanding on my side. I swapped
spl_enable_cache() and setup_qos() for the next version and only do
setup_qos() before lpm resume.

Thanks for all your reviews.

Best
Markus

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 289 bytes --]

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

end of thread, other threads:[~2026-01-05 16:42 UTC | newest]

Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-22 20:01 [PATCH v8 00/13] am62: IO+DDR resume support Markus Schneider-Pargmann (TI.com)
2025-12-22 20:01 ` [PATCH v8 01/13] arm: mach-k3: Kconfig: Add symbol for IO+DDR Low Power Mode Markus Schneider-Pargmann (TI.com)
2025-12-22 20:01 ` [PATCH v8 02/13] arm: mach-k3: am62xx-lpm-common: Add CANUART wakeup check helpers Markus Schneider-Pargmann (TI.com)
2025-12-22 20:01 ` [PATCH v8 03/13] arm: mach-k3: Remove CANUART IO isolation Markus Schneider-Pargmann (TI.com)
2025-12-22 20:01 ` [PATCH v8 04/13] ram: k3-ddrss: Add support for DDR in self-refresh Markus Schneider-Pargmann (TI.com)
2025-12-22 20:01 ` [PATCH v8 05/13] firmware: ti_sci: Add TI_SCI_MSG_MIN_CONTEXT_RESTORE Markus Schneider-Pargmann (TI.com)
2025-12-22 20:01 ` [PATCH v8 06/13] arm: mach-k3: am62xx-lpm-common: Add lpm_resume_from_ddr Markus Schneider-Pargmann (TI.com)
2025-12-22 20:01 ` [PATCH v8 07/13] arm: mach-k3: am62xx-lpm-common: Helper for LPM meta data address from DT Markus Schneider-Pargmann (TI.com)
2025-12-22 20:01 ` [PATCH v8 08/13] arm: mach-k3: am62a7_init: Resume on LPM exit Markus Schneider-Pargmann (TI.com)
2025-12-23  8:10   ` Kumar, Udit
2026-01-05 15:44     ` Markus Schneider-Pargmann
2025-12-22 20:01 ` [PATCH v8 09/13] arm: mach-k3: am62p5_init: " Markus Schneider-Pargmann (TI.com)
2025-12-23  8:13   ` Kumar, Udit
2025-12-22 20:01 ` [PATCH v8 10/13] arm: dts: k3-am62a: Add r5 device nodes Markus Schneider-Pargmann (TI.com)
2025-12-22 20:01 ` [PATCH v8 11/13] arm: dts: k3-am62p: " Markus Schneider-Pargmann (TI.com)
2025-12-22 20:01 ` [PATCH v8 12/13] configs: am62ax_evm_r5: Enable IODDR resume support Markus Schneider-Pargmann (TI.com)
2025-12-22 20:01 ` [PATCH v8 13/13] configs: am62p_evm_r5_defconfig: " Markus Schneider-Pargmann (TI.com)
2025-12-23  8:17 ` [PATCH v8 00/13] am62: IO+DDR " Kumar, Udit

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox