From 4a5517094dd30bb1f271403b62e23053301668e6 Mon Sep 17 00:00:00 2001 From: wdenk Date: Wed, 8 Oct 2003 23:26:14 +0000 Subject: * Patch by Scott McNutt, 04 Oct 2003: - add support for Altera Nios-32 CPU - add support for Nios Cyclone Development Kit (DK-1C20) * Patch by Steven Scholz, 29 Sep 2003: - A second parameter for bootm overwrites the load address for "Standalone Application" images. - bootm sets environment variable "filesize" to the resulting (uncompressed) data length for "Standalone Application" images when autostart is set to "no". Now you can do something like if bootm $fpgadata $some_free_ram ; then fpga load 0 $some_free_ram $filesize fi * Patch by Denis Peter, 25 Sept 2003: add support for the MIP405 Rev. C board --- board/mpl/common/flash.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) (limited to 'board/mpl/common') diff --git a/board/mpl/common/flash.c b/board/mpl/common/flash.c index 99f97d7738..98cfb0d318 100644 --- a/board/mpl/common/flash.c +++ b/board/mpl/common/flash.c @@ -155,7 +155,7 @@ void setup_cs_reloc(void) unsigned long flash_init (void) { - unsigned long size_b0, size_b1,flashcr; + unsigned long size_b0, size_b1,flashcr, size_reg; int mode, i; extern char version_string; char *p=&version_string; @@ -196,6 +196,21 @@ unsigned long flash_init (void) size_b1 = 0 ; flash_info[0].size = size_b0; /* set up flash cs according to the size */ + size_reg=(flash_info[0].size >>20); + switch (size_reg) { + case 0: + case 1: i=0; break; /* <= 1MB */ + case 2: i=1; break; /* = 2MB */ + case 4: i=2; break; /* = 4MB */ + case 8: i=3; break; /* = 8MB */ + case 16: i=4; break; /* = 16MB */ + case 32: i=5; break; /* = 32MB */ + case 64: i=6; break; /* = 64MB */ + case 128: i=7; break; /*= 128MB */ + default: + printf("\n #### ERROR, wrong size %ld MByte reset board #####\n",size_reg); + while(1); + } if(mode & BOOT_MPS) { /* flash is on CS1 */ mtdcr(ebccfga, pb1cr); @@ -203,7 +218,7 @@ unsigned long flash_init (void) /* we map the flash high in every case */ flashcr&=0x0001FFFF; /* mask out address bits */ flashcr|= ((0-flash_info[0].size) & 0xFFF00000); /* start addr */ - flashcr|= (((flash_info[0].size >>21) & 0x07) << 17); /* size addr */ + flashcr|= (i << 17); /* size addr */ mtdcr(ebccfga, pb1cr); mtdcr(ebccfgd, flashcr); } @@ -214,7 +229,7 @@ unsigned long flash_init (void) /* we map the flash high in every case */ flashcr&=0x0001FFFF; /* mask out address bits */ flashcr|= ((0-flash_info[0].size) & 0xFFF00000); /* start addr */ - flashcr|= (((flash_info[0].size >>21) & 0x07) << 17); /* size addr */ + flashcr|= (i << 17); /* size addr */ mtdcr(ebccfga, pb0cr); mtdcr(ebccfgd, flashcr); } -- cgit