aboutsummaryrefslogtreecommitdiffstats
path: root/arch/mips/bcm47xx/prom.c
diff options
context:
space:
mode:
Diffstat (limited to 'arch/mips/bcm47xx/prom.c')
-rw-r--r--arch/mips/bcm47xx/prom.c20
1 files changed, 16 insertions, 4 deletions
diff --git a/arch/mips/bcm47xx/prom.c b/arch/mips/bcm47xx/prom.c
index f6e9063cc4c2..8c155afb1299 100644
--- a/arch/mips/bcm47xx/prom.c
+++ b/arch/mips/bcm47xx/prom.c
@@ -1,6 +1,7 @@
1/* 1/*
2 * Copyright (C) 2004 Florian Schirmer <jolt@tuxbox.org> 2 * Copyright (C) 2004 Florian Schirmer <jolt@tuxbox.org>
3 * Copyright (C) 2007 Aurelien Jarno <aurelien@aurel32.net> 3 * Copyright (C) 2007 Aurelien Jarno <aurelien@aurel32.net>
4 * Copyright (C) 2010-2012 Hauke Mehrtens <hauke@hauke-m.de>
4 * 5 *
5 * This program is free software; you can redistribute it and/or modify it 6 * This program is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License as published by the 7 * under the terms of the GNU General Public License as published by the
@@ -27,6 +28,7 @@
27#include <linux/types.h> 28#include <linux/types.h>
28#include <linux/kernel.h> 29#include <linux/kernel.h>
29#include <linux/spinlock.h> 30#include <linux/spinlock.h>
31#include <linux/smp.h>
30#include <asm/bootinfo.h> 32#include <asm/bootinfo.h>
31#include <asm/fw/cfe/cfe_api.h> 33#include <asm/fw/cfe/cfe_api.h>
32#include <asm/fw/cfe/cfe_error.h> 34#include <asm/fw/cfe/cfe_error.h>
@@ -127,6 +129,8 @@ static __init void prom_init_mem(void)
127{ 129{
128 unsigned long mem; 130 unsigned long mem;
129 unsigned long max; 131 unsigned long max;
132 unsigned long off;
133 struct cpuinfo_mips *c = &current_cpu_data;
130 134
131 /* Figure out memory size by finding aliases. 135 /* Figure out memory size by finding aliases.
132 * 136 *
@@ -143,18 +147,26 @@ static __init void prom_init_mem(void)
143 * max contains the biggest possible address supported by the platform. 147 * max contains the biggest possible address supported by the platform.
144 * If the method wants to try something above we assume 128MB ram. 148 * If the method wants to try something above we assume 128MB ram.
145 */ 149 */
146 max = ((unsigned long)(prom_init) | ((128 << 20) - 1)); 150 off = (unsigned long)prom_init;
151 max = off | ((128 << 20) - 1);
147 for (mem = (1 << 20); mem < (128 << 20); mem += (1 << 20)) { 152 for (mem = (1 << 20); mem < (128 << 20); mem += (1 << 20)) {
148 if (((unsigned long)(prom_init) + mem) > max) { 153 if ((off + mem) > max) {
149 mem = (128 << 20); 154 mem = (128 << 20);
150 printk(KERN_DEBUG "assume 128MB RAM\n"); 155 printk(KERN_DEBUG "assume 128MB RAM\n");
151 break; 156 break;
152 } 157 }
153 if (*(unsigned long *)((unsigned long)(prom_init) + mem) == 158 if (!memcmp(prom_init, prom_init + mem, 32))
154 *(unsigned long *)(prom_init))
155 break; 159 break;
156 } 160 }
157 161
162 /* Ignoring the last page when ddr size is 128M. Cached
163 * accesses to last page is causing the processor to prefetch
164 * using address above 128M stepping out of the ddr address
165 * space.
166 */
167 if (c->cputype == CPU_74K && (mem == (128 << 20)))
168 mem -= 0x1000;
169
158 add_memory_region(0, mem, BOOT_MEM_RAM); 170 add_memory_region(0, mem, BOOT_MEM_RAM);
159} 171}
160 172