aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/onenand
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-27 18:34:57 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-04-27 18:34:57 -0400
commitf00546363fff1576ceddc2690d47e5f9c1dd2e05 (patch)
treef6cb8965b6754fc6ce7570cf1471ebe9874e509a /drivers/mtd/onenand
parent50f732ee63b91eb08a29974b36bd63e1150bb642 (diff)
parent28b57cddb3ed4f7999e4b76ef36ebaaf6e2e0c37 (diff)
Merge git://git.infradead.org/mtd-2.6
* git://git.infradead.org/mtd-2.6: (46 commits) [MTD] [MAPS] drivers/mtd/maps/ck804xrom.c: convert pci_module_init() [MTD] [NAND] CM-x270 MTD driver [MTD] [NAND] Wrong calculation of page number in nand_block_bad() [MTD] [MAPS] fix plat-ram printk format [JFFS2] Fix compr_rubin.c build after include file elimination. [JFFS2] Handle inodes with only a single metadata node with non-zero isize [JFFS2] Tidy up licensing/copyright boilerplate. [MTD] [OneNAND] Exit loop only when column start with 0 [MTD] [OneNAND] Fix access the past of the real oobfree array [MTD] [OneNAND] Update Samsung OneNAND official URL [JFFS2] Better fix for all-zero node headers [JFFS2] Improve read_inode memory usage, v2. [JFFS2] Improve failure mode if inode checking leaves unchecked space. [JFFS2] Fix cross-endian build. [MTD] Finish conversion mtd_blkdevs to use the kthread API [JFFS2] Obsolete dirent nodes immediately on unlink, where possible. Use menuconfig objects: MTD [MTD] mtd_blkdevs: Convert to use the kthread API [MTD] Fix fwh_lock locking [JFFS2] Speed up mount for directly-mapped NOR flash ...
Diffstat (limited to 'drivers/mtd/onenand')
-rw-r--r--drivers/mtd/onenand/Kconfig15
-rw-r--r--drivers/mtd/onenand/onenand_base.c21
2 files changed, 20 insertions, 16 deletions
diff --git a/drivers/mtd/onenand/Kconfig b/drivers/mtd/onenand/Kconfig
index 373bddce8f1c..c257d397d08a 100644
--- a/drivers/mtd/onenand/Kconfig
+++ b/drivers/mtd/onenand/Kconfig
@@ -2,20 +2,18 @@
2# linux/drivers/mtd/onenand/Kconfig 2# linux/drivers/mtd/onenand/Kconfig
3# 3#
4 4
5menu "OneNAND Flash Device Drivers" 5menuconfig MTD_ONENAND
6 depends on MTD != n
7
8config MTD_ONENAND
9 tristate "OneNAND Device Support" 6 tristate "OneNAND Device Support"
10 depends on MTD 7 depends on MTD
11 help 8 help
12 This enables support for accessing all type of OneNAND flash 9 This enables support for accessing all type of OneNAND flash
13 devices. For further information see 10 devices. For further information see
14 <http://www.samsung.com/Products/Semiconductor/Flash/OneNAND_TM/index.htm>. 11 <http://www.samsung.com/Products/Semiconductor/OneNAND/index.htm>
12
13if MTD_ONENAND
15 14
16config MTD_ONENAND_VERIFY_WRITE 15config MTD_ONENAND_VERIFY_WRITE
17 bool "Verify OneNAND page writes" 16 bool "Verify OneNAND page writes"
18 depends on MTD_ONENAND
19 help 17 help
20 This adds an extra check when data is written to the flash. The 18 This adds an extra check when data is written to the flash. The
21 OneNAND flash device internally checks only bits transitioning 19 OneNAND flash device internally checks only bits transitioning
@@ -25,13 +23,12 @@ config MTD_ONENAND_VERIFY_WRITE
25 23
26config MTD_ONENAND_GENERIC 24config MTD_ONENAND_GENERIC
27 tristate "OneNAND Flash device via platform device driver" 25 tristate "OneNAND Flash device via platform device driver"
28 depends on MTD_ONENAND && ARM 26 depends on ARM
29 help 27 help
30 Support for OneNAND flash via platform device driver. 28 Support for OneNAND flash via platform device driver.
31 29
32config MTD_ONENAND_OTP 30config MTD_ONENAND_OTP
33 bool "OneNAND OTP Support" 31 bool "OneNAND OTP Support"
34 depends on MTD_ONENAND
35 help 32 help
36 One Block of the NAND Flash Array memory is reserved as 33 One Block of the NAND Flash Array memory is reserved as
37 a One-Time Programmable Block memory area. 34 a One-Time Programmable Block memory area.
@@ -43,4 +40,4 @@ config MTD_ONENAND_OTP
43 40
44 OTP block is fully-guaranteed to be a valid block. 41 OTP block is fully-guaranteed to be a valid block.
45 42
46endmenu 43endif # MTD_ONENAND
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 9e14a26ca4e8..000794c6caf5 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -836,9 +836,11 @@ static int onenand_transfer_auto_oob(struct mtd_info *mtd, uint8_t *buf, int col
836 int readcol = column; 836 int readcol = column;
837 int readend = column + thislen; 837 int readend = column + thislen;
838 int lastgap = 0; 838 int lastgap = 0;
839 unsigned int i;
839 uint8_t *oob_buf = this->oob_buf; 840 uint8_t *oob_buf = this->oob_buf;
840 841
841 for (free = this->ecclayout->oobfree; free->length; ++free) { 842 free = this->ecclayout->oobfree;
843 for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES && free->length; i++, free++) {
842 if (readcol >= lastgap) 844 if (readcol >= lastgap)
843 readcol += free->offset - lastgap; 845 readcol += free->offset - lastgap;
844 if (readend >= lastgap) 846 if (readend >= lastgap)
@@ -846,7 +848,8 @@ static int onenand_transfer_auto_oob(struct mtd_info *mtd, uint8_t *buf, int col
846 lastgap = free->offset + free->length; 848 lastgap = free->offset + free->length;
847 } 849 }
848 this->read_bufferram(mtd, ONENAND_SPARERAM, oob_buf, 0, mtd->oobsize); 850 this->read_bufferram(mtd, ONENAND_SPARERAM, oob_buf, 0, mtd->oobsize);
849 for (free = this->ecclayout->oobfree; free->length; ++free) { 851 free = this->ecclayout->oobfree;
852 for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES && free->length; i++, free++) {
850 int free_end = free->offset + free->length; 853 int free_end = free->offset + free->length;
851 if (free->offset < readend && free_end > readcol) { 854 if (free->offset < readend && free_end > readcol) {
852 int st = max_t(int,free->offset,readcol); 855 int st = max_t(int,free->offset,readcol);
@@ -854,7 +857,7 @@ static int onenand_transfer_auto_oob(struct mtd_info *mtd, uint8_t *buf, int col
854 int n = ed - st; 857 int n = ed - st;
855 memcpy(buf, oob_buf + st, n); 858 memcpy(buf, oob_buf + st, n);
856 buf += n; 859 buf += n;
857 } else 860 } else if (column == 0)
858 break; 861 break;
859 } 862 }
860 return 0; 863 return 0;
@@ -1280,15 +1283,18 @@ static int onenand_fill_auto_oob(struct mtd_info *mtd, u_char *oob_buf,
1280 int writecol = column; 1283 int writecol = column;
1281 int writeend = column + thislen; 1284 int writeend = column + thislen;
1282 int lastgap = 0; 1285 int lastgap = 0;
1286 unsigned int i;
1283 1287
1284 for (free = this->ecclayout->oobfree; free->length; ++free) { 1288 free = this->ecclayout->oobfree;
1289 for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES && free->length; i++, free++) {
1285 if (writecol >= lastgap) 1290 if (writecol >= lastgap)
1286 writecol += free->offset - lastgap; 1291 writecol += free->offset - lastgap;
1287 if (writeend >= lastgap) 1292 if (writeend >= lastgap)
1288 writeend += free->offset - lastgap; 1293 writeend += free->offset - lastgap;
1289 lastgap = free->offset + free->length; 1294 lastgap = free->offset + free->length;
1290 } 1295 }
1291 for (free = this->ecclayout->oobfree; free->length; ++free) { 1296 free = this->ecclayout->oobfree;
1297 for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES && free->length; i++, free++) {
1292 int free_end = free->offset + free->length; 1298 int free_end = free->offset + free->length;
1293 if (free->offset < writeend && free_end > writecol) { 1299 if (free->offset < writeend && free_end > writecol) {
1294 int st = max_t(int,free->offset,writecol); 1300 int st = max_t(int,free->offset,writecol);
@@ -1296,7 +1302,7 @@ static int onenand_fill_auto_oob(struct mtd_info *mtd, u_char *oob_buf,
1296 int n = ed - st; 1302 int n = ed - st;
1297 memcpy(oob_buf + st, buf, n); 1303 memcpy(oob_buf + st, buf, n);
1298 buf += n; 1304 buf += n;
1299 } else 1305 } else if (column == 0)
1300 break; 1306 break;
1301 } 1307 }
1302 return 0; 1308 return 0;
@@ -2386,7 +2392,8 @@ int onenand_scan(struct mtd_info *mtd, int maxchips)
2386 * the out of band area 2392 * the out of band area
2387 */ 2393 */
2388 this->ecclayout->oobavail = 0; 2394 this->ecclayout->oobavail = 0;
2389 for (i = 0; this->ecclayout->oobfree[i].length; i++) 2395 for (i = 0; i < MTD_MAX_OOBFREE_ENTRIES &&
2396 this->ecclayout->oobfree[i].length; i++)
2390 this->ecclayout->oobavail += 2397 this->ecclayout->oobavail +=
2391 this->ecclayout->oobfree[i].length; 2398 this->ecclayout->oobfree[i].length;
2392 mtd->oobavail = this->ecclayout->oobavail; 2399 mtd->oobavail = this->ecclayout->oobavail;