]> git.sur5r.net Git - u-boot/commitdiff
kirkwood: implement kw_sdram_size_adjust
authorGerlando Falauto <gerlando.falauto@keymile.com>
Wed, 25 Jul 2012 06:23:48 +0000 (06:23 +0000)
committerPrafulla Wadaskar <prafulla@marvell.com>
Wed, 3 Oct 2012 11:13:13 +0000 (16:43 +0530)
Size of the SDRAM chips might differ between any two (otherwise
identical) instances of the same board.

So add a function kw_sdram_size_adjust() which reads out the current
ram size for a given bank, and adjusts the Kirkwood's SDRAM window size
register accordingly.

Signed-off-by: Gerlando Falauto <gerlando.falauto@keymile.com>
Signed-off-by: Holger Brunck <holger.brunck@keymile.com>
cc: Prafulla Wadaskar <prafulla@marvell.com>
cc: Valentin Longchamp <valentin.longchamp@keymile.com>

arch/arm/cpu/arm926ejs/kirkwood/dram.c
arch/arm/include/asm/arch-kirkwood/cpu.h

index 5e2f9d80ea1dbdc9b3a9a910e4fc71a9d2dbcfe8..807894fff127bf5caac804314c2946480f3ca2c1 100644 (file)
@@ -97,6 +97,17 @@ u32 kw_sdram_bs(enum memory_bank bank)
        return result;
 }
 
+void kw_sdram_size_adjust(enum memory_bank bank)
+{
+       u32 size;
+
+       /* probe currently equipped RAM size */
+       size = get_ram_size((void *)kw_sdram_bar(bank), kw_sdram_bs(bank));
+
+       /* adjust SDRAM window size accordingly */
+       kw_sdram_bs_set(bank, size);
+}
+
 #ifndef CONFIG_SYS_BOARD_DRAM_INIT
 int dram_init(void)
 {
index d28c51a9b6b9ed849de1118c64c4e3e813f46dd5..23783d543205f2efe5f9148e381852dd32c912be 100644 (file)
@@ -159,6 +159,7 @@ void reset_cpu(unsigned long ignored);
 unsigned char get_random_hex(void);
 unsigned int kw_sdram_bar(enum memory_bank bank);
 unsigned int kw_sdram_bs(enum memory_bank bank);
+void kw_sdram_size_adjust(enum memory_bank bank);
 int kw_config_adr_windows(void);
 void kw_config_gpio(unsigned int gpp0_oe_val, unsigned int gpp1_oe_val,
                unsigned int gpp0_oe, unsigned int gpp1_oe);