summaryrefslogtreecommitdiff
path: root/board/innokom
diff options
context:
space:
mode:
authorwdenk <wdenk>2003-03-12 10:41:04 +0000
committerwdenk <wdenk>2003-03-12 10:41:04 +0000
commit3bac351370ef7cbf9d2af27ba52bee1703ad677e (patch)
tree689fbd22fcde4e63a0f4909acb3ea65475099e9c /board/innokom
parent1cb8e980c41e86760fa93de63f4e4cf643bef9d9 (diff)
downloadu-boot-imx-3bac351370ef7cbf9d2af27ba52bee1703ad677e.zip
u-boot-imx-3bac351370ef7cbf9d2af27ba52bee1703ad677e.tar.gz
u-boot-imx-3bac351370ef7cbf9d2af27ba52bee1703ad677e.tar.bz2
* Patch by Josef Wagner, 12 Mar 2003:
- 16/32 MB and 50/80 MHz support with auto-detection for IP860 - ETH05 and BEDBUG support for CU824 - added support for MicroSys CPC45 - new BOOTROM/FLASH0 and DOC base for PM826 * Patch by Robert Schwebel, 12 Mar 2003: Fix the chpart command on innokom board * Name cleanup: mv include/asm-i386/ppcboot-i386.h include/asm-i386/u-boot-i386.h s/PPCBoot/U-Boot/ in some files s/pImage/uImage/ in some files * Patch by Detlev Zundel, 15 Jan 2003: Fix '' command line quoting * Patch by The LEOX team, 19 Jan 2003: - add support for the ELPT860 board - add support for Dallas ds164x RTC
Diffstat (limited to 'board/innokom')
-rw-r--r--board/innokom/flash.c109
1 files changed, 52 insertions, 57 deletions
diff --git a/board/innokom/flash.c b/board/innokom/flash.c
index 5505bb5..b56707d 100644
--- a/board/innokom/flash.c
+++ b/board/innokom/flash.c
@@ -86,81 +86,79 @@ flash_info_t flash_info[CFG_MAX_FLASH_BANKS];
*/
static struct part_info part;
+static int current_part = -1;
#ifdef CONFIG_MTD_INNOKOM_16MB
#ifdef CONFIG_MTD_INNOKOM_64MB
#error Please define only one CONFIG_MTD_INNOKOM_XXMB option.
#endif
struct part_info* jffs2_part_info(int part_num) {
+ void *jffs2_priv_saved = part.jffs2_priv;
PRINTK2("jffs2_part_info: part_num=%i\n",part_num);
+ if (current_part == part_num)
+ return &part;
+
/* u-boot partition */
if(part_num==0){
- if(part.usr_priv==(void*)1) return &part;
-
memset(&part, 0, sizeof(part));
-
+
part.offset=(char*)0x00000000;
part.size=256*1024;
-
+
/* Mark the struct as ready */
- part.usr_priv=(void*)1;
+ current_part = part_num;
PRINTK("part.offset = 0x%08x\n",(unsigned int)part.offset);
PRINTK("part.size = 0x%08x\n",(unsigned int)part.size);
- return &part;
}
/* primary OS+firmware partition */
if(part_num==1){
- if(part.usr_priv==(void*)1) return &part;
-
memset(&part, 0, sizeof(part));
-
+
part.offset=(char*)0x00040000;
part.size=768*1024;
-
+
/* Mark the struct as ready */
- part.usr_priv=(void*)1;
+ current_part = part_num;
PRINTK("part.offset = 0x%08x\n",(unsigned int)part.offset);
PRINTK("part.size = 0x%08x\n",(unsigned int)part.size);
- return &part;
}
-
+
/* secondary OS+firmware partition */
if(part_num==2){
- if(part.usr_priv==(void*)1) return &part;
-
memset(&part, 0, sizeof(part));
-
+
part.offset=(char*)0x00100000;
part.size=8*1024*1024;
-
+
/* Mark the struct as ready */
- part.usr_priv=(void*)1;
+ current_part = part_num;
PRINTK("part.offset = 0x%08x\n",(unsigned int)part.offset);
PRINTK("part.size = 0x%08x\n",(unsigned int)part.size);
- return &part;
}
/* data partition */
if(part_num==3){
- if(part.usr_priv==(void*)1) return &part;
-
memset(&part, 0, sizeof(part));
-
+
part.offset=(char*)0x00900000;
part.size=7*1024*1024;
-
+
/* Mark the struct as ready */
- part.usr_priv=(void*)1;
+ current_part = part_num;
PRINTK("part.offset = 0x%08x\n",(unsigned int)part.offset);
PRINTK("part.size = 0x%08x\n",(unsigned int)part.size);
-
+ }
+
+ if (current_part == part_num) {
+ part.usr_priv = &current_part;
+ part.jffs2_priv = jffs2_priv_saved;
return &part;
}
@@ -174,75 +172,72 @@ struct part_info* jffs2_part_info(int part_num) {
#error Please define only one CONFIG_MTD_INNOKOM_XXMB option.
#endif
struct part_info* jffs2_part_info(int part_num) {
+ void *jffs2_priv_saved = part.jffs2_priv;
PRINTK2("jffs2_part_info: part_num=%i\n",part_num);
+ if (current_part == part_num)
+ return &part;
+
/* u-boot partition */
if(part_num==0){
- if(part.usr_priv==(void*)1) return &part;
-
memset(&part, 0, sizeof(part));
-
+
part.offset=(char*)0x00000000;
part.size=256*1024;
-
+
/* Mark the struct as ready */
- part.usr_priv=(void*)1;
+ current_part = part_num;
PRINTK("part.offset = 0x%08x\n",(unsigned int)part.offset);
PRINTK("part.size = 0x%08x\n",(unsigned int)part.size);
- return &part;
}
/* primary OS+firmware partition */
if(part_num==1){
- if(part.usr_priv==(void*)1) return &part;
-
memset(&part, 0, sizeof(part));
-
+
part.offset=(char*)0x00040000;
part.size=16*1024*1024-128*1024;
-
+
/* Mark the struct as ready */
- part.usr_priv=(void*)1;
+ current_part = part_num;
PRINTK("part.offset = 0x%08x\n",(unsigned int)part.offset);
PRINTK("part.size = 0x%08x\n",(unsigned int)part.size);
- return &part;
}
-
+
/* secondary OS+firmware partition */
if(part_num==2){
- if(part.usr_priv==(void*)1) return &part;
-
memset(&part, 0, sizeof(part));
-
+
part.offset=(char*)0x01020000;
part.size=16*1024*1024-128*1024;
-
+
/* Mark the struct as ready */
- part.usr_priv=(void*)1;
+ current_part = part_num;
PRINTK("part.offset = 0x%08x\n",(unsigned int)part.offset);
PRINTK("part.size = 0x%08x\n",(unsigned int)part.size);
- return &part;
}
/* data partition */
if(part_num==3){
- if(part.usr_priv==(void*)1) return &part;
-
memset(&part, 0, sizeof(part));
-
+
part.offset=(char*)0x02000000;
part.size=32*1024*1024;
-
+
/* Mark the struct as ready */
- part.usr_priv=(void*)1;
+ current_part = part_num;
PRINTK("part.offset = 0x%08x\n",(unsigned int)part.offset);
PRINTK("part.size = 0x%08x\n",(unsigned int)part.size);
-
+ }
+
+ if (current_part == part_num) {
+ part.usr_priv = &current_part;
+ part.jffs2_priv = jffs2_priv_saved;
return &part;
}
@@ -336,13 +331,13 @@ void flash_print_info (flash_info_t *info)
return;
}
- printf(" Size: %ld MB in %d Sectors\n",
+ printf(" Size: %ld MB in %d Sectors\n",
info->size >> 20, info->sector_count);
printf(" Sector Start Addresses:");
for (i = 0; i < info->sector_count; i++) {
if ((i % 5) == 0) printf ("\n ");
-
+
printf (" %08lX%s", info->start[i],
info->protect[i] ? " (RO)" : " ");
}
@@ -371,7 +366,7 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)
if ((info->flash_id & FLASH_VENDMASK) != (INTEL_MANUFACT & FLASH_VENDMASK))
return ERR_UNKNOWN_FLASH_VENDOR;
-
+
prot = 0;
for (sect=s_first; sect<=s_last; ++sect) {
if (info->protect[sect]) prot++;
@@ -421,13 +416,13 @@ int flash_erase(flash_info_t *info, int s_first, int s_last)
goto outahere;
}
}
-
+
PRINTK("clearing status register\n");
- *addr = 0x0050;
+ *addr = 0x0050;
PRINTK("resetting to read mode");
- *addr = 0x00FF;
+ *addr = 0x00FF;
}
-
+
printf("ok.\n");
}