aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd/nand/fsl_elbc_nand.c
diff options
context:
space:
mode:
authorLiu Shuo <b35362@freescale.com>2011-12-03 23:31:36 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2012-01-09 13:13:10 -0500
commita9a552f0bf6258c3593e8887c7212f0fbec8b44c (patch)
treeaa4a9ffa2c1e8e289e64031819e152321de92801 /drivers/mtd/nand/fsl_elbc_nand.c
parentb604436cb06626363f0da357759797a5e1894baf (diff)
mtd: nand: use elbc_fcm_ctrl->oob to set FPAR_MS bit of FPAR
On both of large-page chip and small-page chip, we always should use 'elbc_fcm_ctrl->oob' to set the FPAR_LP_MS/FPAR_SP_MS bit of FPAR, don't use a overflowed 'column' to set it. Signed-off-by: Liu Shuo <b35362@freescale.com> Signed-off-by: Li Yang <leoli@freescale.com> Signed-off-by: Artem Bityutskiy <Artem.Bityutskiy@linux.intel.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
Diffstat (limited to 'drivers/mtd/nand/fsl_elbc_nand.c')
-rw-r--r--drivers/mtd/nand/fsl_elbc_nand.c18
1 files changed, 11 insertions, 7 deletions
diff --git a/drivers/mtd/nand/fsl_elbc_nand.c b/drivers/mtd/nand/fsl_elbc_nand.c
index f2f6e874d4de..c554c2f9c0ec 100644
--- a/drivers/mtd/nand/fsl_elbc_nand.c
+++ b/drivers/mtd/nand/fsl_elbc_nand.c
@@ -407,9 +407,17 @@ static void fsl_elbc_cmdfunc(struct mtd_info *mtd, unsigned int command,
407 page_addr, column); 407 page_addr, column);
408 408
409 elbc_fcm_ctrl->column = column; 409 elbc_fcm_ctrl->column = column;
410 elbc_fcm_ctrl->oob = 0;
411 elbc_fcm_ctrl->use_mdr = 1; 410 elbc_fcm_ctrl->use_mdr = 1;
412 411
412 if (column >= mtd->writesize) {
413 /* OOB area */
414 column -= mtd->writesize;
415 elbc_fcm_ctrl->oob = 1;
416 } else {
417 WARN_ON(column != 0);
418 elbc_fcm_ctrl->oob = 0;
419 }
420
413 fcr = (NAND_CMD_STATUS << FCR_CMD1_SHIFT) | 421 fcr = (NAND_CMD_STATUS << FCR_CMD1_SHIFT) |
414 (NAND_CMD_SEQIN << FCR_CMD2_SHIFT) | 422 (NAND_CMD_SEQIN << FCR_CMD2_SHIFT) |
415 (NAND_CMD_PAGEPROG << FCR_CMD3_SHIFT); 423 (NAND_CMD_PAGEPROG << FCR_CMD3_SHIFT);
@@ -434,16 +442,12 @@ static void fsl_elbc_cmdfunc(struct mtd_info *mtd, unsigned int command,
434 (FIR_OP_CW1 << FIR_OP6_SHIFT) | 442 (FIR_OP_CW1 << FIR_OP6_SHIFT) |
435 (FIR_OP_RS << FIR_OP7_SHIFT)); 443 (FIR_OP_RS << FIR_OP7_SHIFT));
436 444
437 if (column >= mtd->writesize) { 445 if (elbc_fcm_ctrl->oob)
438 /* OOB area --> READOOB */ 446 /* OOB area --> READOOB */
439 column -= mtd->writesize;
440 fcr |= NAND_CMD_READOOB << FCR_CMD0_SHIFT; 447 fcr |= NAND_CMD_READOOB << FCR_CMD0_SHIFT;
441 elbc_fcm_ctrl->oob = 1; 448 else
442 } else {
443 WARN_ON(column != 0);
444 /* First 256 bytes --> READ0 */ 449 /* First 256 bytes --> READ0 */
445 fcr |= NAND_CMD_READ0 << FCR_CMD0_SHIFT; 450 fcr |= NAND_CMD_READ0 << FCR_CMD0_SHIFT;
446 }
447 } 451 }
448 452
449 out_be32(&lbc->fcr, fcr); 453 out_be32(&lbc->fcr, fcr);