2 * Copyright (C) 2010 Albert ARIBAUD <albert.u.boot@aribaud.net>
4 * Based on original Kirkwood support which is
6 * Marvell Semiconductor <www.marvell.com>
7 * Written-by: Prafulla Wadaskar <prafulla@marvell.com>
9 * See file CREDITS for list of people who contributed to this
12 * This program is free software; you can redistribute it and/or
13 * modify it under the terms of the GNU General Public License as
14 * published by the Free Software Foundation; either version 2 of
15 * the License, or (at your option) any later version.
17 * This program is distributed in the hope that it will be useful,
18 * but WITHOUT ANY WARRANTY; without even the implied warranty of
19 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20 * GNU General Public License for more details.
22 * You should have received a copy of the GNU General Public License
23 * along with this program; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
30 #include <asm/arch/cpu.h>
32 DECLARE_GLOBAL_DATA_PTR;
35 * orion5x_sdram_bar - reads SDRAM Base Address Register
37 u32 orion5x_sdram_bar(enum memory_bank bank)
39 struct orion5x_ddr_addr_decode_registers *winregs =
40 (struct orion5x_ddr_addr_decode_registers *)
44 u32 enable = 0x01 & winregs[bank].size;
46 if ((!enable) || (bank > BANK3))
49 result = winregs[bank].base;
54 /* dram_init must store complete ramsize in gd->ram_size */
55 gd->ram_size = get_ram_size(
56 (long *) orion5x_sdram_bar(0),
57 CONFIG_MAX_RAM_BANK_SIZE);
61 void dram_init_banksize (void)
65 for (i = 0; i < CONFIG_NR_DRAM_BANKS; i++) {
66 gd->bd->bi_dram[i].start = orion5x_sdram_bar(i);
67 gd->bd->bi_dram[i].size = get_ram_size(
68 (long *) (gd->bd->bi_dram[i].start),
69 CONFIG_MAX_RAM_BANK_SIZE);