power management for NAND flash
Subsystems (2)
PATCH 1/1 power management for NAND flash
Greetings,
the patch inlined below allows to suspend/resume NAND flash.
It's similar to what is implemented for NOR flashes in cfi_cmdset_0001.c/cfi_cmdset_0002.c. It's based on 2.6.10 kernel but applies to the current CVS snapshot.
Best regards,
Vitaly
include/linux/mtd/nand.h +1 -0
@@ -244,6 +244,7 @@FL_ERASING ,FL_SYNCING ,FL_CACHEDPRG , +FL_PM_SUSPENDED , } nand_state_t;/* Keep gcc happy */
drivers/mtd/nand/nand_base.c +39 -5
80 lines not on this page · raw message
hoi :)
Quoted 1 line · Vitaly Wool
the patch inlined below allows to suspend/resume NAND flash.
shouldn't we call the board driver while suspending, to allow to actually power down the NAND flash?
Signature · 1 line
Martin Waitz
Hi Martin,
Exactly. We should.
But prior to shut off the clock/power down the flash we need to put the flash driver into the corresponding state (suspended).
Thus, a typical suspend (pseudo) code for NAND flash will look the following way:
static int chip_nand_suspend(struct device *dev, u32 state, u32 level)
{
int retval = 0;#ifdef CONFIG_PM
struct mtd_info *mtd = dev_get_drvdata(dev);
if (mtd && mtd->suspend && level == SUSPEND_SAVE_STATE) {
retval = mtd->suspend(mtd);
if (retval == 0) {
/* shut off the clocks and power down the
controller here */
}
}
#endif
return retval;
}with a resume routine doing just the oppsite.
Hope that clarifies the whole thing :)
Best regards,
Vitaly
Quoted 14 lines · Martin Waitz
hoi :)
Quoted 3 lines · Vitaly Wool
the patch inlined below allows to suspend/resume NAND flash.
shouldn't we call the board driver while suspending, to allow to actually power down the NAND flash?
hoi :)
Quoted 1 line · Vitaly Wool
Hope that clarifies the whole thing :)
yeah, thanks a lot.
now it's clear how to integrate it into drivers.
Signature · 1 line
Martin Waitz