aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@nokia.com>2010-02-19 09:39:52 -0500
committerDavid Woodhouse <David.Woodhouse@intel.com>2011-01-06 10:34:19 -0500
commitcf24dc85ff29a41abd8e73730e5feb22b2666bd3 (patch)
tree5983bf84fa5a9ea22863df1efc8fba121619dbf8
parent8fffed8cfdd511056cb17c70f525017fbb643b94 (diff)
mtd: OneNAND: add enable / disable methods to onenand_chip
Add enable / disable methods called from get_device() / release_device(). These can be used, for example, to allow the driver to prevent the voltage regulator from being put to sleep while OneNAND is in use. Signed-off-by: Adrian Hunter <adrian.hunter@nokia.com> Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
-rw-r--r--drivers/mtd/onenand/onenand_base.c4
-rw-r--r--include/linux/mtd/onenand.h2
2 files changed, 6 insertions, 0 deletions
diff --git a/drivers/mtd/onenand/onenand_base.c b/drivers/mtd/onenand/onenand_base.c
index 2d7c90de3144..2edef5868ace 100644
--- a/drivers/mtd/onenand/onenand_base.c
+++ b/drivers/mtd/onenand/onenand_base.c
@@ -948,6 +948,8 @@ static int onenand_get_device(struct mtd_info *mtd, int new_state)
948 if (this->state == FL_READY) { 948 if (this->state == FL_READY) {
949 this->state = new_state; 949 this->state = new_state;
950 spin_unlock(&this->chip_lock); 950 spin_unlock(&this->chip_lock);
951 if (new_state != FL_PM_SUSPENDED && this->enable)
952 this->enable(mtd);
951 break; 953 break;
952 } 954 }
953 if (new_state == FL_PM_SUSPENDED) { 955 if (new_state == FL_PM_SUSPENDED) {
@@ -974,6 +976,8 @@ static void onenand_release_device(struct mtd_info *mtd)
974{ 976{
975 struct onenand_chip *this = mtd->priv; 977 struct onenand_chip *this = mtd->priv;
976 978
979 if (this->state != FL_PM_SUSPENDED && this->disable)
980 this->disable(mtd);
977 /* Release the chip */ 981 /* Release the chip */
978 spin_lock(&this->chip_lock); 982 spin_lock(&this->chip_lock);
979 this->state = FL_READY; 983 this->state = FL_READY;
diff --git a/include/linux/mtd/onenand.h b/include/linux/mtd/onenand.h
index 6da3fe314828..ae418e41d8f5 100644
--- a/include/linux/mtd/onenand.h
+++ b/include/linux/mtd/onenand.h
@@ -118,6 +118,8 @@ struct onenand_chip {
118 int (*chip_probe)(struct mtd_info *mtd); 118 int (*chip_probe)(struct mtd_info *mtd);
119 int (*block_markbad)(struct mtd_info *mtd, loff_t ofs); 119 int (*block_markbad)(struct mtd_info *mtd, loff_t ofs);
120 int (*scan_bbt)(struct mtd_info *mtd); 120 int (*scan_bbt)(struct mtd_info *mtd);
121 int (*enable)(struct mtd_info *mtd);
122 int (*disable)(struct mtd_info *mtd);
121 123
122 struct completion complete; 124 struct completion complete;
123 int irq; 125 int irq;