Commit 2ee951ba2ac9874d2a93d52e7a187d3184be937e
1 parent
9def12cae3
Exists in
master
and in
54 other branches
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>
Showing 3 changed files with 13 additions and 0 deletions Side-by-side Diff
common/cmd_ubi.c
... | ... | @@ -31,6 +31,7 @@ |
31 | 31 | /* Private own data */ |
32 | 32 | static struct ubi_device *ubi; |
33 | 33 | static char buffer[80]; |
34 | +static int ubi_initialized; | |
34 | 35 | |
35 | 36 | struct selected_dev { |
36 | 37 | char dev_name[32]; /* NAND/OneNAND etc */ |
... | ... | @@ -428,6 +429,8 @@ |
428 | 429 | return err; |
429 | 430 | } |
430 | 431 | |
432 | + ubi_initialized = 1; | |
433 | + | |
431 | 434 | return 0; |
432 | 435 | } |
433 | 436 | |
... | ... | @@ -462,6 +465,14 @@ |
462 | 465 | |
463 | 466 | /* todo: get dev number for NAND... */ |
464 | 467 | ubi_dev.nr = 0; |
468 | + | |
469 | + /* | |
470 | + * Call ubi_exit() before re-initializing the UBI subsystem | |
471 | + */ | |
472 | + if (ubi_initialized) { | |
473 | + ubi_exit(); | |
474 | + del_mtd_partitions(ubi_dev.mtd_info); | |
475 | + } | |
465 | 476 | |
466 | 477 | /* |
467 | 478 | * Check for nand|onenand selection |
drivers/mtd/ubi/build.c
include/ubi_uboot.h