aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/chips/Kconfig2
-rw-r--r--drivers/mtd/chips/cfi_cmdset_0020.c5
-rw-r--r--drivers/mtd/devices/docecc.c1
-rw-r--r--drivers/mtd/nand/nand_base.c22
-rw-r--r--drivers/mtd/nand/nand_bbt.c20
5 files changed, 26 insertions, 24 deletions
diff --git a/drivers/mtd/chips/Kconfig b/drivers/mtd/chips/Kconfig
index b5dc59389bb3..df95d2158b16 100644
--- a/drivers/mtd/chips/Kconfig
+++ b/drivers/mtd/chips/Kconfig
@@ -300,7 +300,7 @@ config MTD_JEDEC
300 300
301config MTD_XIP 301config MTD_XIP
302 bool "XIP aware MTD support" 302 bool "XIP aware MTD support"
303 depends on !SMP && (MTD_CFI_INTELEXT || MTD_CFI_AMDSTD) && EXPERIMENTAL 303 depends on !SMP && (MTD_CFI_INTELEXT || MTD_CFI_AMDSTD) && EXPERIMENTAL && ARM
304 default y if XIP_KERNEL 304 default y if XIP_KERNEL
305 help 305 help
306 This allows MTD support to work with flash memory which is also 306 This allows MTD support to work with flash memory which is also
diff --git a/drivers/mtd/chips/cfi_cmdset_0020.c b/drivers/mtd/chips/cfi_cmdset_0020.c
index 8c24e18db3b4..c894f8801578 100644
--- a/drivers/mtd/chips/cfi_cmdset_0020.c
+++ b/drivers/mtd/chips/cfi_cmdset_0020.c
@@ -4,7 +4,7 @@
4 * 4 *
5 * (C) 2000 Red Hat. GPL'd 5 * (C) 2000 Red Hat. GPL'd
6 * 6 *
7 * $Id: cfi_cmdset_0020.c,v 1.17 2004/11/20 12:49:04 dwmw2 Exp $ 7 * $Id: cfi_cmdset_0020.c,v 1.19 2005/07/13 15:52:45 dwmw2 Exp $
8 * 8 *
9 * 10/10/2000 Nicolas Pitre <nico@cam.org> 9 * 10/10/2000 Nicolas Pitre <nico@cam.org>
10 * - completely revamped method functions so they are aware and 10 * - completely revamped method functions so they are aware and
@@ -16,6 +16,8 @@
16 * - modified Intel Command Set 0x0001 to support ST Advanced Architecture 16 * - modified Intel Command Set 0x0001 to support ST Advanced Architecture
17 * (command set 0x0020) 17 * (command set 0x0020)
18 * - added a writev function 18 * - added a writev function
19 * 07/13/2005 Joern Engel <joern@wh.fh-wedel.de>
20 * - Plugged memory leak in cfi_staa_writev().
19 */ 21 */
20 22
21#include <linux/version.h> 23#include <linux/version.h>
@@ -719,6 +721,7 @@ cfi_staa_writev(struct mtd_info *mtd, const struct kvec *vecs,
719write_error: 721write_error:
720 if (retlen) 722 if (retlen)
721 *retlen = totlen; 723 *retlen = totlen;
724 kfree(buffer);
722 return ret; 725 return ret;
723} 726}
724 727
diff --git a/drivers/mtd/devices/docecc.c b/drivers/mtd/devices/docecc.c
index 933877ff4d88..9a087c1fb0b7 100644
--- a/drivers/mtd/devices/docecc.c
+++ b/drivers/mtd/devices/docecc.c
@@ -40,6 +40,7 @@
40#include <linux/mtd/mtd.h> 40#include <linux/mtd/mtd.h>
41#include <linux/mtd/doc2000.h> 41#include <linux/mtd/doc2000.h>
42 42
43#define DEBUG 0
43/* need to undef it (from asm/termbits.h) */ 44/* need to undef it (from asm/termbits.h) */
44#undef B0 45#undef B0
45 46
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 1bd71a598c79..eee5115658c8 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.146 2005/06/17 15:02:06 gleixner Exp $ 62 * $Id: nand_base.c,v 1.147 2005/07/15 07:18:06 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
@@ -1409,16 +1409,6 @@ static int nand_read_oob (struct mtd_info *mtd, loff_t from, size_t len, size_t
1409 thislen = min_t(int, thislen, len); 1409 thislen = min_t(int, thislen, len);
1410 this->read_buf(mtd, &buf[i], thislen); 1410 this->read_buf(mtd, &buf[i], thislen);
1411 i += thislen; 1411 i += thislen;
1412
1413 /* Apply delay or wait for ready/busy pin
1414 * Do this before the AUTOINCR check, so no problems
1415 * arise if a chip which does auto increment
1416 * is marked as NOAUTOINCR by the board driver.
1417 */
1418 if (!this->dev_ready)
1419 udelay (this->chip_delay);
1420 else
1421 nand_wait_ready(mtd);
1422 1412
1423 /* Read more ? */ 1413 /* Read more ? */
1424 if (i < len) { 1414 if (i < len) {
@@ -1432,6 +1422,16 @@ static int nand_read_oob (struct mtd_info *mtd, loff_t from, size_t len, size_t
1432 this->select_chip(mtd, chipnr); 1422 this->select_chip(mtd, chipnr);
1433 } 1423 }
1434 1424
1425 /* Apply delay or wait for ready/busy pin
1426 * Do this before the AUTOINCR check, so no problems
1427 * arise if a chip which does auto increment
1428 * is marked as NOAUTOINCR by the board driver.
1429 */
1430 if (!this->dev_ready)
1431 udelay (this->chip_delay);
1432 else
1433 nand_wait_ready(mtd);
1434
1435 /* Check, if the chip supports auto page increment 1435 /* Check, if the chip supports auto page increment
1436 * or if we have hit a block boundary. 1436 * or if we have hit a block boundary.
1437 */ 1437 */
diff --git a/drivers/mtd/nand/nand_bbt.c b/drivers/mtd/nand/nand_bbt.c
index 5ac2d2962220..7535ef53685e 100644
--- a/drivers/mtd/nand/nand_bbt.c
+++ b/drivers/mtd/nand/nand_bbt.c
@@ -6,7 +6,7 @@
6 * 6 *
7 * Copyright (C) 2004 Thomas Gleixner (tglx@linutronix.de) 7 * Copyright (C) 2004 Thomas Gleixner (tglx@linutronix.de)
8 * 8 *
9 * $Id: nand_bbt.c,v 1.33 2005/06/14 15:47:56 gleixner Exp $ 9 * $Id: nand_bbt.c,v 1.35 2005/07/15 13:53:47 gleixner Exp $
10 * 10 *
11 * This program is free software; you can redistribute it and/or modify 11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License version 2 as 12 * it under the terms of the GNU General Public License version 2 as
@@ -109,24 +109,21 @@ static int check_pattern (uint8_t *buf, int len, int paglen, struct nand_bbt_des
109/** 109/**
110 * check_short_pattern - [GENERIC] check if a pattern is in the buffer 110 * check_short_pattern - [GENERIC] check if a pattern is in the buffer
111 * @buf: the buffer to search 111 * @buf: the buffer to search
112 * @len: the length of buffer to search
113 * @paglen: the pagelength
114 * @td: search pattern descriptor 112 * @td: search pattern descriptor
115 * 113 *
116 * Check for a pattern at the given place. Used to search bad block 114 * Check for a pattern at the given place. Used to search bad block
117 * tables and good / bad block identifiers. Same as check_pattern, but 115 * tables and good / bad block identifiers. Same as check_pattern, but
118 * no optional empty check and the pattern is expected to start 116 * no optional empty check
119 * at offset 0.
120 * 117 *
121*/ 118*/
122static int check_short_pattern (uint8_t *buf, int len, int paglen, struct nand_bbt_descr *td) 119static int check_short_pattern (uint8_t *buf, struct nand_bbt_descr *td)
123{ 120{
124 int i; 121 int i;
125 uint8_t *p = buf; 122 uint8_t *p = buf;
126 123
127 /* Compare the pattern */ 124 /* Compare the pattern */
128 for (i = 0; i < td->len; i++) { 125 for (i = 0; i < td->len; i++) {
129 if (p[i] != td->pattern[i]) 126 if (p[td->offs + i] != td->pattern[i])
130 return -1; 127 return -1;
131 } 128 }
132 return 0; 129 return 0;
@@ -337,13 +334,14 @@ static int create_bbt (struct mtd_info *mtd, uint8_t *buf, struct nand_bbt_descr
337 if (!(bd->options & NAND_BBT_SCANEMPTY)) { 334 if (!(bd->options & NAND_BBT_SCANEMPTY)) {
338 size_t retlen; 335 size_t retlen;
339 336
340 /* No need to read pages fully, just read required OOB bytes */ 337 /* Read the full oob until read_oob is fixed to
341 ret = mtd->read_oob(mtd, from + j * mtd->oobblock + bd->offs, 338 * handle single byte reads for 16 bit buswidth */
342 readlen, &retlen, &buf[0]); 339 ret = mtd->read_oob(mtd, from + j * mtd->oobblock,
340 mtd->oobsize, &retlen, buf);
343 if (ret) 341 if (ret)
344 return ret; 342 return ret;
345 343
346 if (check_short_pattern (&buf[j * scanlen], scanlen, mtd->oobblock, bd)) { 344 if (check_short_pattern (buf, bd)) {
347 this->bbt[i >> 3] |= 0x03 << (i & 0x6); 345 this->bbt[i >> 3] |= 0x03 << (i & 0x6);
348 printk (KERN_WARNING "Bad eraseblock %d at 0x%08x\n", 346 printk (KERN_WARNING "Bad eraseblock %d at 0x%08x\n",
349 i >> 1, (unsigned int) from); 347 i >> 1, (unsigned int) from);