diff options
Diffstat (limited to 'recipes/u-boot/u-boot-1.1.4/u-boot-jerase-cmd.patch')
-rw-r--r-- | recipes/u-boot/u-boot-1.1.4/u-boot-jerase-cmd.patch | 107 |
1 files changed, 107 insertions, 0 deletions
diff --git a/recipes/u-boot/u-boot-1.1.4/u-boot-jerase-cmd.patch b/recipes/u-boot/u-boot-1.1.4/u-boot-jerase-cmd.patch new file mode 100644 index 0000000000..698f7a2d78 --- /dev/null +++ b/recipes/u-boot/u-boot-1.1.4/u-boot-jerase-cmd.patch @@ -0,0 +1,107 @@ +--- u-boot-orig/common/cmd_flash.c 2004-12-31 01:32:50.000000000 -0800 ++++ u-boot-1.1.2/common/cmd_flash.c 2005-09-13 23:00:14.000000000 -0700 +@@ -36,6 +36,11 @@ + + extern flash_info_t flash_info[]; /* info for FLASH chips */ + ++static const unsigned int JFFS2_CLEAN_HEADER[] = { 0x20031985, ++ 0x0000000c, ++ 0xe41eb0b1 ++ }; ++ + /* + * The user interface starts numbering for Flash banks with 1 + * for historical reasons. +@@ -206,29 +211,46 @@ + flash_print_info (&flash_info[bank-1]); + return 0; + } + ++void jffs2_write_header(flash_info_t *info, unsigned int first, unsigned int last) ++{ ++ unsigned int i; ++ for(i=first; i<=last; i++) ++ { ++ flash_write(JFFS2_CLEAN_HEADER, info->start[i], 12); ++ } ++} ++ + int do_flerase (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[]) + { + flash_info_t *info; + ulong bank, addr_first, addr_last; + int n, sect_first, sect_last; + #if (CONFIG_COMMANDS & CFG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE) + struct mtd_device *dev; + struct part_info *part; + u8 dev_type, dev_num, pnum; + #endif + int rcode = 0; ++ int jffs2erase = 0; + + if (argc < 2) { + printf ("Usage:\n%s\n", cmdtp->usage); + return 1; + } + ++ // Special JFFS2 erase which will write a JFFS2 "clean" header after the erase ++ if('j' == argv[0][0]) ++ { ++ jffs2erase = 1; ++ } ++ + if (strcmp(argv[1], "all") == 0) { + for (bank=1; bank<=CFG_MAX_FLASH_BANKS; ++bank) { + printf ("Erase Flash Bank # %ld ", bank); + info = &flash_info[bank-1]; + rcode = flash_erase (info, 0, info->sector_count-1); ++ if(jffs2erase) jffs2_write_header(info, 0, info->sector_count-1); + } + return rcode; + } +@@ -235,6 +257,7 @@ + printf ("Erase Flash Sectors %d-%d in Bank # %d ", + sect_first, sect_last, (info-flash_info)+1); + rcode = flash_erase(info, sect_first, sect_last); ++ if(jffs2erase) jffs2_write_header(info, sect_first, sect_last); + return rcode; + } + +@@ -253,6 +276,7 @@ + printf ("Erase Flash Bank # %ld ", bank); + info = &flash_info[bank-1]; + rcode = flash_erase (info, 0, info->sector_count-1); ++ if(jffs2erase) jffs2_write_header(info, 0, info->sector_count-1); + return rcode; + } + +@@ -264,6 +288,12 @@ + return 1; + } + ++ if (jffs2erase) ++ { ++ printf ("Usage:\n%s\n", cmdtp->usage); ++ return 1; ++ } ++ + rcode = flash_sect_erase(addr_first, addr_last); + return rcode; + } +@@ -517,6 +547,16 @@ + ); + + U_BOOT_CMD( ++ jerase, 3, 1, do_flerase, ++ "jerase - erase FLASH memory for JFFS2\n", ++ "jerase N:SF[-SL]\n - erase sectors SF-SL in FLASH bank # N\n" ++ "jerase bank N\n - erase FLASH bank # N\n" ++ "jerase all\n - erase all FLASH banks\n" ++ " in each case, after erasing a flash sector, that sector\n" ++ " has a JFFS2 'clean' marker written to it\n" ++); ++ ++U_BOOT_CMD( + protect, 4, 1, do_protect, + "protect - enable or disable FLASH write protection\n", + "on start end\n" |