From d38eebc0e9c55ca1d73c30b78a8534050daa02e2 Mon Sep 17 00:00:00 2001 From: Jukka Laitinen Date: Thu, 24 Aug 2023 11:02:30 +0300 Subject: [PATCH] arch/risc-v/src/mpfs/mpfs_ddr.c: Don't auto-determine the write latency It doesn't make sense to try to auto-determine write latency, it may pass with too low value. Keep the existing implementation if the write latency has been set to minimum value, otherwise just set it. Signed-off-by: Jukka Laitinen --- arch/risc-v/src/mpfs/mpfs_ddr.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/arch/risc-v/src/mpfs/mpfs_ddr.c b/arch/risc-v/src/mpfs/mpfs_ddr.c index 3b5806c07a1..dcd98792818 100644 --- a/arch/risc-v/src/mpfs/mpfs_ddr.c +++ b/arch/risc-v/src/mpfs/mpfs_ddr.c @@ -3725,14 +3725,22 @@ static int mpfs_training_write_calibration(struct mpfs_ddr_priv_s *priv) #endif - /* Find the proper write latency by using mtc test */ + if (LIBERO_SETTING_CFG_WRITE_LATENCY_SET == 0) + { + /* Find the proper write latency by using mtc test */ - do + do + { + putreg32(write_latency, MPFS_DDR_CSR_APB_CFG_DFI_T_PHY_WRLAT); + error = mpfs_write_calibration_using_mtc(priv); + } + while (error && ++write_latency <= WR_LATENCY_MAX); + } + else { putreg32(write_latency, MPFS_DDR_CSR_APB_CFG_DFI_T_PHY_WRLAT); error = mpfs_write_calibration_using_mtc(priv); } - while (error && ++write_latency <= WR_LATENCY_MAX); /* Return error if mtc test failed on all allowed latency values */