From mboxrd@z Thu Jan 1 00:00:00 1970 From: Jerry Van Baren Date: Fri, 11 Jan 2008 16:46:41 -0500 Subject: [U-Boot-Users] [PATCH] Fix "i2c sdram" command for DDR2 DIMMs In-Reply-To: <4787DECC.6040609@acm.org> References: <4786E13B.3030105@acm.org> <4787709B.8000907@ge.com> <4787DECC.6040609@acm.org> Message-ID: <4787E3C1.4010709@ge.com> List-Id: MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit To: u-boot@lists.denx.de Lawrence R. Johnson wrote: > Jerry Van Baren wrote: >> Larry Johnson wrote: [snip] >>> + switch (type) { >>> + case DDR2: >>> + printf("RAS to CAS delay min %d", data[29] >> 2); >>> + switch (data[29] & 0x03) { >>> + case 0x0: puts(".00 ns\n"); break; >>> + case 0x1: puts(".25 ns\n"); break; >>> + case 0x2: puts(".50 ns\n"); break; >>> + case 0x3: puts(".75 ns\n"); break; >>> + } >>> + break; >> Hmm, another troika that could be refactored into a helper subroutine. >> On second thought, this is probably not worth a helper routine (too >> trivial?): replacing the switch statements with arithmetic is going to >> be slightly less speed efficient, but quite a bit more code efficient: >> >> printf(".%02d ns\n", (data[29] & 0x03) * 25); >> >> [snip] > > Doh! I must have been stuck in switch-statement mode. You were set up on that one! :-D >> Thanks again, >> gvb >> > > You have inspired me to go ahead with the refactoring. I'm running > MAKEALLs on my changes, and will post them when they come out OK. I > plan to create the patch against my original submission, which should > make the changes easier to follow. > > Best regards, > Larry Always a good plan, make it work before optimizing. DAMHIKT :-/ gvb