diff options
author | Stefan Roese <sr@denx.de> | 2008-11-27 14:07:09 +0100 |
---|---|---|
committer | Stefan Roese <sr@denx.de> | 2008-12-09 10:07:36 +0100 |
commit | 2ee951ba2ac9874d2a93d52e7a187d3184be937e (patch) | |
tree | d377165f9fc4d4bd1ac89ff00253681f269c0100 /common/cmd_ubi.c | |
parent | 9def12cae33d2d3ea2dd56b197fd3dfb3ad60bf4 (diff) | |
download | u-boot-imx-2ee951ba2ac9874d2a93d52e7a187d3184be937e.zip u-boot-imx-2ee951ba2ac9874d2a93d52e7a187d3184be937e.tar.gz u-boot-imx-2ee951ba2ac9874d2a93d52e7a187d3184be937e.tar.bz2 |
UBI: Enable re-initializing of the "ubi part" command
With this patch now, the user can call "ubi part" multiple times to
re-connect the UBI device to another MTD partition.
Signed-off-by: Stefan Roese <sr@denx.de>
Diffstat (limited to 'common/cmd_ubi.c')
-rw-r--r-- | common/cmd_ubi.c | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/common/cmd_ubi.c b/common/cmd_ubi.c index 8446765..495d71e 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) |