diff options
author | Marek Vasut <marex@denx.de> | 2015-07-26 11:42:53 +0200 |
---|---|---|
committer | Marek Vasut <marex@denx.de> | 2015-08-08 14:14:24 +0200 |
commit | 6a39be6ca93bfeb7f89d5ae2c170ea929d8222a0 (patch) | |
tree | 0f30d9a987c0a6dd27df3b90e0a1b1e1639bcc0e /drivers | |
parent | cbcaf4604329a6a69597630d7abdab942e2c59c8 (diff) | |
download | u-boot-imx-6a39be6ca93bfeb7f89d5ae2c170ea929d8222a0.zip u-boot-imx-6a39be6ca93bfeb7f89d5ae2c170ea929d8222a0.tar.gz u-boot-imx-6a39be6ca93bfeb7f89d5ae2c170ea929d8222a0.tar.bz2 |
ddr: altera: Clean up of delay_for_n_mem_clocks() part 3
Clean up the computation of c_loop, outer and inner variables.
Signed-off-by: Marek Vasut <marex@denx.de>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ddr/altera/sequencer.c | 24 |
1 files changed, 6 insertions, 18 deletions
diff --git a/drivers/ddr/altera/sequencer.c b/drivers/ddr/altera/sequencer.c index 25de209..ed4d791 100644 --- a/drivers/ddr/altera/sequencer.c +++ b/drivers/ddr/altera/sequencer.c @@ -761,9 +761,9 @@ static void set_jump_as_return(void) static void delay_for_n_mem_clocks(const u32 clocks) { u32 afi_clocks; - u16 c_loop = 0; - u8 inner = 0; - u8 outer = 0; + u16 c_loop; + u8 inner; + u8 outer; debug("%s:%d: clocks=%u ... start\n", __func__, __LINE__, clocks); @@ -779,21 +779,9 @@ static void delay_for_n_mem_clocks(const u32 clocks) * before the decrement, and so always perform the loop * 1 time more than the counter value */ - if (afi_clocks == 0) { - ; - } else if (afi_clocks < 0x100) { - inner = afi_clocks; - outer = 0; - c_loop = 0; - } else if (afi_clocks < 0x10000) { - inner = 0xff; - outer = afi_clocks >> 8; - c_loop = 0; - } else { /* >= 0x10000 */ - inner = 0xff; - outer = 0xff; - c_loop = afi_clocks >> 16; - } + c_loop = afi_clocks >> 16; + outer = c_loop ? 0xff : (afi_clocks >> 8); + inner = outer ? 0xff : afi_clocks; /* * rom instructions are structured as follows: |