diff options
Diffstat (limited to 'arch/ppc/boot/simple/misc-mv64x60.c')
-rw-r--r-- | arch/ppc/boot/simple/misc-mv64x60.c | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/arch/ppc/boot/simple/misc-mv64x60.c b/arch/ppc/boot/simple/misc-mv64x60.c index 7e88fc6d207..258d4599fad 100644 --- a/arch/ppc/boot/simple/misc-mv64x60.c +++ b/arch/ppc/boot/simple/misc-mv64x60.c @@ -19,6 +19,33 @@ extern struct bi_record *decompress_kernel(unsigned long load_addr, int num_words, unsigned long cksum); + +u32 size_reg[MV64x60_CPU2MEM_WINDOWS] = { + MV64x60_CPU2MEM_0_SIZE, MV64x60_CPU2MEM_1_SIZE, + MV64x60_CPU2MEM_2_SIZE, MV64x60_CPU2MEM_3_SIZE +}; + +/* Read mem ctlr to get the amount of mem in system */ +unsigned long +mv64360_get_mem_size(void) +{ + u32 enables, i, v; + u32 mem = 0; + + enables = in_le32((void __iomem *)CONFIG_MV64X60_NEW_BASE + + MV64360_CPU_BAR_ENABLE) & 0xf; + + for (i=0; i<MV64x60_CPU2MEM_WINDOWS; i++) + if (!(enables & (1<<i))) { + v = in_le32((void __iomem *)CONFIG_MV64X60_NEW_BASE + + size_reg[i]) & 0xffff; + v = (v + 1) << 16; + mem += v; + } + + return mem; +} + void mv64x60_move_base(void __iomem *old_base, void __iomem *new_base) { |