[RFC PATCH 08/19] board: ti: j721e: Add exit retention for k3-ddrss (J7200)
Prasanth Babu Mantena
p-mantena at ti.com
Fri Mar 13 14:58:49 CET 2026
From: Thomas Richard <thomas.richard at bootlin.com>
Add the board specific part of the exit retention sequence for k3-ddrss
Following the DDR resume sequence,
- exit DDR from retention
- de-assert the DDR_RET pin
- restore DDR max frequency
- exit DDR from low power
Signed-off-by: Thomas Richard <thomas.richard at bootlin.com>
Signed-off-by: Richard Genoud <richard.genoud at bootlin.com>
Signed-off-by: Prasanth Babu Mantena <p-mantena at ti.com>
---
arch/arm/mach-k3/j721e/j721e_init.c | 56 +++++++++++++++++++++++++++++
1 file changed, 56 insertions(+)
diff --git a/arch/arm/mach-k3/j721e/j721e_init.c b/arch/arm/mach-k3/j721e/j721e_init.c
index f325597a70b..220cb700ff7 100644
--- a/arch/arm/mach-k3/j721e/j721e_init.c
+++ b/arch/arm/mach-k3/j721e/j721e_init.c
@@ -23,6 +23,8 @@
#include "../sysfw-loader.h"
#include "../common.h"
+#include <power/pmic.h>
+#include <mach/k3-ddr.h>
/* NAVSS North Bridge (NB) registers */
#define NAVSS0_NBSS_NB0_CFG_MMRS 0x03802000
@@ -294,10 +296,50 @@ void do_dt_magic(void)
}
#endif
+#define GPIO_OUT_1 0x3D
+#define DDR_RET_VAL BIT(1)
+#define DDR_RET_CLK BIT(2)
+#define PMIC_NSLEEP_REG 0x86
+
+static void k3_deassert_DDR_RET(void)
+{
+ struct udevice *pmica;
+ struct udevice *pmicb;
+ int regval;
+ int ret;
+
+ ret = uclass_get_device_by_name(UCLASS_PMIC,
+ "pmic at 48", &pmica);
+ if (ret) {
+ printf("Getting PMICA init failed: %d\n", ret);
+ return;
+ }
+
+ ret = uclass_get_device_by_name(UCLASS_PMIC,
+ "pmic at 4c", &pmicb);
+ if (ret) {
+ printf("Getting PMICB init failed: %d\n", ret);
+ return;
+ }
+ /* Set DDR_RET Signal Low on PMIC B */
+ regval = pmic_reg_read(pmicb, GPIO_OUT_1) & ~DDR_RET_VAL;
+
+ pmic_reg_write(pmicb, GPIO_OUT_1, regval);
+
+ /* Now toggle the CLK of the latch for DDR ret */
+ pmic_reg_write(pmicb, GPIO_OUT_1, regval | DDR_RET_CLK);
+ pmic_reg_write(pmicb, GPIO_OUT_1, regval & ~(DDR_RET_CLK));
+ pmic_reg_write(pmicb, GPIO_OUT_1, regval | DDR_RET_CLK);
+ pmic_reg_write(pmicb, GPIO_OUT_1, regval & ~(DDR_RET_CLK));
+
+ pmic_reg_write(pmica, PMIC_NSLEEP_REG, 0x3);
+}
+
void board_init_f(ulong dummy)
{
int ret;
#if defined(CONFIG_K3_J721E_DDRSS) || defined(CONFIG_K3_LOAD_SYSFW)
+ struct k3_ddrss_regs regs;
struct udevice *dev;
#endif
@@ -414,6 +456,20 @@ void board_init_f(ulong dummy)
ret = uclass_get_device(UCLASS_RAM, 0, &dev);
if (ret)
panic("DRAM init failed: %d\n", ret);
+
+ if (board_is_resuming()) {
+ /*
+ * The DDR resume sequence is:
+ * - exit DDR from retention
+ * - de-assert the DDR_RET pin
+ * - restore DDR max frequency
+ * - exit DDR from low power
+ */
+ k3_ddrss_lpddr4_exit_retention(dev, ®s);
+ k3_deassert_DDR_RET();
+ k3_ddrss_lpddr4_change_freq(dev);
+ k3_ddrss_lpddr4_exit_low_power(dev, ®s);
+ }
#endif
spl_enable_cache();
--
2.34.1
More information about the U-Boot
mailing list