[U-Boot-Users] [PATCH] Fix "i2c sdram" command for DDR2 DIMMs

Jerry Van Baren gerald.vanbaren at ge.com
Fri Jan 11 22:46:41 CET 2008


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




More information about the U-Boot mailing list