aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/mtd/mtdpart.c5
-rw-r--r--drivers/mtd/nand/raw/gpmi-nand/gpmi-lib.c13
-rw-r--r--drivers/mtd/nand/raw/nand_base.c1
-rw-r--r--drivers/mtd/nand/raw/nand_bbt.c2
-rw-r--r--drivers/mtd/nand/spi/core.c46
5 files changed, 34 insertions, 33 deletions
diff --git a/drivers/mtd/mtdpart.c b/drivers/mtd/mtdpart.c
index 60104e1079c5..37f174ccbcec 100644
--- a/drivers/mtd/mtdpart.c
+++ b/drivers/mtd/mtdpart.c
@@ -480,6 +480,10 @@ static struct mtd_part *allocate_partition(struct mtd_info *parent,
480 /* let's register it anyway to preserve ordering */ 480 /* let's register it anyway to preserve ordering */
481 slave->offset = 0; 481 slave->offset = 0;
482 slave->mtd.size = 0; 482 slave->mtd.size = 0;
483
484 /* Initialize ->erasesize to make add_mtd_device() happy. */
485 slave->mtd.erasesize = parent->erasesize;
486
483 printk(KERN_ERR"mtd: partition \"%s\" is out of reach -- disabled\n", 487 printk(KERN_ERR"mtd: partition \"%s\" is out of reach -- disabled\n",
484 part->name); 488 part->name);
485 goto out_register; 489 goto out_register;
@@ -632,7 +636,6 @@ err_remove_part:
632 mutex_unlock(&mtd_partitions_mutex); 636 mutex_unlock(&mtd_partitions_mutex);
633 637
634 free_partition(new); 638 free_partition(new);
635 pr_info("%s:%i\n", __func__, __LINE__);
636 639
637 return ret; 640 return ret;
638} 641}
diff --git a/drivers/mtd/nand/raw/gpmi-nand/gpmi-lib.c b/drivers/mtd/nand/raw/gpmi-nand/gpmi-lib.c
index bd4cfac6b5aa..a4768df5083f 100644
--- a/drivers/mtd/nand/raw/gpmi-nand/gpmi-lib.c
+++ b/drivers/mtd/nand/raw/gpmi-nand/gpmi-lib.c
@@ -155,9 +155,10 @@ int gpmi_init(struct gpmi_nand_data *this)
155 155
156 /* 156 /*
157 * Reset BCH here, too. We got failures otherwise :( 157 * Reset BCH here, too. We got failures otherwise :(
158 * See later BCH reset for explanation of MX23 handling 158 * See later BCH reset for explanation of MX23 and MX28 handling
159 */ 159 */
160 ret = gpmi_reset_block(r->bch_regs, GPMI_IS_MX23(this)); 160 ret = gpmi_reset_block(r->bch_regs,
161 GPMI_IS_MX23(this) || GPMI_IS_MX28(this));
161 if (ret) 162 if (ret)
162 goto err_out; 163 goto err_out;
163 164
@@ -263,12 +264,10 @@ int bch_set_geometry(struct gpmi_nand_data *this)
263 /* 264 /*
264 * Due to erratum #2847 of the MX23, the BCH cannot be soft reset on this 265 * Due to erratum #2847 of the MX23, the BCH cannot be soft reset on this
265 * chip, otherwise it will lock up. So we skip resetting BCH on the MX23. 266 * chip, otherwise it will lock up. So we skip resetting BCH on the MX23.
266 * On the other hand, the MX28 needs the reset, because one case has been 267 * and MX28.
267 * seen where the BCH produced ECC errors constantly after 10000
268 * consecutive reboots. The latter case has not been seen on the MX23
269 * yet, still we don't know if it could happen there as well.
270 */ 268 */
271 ret = gpmi_reset_block(r->bch_regs, GPMI_IS_MX23(this)); 269 ret = gpmi_reset_block(r->bch_regs,
270 GPMI_IS_MX23(this) || GPMI_IS_MX28(this));
272 if (ret) 271 if (ret)
273 goto err_out; 272 goto err_out;
274 273
diff --git a/drivers/mtd/nand/raw/nand_base.c b/drivers/mtd/nand/raw/nand_base.c
index cca4b24d2ffa..839494ac457c 100644
--- a/drivers/mtd/nand/raw/nand_base.c
+++ b/drivers/mtd/nand/raw/nand_base.c
@@ -410,6 +410,7 @@ static int nand_check_wp(struct nand_chip *chip)
410 410
411/** 411/**
412 * nand_fill_oob - [INTERN] Transfer client buffer to oob 412 * nand_fill_oob - [INTERN] Transfer client buffer to oob
413 * @chip: NAND chip object
413 * @oob: oob data buffer 414 * @oob: oob data buffer
414 * @len: oob data write length 415 * @len: oob data write length
415 * @ops: oob ops structure 416 * @ops: oob ops structure
diff --git a/drivers/mtd/nand/raw/nand_bbt.c b/drivers/mtd/nand/raw/nand_bbt.c
index 1b722fe9213c..19a2b563acdf 100644
--- a/drivers/mtd/nand/raw/nand_bbt.c
+++ b/drivers/mtd/nand/raw/nand_bbt.c
@@ -158,7 +158,7 @@ static u32 add_marker_len(struct nand_bbt_descr *td)
158 158
159/** 159/**
160 * read_bbt - [GENERIC] Read the bad block table starting from page 160 * read_bbt - [GENERIC] Read the bad block table starting from page
161 * @chip: NAND chip object 161 * @this: NAND chip object
162 * @buf: temporary buffer 162 * @buf: temporary buffer
163 * @page: the starting page 163 * @page: the starting page
164 * @num: the number of bbt descriptors to read 164 * @num: the number of bbt descriptors to read
diff --git a/drivers/mtd/nand/spi/core.c b/drivers/mtd/nand/spi/core.c
index 479c2f2cf17f..fa87ae28cdfe 100644
--- a/drivers/mtd/nand/spi/core.c
+++ b/drivers/mtd/nand/spi/core.c
@@ -304,24 +304,30 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand,
304 struct nand_device *nand = spinand_to_nand(spinand); 304 struct nand_device *nand = spinand_to_nand(spinand);
305 struct mtd_info *mtd = nanddev_to_mtd(nand); 305 struct mtd_info *mtd = nanddev_to_mtd(nand);
306 struct nand_page_io_req adjreq = *req; 306 struct nand_page_io_req adjreq = *req;
307 unsigned int nbytes = 0; 307 void *buf = spinand->databuf;
308 void *buf = NULL; 308 unsigned int nbytes;
309 u16 column = 0; 309 u16 column = 0;
310 int ret; 310 int ret;
311 311
312 memset(spinand->databuf, 0xff, 312 /*
313 nanddev_page_size(nand) + 313 * Looks like PROGRAM LOAD (AKA write cache) does not necessarily reset
314 nanddev_per_page_oobsize(nand)); 314 * the cache content to 0xFF (depends on vendor implementation), so we
315 * must fill the page cache entirely even if we only want to program
316 * the data portion of the page, otherwise we might corrupt the BBM or
317 * user data previously programmed in OOB area.
318 */
319 nbytes = nanddev_page_size(nand) + nanddev_per_page_oobsize(nand);
320 memset(spinand->databuf, 0xff, nbytes);
321 adjreq.dataoffs = 0;
322 adjreq.datalen = nanddev_page_size(nand);
323 adjreq.databuf.out = spinand->databuf;
324 adjreq.ooblen = nanddev_per_page_oobsize(nand);
325 adjreq.ooboffs = 0;
326 adjreq.oobbuf.out = spinand->oobbuf;
315 327
316 if (req->datalen) { 328 if (req->datalen)
317 memcpy(spinand->databuf + req->dataoffs, req->databuf.out, 329 memcpy(spinand->databuf + req->dataoffs, req->databuf.out,
318 req->datalen); 330 req->datalen);
319 adjreq.dataoffs = 0;
320 adjreq.datalen = nanddev_page_size(nand);
321 adjreq.databuf.out = spinand->databuf;
322 nbytes = adjreq.datalen;
323 buf = spinand->databuf;
324 }
325 331
326 if (req->ooblen) { 332 if (req->ooblen) {
327 if (req->mode == MTD_OPS_AUTO_OOB) 333 if (req->mode == MTD_OPS_AUTO_OOB)
@@ -332,14 +338,6 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand,
332 else 338 else
333 memcpy(spinand->oobbuf + req->ooboffs, req->oobbuf.out, 339 memcpy(spinand->oobbuf + req->ooboffs, req->oobbuf.out,
334 req->ooblen); 340 req->ooblen);
335
336 adjreq.ooblen = nanddev_per_page_oobsize(nand);
337 adjreq.ooboffs = 0;
338 nbytes += nanddev_per_page_oobsize(nand);
339 if (!buf) {
340 buf = spinand->oobbuf;
341 column = nanddev_page_size(nand);
342 }
343 } 341 }
344 342
345 spinand_cache_op_adjust_colum(spinand, &adjreq, &column); 343 spinand_cache_op_adjust_colum(spinand, &adjreq, &column);
@@ -370,8 +368,8 @@ static int spinand_write_to_cache_op(struct spinand_device *spinand,
370 368
371 /* 369 /*
372 * We need to use the RANDOM LOAD CACHE operation if there's 370 * We need to use the RANDOM LOAD CACHE operation if there's
373 * more than one iteration, because the LOAD operation resets 371 * more than one iteration, because the LOAD operation might
374 * the cache to 0xff. 372 * reset the cache to 0xff.
375 */ 373 */
376 if (nbytes) { 374 if (nbytes) {
377 column = op.addr.val; 375 column = op.addr.val;
@@ -1018,11 +1016,11 @@ static int spinand_init(struct spinand_device *spinand)
1018 for (i = 0; i < nand->memorg.ntargets; i++) { 1016 for (i = 0; i < nand->memorg.ntargets; i++) {
1019 ret = spinand_select_target(spinand, i); 1017 ret = spinand_select_target(spinand, i);
1020 if (ret) 1018 if (ret)
1021 goto err_free_bufs; 1019 goto err_manuf_cleanup;
1022 1020
1023 ret = spinand_lock_block(spinand, BL_ALL_UNLOCKED); 1021 ret = spinand_lock_block(spinand, BL_ALL_UNLOCKED);
1024 if (ret) 1022 if (ret)
1025 goto err_free_bufs; 1023 goto err_manuf_cleanup;
1026 } 1024 }
1027 1025
1028 ret = nanddev_init(nand, &spinand_ops, THIS_MODULE); 1026 ret = nanddev_init(nand, &spinand_ops, THIS_MODULE);