mirror of
https://github.com/Stichting-MINIX-Research-Foundation/u-boot.git
synced 2025-09-10 12:39:22 -04:00
Merge branch 'master' of git://git.denx.de/u-boot-ubi
This commit is contained in:
commit
bd4345c175
@ -31,6 +31,7 @@
|
|||||||
/* Private own data */
|
/* Private own data */
|
||||||
static struct ubi_device *ubi;
|
static struct ubi_device *ubi;
|
||||||
static char buffer[80];
|
static char buffer[80];
|
||||||
|
static int ubi_initialized;
|
||||||
|
|
||||||
struct selected_dev {
|
struct selected_dev {
|
||||||
char dev_name[32]; /* NAND/OneNAND etc */
|
char dev_name[32]; /* NAND/OneNAND etc */
|
||||||
@ -428,6 +429,8 @@ static int ubi_dev_scan(struct mtd_info *info, char *ubidev)
|
|||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ubi_initialized = 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -463,6 +466,14 @@ static int do_ubi(cmd_tbl_t * cmdtp, int flag, int argc, char *argv[])
|
|||||||
/* todo: get dev number for NAND... */
|
/* todo: get dev number for NAND... */
|
||||||
ubi_dev.nr = 0;
|
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
|
* Check for nand|onenand selection
|
||||||
*/
|
*/
|
||||||
@ -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);
|
err = ubi_dev_scan(ubi_dev.mtd_info, ubi_dev.part_name);
|
||||||
if (err) {
|
if (err) {
|
||||||
printf("UBI init error %d\n", err);
|
printf("UBI init error %d\n", err);
|
||||||
|
ubi_dev.type = DEV_TYPE_NONE;
|
||||||
return err;
|
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 */
|
/* E.g., create volume size */
|
||||||
if (argc == 4) {
|
if (argc == 4) {
|
||||||
addr = simple_strtoul(argv[3], NULL, 16);
|
size = simple_strtoul(argv[3], NULL, 16);
|
||||||
argc--;
|
argc--;
|
||||||
}
|
}
|
||||||
/* Use maximum available size */
|
/* Use maximum available size */
|
||||||
|
@ -20,7 +20,7 @@
|
|||||||
#include <linux/mtd/compat.h>
|
#include <linux/mtd/compat.h>
|
||||||
|
|
||||||
/* Our partition linked list */
|
/* Our partition linked list */
|
||||||
static LIST_HEAD(mtd_partitions);
|
struct list_head mtd_partitions;
|
||||||
|
|
||||||
/* Our partition node structure */
|
/* Our partition node structure */
|
||||||
struct mtd_part {
|
struct mtd_part {
|
||||||
@ -349,6 +349,14 @@ int add_mtd_partitions(struct mtd_info *master,
|
|||||||
u_int32_t cur_offset = 0;
|
u_int32_t cur_offset = 0;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Need to init the list here, since LIST_INIT() does not
|
||||||
|
* work on platforms where relocation has problems (like MIPS
|
||||||
|
* & PPC).
|
||||||
|
*/
|
||||||
|
if (mtd_partitions.next == NULL)
|
||||||
|
INIT_LIST_HEAD(&mtd_partitions);
|
||||||
|
|
||||||
printk (KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n", nbparts, master->name);
|
printk (KERN_NOTICE "Creating %d MTD partitions on \"%s\":\n", nbparts, master->name);
|
||||||
|
|
||||||
for (i = 0; i < nbparts; i++) {
|
for (i = 0; i < nbparts; i++) {
|
||||||
|
@ -784,19 +784,20 @@ int ubi_attach_mtd_dev(struct mtd_info *mtd, int ubi_num, int vid_hdr_offset)
|
|||||||
if (err)
|
if (err)
|
||||||
goto out_free;
|
goto out_free;
|
||||||
|
|
||||||
|
err = -ENOMEM;
|
||||||
ubi->peb_buf1 = vmalloc(ubi->peb_size);
|
ubi->peb_buf1 = vmalloc(ubi->peb_size);
|
||||||
if (!ubi->peb_buf1)
|
if (!ubi->peb_buf1)
|
||||||
goto out_free;
|
goto out_free;
|
||||||
|
|
||||||
ubi->peb_buf2 = vmalloc(ubi->peb_size);
|
ubi->peb_buf2 = vmalloc(ubi->peb_size);
|
||||||
if (!ubi->peb_buf2)
|
if (!ubi->peb_buf2)
|
||||||
goto out_free;
|
goto out_free;
|
||||||
|
|
||||||
#ifdef CONFIG_MTD_UBI_DEBUG
|
#ifdef CONFIG_MTD_UBI_DEBUG
|
||||||
mutex_init(&ubi->dbg_buf_mutex);
|
mutex_init(&ubi->dbg_buf_mutex);
|
||||||
ubi->dbg_peb_buf = vmalloc(ubi->peb_size);
|
ubi->dbg_peb_buf = vmalloc(ubi->peb_size);
|
||||||
if (!ubi->dbg_peb_buf)
|
if (!ubi->dbg_peb_buf)
|
||||||
goto out_free;
|
goto out_free;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
err = attach_by_scanning(ubi);
|
err = attach_by_scanning(ubi);
|
||||||
@ -1059,6 +1060,7 @@ void __exit ubi_exit(void)
|
|||||||
misc_deregister(&ubi_ctrl_cdev);
|
misc_deregister(&ubi_ctrl_cdev);
|
||||||
class_remove_file(ubi_class, &ubi_version);
|
class_remove_file(ubi_class, &ubi_version);
|
||||||
class_destroy(ubi_class);
|
class_destroy(ubi_class);
|
||||||
|
mtd_devs = 0;
|
||||||
}
|
}
|
||||||
module_exit(ubi_exit);
|
module_exit(ubi_exit);
|
||||||
|
|
||||||
|
@ -211,6 +211,7 @@ static inline long IS_ERR(const void *ptr)
|
|||||||
/* functions */
|
/* functions */
|
||||||
extern int ubi_mtd_param_parse(const char *val, struct kernel_param *kp);
|
extern int ubi_mtd_param_parse(const char *val, struct kernel_param *kp);
|
||||||
extern int ubi_init(void);
|
extern int ubi_init(void);
|
||||||
|
extern void ubi_exit(void);
|
||||||
|
|
||||||
extern struct ubi_device *ubi_devices[];
|
extern struct ubi_device *ubi_devices[];
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user