| 1 | /* |
| 2 | * Early initialization code for BCM94710 boards |
| 3 | * |
| 4 | * Copyright 2004, Broadcom Corporation |
| 5 | * All Rights Reserved. |
| 6 | * |
| 7 | * THIS SOFTWARE IS OFFERED "AS IS", AND BROADCOM GRANTS NO WARRANTIES OF ANY |
| 8 | * KIND, EXPRESS OR IMPLIED, BY STATUTE, COMMUNICATION OR OTHERWISE. BROADCOM |
| 9 | * SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS |
| 10 | * FOR A SPECIFIC PURPOSE OR NONINFRINGEMENT CONCERNING THIS SOFTWARE. |
| 11 | * |
| 12 | */ |
| 13 | |
| 14 | #include <linux/config.h> |
| 15 | #include <linux/init.h> |
| 16 | #include <linux/kernel.h> |
| 17 | #include <linux/types.h> |
| 18 | #include <asm/bootinfo.h> |
| 19 | |
| 20 | void __init |
| 21 | prom_init(int argc, const char **argv) |
| 22 | { |
| 23 | unsigned long mem; |
| 24 | unsigned long max; |
| 25 | |
| 26 | mips_machgroup = MACH_GROUP_BRCM; |
| 27 | mips_machtype = MACH_BCM947XX; |
| 28 | |
| 29 | /* Figure out memory size by finding aliases |
| 30 | * |
| 31 | * BCM47XX uses 128MB for addressing the ram, if the system contains |
| 32 | * less that that amount of ram it remaps the ram more often into the |
| 33 | * available space. |
| 34 | * Accessing memory after 128MB will cause an exception. |
| 35 | * max contains the biggest possible address supported by the platform. |
| 36 | * If the method wants to try something above we assume 128MB ram. |
| 37 | */ |
| 38 | max = ((unsigned long)(prom_init) | ((128 << 20) - 1)); |
| 39 | for (mem = (1 << 20); mem < (128 << 20); mem += (1 << 20)) { |
| 40 | if (((unsigned long)(prom_init) + mem) > max) { |
| 41 | mem = (128 << 20); |
| 42 | printk("assume 128MB RAM\n"); |
| 43 | break; |
| 44 | } |
| 45 | if (*(unsigned long *)((unsigned long)(prom_init) + mem) == |
| 46 | *(unsigned long *)(prom_init)) |
| 47 | break; |
| 48 | } |
| 49 | |
| 50 | add_memory_region(0, mem, BOOT_MEM_RAM); |
| 51 | } |
| 52 | |
| 53 | void __init |
| 54 | prom_free_prom_memory(void) |
| 55 | { |
| 56 | } |
| 57 | |