* am335x: memory configuration
@ 2016-10-06 9:08 Yegor Yefremov
2016-10-06 13:45 ` Jan Remmet
[not found] ` <57f65594.d4491c0a.37103.324dSMTPIN_ADDED_BROKEN@mx.google.com>
0 siblings, 2 replies; 3+ messages in thread
From: Yegor Yefremov @ 2016-10-06 9:08 UTC (permalink / raw)
To: barebox
I've submitted a patch [1] to support our Baltos systems back in the
May. There was an issue with dynamically detecting RAM size as the
systems can have either 256MB or 512MB modules.
So far u-boot was able to detect the RAM size dynamically. In order to
do so it uses following code in arch/arm/cpu/armv7/am33xx/emif4.c:
int dram_init(void)
{
#ifndef CONFIG_SKIP_LOWLEVEL_INIT
sdram_init();
#endif
/* dram_init must store complete ramsize in gd->ram_size */
gd->ram_size = get_ram_size(
(void *)CONFIG_SYS_SDRAM_BASE,
CONFIG_MAX_RAM_BANK_SIZE);
return 0;
}
void dram_init_banksize(void)
{
gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
gd->bd->bi_dram[0].size = gd->ram_size;
}
This peace of code will be excuted in u-boot.img (not in MLO).
In Barebox we have get_ram_size(), that provides real RAM size and
am335x_sdram_size(), that returns RAM controller settings. So far DDR
controler will be configured for 512MB regardless of the module. Hence
the return value from am335x_sdram_size() cannot be used for crating
ram0 node.
What were the best way to provide get_ram_size() from lowlevel.c to
board.c, where I would invoke:
arm_add_mem_device("ram0", 0x80000000, sdram_size);
[1] http://lists.infradead.org/pipermail/barebox/2016-May/027224.html
Yegor
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: am335x: memory configuration
2016-10-06 9:08 am335x: memory configuration Yegor Yefremov
@ 2016-10-06 13:45 ` Jan Remmet
[not found] ` <57f65594.d4491c0a.37103.324dSMTPIN_ADDED_BROKEN@mx.google.com>
1 sibling, 0 replies; 3+ messages in thread
From: Jan Remmet @ 2016-10-06 13:45 UTC (permalink / raw)
To: Yegor Yefremov; +Cc: barebox
On Thu, Oct 06, 2016 at 11:08:07AM +0200, Yegor Yefremov wrote:
> I've submitted a patch [1] to support our Baltos systems back in the
> May. There was an issue with dynamically detecting RAM size as the
> systems can have either 256MB or 512MB modules.
>
> So far u-boot was able to detect the RAM size dynamically. In order to
> do so it uses following code in arch/arm/cpu/armv7/am33xx/emif4.c:
>
> int dram_init(void)
> {
>
> #ifndef CONFIG_SKIP_LOWLEVEL_INIT
> sdram_init();
> #endif
>
> /* dram_init must store complete ramsize in gd->ram_size */
> gd->ram_size = get_ram_size(
> (void *)CONFIG_SYS_SDRAM_BASE,
> CONFIG_MAX_RAM_BANK_SIZE);
> return 0;
> }
>
> void dram_init_banksize(void)
> {
> gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
> gd->bd->bi_dram[0].size = gd->ram_size;
> }
>
> This peace of code will be excuted in u-boot.img (not in MLO).
>
> In Barebox we have get_ram_size(), that provides real RAM size and
> am335x_sdram_size(), that returns RAM controller settings. So far DDR
> controler will be configured for 512MB regardless of the module. Hence
> the return value from am335x_sdram_size() cannot be used for crating
> ram0 node.
On our am335x boards we use MLOs with individual RAM timings and EMIF config
values. So am335x_sdram_size works fine in barebox.bin.
Maybe get_ram_size works if the timing settings are equal?
Jan
>
> What were the best way to provide get_ram_size() from lowlevel.c to
> board.c, where I would invoke:
> arm_add_mem_device("ram0", 0x80000000, sdram_size);
>
> [1] http://lists.infradead.org/pipermail/barebox/2016-May/027224.html
>
> Yegor
>
> _______________________________________________
> barebox mailing list
> barebox@lists.infradead.org
> http://lists.infradead.org/mailman/listinfo/barebox
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
[parent not found: <57f65594.d4491c0a.37103.324dSMTPIN_ADDED_BROKEN@mx.google.com>]
* Re: am335x: memory configuration
[not found] ` <57f65594.d4491c0a.37103.324dSMTPIN_ADDED_BROKEN@mx.google.com>
@ 2016-10-06 13:50 ` Yegor Yefremov
0 siblings, 0 replies; 3+ messages in thread
From: Yegor Yefremov @ 2016-10-06 13:50 UTC (permalink / raw)
To: Jan Remmet; +Cc: barebox
Hi Jan,
On Thu, Oct 6, 2016 at 3:45 PM, Jan Remmet <J.Remmet@phytec.de> wrote:
> On Thu, Oct 06, 2016 at 11:08:07AM +0200, Yegor Yefremov wrote:
>> I've submitted a patch [1] to support our Baltos systems back in the
>> May. There was an issue with dynamically detecting RAM size as the
>> systems can have either 256MB or 512MB modules.
>>
>> So far u-boot was able to detect the RAM size dynamically. In order to
>> do so it uses following code in arch/arm/cpu/armv7/am33xx/emif4.c:
>>
>> int dram_init(void)
>> {
>>
>> #ifndef CONFIG_SKIP_LOWLEVEL_INIT
>> sdram_init();
>> #endif
>>
>> /* dram_init must store complete ramsize in gd->ram_size */
>> gd->ram_size = get_ram_size(
>> (void *)CONFIG_SYS_SDRAM_BASE,
>> CONFIG_MAX_RAM_BANK_SIZE);
>> return 0;
>> }
>>
>> void dram_init_banksize(void)
>> {
>> gd->bd->bi_dram[0].start = CONFIG_SYS_SDRAM_BASE;
>> gd->bd->bi_dram[0].size = gd->ram_size;
>> }
>>
>> This peace of code will be excuted in u-boot.img (not in MLO).
>>
>> In Barebox we have get_ram_size(), that provides real RAM size and
>> am335x_sdram_size(), that returns RAM controller settings. So far DDR
>> controler will be configured for 512MB regardless of the module. Hence
>> the return value from am335x_sdram_size() cannot be used for crating
>> ram0 node.
> On our am335x boards we use MLOs with individual RAM timings and EMIF config
> values. So am335x_sdram_size works fine in barebox.bin.
> Maybe get_ram_size works if the timing settings are equal?
I've solved the problem the way Sascha proposed earlier (see the third
version of my patch sent today).
In MLO I setup memory controller to 512MB, then I check the real
amount via get_ram_size() and if I have 256MB I just reinitialize the
memory controller with values for 256Mb i.e. rows 14 instead of 15.
With this done one can use am335x_sdram_size() in other parts of
berebox.
Thanks for the feedback.
Yegor
_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-10-06 13:51 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-10-06 9:08 am335x: memory configuration Yegor Yefremov
2016-10-06 13:45 ` Jan Remmet
[not found] ` <57f65594.d4491c0a.37103.324dSMTPIN_ADDED_BROKEN@mx.google.com>
2016-10-06 13:50 ` Yegor Yefremov
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox