[PATCH] ddr: altera: n5x: Copies calibration data to DDR when DDR retention is set

Jit Loon Lim jit.loon.lim at intel.com
Wed Nov 23 15:32:57 CET 2022


From: Tien Fong Chee <tien.fong.chee at intel.com>

Ensure the PHY calibration data is copied to DDR only when DDR retention
is set.

Signed-off-by: Tien Fong Chee <tien.fong.chee at intel.com>
Signed-off-by: Jit Loon Lim <jit.loon.lim at intel.com>
---
 drivers/ddr/altera/sdram_n5x.c | 11 +++++++----
 1 file changed, 7 insertions(+), 4 deletions(-)

diff --git a/drivers/ddr/altera/sdram_n5x.c b/drivers/ddr/altera/sdram_n5x.c
index 8d28cdbc03..72c231b3f1 100644
--- a/drivers/ddr/altera/sdram_n5x.c
+++ b/drivers/ddr/altera/sdram_n5x.c
@@ -3045,10 +3045,13 @@ int sdram_mmr_init_full(struct udevice *dev)
 
 	sdram_set_firewall(&bd);
 
-	ddr_offset = simple_strtoul(offset, &endptr, 16);
-	if (!(offset == endptr || *endptr != '\0'))
-		memcpy((void *)ddr_offset,
-		       (const void *)SOC64_OCRAM_PHY_BACKUP_BASE, SZ_4K);
+	if (is_ddr_retention_enabled(reg)) {
+		ddr_offset = simple_strtoul(offset, &endptr, 16);
+		if (!(offset == endptr || *endptr != '\0'))
+			memcpy((void *)ddr_offset,
+			       (const void *)SOC64_OCRAM_PHY_BACKUP_BASE,
+			       SZ_4K);
+	}
 
 	return 0;
 }
-- 
2.26.2



More information about the U-Boot mailing list