diff options
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/nand/nand_base.c | 27 |
1 files changed, 23 insertions, 4 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c index ff5652211607..c2e1232cd45c 100644 --- a/drivers/mtd/nand/nand_base.c +++ b/drivers/mtd/nand/nand_base.c | |||
@@ -566,6 +566,25 @@ void nand_wait_ready(struct mtd_info *mtd) | |||
566 | EXPORT_SYMBOL_GPL(nand_wait_ready); | 566 | EXPORT_SYMBOL_GPL(nand_wait_ready); |
567 | 567 | ||
568 | /** | 568 | /** |
569 | * nand_wait_status_ready - [GENERIC] Wait for the ready status after commands. | ||
570 | * @mtd: MTD device structure | ||
571 | * @timeo: Timeout in ms | ||
572 | * | ||
573 | * Wait for status ready (i.e. command done) or timeout. | ||
574 | */ | ||
575 | static void nand_wait_status_ready(struct mtd_info *mtd, unsigned long timeo) | ||
576 | { | ||
577 | register struct nand_chip *chip = mtd->priv; | ||
578 | |||
579 | timeo = jiffies + msecs_to_jiffies(timeo); | ||
580 | do { | ||
581 | if ((chip->read_byte(mtd) & NAND_STATUS_READY)) | ||
582 | break; | ||
583 | touch_softlockup_watchdog(); | ||
584 | } while (time_before(jiffies, timeo)); | ||
585 | }; | ||
586 | |||
587 | /** | ||
569 | * nand_command - [DEFAULT] Send command to NAND device | 588 | * nand_command - [DEFAULT] Send command to NAND device |
570 | * @mtd: MTD device structure | 589 | * @mtd: MTD device structure |
571 | * @command: the command to be sent | 590 | * @command: the command to be sent |
@@ -643,8 +662,8 @@ static void nand_command(struct mtd_info *mtd, unsigned int command, | |||
643 | NAND_CTRL_CLE | NAND_CTRL_CHANGE); | 662 | NAND_CTRL_CLE | NAND_CTRL_CHANGE); |
644 | chip->cmd_ctrl(mtd, | 663 | chip->cmd_ctrl(mtd, |
645 | NAND_CMD_NONE, NAND_NCE | NAND_CTRL_CHANGE); | 664 | NAND_CMD_NONE, NAND_NCE | NAND_CTRL_CHANGE); |
646 | while (!(chip->read_byte(mtd) & NAND_STATUS_READY)) | 665 | /* EZ-NAND can take upto 250ms as per ONFi v4.0 */ |
647 | ; | 666 | nand_wait_status_ready(mtd, 250); |
648 | return; | 667 | return; |
649 | 668 | ||
650 | /* This applies to read commands */ | 669 | /* This applies to read commands */ |
@@ -740,8 +759,8 @@ static void nand_command_lp(struct mtd_info *mtd, unsigned int command, | |||
740 | NAND_NCE | NAND_CLE | NAND_CTRL_CHANGE); | 759 | NAND_NCE | NAND_CLE | NAND_CTRL_CHANGE); |
741 | chip->cmd_ctrl(mtd, NAND_CMD_NONE, | 760 | chip->cmd_ctrl(mtd, NAND_CMD_NONE, |
742 | NAND_NCE | NAND_CTRL_CHANGE); | 761 | NAND_NCE | NAND_CTRL_CHANGE); |
743 | while (!(chip->read_byte(mtd) & NAND_STATUS_READY)) | 762 | /* EZ-NAND can take upto 250ms as per ONFi v4.0 */ |
744 | ; | 763 | nand_wait_status_ready(mtd, 250); |
745 | return; | 764 | return; |
746 | 765 | ||
747 | case NAND_CMD_RNDOUT: | 766 | case NAND_CMD_RNDOUT: |