[U-Boot] [PATCH v2] arm: cm4008, cm41xx: set gd->ram_size in dram_init
Andreas Bießmann
andreas.devel at googlemail.com
Fri Jul 6 10:43:40 CEST 2012
Dear Yann Vernier,
On 06.07.2012 10:15, Yann Vernier wrote:
> On Thursday 05 July 2012 16:48:22 you wrote:
>> On 05.07.2012 14:11, Yann Vernier wrote:
<snip>
>>> + /* 8 column address bits, 4 banks, 32 bits data width */
>>> + ldr r2,
>>> =((CONFIG_SYS_SDRAM_BASE+CONFIG_SYS_SDRAM_SIZE-0x10000)<<(22-16) | \ +
>>> (CONFIG_SYS_SDRAM_BASE>>(16-12) | 0x00e))
>>
>> ugh ... magic. Will it work for every possible setting?
>> How about one setting CONFIG_SYS_SDRAM_BASE != 0x0? I the base address
>> related to register content in any way?
>>
>> Would be great to have a little documentation here why it is shifted
>> that way, unfortunately I can not find a KS8695 spec in the net. Don't
>> get me wrong it is ok to do so. I think it is way better than hard
>> coding the values like before but would be great to understand why it is
>> done that way.
>>
>> Best regards
>>
>> Andreas Bießmann
>
>
> It's not a guarded secret, although it is far from obvious where to find it.
> One way is micrel.com - Products - Ethernet ICs / ARM based SOC's - HW Design
> Kit. Within that zip file,
> KS8695X_EVAL_HW_RV4.0_DP/RegDescription/KS8695X Register Description v1.1.pdf
With this information I understand your equation. I think you should not
do it that way. You may solve the current state (all devices have 8
column, 4 bank and 32 bit). But one adding (well, if that will ever come
;) another board with different setting will get in trouble here and
need to find another solution. Maybe more sophisticated by doing another
equation.
I think a straight forward solution here would be to add another special
define in the board config, write the magic number down there and maybe
describe what the number stands for. You can then just use the
previously defined value in start.S.
You may have a look for at91 lowlevel_init, there it is done that way.
> My personal thought on the matter is that the existing code is rather heavy on
> magic numbers, ergo the comment once I figured out what the first ROM
> reconfiguration was even for.
Well, thats true.
Best regards
Andreas Bießmann
More information about the U-Boot
mailing list