[U-Boot] [U-Boot PATCH v2 08/12] k2hk: add support for k2hk SOC and EVM

Andrianov, Vitaly
2014-03-07T16:41:43Z

Hi Tom,

[snip]
> >>
> >>> + "fdt_high=0xffffffff\0" \
> >>
> >> Please don't do this, set it to the top of kernel low mem.
> >>
> >
> > The EVM may have up to 8GB of DDR and u-boot can see the first 2GB
> > with physical address range 0x80000000-0xffffffff.
> > If we don't use the "fdt_high" environment variable, u-boot relocates
> > the dtb to the end of that memory, which is outside of the lowmem.
>
[snip]

> > But K2 lowmem VA starts from 0xc0000000 and has size ~760MB. That
> > corresponds to the physical range 0x80000000-0xaf800000.
> > That is why we have to use the "fdt_high=0xffffffff" environment
> variable.
> >
> > Have I missed something I u-boot memory configuration?
> > Is there a way to tell u-boot to relocate fdt to the end lowmem?
>
> Yes, set fdt_high to 0xaf800000 instead :)
>

I think there is a bug in the lmb_alloc_base() and this approach doesn't
work.

else if (lmbbase < max_addr) {
base = min(lmbbase + lmbsize, max_addr);
base = lmb_align_down(base - size, align);
} else

For boards that have DDR@the end of 32 bit address space the
(lmbbase + lmbsize) = 0 which is < max_addr.
So, base becomes 0, and moved to the "end of DDR" - size on the next line.

I tried a quick fix in the __lmb_alloc_base() and got the fdt relocated correctly.
As I'm not sure that is only one buggy place in the lmb.c I don't want to commit
the quick fix. Let's leave the "fdt_high=0xffffffff" in the Keystone2 for awhile
and change it later when we fix the bug.

Thanks,
Vitaly