diff options
author | Marek Vasut <marex@denx.de> | 2015-07-19 05:01:12 +0200 |
---|---|---|
committer | Marek Vasut <marex@denx.de> | 2015-08-08 14:14:18 +0200 |
commit | 38ed692238769a5f1080f24fc23dfad8389119b8 (patch) | |
tree | a840acc14c2fdae2cb8f19e859602dbe2d1828ad | |
parent | 36edef3c98f24260e667c727ed26f4c436d04c01 (diff) | |
download | u-boot-imx-38ed692238769a5f1080f24fc23dfad8389119b8.zip u-boot-imx-38ed692238769a5f1080f24fc23dfad8389119b8.tar.gz u-boot-imx-38ed692238769a5f1080f24fc23dfad8389119b8.tar.bz2 |
ddr: altera: Clean up sdr_*_phase() part 4
Get rid of found_{begin,end} variables. Instead of breaking out
through all of the loops, just return when the begin/end of the
window is found and be done with it. Also clean up the trailing
conditional expression, which is now much easier.
Signed-off-by: Marek Vasut <marex@denx.de>
-rw-r--r-- | drivers/ddr/altera/sequencer.c | 41 |
1 files changed, 10 insertions, 31 deletions
diff --git a/drivers/ddr/altera/sequencer.c b/drivers/ddr/altera/sequencer.c index c62bec5..df261ae 100644 --- a/drivers/ddr/altera/sequencer.c +++ b/drivers/ddr/altera/sequencer.c @@ -1337,7 +1337,6 @@ static int sdr_working_phase(uint32_t grp, uint32_t *v, uint32_t *d, uint32_t *p, uint32_t *i, uint32_t *max_working_cnt) { - uint32_t found_begin = 0; uint32_t tmp_delay = 0; uint32_t test_status; u32 bit_chk; @@ -1358,31 +1357,20 @@ static int sdr_working_phase(uint32_t grp, if (test_status) { *max_working_cnt = 1; - found_begin = 1; - break; + return 1; } } - if (found_begin) - break; - if (*p > IO_DQS_EN_PHASE_MAX) /* fiddle with FIFO */ rw_mgr_incr_vfifo(grp, v); } - - if (found_begin) - break; } - if (*i >= VFIFO_SIZE) { - /* cannot find working solution */ - debug_cond(DLEVEL == 2, "%s:%d find_dqs_en_phase: no vfifo/\ - ptap/dtap\n", __func__, __LINE__); - return 0; - } else { - return 1; - } + /* Cannot find working solution */ + debug_cond(DLEVEL == 2, "%s:%d find_dqs_en_phase: no vfifo/\ + ptap/dtap\n", __func__, __LINE__); + return 0; } static void sdr_backup_phase(uint32_t grp, @@ -1438,7 +1426,6 @@ static int sdr_nonworking_phase(uint32_t grp, uint32_t *p, uint32_t *i, uint32_t *max_working_cnt, uint32_t *work_end) { - uint32_t found_end = 0; u32 bit_chk; (*p)++; @@ -1456,16 +1443,12 @@ static int sdr_nonworking_phase(uint32_t grp, if (!rw_mgr_mem_calibrate_read_test_all_ranks (grp, 1, PASS_ONE_BIT, &bit_chk, 0)) { - found_end = 1; - break; + return 1; } else { (*max_working_cnt)++; } } - if (found_end) - break; - if (*p > IO_DQS_EN_PHASE_MAX) { /* fiddle with FIFO */ rw_mgr_incr_vfifo(grp, v); @@ -1473,14 +1456,10 @@ static int sdr_nonworking_phase(uint32_t grp, } } - if (*i >= VFIFO_SIZE + 1) { - /* cannot see edge of failing read */ - debug_cond(DLEVEL == 2, "%s:%d sdr_nonworking_phase: end:\ - failed\n", __func__, __LINE__); - return 0; - } else { - return 1; - } + /* Cannot see edge of failing read. */ + debug_cond(DLEVEL == 2, "%s:%d sdr_nonworking_phase: end:\ + failed\n", __func__, __LINE__); + return 0; } /** |