diff options
author | Wolfgang Denk <wd@denx.de> | 2008-12-13 00:20:01 +0100 |
---|---|---|
committer | Wolfgang Denk <wd@denx.de> | 2008-12-13 00:20:01 +0100 |
commit | bd4345c175116df4a392f05c9f41679c545842d5 (patch) | |
tree | d5f06efbf4882ae8fb920827d3bc66c9b50297d7 /common | |
parent | 2145188bea2df8f2b47a87ec3071b55027e8d0ae (diff) | |
parent | 3b089e4f889a2902449d55e081c886ae607cae89 (diff) | |
download | u-boot-bd4345c175116df4a392f05c9f41679c545842d5.tar.gz u-boot-bd4345c175116df4a392f05c9f41679c545842d5.tar.bz2 u-boot-bd4345c175116df4a392f05c9f41679c545842d5.zip |
Merge branch 'master' of git://git.denx.de/u-boot-ubi
Diffstat (limited to 'common')
-rw-r--r-- | common/cmd_ubi.c | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/common/cmd_ubi.c b/common/cmd_ubi.c index 8446765878..4c358924e4 100644 --- a/common/cmd_ubi.c +++ b/common/cmd_ubi.c @@ -31,6 +31,7 @@ /* Private own data */ static struct ubi_device *ubi; static char buffer[80]; +static int ubi_initialized; struct selected_dev { char dev_name[32]; /* NAND/OneNAND etc */ @@ -428,6 +429,8 @@ static int ubi_dev_scan(struct mtd_info *info, char *ubidev) return err; } + ubi_initialized = 1; + return 0; } @@ -464,6 +467,14 @@ static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) ubi_dev.nr = 0; /* + * Call ubi_exit() before re-initializing the UBI subsystem + */ + if (ubi_initialized) { + ubi_exit(); + del_mtd_partitions(ubi_dev.mtd_info); + } + + /* * Check for nand|onenand selection */ #if defined(CONFIG_CMD_NAND) @@ -497,6 +508,7 @@ static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) err = ubi_dev_scan(ubi_dev.mtd_info, ubi_dev.part_name); if (err) { printf("UBI init error %d\n", err); + ubi_dev.type = DEV_TYPE_NONE; return err; } @@ -535,7 +547,7 @@ static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[]) } /* E.g., create volume size */ if (argc == 4) { - addr = simple_strtoul(argv[3], NULL, 16); + size = simple_strtoul(argv[3], NULL, 16); argc--; } /* Use maximum available size */ |