[U-Boot] [PATCH 1/3] cm4008: set gd->ram_size in dram_init

Andreas Bießmann
2012-07-05T10:02:56Z

On 04.07.2012 15:08, Yann Vernier wrote:
> Leave dram_init_banksize to set up the bank info data.
> ram_size was previously uninitialized.
>
> Signed-off-by: Yann Vernier <yann.vernier@orsoc.se>
> ---
> board/cm4008/cm4008.c | 3 +--
> 1 file changed, 1 insertion(+), 2 deletions(-)
>
> diff --git a/board/cm4008/cm4008.c b/board/cm4008/cm4008.c
> index ed493a8..557cd8e 100644
> --- a/board/cm4008/cm4008.c
> +++ b/board/cm4008/cm4008.c
> @@ -97,8 +97,7 @@ int board_init (void)
>
> int dram_init (void)
> {
> - gd->bd->bi_dram[0].start = PHYS_SDRAM_1;
> - gd->bd->bi_dram[0].size = PHYS_SDRAM_1_SIZE;
> + gd->ram_size = PHYS_SDRAM_1_SIZE;
>
> return (0);
> }
>

The dram_init should look like this nowadays:

---8<---
int dram_init (void)
{
/* dram_init must store complete ramsize in gd->ram_size */
gd->ram_size = get_ram_size((long *)CONFIG_SYS_SDRAM_BASE,
CONFIG_SYS_SDRAM_SIZE);
return 0;
}
--->8---

PHYS_SDRAM_1_SIZE is also a remnant from older days, please switch to
CONFIG_SYS_SDRAM_SIZE. The get_ram_size() should check how many ram is
really accesable (think of a board which may have more options for RAM,
just insert the biggest possible option to CONFIG_SYS_SDRAM_SIZE).