[PATCHv4 6/7] S5P DRAM support
agalakhov at gmail.com
Tue May 22 05:17:32 EDT 2012
On 22.05.2012 02:02, Sascha Hauer wrote:
> On Fri, May 18, 2012 at 03:43:30PM +0600, Alexey Galakhov wrote:
>> +void __bare_init s5p_init_dram_bank(uint32_t base, uint32_t mc0, uint32_t mc1)
>> +#ifdef S5P_DRAM_LPDDR
>> + uint32_t reg = 0x100;
>> +#ifdef S5P_DRAM_LPDDR2
>> + uint32_t reg = 0x200;
>> +#ifdef S5P_DRAM_DDR2
>> + uint32_t reg = 0x400;
>> + reg |= (S5P_DRAM_BURST) << 20;
>> +#ifdef S5P_DRAM_16BIT
>> + reg |= 0x1000;
>> +#else /* 32-bit */
>> + reg |= 0x2000;
> Since this function is called from board specific code, can we pass in
> the DDR/DDR2 16BIT/32BIT settings as arguments to this function and
> get rid of these ifdefs?
Thank you for the question. Most likely not.
According to the datasheet, LPDDR/LPDDR2/DDR2 initialization sequence is
completely different. It is in init_seq() function. Since I have no
LPDDR(2) hardware to test, I coded the DDR2 version only. A runtime
switch like that:
is too expensive for S5PV210's __bare_init which is very limited in
space. Thus it is better to have only one function compiled in.
Of course, it is possible to get rid of #ifdefs in s5p_init_dram_bank()
but #ifdef is still needed for init_seq(). Ot is there any better solution?
More information about the barebox