From: Robert Schwebel <robert@schwebel.de>
To: u-boot@lists.denx.de
Subject: [U-Boot-Users] [PATCH] innokom flash update
Date: Wed, 12 Mar 2003 08:54:06 +0100 [thread overview]
Message-ID: <20030312075406.GT4459@pengutronix.de> (raw)
Here's a patch to fix the chpart command on innokom. Please apply.
Robert
--
Dipl.-Ing. Robert Schwebel | http://www.pengutronix.de
Pengutronix - Linux Solutions for Science and Industry
Braunschweiger Str. 79, 31134 Hildesheim, Germany
Handelsregister: Amtsgericht Hildesheim, HRA 2686
Phone: +49-5121-28619-0 | Fax: +49-5121-28619-4
-------------- next part --------------
diff -urN -x ptx-patches -x CVS u-boot/board/innokom/flash.c u-boot-ptx/board/innokom/flash.c
--- u-boot/board/innokom/flash.c 2003-03-06 16:53:37.000000000 +0100
+++ u-boot-ptx/board/innokom/flash.c 2003-03-07 13:58:46.000000000 +0100
@@ -86,81 +89,79 @@
*/
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 ∂
+
/* u-boot partition */
if(part_num==0){
- if(part.usr_priv==(void*)1) return ∂
-
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 ∂
}
/* primary OS+firmware partition */
if(part_num==1){
- if(part.usr_priv==(void*)1) return ∂
-
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 ∂
}
-
+
/* secondary OS+firmware partition */
if(part_num==2){
- if(part.usr_priv==(void*)1) return ∂
-
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 ∂
}
/* data partition */
if(part_num==3){
- if(part.usr_priv==(void*)1) return ∂
-
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 = ¤t_part;
+ part.jffs2_priv = jffs2_priv_saved;
return ∂
}
@@ -174,75 +175,72 @@
#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 ∂
+
/* u-boot partition */
if(part_num==0){
- if(part.usr_priv==(void*)1) return ∂
-
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 ∂
}
/* primary OS+firmware partition */
if(part_num==1){
- if(part.usr_priv==(void*)1) return ∂
-
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 ∂
}
-
+
/* secondary OS+firmware partition */
if(part_num==2){
- if(part.usr_priv==(void*)1) return ∂
-
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 ∂
}
/* data partition */
if(part_num==3){
- if(part.usr_priv==(void*)1) return ∂
-
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 = ¤t_part;
+ part.jffs2_priv = jffs2_priv_saved;
return ∂
}
@@ -336,13 +334,13 @@
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 +369,7 @@
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 +419,13 @@
goto outahere;
}
}
-
+
PRINTK("clearing status register\n");
- *addr = 0x0050;
+ *addr = 0x0050;
PRINTK("resetting to read mode");
- *addr = 0x00FF;
+ *addr = 0x00FF;
}
-
+
printf("ok.\n");
}
diff -urN -x ptx-patches -x CVS u-boot/common/cmd_flash.c u-boot-ptx/common/cmd_flash.c
--- u-boot/common/cmd_flash.c 2002-09-18 14:49:44.000000000 +0200
+++ u-boot-ptx/common/cmd_flash.c 2003-01-31 23:03:14.000000000 +0100
@@ -129,7 +129,7 @@
if (strcmp(argv[1], "all") == 0) {
for (bank=1; bank<=CFG_MAX_FLASH_BANKS; ++bank) {
- printf ("Erase Flash Bank # %ld ", bank);
+ printf ("Erase Flash Bank #%ld\n", bank);
info = &flash_info[bank-1];
rcode = flash_erase (info, 0, info->sector_count-1);
}
@@ -141,7 +141,7 @@
printf("Bad sector specification\n");
return 1;
}
- printf ("Erase Flash Sectors %d-%d in Bank # %d ",
+ printf ("Erase Flash Sectors %d-%d in Bank #%d\n",
sect_first, sect_last, (info-flash_info)+1);
rcode = flash_erase(info, sect_first, sect_last);
return rcode;
@@ -159,7 +159,7 @@
CFG_MAX_FLASH_BANKS);
return 1;
}
- printf ("Erase Flash Bank # %ld ", bank);
+ printf ("Erase Flash Bank #%ld\n", bank);
info = &flash_info[bank-1];
rcode = flash_erase (info, 0, info->sector_count-1);
return rcode;
reply other threads:[~2003-03-12 7:54 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20030312075406.GT4459@pengutronix.de \
--to=robert@schwebel.de \
--cc=u-boot@lists.denx.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox