mirror of
https://github.com/AsahiLinux/u-boot
synced 2024-11-14 08:57:58 +00:00
401d1c4f5d
Move this out of the common header and include it only where needed. In a number of cases this requires adding "struct udevice;" to avoid adding another large header or in other cases replacing / adding missing header files that had been pulled in, very indirectly. Finally, we have a few cases where we did not need to include <asm/global_data.h> at all, so remove that include. Signed-off-by: Simon Glass <sjg@chromium.org> Signed-off-by: Tom Rini <trini@konsulko.com>
58 lines
1.2 KiB
C
58 lines
1.2 KiB
C
// SPDX-License-Identifier: GPL-2.0+
|
|
/*
|
|
* Copyright (C) 2010 Albert ARIBAUD <albert.u.boot@aribaud.net>
|
|
*
|
|
* Based on original Kirkwood support which is
|
|
* (C) Copyright 2009
|
|
* Marvell Semiconductor <www.marvell.com>
|
|
* Written-by: Prafulla Wadaskar <prafulla@marvell.com>
|
|
*/
|
|
|
|
#include <common.h>
|
|
#include <config.h>
|
|
#include <init.h>
|
|
#include <asm/arch/cpu.h>
|
|
#include <asm/global_data.h>
|
|
|
|
DECLARE_GLOBAL_DATA_PTR;
|
|
|
|
/*
|
|
* orion5x_sdram_bar - reads SDRAM Base Address Register
|
|
*/
|
|
u32 orion5x_sdram_bar(enum memory_bank bank)
|
|
{
|
|
struct orion5x_ddr_addr_decode_registers *winregs =
|
|
(struct orion5x_ddr_addr_decode_registers *)
|
|
ORION5X_DRAM_BASE;
|
|
|
|
u32 result = 0;
|
|
u32 enable = 0x01 & winregs[bank].size;
|
|
|
|
if ((!enable) || (bank > BANK3))
|
|
return 0;
|
|
|
|
result = winregs[bank].base;
|
|
return result;
|
|
}
|
|
int dram_init (void)
|
|
{
|
|
/* dram_init must store complete ramsize in gd->ram_size */
|
|
gd->ram_size = get_ram_size(
|
|
(long *) orion5x_sdram_bar(0),
|
|
CONFIG_MAX_RAM_BANK_SIZE);
|
|
return 0;
|
|
}
|
|
|
|
int dram_init_banksize(void)
|
|
{
|
|
int i;
|
|
|
|
for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
|
|
gd->bd->bi_dram[i].start = orion5x_sdram_bar(i);
|
|
gd->bd->bi_dram[i].size = get_ram_size(
|
|
(long *) (gd->bd->bi_dram[i].start),
|
|
CONFIG_MAX_RAM_BANK_SIZE);
|
|
}
|
|
|
|
return 0;
|
|
}
|