aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2011-03-18 13:50:27 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-03-18 13:50:27 -0400
commit8f627a8a881481598c2591c3acc122fb9be7bac4 (patch)
tree06497d25e30824500aeaf8c736c45b070f121234 /drivers/mtd
parentfd57ed021990157ee5b3997c3f21c734093a9e23 (diff)
parent5d630e43284fdb0613e4e7e7dd906f27bc25b6af (diff)
Merge branch 'linux-next' of git://git.infradead.org/ubifs-2.6
* 'linux-next' of git://git.infradead.org/ubifs-2.6: (25 commits) UBIFS: clean-up commentaries UBIFS: save 128KiB or more RAM UBIFS: allocate orphans scan buffer on demand UBIFS: allocate lpt dump buffer on demand UBIFS: allocate ltab checking buffer on demand UBIFS: allocate scanning buffer on demand UBIFS: allocate dump buffer on demand UBIFS: do not check data crc by default UBIFS: simplify UBIFS Kconfig menu UBIFS: print max. index node size UBIFS: handle allocation failures in UBIFS write path UBIFS: use max_write_size during recovery UBIFS: use max_write_size for write-buffers UBIFS: introduce write-buffer size field UBI: incorporate LEB offset information UBIFS: incorporate maximum write size UBI: provide LEB offset information UBI: incorporate maximum write size UBIFS: fix LEB number in printk UBIFS: restrict world-writable debugfs files ...
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/ubi/build.c14
-rw-r--r--drivers/mtd/ubi/kapi.c2
-rw-r--r--drivers/mtd/ubi/ubi.h3
3 files changed, 19 insertions, 0 deletions
diff --git a/drivers/mtd/ubi/build.c b/drivers/mtd/ubi/build.c
index a801ea6b8b6d..65626c1c446d 100644
--- a/drivers/mtd/ubi/build.c
+++ b/drivers/mtd/ubi/build.c
@@ -690,11 +690,25 @@ static int io_init(struct ubi_device *ubi)
690 ubi_assert(ubi->hdrs_min_io_size <= ubi->min_io_size); 690 ubi_assert(ubi->hdrs_min_io_size <= ubi->min_io_size);
691 ubi_assert(ubi->min_io_size % ubi->hdrs_min_io_size == 0); 691 ubi_assert(ubi->min_io_size % ubi->hdrs_min_io_size == 0);
692 692
693 ubi->max_write_size = ubi->mtd->writebufsize;
694 /*
695 * Maximum write size has to be greater or equivalent to min. I/O
696 * size, and be multiple of min. I/O size.
697 */
698 if (ubi->max_write_size < ubi->min_io_size ||
699 ubi->max_write_size % ubi->min_io_size ||
700 !is_power_of_2(ubi->max_write_size)) {
701 ubi_err("bad write buffer size %d for %d min. I/O unit",
702 ubi->max_write_size, ubi->min_io_size);
703 return -EINVAL;
704 }
705
693 /* Calculate default aligned sizes of EC and VID headers */ 706 /* Calculate default aligned sizes of EC and VID headers */
694 ubi->ec_hdr_alsize = ALIGN(UBI_EC_HDR_SIZE, ubi->hdrs_min_io_size); 707 ubi->ec_hdr_alsize = ALIGN(UBI_EC_HDR_SIZE, ubi->hdrs_min_io_size);
695 ubi->vid_hdr_alsize = ALIGN(UBI_VID_HDR_SIZE, ubi->hdrs_min_io_size); 708 ubi->vid_hdr_alsize = ALIGN(UBI_VID_HDR_SIZE, ubi->hdrs_min_io_size);
696 709
697 dbg_msg("min_io_size %d", ubi->min_io_size); 710 dbg_msg("min_io_size %d", ubi->min_io_size);
711 dbg_msg("max_write_size %d", ubi->max_write_size);
698 dbg_msg("hdrs_min_io_size %d", ubi->hdrs_min_io_size); 712 dbg_msg("hdrs_min_io_size %d", ubi->hdrs_min_io_size);
699 dbg_msg("ec_hdr_alsize %d", ubi->ec_hdr_alsize); 713 dbg_msg("ec_hdr_alsize %d", ubi->ec_hdr_alsize);
700 dbg_msg("vid_hdr_alsize %d", ubi->vid_hdr_alsize); 714 dbg_msg("vid_hdr_alsize %d", ubi->vid_hdr_alsize);
diff --git a/drivers/mtd/ubi/kapi.c b/drivers/mtd/ubi/kapi.c
index 69fa4ef03c53..d39716e5b204 100644
--- a/drivers/mtd/ubi/kapi.c
+++ b/drivers/mtd/ubi/kapi.c
@@ -40,7 +40,9 @@ void ubi_do_get_device_info(struct ubi_device *ubi, struct ubi_device_info *di)
40{ 40{
41 di->ubi_num = ubi->ubi_num; 41 di->ubi_num = ubi->ubi_num;
42 di->leb_size = ubi->leb_size; 42 di->leb_size = ubi->leb_size;
43 di->leb_start = ubi->leb_start;
43 di->min_io_size = ubi->min_io_size; 44 di->min_io_size = ubi->min_io_size;
45 di->max_write_size = ubi->max_write_size;
44 di->ro_mode = ubi->ro_mode; 46 di->ro_mode = ubi->ro_mode;
45 di->cdev = ubi->cdev.dev; 47 di->cdev = ubi->cdev.dev;
46} 48}
diff --git a/drivers/mtd/ubi/ubi.h b/drivers/mtd/ubi/ubi.h
index 49c864d175db..f1be8b79663c 100644
--- a/drivers/mtd/ubi/ubi.h
+++ b/drivers/mtd/ubi/ubi.h
@@ -382,6 +382,8 @@ struct ubi_wl_entry;
382 * @bad_allowed: whether the MTD device admits of bad physical eraseblocks or 382 * @bad_allowed: whether the MTD device admits of bad physical eraseblocks or
383 * not 383 * not
384 * @nor_flash: non-zero if working on top of NOR flash 384 * @nor_flash: non-zero if working on top of NOR flash
385 * @max_write_size: maximum amount of bytes the underlying flash can write at a
386 * time (MTD write buffer size)
385 * @mtd: MTD device descriptor 387 * @mtd: MTD device descriptor
386 * 388 *
387 * @peb_buf1: a buffer of PEB size used for different purposes 389 * @peb_buf1: a buffer of PEB size used for different purposes
@@ -463,6 +465,7 @@ struct ubi_device {
463 int vid_hdr_shift; 465 int vid_hdr_shift;
464 unsigned int bad_allowed:1; 466 unsigned int bad_allowed:1;
465 unsigned int nor_flash:1; 467 unsigned int nor_flash:1;
468 int max_write_size;
466 struct mtd_info *mtd; 469 struct mtd_info *mtd;
467 470
468 void *peb_buf1; 471 void *peb_buf1;