summaryrefslogtreecommitdiff
path: root/drivers/ddr
diff options
context:
space:
mode:
authorMarek Vasut <marex@denx.de>2015-07-19 03:01:12 (GMT)
committerMarek Vasut <marex@denx.de>2015-08-08 12:14:18 (GMT)
commit38ed692238769a5f1080f24fc23dfad8389119b8 (patch)
treea840acc14c2fdae2cb8f19e859602dbe2d1828ad /drivers/ddr
parent36edef3c98f24260e667c727ed26f4c436d04c01 (diff)
downloadu-boot-38ed692238769a5f1080f24fc23dfad8389119b8.tar.xz
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>
Diffstat (limited to 'drivers/ddr')
-rw-r--r--drivers/ddr/altera/sequencer.c41
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;
}
/**