mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-10 23:24:38 +00:00
ddr: altera: Internal mem_calibrate() cleanup part 5
This is kind of microseries-within-series indent cleanup. Rework the code for the the middle-loop of the mega-loop this time and deal with the group_failed variable. Instead of checking if the group failed in the previous calibration part, just jump to the end of the loop if calibration did fail and increment the counter. This shaves away one more level of indent while making the code slightly more readable. It is likely that this patch has checkpatch warnings, but for the sake of not breaking the code, these are ignored. No functional change. Signed-off-by: Marek Vasut <marex@denx.de>
This commit is contained in:
parent
c50ae30341
commit
c452dcd0b7
1 changed files with 54 additions and 46 deletions
|
@ -3326,7 +3326,8 @@ static uint32_t mem_calibrate(void)
|
|||
for (write_group = 0, write_test_bgn = 0; write_group
|
||||
< RW_MGR_MEM_IF_WRITE_DQS_WIDTH; write_group++,
|
||||
write_test_bgn += RW_MGR_MEM_DQ_PER_WRITE_DQS) {
|
||||
/* Initialized the group failure */
|
||||
|
||||
/* Initialize the group failure */
|
||||
group_failed = 0;
|
||||
|
||||
current_run = run_groups & ((1 <<
|
||||
|
@ -3343,7 +3344,7 @@ static uint32_t mem_calibrate(void)
|
|||
|
||||
for (read_group = write_group * rwdqs_ratio,
|
||||
read_test_bgn = 0;
|
||||
read_group < (write_group + 1) * rwdqs_ratio && group_failed == 0;
|
||||
read_group < (write_group + 1) * rwdqs_ratio;
|
||||
read_group++,
|
||||
read_test_bgn += RW_MGR_MEM_DQ_PER_READ_DQS) {
|
||||
if (STATIC_CALIB_STEPS & CALIB_SKIP_VFIFO)
|
||||
|
@ -3354,62 +3355,69 @@ static uint32_t mem_calibrate(void)
|
|||
read_test_bgn))
|
||||
continue;
|
||||
|
||||
if (!(gbl->phy_debug_mode_flags & PHY_DEBUG_SWEEP_ALL_GROUPS))
|
||||
return 0;
|
||||
|
||||
/* The group failed, we're done. */
|
||||
goto grp_failed;
|
||||
}
|
||||
|
||||
/* Calibrate the output side */
|
||||
for (rank_bgn = 0, sr = 0;
|
||||
rank_bgn < RW_MGR_MEM_NUMBER_OF_RANKS;
|
||||
rank_bgn += NUM_RANKS_PER_SHADOW_REG, sr++) {
|
||||
if (STATIC_CALIB_STEPS & CALIB_SKIP_WRITES)
|
||||
continue;
|
||||
|
||||
/* Not needed in quick mode! */
|
||||
if (STATIC_CALIB_STEPS & CALIB_SKIP_DELAY_SWEEPS)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Determine if this set of ranks
|
||||
* should be skipped entirely.
|
||||
*/
|
||||
if (param->skip_shadow_regs[sr])
|
||||
continue;
|
||||
|
||||
/* Calibrate WRITEs */
|
||||
if (rw_mgr_mem_calibrate_writes(rank_bgn,
|
||||
write_group, write_test_bgn))
|
||||
continue;
|
||||
|
||||
group_failed = 1;
|
||||
if (!(gbl->phy_debug_mode_flags & PHY_DEBUG_SWEEP_ALL_GROUPS))
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Calibrate the output side */
|
||||
if (group_failed == 0) {
|
||||
for (rank_bgn = 0, sr = 0;
|
||||
rank_bgn < RW_MGR_MEM_NUMBER_OF_RANKS;
|
||||
rank_bgn += NUM_RANKS_PER_SHADOW_REG, sr++) {
|
||||
if (STATIC_CALIB_STEPS & CALIB_SKIP_WRITES)
|
||||
continue;
|
||||
/* Some group failed, we're done. */
|
||||
if (group_failed)
|
||||
goto grp_failed;
|
||||
|
||||
/* Not needed in quick mode! */
|
||||
if (STATIC_CALIB_STEPS & CALIB_SKIP_DELAY_SWEEPS)
|
||||
continue;
|
||||
for (read_group = write_group * rwdqs_ratio,
|
||||
read_test_bgn = 0;
|
||||
read_group < (write_group + 1) * rwdqs_ratio;
|
||||
read_group++,
|
||||
read_test_bgn += RW_MGR_MEM_DQ_PER_READ_DQS) {
|
||||
if (STATIC_CALIB_STEPS & CALIB_SKIP_WRITES)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* Determine if this set of ranks
|
||||
* should be skipped entirely.
|
||||
*/
|
||||
if (param->skip_shadow_regs[sr])
|
||||
continue;
|
||||
if (rw_mgr_mem_calibrate_vfifo_end(read_group,
|
||||
read_test_bgn))
|
||||
continue;
|
||||
|
||||
/* Calibrate WRITEs */
|
||||
if (rw_mgr_mem_calibrate_writes(rank_bgn,
|
||||
write_group, write_test_bgn))
|
||||
continue;
|
||||
if (!(gbl->phy_debug_mode_flags & PHY_DEBUG_SWEEP_ALL_GROUPS))
|
||||
return 0;
|
||||
|
||||
group_failed = 1;
|
||||
if (!(gbl->phy_debug_mode_flags & PHY_DEBUG_SWEEP_ALL_GROUPS))
|
||||
return 0;
|
||||
}
|
||||
/* The group failed, we're done. */
|
||||
goto grp_failed;
|
||||
}
|
||||
|
||||
if (group_failed == 0) {
|
||||
for (read_group = write_group * rwdqs_ratio,
|
||||
read_test_bgn = 0;
|
||||
read_group < (write_group + 1) * rwdqs_ratio && group_failed == 0;
|
||||
read_group++,
|
||||
read_test_bgn += RW_MGR_MEM_DQ_PER_READ_DQS) {
|
||||
if (STATIC_CALIB_STEPS & CALIB_SKIP_WRITES)
|
||||
continue;
|
||||
/* No group failed, continue as usual. */
|
||||
continue;
|
||||
|
||||
if (rw_mgr_mem_calibrate_vfifo_end(read_group,
|
||||
read_test_bgn))
|
||||
continue;
|
||||
|
||||
group_failed = 1;
|
||||
if (!(gbl->phy_debug_mode_flags & PHY_DEBUG_SWEEP_ALL_GROUPS))
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
if (group_failed != 0)
|
||||
failing_groups++;
|
||||
grp_failed: /* A group failed, increment the counter. */
|
||||
failing_groups++;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
Loading…
Reference in a new issue