mtd: Add subpagesize to mtd_info_user
ubiformat needs the subpagesize to work correctly. The kernel uses sysfs to pass the subpagesize, but in barebox we have the possibility to extend struct mtd_info_user. Add a corresponding field and use it in ubiformat. Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
080a4e9c9b
commit
d7fe5e2263
|
@ -236,6 +236,7 @@ int mtd_ioctl(struct cdev *cdev, int request, void *buf)
|
|||
user->erasesize = mtd->erasesize;
|
||||
user->writesize = mtd->writesize;
|
||||
user->oobsize = mtd->oobsize;
|
||||
user->subpagesize = mtd->writesize >> mtd->subpage_sft;
|
||||
user->mtd = mtd;
|
||||
/* The below fields are obsolete */
|
||||
user->ecctype = -1;
|
||||
|
|
|
@ -171,6 +171,7 @@ static int partition_ioctl(struct cdev *cdev, int request, void *buf)
|
|||
user->erasesize = cdev->mtd->erasesize;
|
||||
user->writesize = cdev->mtd->writesize;
|
||||
user->oobsize = cdev->mtd->oobsize;
|
||||
user->subpagesize = cdev->mtd->writesize >> cdev->mtd->subpage_sft;
|
||||
user->mtd = cdev->mtd;
|
||||
/* The below fields are obsolete */
|
||||
user->ecctype = -1;
|
||||
|
|
|
@ -82,6 +82,7 @@ struct mtd_info_user {
|
|||
uint32_t ecctype;
|
||||
uint32_t eccsize;
|
||||
struct mtd_info *mtd;
|
||||
uint32_t subpagesize;
|
||||
};
|
||||
|
||||
struct region_info_user {
|
||||
|
|
|
@ -308,6 +308,7 @@ int mtd_get_dev_info(const char *node, struct mtd_dev_info *mtd)
|
|||
mtd->eb_size = ui.erasesize;
|
||||
mtd->min_io_size = ui.writesize;
|
||||
mtd->oob_size = ui.oobsize;
|
||||
mtd->subpage_size = ui.subpagesize;
|
||||
|
||||
if (mtd->min_io_size <= 0) {
|
||||
errmsg("%s has insane min. I/O unit size %d",
|
||||
|
@ -356,7 +357,6 @@ int mtd_get_dev_info(const char *node, struct mtd_dev_info *mtd)
|
|||
|
||||
if (ui.flags & MTD_WRITEABLE)
|
||||
mtd->writable = 1;
|
||||
mtd->subpage_size = mtd->min_io_size;
|
||||
|
||||
close(fd);
|
||||
|
||||
|
|
Loading…
Reference in New Issue