Commit 72ea4036 authored by Scott Branden's avatar Scott Branden Committed by Brian Norris

mtd: nand: added nand_shutdown

Add nand_shutdown to wait for current nand operations to finish and prevent
further operations by changing the nand flash state to FL_SHUTDOWN.

This is addressing a problem observed during reboot tests using UBIFS
root file system: NAND erase operations that are in progress during
system reboot/shutdown are causing partial erased blocks. Although UBI should
be able to detect and recover from this error, this change will avoid
the creation of partial erased blocks on reboot in the middle of a NAND erase
operation.
Signed-off-by: default avatarScott Branden <sbranden@broadcom.com>
Tested-by: default avatarScott Branden <sbranden@broadcom.com>
Signed-off-by: default avatarBrian Norris <computersforpeace@gmail.com>
parent 3efe41be
...@@ -2944,6 +2944,16 @@ static void nand_resume(struct mtd_info *mtd) ...@@ -2944,6 +2944,16 @@ static void nand_resume(struct mtd_info *mtd)
__func__); __func__);
} }
/**
* nand_shutdown - [MTD Interface] Finish the current NAND operation and
* prevent further operations
* @mtd: MTD device structure
*/
static void nand_shutdown(struct mtd_info *mtd)
{
nand_get_device(mtd, FL_SHUTDOWN);
}
/* Set default functions */ /* Set default functions */
static void nand_set_defaults(struct nand_chip *chip, int busw) static void nand_set_defaults(struct nand_chip *chip, int busw)
{ {
...@@ -4146,6 +4156,7 @@ int nand_scan_tail(struct mtd_info *mtd) ...@@ -4146,6 +4156,7 @@ int nand_scan_tail(struct mtd_info *mtd)
mtd->_unlock = NULL; mtd->_unlock = NULL;
mtd->_suspend = nand_suspend; mtd->_suspend = nand_suspend;
mtd->_resume = nand_resume; mtd->_resume = nand_resume;
mtd->_reboot = nand_shutdown;
mtd->_block_isreserved = nand_block_isreserved; mtd->_block_isreserved = nand_block_isreserved;
mtd->_block_isbad = nand_block_isbad; mtd->_block_isbad = nand_block_isbad;
mtd->_block_markbad = nand_block_markbad; mtd->_block_markbad = nand_block_markbad;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment