aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorPrabhakar Kushwaha <prabhakar@freescale.com>2013-10-03 02:06:41 -0400
committerBrian Norris <computersforpeace@gmail.com>2013-11-07 02:33:01 -0500
commit4af9874916b14db407bee18590fe1847f541c2e2 (patch)
tree4325ff19567fb8843dfa1c9ba040f4c3b0264bfa /drivers/mtd
parentebff90b288c347f3af1b3d164c258aeb2bed60ec (diff)
driver/mtd/ifc: Read Status while programming NAND flash
as per controller description, "While programming a NAND flash, status read should never skipped. Because it may happen that a new command is issued to the NAND Flash, even when the device has not yet finished processing the previous request. This may result in unpredictable behaviour." IFC controller never polls for R/B signal after command send. It just return control to software. This behaviour may not occur with NAND flash access. because new commands are sent after polling R/B signal. But it may happen in scenario where GPCM-ASIC and NAND flash device are working simultaneously. Update the controller driver to take care of this requirement Signed-off-by: Prabhakar Kushwaha <prabhakar@freescale.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/fsl_ifc_nand.c34
1 files changed, 24 insertions, 10 deletions
diff --git a/drivers/mtd/nand/fsl_ifc_nand.c b/drivers/mtd/nand/fsl_ifc_nand.c
index 9d1cf005878f..c96e1e0943f5 100644
--- a/drivers/mtd/nand/fsl_ifc_nand.c
+++ b/drivers/mtd/nand/fsl_ifc_nand.c
@@ -504,20 +504,29 @@ static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command,
504 if (mtd->writesize > 512) { 504 if (mtd->writesize > 512) {
505 nand_fcr0 = 505 nand_fcr0 =
506 (NAND_CMD_SEQIN << IFC_NAND_FCR0_CMD0_SHIFT) | 506 (NAND_CMD_SEQIN << IFC_NAND_FCR0_CMD0_SHIFT) |
507 (NAND_CMD_PAGEPROG << IFC_NAND_FCR0_CMD1_SHIFT); 507 (NAND_CMD_STATUS << IFC_NAND_FCR0_CMD1_SHIFT) |
508 (NAND_CMD_PAGEPROG << IFC_NAND_FCR0_CMD2_SHIFT);
508 509
509 iowrite32be( 510 iowrite32be(
510 (IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) | 511 (IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) |
511 (IFC_FIR_OP_CA0 << IFC_NAND_FIR0_OP1_SHIFT) | 512 (IFC_FIR_OP_CA0 << IFC_NAND_FIR0_OP1_SHIFT) |
512 (IFC_FIR_OP_RA0 << IFC_NAND_FIR0_OP2_SHIFT) | 513 (IFC_FIR_OP_RA0 << IFC_NAND_FIR0_OP2_SHIFT) |
513 (IFC_FIR_OP_WBCD << IFC_NAND_FIR0_OP3_SHIFT) | 514 (IFC_FIR_OP_WBCD << IFC_NAND_FIR0_OP3_SHIFT) |
514 (IFC_FIR_OP_CW1 << IFC_NAND_FIR0_OP4_SHIFT), 515 (IFC_FIR_OP_CMD2 << IFC_NAND_FIR0_OP4_SHIFT),
515 &ifc->ifc_nand.nand_fir0); 516 &ifc->ifc_nand.nand_fir0);
517 iowrite32be(
518 (IFC_FIR_OP_CW1 << IFC_NAND_FIR1_OP5_SHIFT) |
519 (IFC_FIR_OP_RDSTAT <<
520 IFC_NAND_FIR1_OP6_SHIFT) |
521 (IFC_FIR_OP_NOP << IFC_NAND_FIR1_OP7_SHIFT),
522 &ifc->ifc_nand.nand_fir1);
516 } else { 523 } else {
517 nand_fcr0 = ((NAND_CMD_PAGEPROG << 524 nand_fcr0 = ((NAND_CMD_PAGEPROG <<
518 IFC_NAND_FCR0_CMD1_SHIFT) | 525 IFC_NAND_FCR0_CMD1_SHIFT) |
519 (NAND_CMD_SEQIN << 526 (NAND_CMD_SEQIN <<
520 IFC_NAND_FCR0_CMD2_SHIFT)); 527 IFC_NAND_FCR0_CMD2_SHIFT) |
528 (NAND_CMD_STATUS <<
529 IFC_NAND_FCR0_CMD3_SHIFT));
521 530
522 iowrite32be( 531 iowrite32be(
523 (IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) | 532 (IFC_FIR_OP_CW0 << IFC_NAND_FIR0_OP0_SHIFT) |
@@ -526,8 +535,13 @@ static void fsl_ifc_cmdfunc(struct mtd_info *mtd, unsigned int command,
526 (IFC_FIR_OP_RA0 << IFC_NAND_FIR0_OP3_SHIFT) | 535 (IFC_FIR_OP_RA0 << IFC_NAND_FIR0_OP3_SHIFT) |
527 (IFC_FIR_OP_WBCD << IFC_NAND_FIR0_OP4_SHIFT), 536 (IFC_FIR_OP_WBCD << IFC_NAND_FIR0_OP4_SHIFT),
528 &ifc->ifc_nand.nand_fir0); 537 &ifc->ifc_nand.nand_fir0);
529 iowrite32be(IFC_FIR_OP_CW1 << IFC_NAND_FIR1_OP5_SHIFT, 538 iowrite32be(
530 &ifc->ifc_nand.nand_fir1); 539 (IFC_FIR_OP_CMD1 << IFC_NAND_FIR1_OP5_SHIFT) |
540 (IFC_FIR_OP_CW3 << IFC_NAND_FIR1_OP6_SHIFT) |
541 (IFC_FIR_OP_RDSTAT <<
542 IFC_NAND_FIR1_OP7_SHIFT) |
543 (IFC_FIR_OP_NOP << IFC_NAND_FIR1_OP8_SHIFT),
544 &ifc->ifc_nand.nand_fir1);
531 545
532 if (column >= mtd->writesize) 546 if (column >= mtd->writesize)
533 nand_fcr0 |= 547 nand_fcr0 |=