From: Jerry Van Baren <gerald.vanbaren@ge.com>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] Fix "i2c sdram" command for DDR2 DIMMs
Date: Fri, 11 Jan 2008 16:46:41 -0500 [thread overview]
Message-ID: <4787E3C1.4010709@ge.com> (raw)
In-Reply-To: <4787DECC.6040609@acm.org>
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
next prev parent reply other threads:[~2008-01-11 21:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-01-11 3:23 [U-Boot-Users] [PATCH] Fix "i2c sdram" command for DDR2 DIMMs Larry Johnson
2008-01-11 6:44 ` Stefan Roese
2008-01-11 13:35 ` Jerry Van Baren
2008-01-11 17:02 ` Jon Loeliger
2008-01-11 17:20 ` Jerry Van Baren
2008-01-11 21:25 ` Lawrence R. Johnson
2008-01-11 21:46 ` Jerry Van Baren [this message]
2008-01-12 17:29 ` gvb.uboot
2008-01-12 20:02 ` Wolfgang Denk
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4787E3C1.4010709@ge.com \
--to=gerald.vanbaren@ge.com \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox