diff options
author | Florian Fainelli <florian@openwrt.org> | 2007-06-14 11:59:31 +0000 |
---|---|---|
committer | Florian Fainelli <florian@openwrt.org> | 2007-06-14 11:59:31 +0000 |
commit | 8ed6f003520655bef682a07cb8f56250935233d4 (patch) | |
tree | 5a056d15be0287bc3d4cd53407ba5f587946d3b4 /target/linux/adm5120-2.6/files/arch/mips/adm5120/memory.c | |
parent | 816e40a9fe289b542416e0d33d4c0810933239a6 (diff) | |
download | upstream-8ed6f003520655bef682a07cb8f56250935233d4.tar.gz upstream-8ed6f003520655bef682a07cb8f56250935233d4.tar.bz2 upstream-8ed6f003520655bef682a07cb8f56250935233d4.zip |
Fix memory detection and hcd compilation, thanks Gabor ! (closes #1813)
SVN-Revision: 7631
Diffstat (limited to 'target/linux/adm5120-2.6/files/arch/mips/adm5120/memory.c')
-rw-r--r-- | target/linux/adm5120-2.6/files/arch/mips/adm5120/memory.c | 61 |
1 files changed, 8 insertions, 53 deletions
diff --git a/target/linux/adm5120-2.6/files/arch/mips/adm5120/memory.c b/target/linux/adm5120-2.6/files/arch/mips/adm5120/memory.c index 947b5b96a8..190a0788fc 100644 --- a/target/linux/adm5120-2.6/files/arch/mips/adm5120/memory.c +++ b/target/linux/adm5120-2.6/files/arch/mips/adm5120/memory.c @@ -35,49 +35,19 @@ #include <asm/page.h> #include <asm/sections.h> +#include <asm/mach-adm5120/adm5120_info.h> #include <asm-mips/mips-boards/prom.h> -extern char *prom_getenv(char *envname); -void prom_printf(char *, ...); - #define PFN_ALIGN(x) (((unsigned long)(x) + (PAGE_SIZE - 1)) & PAGE_MASK) -#define ADM5120_MEMCTRL 0x1200001c -#define ADM5120_MEMCTRL_SDRAM_MASK 0x7 - -static const unsigned long adm_sdramsize[] __initdata = { - 0x0, /* Reserved */ - 0x0400000, /* 4Mb */ - 0x0800000, /* 8Mb */ - 0x1000000, /* 16Mb */ - 0x4000000, /* 64Mb */ - 0x8000000, /* 128Mb */ -}; - -/* determined physical memory size, not overridden by command line args */ -unsigned long physical_memsize = 0L; - struct prom_pmemblock mdesc[PROM_MAX_PMEMBLOCKS]; struct prom_pmemblock * __init prom_getmdesc(void) { - char *memsize_str; unsigned int memsize; char cmdline[CL_SIZE], *ptr; - memsize_str = prom_getenv("memsize"); - - if (!memsize_str) - { - prom_printf("memsize not set in boot prom, set to default (8Mb)\n"); - physical_memsize = 0x00800000; - } - else -#ifdef DEBUG - prom_printf("prom_memsize = %s\n", memsize_str); -#endif - physical_memsize = simple_strtol(memsize_str, NULL, 0); - + memsize = adm5120_memsize; /* Check the command line for a memsize directive that overrides * the physical/default amount */ strcpy(cmdline, arcs_cmdline); @@ -87,16 +57,13 @@ struct prom_pmemblock * __init prom_getmdesc(void) if (ptr) memsize = memparse(ptr + 8, &ptr); - else - memsize = physical_memsize; + + memset(mdesc, 0, sizeof(mdesc)); + mdesc[0].type = BOOT_MEM_RAM; + mdesc[0].base = CPHYSADDR(PFN_ALIGN(&_end)); + mdesc[0].size = memsize - mdesc[0].base; - memset(mdesc, 0, sizeof(mdesc)); - - mdesc[0].type = BOOT_MEM_RAM; - mdesc[0].base = CPHYSADDR(PFN_ALIGN(&_end)); - mdesc[0].size = memsize - mdesc[0].base; - - return &mdesc[0]; + return &mdesc[0]; } void __init prom_meminit(void) @@ -117,18 +84,6 @@ void __init prom_meminit(void) } } -#if 0 -void __init prom_meminit(void) -{ - unsigned long base = CPHYSADDR(PFN_ALIGN(&_end)); - unsigned long size; - - u32 memctrl = *(u32*)KSEG1ADDR(ADM5120_MEMCTRL); - size = adm_sdramsize[memctrl & ADM5120_MEMCTRL_SDRAM_MASK]; - add_memory_region(base, size-base, BOOT_MEM_RAM); -} -#endif - void __init prom_free_prom_memory(void) { /* We do not have to prom memory to free */ |