aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorThomas Gleixner <tglx@linutronix.de>2005-05-19 12:10:26 -0400
committerThomas Gleixner <tglx@mtd.linutronix.de>2005-05-23 07:20:45 -0400
commit90e260c84f563a4ac6b47886e8188af06f4a4a46 (patch)
treea487cfe4fb96fc09d0102689cd1f78ba9dee3e67
parenta69dde91e8940b49bdc9920dd65ec02c6a51f85c (diff)
[MTD] NAND: Honour autoplacement schemes supplied by the caller
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
-rw-r--r--drivers/mtd/nand/nand_base.c10
-rw-r--r--include/mtd/mtd-abi.h3
2 files changed, 10 insertions, 3 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index c1a971ca57e6..f1db0bf9306b 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -59,7 +59,7 @@
59 * The AG-AND chips have nice features for speed improvement, 59 * The AG-AND chips have nice features for speed improvement,
60 * which are not supported yet. Read / program 4 pages in one go. 60 * which are not supported yet. Read / program 4 pages in one go.
61 * 61 *
62 * $Id: nand_base.c,v 1.142 2005/04/11 14:16:07 lavinen Exp $ 62 * $Id: nand_base.c,v 1.143 2005/05/19 16:10:22 gleixner Exp $
63 * 63 *
64 * This program is free software; you can redistribute it and/or modify 64 * This program is free software; you can redistribute it and/or modify
65 * it under the terms of the GNU General Public License version 2 as 65 * it under the terms of the GNU General Public License version 2 as
@@ -1195,7 +1195,8 @@ int nand_do_read_ecc (struct mtd_info *mtd, loff_t from, size_t len,
1195 } 1195 }
1196 1196
1197 /* get oob area, if we have no oob buffer from fs-driver */ 1197 /* get oob area, if we have no oob buffer from fs-driver */
1198 if (!oob_buf || oobsel->useecc == MTD_NANDECC_AUTOPLACE) 1198 if (!oob_buf || oobsel->useecc == MTD_NANDECC_AUTOPLACE ||
1199 oobsel->useecc == MTD_NANDECC_AUTOPL_USR)
1199 oob_data = &this->data_buf[end]; 1200 oob_data = &this->data_buf[end];
1200 1201
1201 eccsteps = this->eccsteps; 1202 eccsteps = this->eccsteps;
@@ -1284,6 +1285,7 @@ int nand_do_read_ecc (struct mtd_info *mtd, loff_t from, size_t len,
1284 /* without autoplace. Legacy mode used by YAFFS1 */ 1285 /* without autoplace. Legacy mode used by YAFFS1 */
1285 switch(oobsel->useecc) { 1286 switch(oobsel->useecc) {
1286 case MTD_NANDECC_AUTOPLACE: 1287 case MTD_NANDECC_AUTOPLACE:
1288 case MTD_NANDECC_AUTOPL_USR:
1287 /* Walk through the autoplace chunks */ 1289 /* Walk through the autoplace chunks */
1288 for (i = 0; oobsel->oobfree[i][1]; i++) { 1290 for (i = 0; oobsel->oobfree[i][1]; i++) {
1289 int from = oobsel->oobfree[i][0]; 1291 int from = oobsel->oobfree[i][0];
@@ -1645,6 +1647,8 @@ static int nand_write_ecc (struct mtd_info *mtd, loff_t to, size_t len,
1645 oobsel = this->autooob; 1647 oobsel = this->autooob;
1646 autoplace = 1; 1648 autoplace = 1;
1647 } 1649 }
1650 if (oobsel->useecc == MTD_NANDECC_AUTOPL_USR)
1651 autoplace = 1;
1648 1652
1649 /* Setup variables and oob buffer */ 1653 /* Setup variables and oob buffer */
1650 totalpages = len >> this->page_shift; 1654 totalpages = len >> this->page_shift;
@@ -1919,6 +1923,8 @@ static int nand_writev_ecc (struct mtd_info *mtd, const struct kvec *vecs, unsig
1919 oobsel = this->autooob; 1923 oobsel = this->autooob;
1920 autoplace = 1; 1924 autoplace = 1;
1921 } 1925 }
1926 if (oobsel->useecc == MTD_NANDECC_AUTOPL_USR)
1927 autoplace = 1;
1922 1928
1923 /* Setup start page */ 1929 /* Setup start page */
1924 page = (int) (to >> this->page_shift); 1930 page = (int) (to >> this->page_shift);
diff --git a/include/mtd/mtd-abi.h b/include/mtd/mtd-abi.h
index cacb9842b195..428d9122940b 100644
--- a/include/mtd/mtd-abi.h
+++ b/include/mtd/mtd-abi.h
@@ -1,5 +1,5 @@
1/* 1/*
2 * $Id: mtd-abi.h,v 1.10 2005/02/09 09:17:42 pavlov Exp $ 2 * $Id: mtd-abi.h,v 1.11 2005/05/19 16:08:58 gleixner Exp $
3 * 3 *
4 * Portions of MTD ABI definition which are shared by kernel and user space 4 * Portions of MTD ABI definition which are shared by kernel and user space
5 */ 5 */
@@ -61,6 +61,7 @@ struct mtd_oob_buf {
61#define MTD_NANDECC_PLACE 1 // Use the given placement in the structure (YAFFS1 legacy mode) 61#define MTD_NANDECC_PLACE 1 // Use the given placement in the structure (YAFFS1 legacy mode)
62#define MTD_NANDECC_AUTOPLACE 2 // Use the default placement scheme 62#define MTD_NANDECC_AUTOPLACE 2 // Use the default placement scheme
63#define MTD_NANDECC_PLACEONLY 3 // Use the given placement in the structure (Do not store ecc result on read) 63#define MTD_NANDECC_PLACEONLY 3 // Use the given placement in the structure (Do not store ecc result on read)
64#define MTD_NANDECC_AUTOPL_USR 4 // Use the given autoplacement scheme rather than using the default
64 65
65/* OTP mode selection */ 66/* OTP mode selection */
66#define MTD_OTP_OFF 0 67#define MTD_OTP_OFF 0