]> git.kernelconcepts.de Git - karo-tx-uboot.git/blobdiff - common/cmd_flash.c
Merge branch 'master' of git://git.denx.de/u-boot-arm
[karo-tx-uboot.git] / common / cmd_flash.c
index 2df40f0ee545080ebf56eaa10aaf777d93e5a8f1..6361c4ef9bfdf24a60dae5daf428d2d66708b2ec 100644 (file)
 #include <dataflash.h>
 #endif
 
-#if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
+#if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_CMD_MTDPARTS)
 #include <jffs2/jffs2.h>
 
-/* parition handling routines */
+/* partition handling routines */
 int mtdparts_init(void);
-int id_parse(const char *id, const char **ret_id, u8 *dev_type, u8 *dev_num);
+int mtd_id_parse(const char *id, const char **ret_id, u8 *dev_type, u8 *dev_num);
 int find_dev_and_part(const char *id, struct mtd_device **dev,
                u8 *part_num, struct part_info **part);
 #endif
@@ -325,7 +325,7 @@ 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 defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
+#if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_CMD_MTDPARTS)
        struct mtd_device *dev;
        struct part_info *part;
        u8 dev_type, dev_num, pnum;
@@ -357,9 +357,9 @@ int do_flerase (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                return rcode;
        }
 
-#if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
+#if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_CMD_MTDPARTS)
        /* erase <part-id> - erase partition */
-       if ((argc == 2) && (id_parse(argv[1], NULL, &dev_type, &dev_num) == 0)) {
+       if ((argc == 2) && (mtd_id_parse(argv[1], NULL, &dev_type, &dev_num) == 0)) {
                mtdparts_init();
                if (find_dev_and_part(argv[1], &dev, &pnum, &part) == 0) {
                        if (dev->id->type == MTD_DEV_TYPE_NOR) {
@@ -368,7 +368,7 @@ int do_flerase (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                                addr_first = part->offset + info->start[0];
                                addr_last = addr_first + part->size - 1;
 
-                               printf ("Erase Flash Parition %s, "
+                               printf ("Erase Flash Partition %s, "
                                                "bank %ld, 0x%08lx - 0x%08lx ",
                                                argv[1], bank, addr_first,
                                                addr_last);
@@ -468,17 +468,19 @@ int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
        ulong bank;
        int i, n, sect_first, sect_last;
 #endif /* CONFIG_SYS_NO_FLASH */
+#if !defined(CONFIG_SYS_NO_FLASH) || defined(CONFIG_HAS_DATAFLASH)
        ulong addr_first, addr_last;
-       int p;
-#if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
+#endif
+#if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_CMD_MTDPARTS)
        struct mtd_device *dev;
        struct part_info *part;
        u8 dev_type, dev_num, pnum;
 #endif
-       int rcode = 0;
 #ifdef CONFIG_HAS_DATAFLASH
        int status;
 #endif
+       int p;
+       int rcode = 0;
 
        if (argc < 3) {
                cmd_usage(cmdtp);
@@ -563,9 +565,9 @@ int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                return rcode;
        }
 
-#if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
+#if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_CMD_MTDPARTS)
        /* protect on/off <part-id> */
-       if ((argc == 3) && (id_parse(argv[2], NULL, &dev_type, &dev_num) == 0)) {
+       if ((argc == 3) && (mtd_id_parse(argv[2], NULL, &dev_type, &dev_num) == 0)) {
                mtdparts_init();
                if (find_dev_and_part(argv[2], &dev, &pnum, &part) == 0) {
                        if (dev->id->type == MTD_DEV_TYPE_NOR) {
@@ -574,7 +576,7 @@ int do_protect (cmd_tbl_t *cmdtp, int flag, int argc, char *argv[])
                                addr_first = part->offset + info->start[0];
                                addr_last = addr_first + part->size - 1;
 
-                               printf ("%sProtect Flash Parition %s, "
+                               printf ("%sProtect Flash Partition %s, "
                                                "bank %ld, 0x%08lx - 0x%08lx\n",
                                                p ? "" : "Un", argv[1],
                                                bank, addr_first, addr_last);
@@ -698,7 +700,7 @@ int flash_sect_protect (int p, ulong addr_first, ulong addr_last)
 
 
 /**************************************************/
-#if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_JFFS2_CMDLINE)
+#if defined(CONFIG_CMD_JFFS2) && defined(CONFIG_CMD_MTDPARTS)
 # define TMP_ERASE     "erase <part-id>\n    - erase partition\n"
 # define TMP_PROT_ON   "protect on <part-id>\n    - protect partition\n"
 # define TMP_PROT_OFF  "protect off <part-id>\n    - make partition writable\n"
@@ -710,14 +712,14 @@ int flash_sect_protect (int p, ulong addr_first, ulong addr_last)
 
 U_BOOT_CMD(
        flinfo,    2,    1,    do_flinfo,
-       "flinfo  - print FLASH memory information\n",
+       "print FLASH memory information",
        "\n    - print information for all FLASH memory banks\n"
-       "flinfo N\n    - print information for FLASH memory bank # N\n"
+       "flinfo N\n    - print information for FLASH memory bank # N"
 );
 
 U_BOOT_CMD(
        erase,   3,   0,  do_flerase,
-       "erase   - erase FLASH memory\n",
+       "erase FLASH memory",
        "start end\n"
        "    - erase FLASH from addr 'start' to addr 'end'\n"
        "erase start +len\n"
@@ -726,12 +728,12 @@ U_BOOT_CMD(
        "erase N:SF[-SL]\n    - erase sectors SF-SL in FLASH bank # N\n"
        "erase bank N\n    - erase FLASH bank # N\n"
        TMP_ERASE
-       "erase all\n    - erase all FLASH banks\n"
+       "erase all\n    - erase all FLASH banks"
 );
 
 U_BOOT_CMD(
        protect,  4,  0,   do_protect,
-       "protect - enable or disable FLASH write protection\n",
+       "enable or disable FLASH write protection",
        "on  start end\n"
        "    - protect FLASH from addr 'start' to addr 'end'\n"
        "protect on start +len\n"
@@ -751,7 +753,7 @@ U_BOOT_CMD(
        "    - make sectors SF-SL writable in FLASH bank # N\n"
        "protect off bank N\n    - make FLASH bank # N writable\n"
        TMP_PROT_OFF
-       "protect off all\n    - make all FLASH banks writable\n"
+       "protect off all\n    - make all FLASH banks writable"
 );
 
 #undef TMP_ERASE