aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/ftl.c3
-rw-r--r--drivers/mtd/inftlcore.c3
-rw-r--r--drivers/mtd/mtd_blkdevs.c15
-rw-r--r--drivers/mtd/mtdblock.c3
-rw-r--r--drivers/mtd/mtdblock_ro.c3
-rw-r--r--drivers/mtd/nftlcore.c3
-rw-r--r--drivers/mtd/rfd_ftl.c3
7 files changed, 21 insertions, 12 deletions
diff --git a/drivers/mtd/ftl.c b/drivers/mtd/ftl.c
index 8a878b34eca0..da39355132d8 100644
--- a/drivers/mtd/ftl.c
+++ b/drivers/mtd/ftl.c
@@ -1054,7 +1054,7 @@ static void ftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
1054 le32_to_cpu(partition->header.FormattedSize) >> 10); 1054 le32_to_cpu(partition->header.FormattedSize) >> 10);
1055#endif 1055#endif
1056 partition->mbd.size = le32_to_cpu(partition->header.FormattedSize) >> 9; 1056 partition->mbd.size = le32_to_cpu(partition->header.FormattedSize) >> 9;
1057 partition->mbd.blksize = SECTOR_SIZE; 1057
1058 partition->mbd.tr = tr; 1058 partition->mbd.tr = tr;
1059 partition->mbd.devnum = -1; 1059 partition->mbd.devnum = -1;
1060 if (!add_mtd_blktrans_dev((void *)partition)) 1060 if (!add_mtd_blktrans_dev((void *)partition))
@@ -1076,6 +1076,7 @@ struct mtd_blktrans_ops ftl_tr = {
1076 .name = "ftl", 1076 .name = "ftl",
1077 .major = FTL_MAJOR, 1077 .major = FTL_MAJOR,
1078 .part_bits = PART_BITS, 1078 .part_bits = PART_BITS,
1079 .blksize = SECTOR_SIZE,
1079 .readsect = ftl_readsect, 1080 .readsect = ftl_readsect,
1080 .writesect = ftl_writesect, 1081 .writesect = ftl_writesect,
1081 .getgeo = ftl_getgeo, 1082 .getgeo = ftl_getgeo,
diff --git a/drivers/mtd/inftlcore.c b/drivers/mtd/inftlcore.c
index 4116535805f1..a1b2de605000 100644
--- a/drivers/mtd/inftlcore.c
+++ b/drivers/mtd/inftlcore.c
@@ -77,7 +77,7 @@ static void inftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
77 77
78 inftl->mbd.mtd = mtd; 78 inftl->mbd.mtd = mtd;
79 inftl->mbd.devnum = -1; 79 inftl->mbd.devnum = -1;
80 inftl->mbd.blksize = 512; 80
81 inftl->mbd.tr = tr; 81 inftl->mbd.tr = tr;
82 82
83 if (INFTL_mount(inftl) < 0) { 83 if (INFTL_mount(inftl) < 0) {
@@ -945,6 +945,7 @@ static struct mtd_blktrans_ops inftl_tr = {
945 .name = "inftl", 945 .name = "inftl",
946 .major = INFTL_MAJOR, 946 .major = INFTL_MAJOR,
947 .part_bits = INFTL_PARTN_BITS, 947 .part_bits = INFTL_PARTN_BITS,
948 .blksize = 512,
948 .getgeo = inftl_getgeo, 949 .getgeo = inftl_getgeo,
949 .readsect = inftl_readblock, 950 .readsect = inftl_readblock,
950 .writesect = inftl_writeblock, 951 .writesect = inftl_writeblock,
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index 178b53b56be9..b5d62cb357da 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -42,19 +42,20 @@ static int do_blktrans_request(struct mtd_blktrans_ops *tr,
42 unsigned long block, nsect; 42 unsigned long block, nsect;
43 char *buf; 43 char *buf;
44 44
45 block = req->sector; 45 block = req->sector << 9 >> tr->blkshift;
46 nsect = req->current_nr_sectors; 46 nsect = req->current_nr_sectors << 9 >> tr->blkshift;
47
47 buf = req->buffer; 48 buf = req->buffer;
48 49
49 if (!blk_fs_request(req)) 50 if (!blk_fs_request(req))
50 return 0; 51 return 0;
51 52
52 if (block + nsect > get_capacity(req->rq_disk)) 53 if (req->sector + req->current_nr_sectors > get_capacity(req->rq_disk))
53 return 0; 54 return 0;
54 55
55 switch(rq_data_dir(req)) { 56 switch(rq_data_dir(req)) {
56 case READ: 57 case READ:
57 for (; nsect > 0; nsect--, block++, buf += 512) 58 for (; nsect > 0; nsect--, block++, buf += tr->blksize)
58 if (tr->readsect(dev, block, buf)) 59 if (tr->readsect(dev, block, buf))
59 return 0; 60 return 0;
60 return 1; 61 return 1;
@@ -63,7 +64,7 @@ static int do_blktrans_request(struct mtd_blktrans_ops *tr,
63 if (!tr->writesect) 64 if (!tr->writesect)
64 return 0; 65 return 0;
65 66
66 for (; nsect > 0; nsect--, block++, buf += 512) 67 for (; nsect > 0; nsect--, block++, buf += tr->blksize)
67 if (tr->writesect(dev, block, buf)) 68 if (tr->writesect(dev, block, buf))
68 return 0; 69 return 0;
69 return 1; 70 return 1;
@@ -297,7 +298,7 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
297 298
298 /* 2.5 has capacity in units of 512 bytes while still 299 /* 2.5 has capacity in units of 512 bytes while still
299 having BLOCK_SIZE_BITS set to 10. Just to keep us amused. */ 300 having BLOCK_SIZE_BITS set to 10. Just to keep us amused. */
300 set_capacity(gd, (new->size * new->blksize) >> 9); 301 set_capacity(gd, (new->size * tr->blksize) >> 9);
301 302
302 gd->private_data = new; 303 gd->private_data = new;
303 new->blkcore_priv = gd; 304 new->blkcore_priv = gd;
@@ -401,6 +402,8 @@ int register_mtd_blktrans(struct mtd_blktrans_ops *tr)
401 } 402 }
402 403
403 tr->blkcore_priv->rq->queuedata = tr; 404 tr->blkcore_priv->rq->queuedata = tr;
405 blk_queue_hardsect_size(tr->blkcore_priv->rq, tr->blksize);
406 tr->blkshift = ffs(tr->blksize) - 1;
404 407
405 ret = kernel_thread(mtd_blktrans_thread, tr, CLONE_KERNEL); 408 ret = kernel_thread(mtd_blktrans_thread, tr, CLONE_KERNEL);
406 if (ret < 0) { 409 if (ret < 0) {
diff --git a/drivers/mtd/mtdblock.c b/drivers/mtd/mtdblock.c
index 04ed34694b14..a052648f6e31 100644
--- a/drivers/mtd/mtdblock.c
+++ b/drivers/mtd/mtdblock.c
@@ -348,7 +348,7 @@ static void mtdblock_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
348 348
349 dev->mtd = mtd; 349 dev->mtd = mtd;
350 dev->devnum = mtd->index; 350 dev->devnum = mtd->index;
351 dev->blksize = 512; 351
352 dev->size = mtd->size >> 9; 352 dev->size = mtd->size >> 9;
353 dev->tr = tr; 353 dev->tr = tr;
354 354
@@ -368,6 +368,7 @@ static struct mtd_blktrans_ops mtdblock_tr = {
368 .name = "mtdblock", 368 .name = "mtdblock",
369 .major = 31, 369 .major = 31,
370 .part_bits = 0, 370 .part_bits = 0,
371 .blksize = 512,
371 .open = mtdblock_open, 372 .open = mtdblock_open,
372 .flush = mtdblock_flush, 373 .flush = mtdblock_flush,
373 .release = mtdblock_release, 374 .release = mtdblock_release,
diff --git a/drivers/mtd/mtdblock_ro.c b/drivers/mtd/mtdblock_ro.c
index 29563ed258a4..642ccc66f283 100644
--- a/drivers/mtd/mtdblock_ro.c
+++ b/drivers/mtd/mtdblock_ro.c
@@ -42,7 +42,7 @@ static void mtdblock_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
42 42
43 dev->mtd = mtd; 43 dev->mtd = mtd;
44 dev->devnum = mtd->index; 44 dev->devnum = mtd->index;
45 dev->blksize = 512; 45
46 dev->size = mtd->size >> 9; 46 dev->size = mtd->size >> 9;
47 dev->tr = tr; 47 dev->tr = tr;
48 dev->readonly = 1; 48 dev->readonly = 1;
@@ -60,6 +60,7 @@ static struct mtd_blktrans_ops mtdblock_tr = {
60 .name = "mtdblock", 60 .name = "mtdblock",
61 .major = 31, 61 .major = 31,
62 .part_bits = 0, 62 .part_bits = 0,
63 .blksize = 512,
63 .readsect = mtdblock_readsect, 64 .readsect = mtdblock_readsect,
64 .writesect = mtdblock_writesect, 65 .writesect = mtdblock_writesect,
65 .add_mtd = mtdblock_add_mtd, 66 .add_mtd = mtdblock_add_mtd,
diff --git a/drivers/mtd/nftlcore.c b/drivers/mtd/nftlcore.c
index b5a5f8da4722..d974adab3492 100644
--- a/drivers/mtd/nftlcore.c
+++ b/drivers/mtd/nftlcore.c
@@ -67,7 +67,7 @@ static void nftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
67 67
68 nftl->mbd.mtd = mtd; 68 nftl->mbd.mtd = mtd;
69 nftl->mbd.devnum = -1; 69 nftl->mbd.devnum = -1;
70 nftl->mbd.blksize = 512; 70
71 nftl->mbd.tr = tr; 71 nftl->mbd.tr = tr;
72 72
73 if (NFTL_mount(nftl) < 0) { 73 if (NFTL_mount(nftl) < 0) {
@@ -797,6 +797,7 @@ static struct mtd_blktrans_ops nftl_tr = {
797 .name = "nftl", 797 .name = "nftl",
798 .major = NFTL_MAJOR, 798 .major = NFTL_MAJOR,
799 .part_bits = NFTL_PARTN_BITS, 799 .part_bits = NFTL_PARTN_BITS,
800 .blksize = 512,
800 .getgeo = nftl_getgeo, 801 .getgeo = nftl_getgeo,
801 .readsect = nftl_readblock, 802 .readsect = nftl_readblock,
802#ifdef CONFIG_NFTL_RW 803#ifdef CONFIG_NFTL_RW
diff --git a/drivers/mtd/rfd_ftl.c b/drivers/mtd/rfd_ftl.c
index fa4362fb4dd8..d60cc6696cbd 100644
--- a/drivers/mtd/rfd_ftl.c
+++ b/drivers/mtd/rfd_ftl.c
@@ -787,7 +787,6 @@ static void rfd_ftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
787 787
788 if (scan_header(part) == 0) { 788 if (scan_header(part) == 0) {
789 part->mbd.size = part->sector_count; 789 part->mbd.size = part->sector_count;
790 part->mbd.blksize = SECTOR_SIZE;
791 part->mbd.tr = tr; 790 part->mbd.tr = tr;
792 part->mbd.devnum = -1; 791 part->mbd.devnum = -1;
793 if (!(mtd->flags & MTD_WRITEABLE)) 792 if (!(mtd->flags & MTD_WRITEABLE))
@@ -829,6 +828,8 @@ struct mtd_blktrans_ops rfd_ftl_tr = {
829 .name = "rfd", 828 .name = "rfd",
830 .major = RFD_FTL_MAJOR, 829 .major = RFD_FTL_MAJOR,
831 .part_bits = PART_BITS, 830 .part_bits = PART_BITS,
831 .blksize = SECTOR_SIZE,
832
832 .readsect = rfd_ftl_readsect, 833 .readsect = rfd_ftl_readsect,
833 .writesect = rfd_ftl_writesect, 834 .writesect = rfd_ftl_writesect,
834 .getgeo = rfd_ftl_getgeo, 835 .getgeo = rfd_ftl_getgeo,